123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- #if UNITY_EDITOR
- using UnityEditor;
- #endif
- using UnityEngine;
- namespace XRTool.Util
- {
- /// <summary>
- /// public Version(int major, int minor, int build, int revision);
- /// </summary>
- public enum BuildVersion
- {
- /// <summary>
- /// 主要
- /// </summary>
- Major = 0,
- /// <summary>
- /// 次要
- /// </summary>
- Minor = 1,
- /// <summary>
- /// 构建版本
- /// </summary>
- Build = 2
- ///// <summary>
- ///// 补丁版本,修订
- ///// </summary>
- //revision = 3,
- }
- /// <summary>
- /// 发布模式
- /// 主要根据此模式,来做对应的处理,例如debug模式下,会输出全部日志
- /// 测试模式下,会输出error和异常。测试模式下可以调出相关的指令,但是输出更多的设置内容
- /// release是正式发布版本,不会输出日志。同时提升系统性能
- /// debug,test,release
- /// </summary>
- public enum BuildType
- {
- /// <summary>
- /// 日志模式,可以记录用户日志
- /// </summary>
- Debug = 0,
- /// <summary>
- /// 测试版本,程序自测版本,拥有更多的操控权限
- /// </summary>
- Test = 1,
- /// <summary>
- /// 商用版本
- /// </summary>
- Release = 2
- }
- /// <summary>
- /// 资源的读取方式Editor LocalEditor
- /// </summary>
- public enum AssetsType
- {
- /// <summary>
- /// Resource加载,仅支持Resource路径下的资源加载
- /// 其他模式为了后续支持AssetBundle资源加载
- /// </summary>
- Resource = -2,
- /// <summary>
- /// 编辑器模式下,读取编辑器Asset下资源
- /// </summary>
- Editor = -1,
- /// <summary>
- /// 编辑器模式下读取指定路径的打包后的资源
- /// </summary>
- LocalEditor = 0,
- /// <summary>
- /// 真机运行下读取游戏路径下的资源
- /// </summary>
- LocalPhone = 1,
- /// <summary>
- /// 真机运行下读取指定路径下的资源
- /// </summary>
- App = 2,
- /// <summary>
- /// 读取StreamingAsset路径下资源
- /// </summary>
- Stream = 3
- }
- /// <summary>
- /// 编译的平台
- /// 在打包的时候要选择对应的平台
- /// </summary>
- public enum BuildPlatform
- {
- /// <summary>
- /// PC版本
- /// </summary>
- StandaloneWindows = 0,
- /// <summary>
- /// IOS版本
- /// </summary>
- iOS = 1,
- /// <summary>
- /// 安卓版本
- /// </summary>
- Android = 2
- }
- /// <summary>
- /// 播放模式
- /// </summary>
- public enum PlayType
- {
- /// <summary>
- /// 电脑模式,PC端运行
- /// </summary>
- PC = 0,
- /// <summary>
- /// VR模式,VR头盔
- /// </summary>
- VRGlass = 1,
- /// <summary>
- /// AR模式,AR眼睛
- /// </summary>
- ARGlass = 2,
- /// <summary>
- /// 移动手机模式,触屏操作
- /// </summary>
- Mobile = 3
- }
- public class BuildConfig : ScriptableObject
- {
- public static BuildConfig Instance;
- /// <summary>
- /// 发布模式,debug release
- /// </summary>
- [Tooltip("发布模式")]
- public BuildType buildType;
- /// <summary>
- /// 资源访问方式LocalEditor APP
- /// </summary>
- [Tooltip("资源访问方式")]
- public AssetsType assetsType;
- /// <summary>
- /// 发布的平台 BuildTarget IOS Android
- /// </summary>
- #if UNITY_EDITOR
- [Tooltip("发布的平台")]
- public BuildTarget buildTarget;
- #endif
- /// <summary>
- /// 运行的模式Normal AR
- /// </summary>
- [Tooltip("运行的模式")]
- public PlayType playType;
- [Tooltip("APP发布时间")]
- public string buildTime;
- [Tooltip("APP版本号")]
- public string appVersion;
- public ServerConfig[] serverList;
- public string otherSymbol = "TRILIB_USE_ZIP";
- /// <summary>
- /// 版本类型,修订版,补丁版
- /// </summary>
- [Tooltip("版本类型")]
- public BuildVersion buildVersion = BuildVersion.Build;
- public string languagePath = "Language";
- public string artInfoPath="ArtInfo";
- public string prefix = "T";
- public bool useHand = false;
- public string loginUrl;
- public string lobbyUrl;
- public string roomUrl;
- public string rtcUrl;
- #if UNITY_EDITOR
- public BuildTargetGroup buildTargetGroup = BuildTargetGroup.Standalone;
- [MenuItem("Assets/Create/BuildConfig", false, 0)]
- static void CreateDynamicConf()
- {
- Object obj = Selection.activeObject;
- if (obj)
- {
- string path = AssetDatabase.GetAssetPath(obj);
- BuildConfig bullet = CreateInstance<BuildConfig>();
- if (bullet)
- {
- string confName =UnityUtil. TryGetName<BuildConfig>(path);
- AssetDatabase.CreateAsset(bullet, confName);
- Instance = bullet;
- }
- else
- {
- Debug.Log(typeof(BuildConfig) + " is null");
- }
- }
- }
- #endif
- }
- }
|