diff --git a/Assets/Framework.meta b/Assets/Framework.meta new file mode 100644 index 0000000..a73ac7c --- /dev/null +++ b/Assets/Framework.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2503af1b9165311458e5bb89cb59df6f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/GameLauncher.cs b/Assets/Framework/GameLauncher.cs new file mode 100644 index 0000000..53d3027 --- /dev/null +++ b/Assets/Framework/GameLauncher.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Framework.Scripts.Runtime.Engine.Engine.Camera; +using UnityEngine; + +// 添加游戏开发中常用的游戏模块的命名空间 +using MotionFramework; +using MotionFramework.Console; +using MotionFramework.Event; +using MotionFramework.Scripts.Runtime.Engine.Engine.Network.WebRequest; +using MotionFramework.Utility; + +public class GameLauncher : MonoBehaviour +{ + [Tooltip("在编辑器下模拟运行")] + public bool SimulationOnEditor = true; + + void Awake() + { +#if !UNITY_EDITOR + SimulationOnEditor = false; +#endif + + // 初始化控制台 + if (Application.isEditor || Debug.isDebugBuild) + DeveloperConsole.Initialize(); + + + // 初始化框架 + MotionEngine.Initialize(this, HandleMotionFrameworkLog); + } + void Start() + { + // 创建游戏模块 + CreateGameModules(); + } + void Update() + { + // 更新框架 + MotionEngine.Update(); + } + void OnGUI() + { + // 绘制控制台 + if (Application.isEditor || Debug.isDebugBuild) + DeveloperConsole.Draw(); + } + + private void CreateGameModules() + { + // 创建事件管理器 + MotionEngine.CreateModule(); + + //webrequest管理器 + MotionEngine.CreateModule(); + + } + + private void HandleMotionFrameworkLog(ELogLevel logLevel, string log) + { + if (logLevel == ELogLevel.Log) + { + UnityEngine.Debug.Log(log); + } + else if (logLevel == ELogLevel.Error) + { + UnityEngine.Debug.LogError(log); + } + else if (logLevel == ELogLevel.Warning) + { + UnityEngine.Debug.LogWarning(log); + } + else if (logLevel == ELogLevel.Exception) + { + UnityEngine.Debug.LogError(log); + } + else + { + throw new NotImplementedException($"{logLevel}"); + } + } +} \ No newline at end of file diff --git a/Assets/Framework/GameLauncher.cs.meta b/Assets/Framework/GameLauncher.cs.meta new file mode 100644 index 0000000..8b740b0 --- /dev/null +++ b/Assets/Framework/GameLauncher.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9285dff9c8040aa4488bf8974674f237 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts.meta b/Assets/Framework/Scripts.meta new file mode 100644 index 0000000..3fb96b5 --- /dev/null +++ b/Assets/Framework/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2f4cf2a58e574d74aac5310ccd75525a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Editor.meta b/Assets/Framework/Scripts/Editor.meta new file mode 100644 index 0000000..7d166ef --- /dev/null +++ b/Assets/Framework/Scripts/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 388029185fa707340a861f57cd175df2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime.meta b/Assets/Framework/Scripts/Runtime.meta new file mode 100644 index 0000000..746fedf --- /dev/null +++ b/Assets/Framework/Scripts/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a5ef71c752c838c459544a86dd58463c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine.meta b/Assets/Framework/Scripts/Runtime/Engine.meta new file mode 100644 index 0000000..76fe192 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 427646cfb10656d498f5e8d094a680f2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Core.meta b/Assets/Framework/Scripts/Runtime/Engine/Core.meta new file mode 100644 index 0000000..1f58903 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Core.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 03ce8fe28e97d2f40b814dcae8cad75d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Core/ELogLevel.cs b/Assets/Framework/Scripts/Runtime/Engine/Core/ELogLevel.cs new file mode 100644 index 0000000..9306816 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Core/ELogLevel.cs @@ -0,0 +1,30 @@ +锘 + +namespace MotionFramework +{ + /// + /// 鏃ュ織绛夌骇 + /// + public enum ELogLevel + { + /// + /// 淇℃伅 + /// + Log, + + /// + /// 璀﹀憡 + /// + Warning, + + /// + /// 閿欒 + /// + Error, + + /// + /// 寮傚父 + /// + Exception, + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Core/ELogLevel.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Core/ELogLevel.cs.meta new file mode 100644 index 0000000..3801df5 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Core/ELogLevel.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ae9a7933bf5cb574ab1fa7b757931fcc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Core/IActivatorServices.cs b/Assets/Framework/Scripts/Runtime/Engine/Core/IActivatorServices.cs new file mode 100644 index 0000000..cc5ad0d --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Core/IActivatorServices.cs @@ -0,0 +1,17 @@ +锘縰sing System; + +namespace MotionFramework +{ + public interface IActivatorServices + { + /// + /// 鍒涘缓瀹炰緥 + /// + object CreateInstance(Type classType); + + /// + /// 鑾峰彇鐗规 + /// + Attribute GetAttribute(Type classType); + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Core/IActivatorServices.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Core/IActivatorServices.cs.meta new file mode 100644 index 0000000..262fc76 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Core/IActivatorServices.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: beee09ffd49d7ef49a983e15cca8fe5e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Core/IModule.cs b/Assets/Framework/Scripts/Runtime/Engine/Core/IModule.cs new file mode 100644 index 0000000..23750f5 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Core/IModule.cs @@ -0,0 +1,27 @@ +锘 + +namespace MotionFramework +{ + public interface IModule + { + /// + /// 鍒涘缓妯″潡 + /// + void OnCreate(System.Object createParam); + + /// + /// 杞妯″潡 + /// + void OnUpdate(); + + /// + /// 閿姣佹ā鍧 + /// + void OnDestroy(); + + /// + /// GUI缁樺埗 + /// + void OnGUI(); + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Core/IModule.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Core/IModule.cs.meta new file mode 100644 index 0000000..74cdaad --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Core/IModule.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4f4757101f8553d49ad6da27c94c50c5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Core/MainThreadSyncContext.cs b/Assets/Framework/Scripts/Runtime/Engine/Core/MainThreadSyncContext.cs new file mode 100644 index 0000000..fdc973a --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Core/MainThreadSyncContext.cs @@ -0,0 +1,39 @@ +锘 +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Threading; + +namespace MotionFramework +{ + /// + /// 鍚屾鍏跺畠绾跨▼閲岀殑鍥炶皟鍒颁富绾跨▼閲 + /// 娉ㄦ剰锛歎nity3D涓渶瑕佽缃甋cripting Runtime Version涓.NET4.6 + /// + public sealed class MainThreadSyncContext : SynchronizationContext + { + private readonly ConcurrentQueue _safeQueue = new ConcurrentQueue(); + + /// + /// 鏇存柊鍚屾闃熷垪 + /// + public void Update() + { + while (true) + { + if (_safeQueue.TryDequeue(out Action action) == false) + return; + action.Invoke(); + } + } + + /// + /// 鍚戝悓姝ラ槦鍒楅噷鎶曢掍竴涓洖璋冩柟娉 + /// + public override void Post(SendOrPostCallback callback, object state) + { + Action action = new Action(() => { callback(state); }); + _safeQueue.Enqueue(action); + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Core/MainThreadSyncContext.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Core/MainThreadSyncContext.cs.meta new file mode 100644 index 0000000..2ff67ea --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Core/MainThreadSyncContext.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8dc088445ce08dc4e81bfe04a381b449 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Core/ModuleSingleton.cs b/Assets/Framework/Scripts/Runtime/Engine/Core/ModuleSingleton.cs new file mode 100644 index 0000000..5316cc0 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Core/ModuleSingleton.cs @@ -0,0 +1,29 @@ +锘 + +namespace MotionFramework +{ + public abstract class ModuleSingleton where T : class, IModule + { + private static T _instance; + public static T Instance + { + get + { + if (_instance == null) + MotionLog.Error($"{typeof(T)} is not create. Use {nameof(MotionEngine)}.{nameof(MotionEngine.CreateModule)} create."); + return _instance; + } + } + + protected ModuleSingleton() + { + if (_instance != null) + throw new System.Exception($"{typeof(T)} instance already created."); + _instance = this as T; + } + protected void DestroySingleton() + { + _instance = null; + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Core/ModuleSingleton.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Core/ModuleSingleton.cs.meta new file mode 100644 index 0000000..1638ca2 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Core/ModuleSingleton.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b6c8230c0d097534e950f4e84ce01e96 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Core/MotionEngine.cs b/Assets/Framework/Scripts/Runtime/Engine/Core/MotionEngine.cs new file mode 100644 index 0000000..77de5fb --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Core/MotionEngine.cs @@ -0,0 +1,267 @@ +锘 +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace MotionFramework +{ + public static class MotionEngine + { + private class ModuleWrapper + { + public int Priority { private set; get; } + public IModule Module { private set; get; } + + public ModuleWrapper(IModule module, int priority) + { + Module = module; + Priority = priority; + } + } + + private static readonly List _coms = new List(100); + private static MonoBehaviour _behaviour; + private static bool _isDirty = false; + private static long _frame = 0; + + /// + /// 鍒濆鍖栨鏋 + /// + public static void Initialize(MonoBehaviour behaviour, Action logCallback) + { + if (behaviour == null) + throw new Exception("MotionFramework behaviour is null."); + if (_behaviour != null) + throw new Exception($"{nameof(MotionEngine)} is already initialized."); + + UnityEngine.Object.DontDestroyOnLoad(behaviour.gameObject); + _behaviour = behaviour; + + // 娉ㄥ唽鏃ュ織鍥炶皟 + if (logCallback != null) + MotionLog.RegisterCallback(logCallback); + + behaviour.StartCoroutine(CheckFrame()); + } + + /// + /// 妫娴婱otionEngine鏇存柊鏂规硶 + /// + private static IEnumerator CheckFrame() + { + var wait = new WaitForSeconds(1f); + yield return wait; + + // 璇存槑锛氬垵濮嬪寲涔嬪悗锛屽鏋滃繕璁版洿鏂癕otionEngine锛岃繖閲屼細鎶涘嚭寮傚父 + if (_frame == 0) + throw new Exception($"Please call update method : MotionEngine.Update"); + } + + /// + /// 鏇存柊妗嗘灦 + /// + public static void Update() + { + _frame++; + + // 濡傛灉鏈夋柊妯″潡闇瑕侀噸鏂版帓搴 + if (_isDirty) + { + _isDirty = false; + _coms.Sort((left, right) => + { + if (left.Priority > right.Priority) + return -1; + else if (left.Priority == right.Priority) + return 0; + else + return 1; + }); + } + + // 杞鎵鏈夋ā鍧 + for (int i = 0; i < _coms.Count; i++) + { + _coms[i].Module.OnUpdate(); + } + } + + /// + /// 缁樺埗鎵鏈夋ā鍧楃殑GUI鍐呭 + /// + internal static void DrawModulesGUIContent() + { + for (int i = 0; i < _coms.Count; i++) + { + _coms[i].Module.OnGUI(); + } + } + + /// + /// 鏌ヨ娓告垙妯″潡鏄惁瀛樺湪 + /// + public static bool Contains() where T : class, IModule + { + System.Type type = typeof(T); + return Contains(type); + } + + /// + /// 鏌ヨ娓告垙妯″潡鏄惁瀛樺湪 + /// + public static bool Contains(System.Type moduleType) + { + for (int i = 0; i < _coms.Count; i++) + { + if (_coms[i].Module.GetType() == moduleType) + return true; + } + return false; + } + + /// + /// 鍒涘缓娓告垙妯″潡 + /// + /// 妯″潡绫 + /// 杩愯鏃剁殑浼樺厛绾э紝浼樺厛绾ц秺澶ц秺鏃╂墽琛屻傚鏋滄病鏈夎缃紭鍏堢骇锛岄偅涔堜細鎸夌収娣诲姞椤哄簭鎵ц + public static T CreateModule(int priority = 0) where T : class, IModule + { + return CreateModule(null, priority); + } + + /// + /// 鍒涘缓娓告垙妯″潡 + /// + /// 妯″潡绫 + /// 鍒涘缓鍙傛暟 + /// 杩愯鏃剁殑浼樺厛绾э紝浼樺厛绾ц秺澶ц秺鏃╂墽琛屻傚鏋滄病鏈夎缃紭鍏堢骇锛岄偅涔堜細鎸夌収娣诲姞椤哄簭鎵ц + public static T CreateModule(System.Object createParam, int priority = 0) where T : class, IModule + { + if (priority < 0) + throw new Exception("The priority can not be negative"); + + if (Contains(typeof(T))) + throw new Exception($"Game module {typeof(T)} is already existed"); + + // 濡傛灉娌℃湁璁剧疆浼樺厛绾 + if (priority == 0) + { + int minPriority = GetMinPriority(); + priority = --minPriority; + } + + MotionLog.Log($"Create game module : {typeof(T)}"); + T module = Activator.CreateInstance(); + ModuleWrapper wrapper = new ModuleWrapper(module, priority); + wrapper.Module.OnCreate(createParam); + _coms.Add(wrapper); + _isDirty = true; + return module; + } + + /// + /// 閿姣佹ā鍧 + /// + /// 妯″潡绫 + public static bool DestroyModule() + { + var moduleType = typeof(T); + for (int i = 0; i < _coms.Count; i++) + { + if (_coms[i].Module.GetType() == moduleType) + { + _coms[i].Module.OnDestroy(); + _coms.RemoveAt(i); + return true; + } + } + return false; + } + + /// + /// 鑾峰彇娓告垙妯″潡 + /// + /// 妯″潡绫 + public static T GetModule() where T : class, IModule + { + System.Type type = typeof(T); + for (int i = 0; i < _coms.Count; i++) + { + if (_coms[i].Module.GetType() == type) + return _coms[i].Module as T; + } + + MotionLog.Warning($"Not found game module {type}"); + return null; + } + + /// + /// 鑾峰彇褰撳墠妯″潡閲屾渶灏忕殑浼樺厛绾 + /// + private static int GetMinPriority() + { + int minPriority = 0; + for (int i = 0; i < _coms.Count; i++) + { + if (_coms[i].Priority < minPriority) + minPriority = _coms[i].Priority; + } + return minPriority; //灏忎簬绛変簬闆 + } + + #region 鍗忕▼鐩稿叧 + /// + /// 寮鍚竴涓崗绋 + /// + public static Coroutine StartCoroutine(IEnumerator coroutine) + { + if (_behaviour == null) + throw new Exception($"{nameof(MotionEngine)} is not initialize. Use MotionEngine.Initialize"); + return _behaviour.StartCoroutine(coroutine); + } + + /// + /// 鍋滄涓涓崗绋 + /// + public static void StopCoroutine(Coroutine coroutine) + { + if (_behaviour == null) + throw new Exception($"{nameof(MotionEngine)} is not initialize. Use MotionEngine.Initialize"); + _behaviour.StopCoroutine(coroutine); + } + + + /// + /// 寮鍚竴涓崗绋 + /// + public static void StartCoroutine(string methodName) + { + if (_behaviour == null) + throw new Exception($"{nameof(MotionEngine)} is not initialize. Use MotionEngine.Initialize"); + _behaviour.StartCoroutine(methodName); + } + + /// + /// 鍋滄涓涓崗绋 + /// + public static void StopCoroutine(string methodName) + { + if (_behaviour == null) + throw new Exception($"{nameof(MotionEngine)} is not initialize. Use MotionEngine.Initialize"); + _behaviour.StopCoroutine(methodName); + } + + + /// + /// 鍋滄鎵鏈夊崗绋 + /// + public static void StopAllCoroutines() + { + if (_behaviour == null) + throw new Exception($"{nameof(MotionEngine)} is not initialize. Use MotionEngine.Initialize"); + _behaviour.StopAllCoroutines(); + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Core/MotionEngine.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Core/MotionEngine.cs.meta new file mode 100644 index 0000000..0ef990c --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Core/MotionEngine.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b799b83d73a9cb543b2504ccb1cf796a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Core/MotionLog.cs b/Assets/Framework/Scripts/Runtime/Engine/Core/MotionLog.cs new file mode 100644 index 0000000..9786722 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Core/MotionLog.cs @@ -0,0 +1,49 @@ +锘 + +namespace MotionFramework +{ + internal static class MotionLog + { + private static System.Action _callback; + + /// + /// 鐩戝惉鏃ュ織 + /// + public static void RegisterCallback(System.Action callback) + { + _callback += callback; + } + + /// + /// 鏃ュ織 + /// + public static void Log(string info) + { + _callback?.Invoke(ELogLevel.Log, $"[MotionLog] {info}"); + } + + /// + /// 璀﹀憡 + /// + public static void Warning(string info) + { + _callback?.Invoke(ELogLevel.Warning, $"[MotionLog] {info}"); + } + + /// + /// 閿欒 + /// + public static void Error(string info) + { + _callback?.Invoke(ELogLevel.Error, $"[MotionLog] {info}"); + } + + /// + /// 寮傚父 + /// + public static void Exception(string info) + { + _callback?.Invoke(ELogLevel.Exception, $"[MotionLog] {info}"); + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Core/MotionLog.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Core/MotionLog.cs.meta new file mode 100644 index 0000000..b066e9e --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Core/MotionLog.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dbad3cd04905bab4fb6391f5184bcfa0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation.meta new file mode 100644 index 0000000..cb82e93 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 2d31ab63c6e8982469ffce74914f4a4b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimBehaviour.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimBehaviour.cs new file mode 100644 index 0000000..faba5eb --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimBehaviour.cs @@ -0,0 +1,161 @@ +锘縰sing System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using MotionFramework.Experimental.Animation; + +[RequireComponent(typeof(Animator))] +public class AnimBehaviour : MonoBehaviour +{ + [Serializable] + public class AnimationWrapper + { + public int Layer; + public WrapMode Mode; + public AnimationClip Clip; + } + + private AnimPlayable _animPlayable; + private Animator _animator; + + [SerializeField] + protected AnimationWrapper[] _animations; + + [SerializeField] + protected bool _playAutomatically = true; + + [SerializeField] + protected bool _animatePhysics = false; + + /// + /// 鑷姩鎾斁鍔ㄧ敾 + /// + public bool PlayAutomatically + { + get + { + return _playAutomatically; + } + set + { + _playAutomatically = value; + } + } + + /// + /// 鐗╃悊鏇存柊妯″紡 + /// + public bool AnimatePhysics + { + get + { + return _animatePhysics; + } + set + { + _animatePhysics = value; + _animator.updateMode = _animatePhysics ? AnimatorUpdateMode.AnimatePhysics : AnimatorUpdateMode.Normal; + } + } + + + public void Awake() + { + _animator = GetComponent(); + _animator.updateMode = _animatePhysics ? AnimatorUpdateMode.AnimatePhysics : AnimatorUpdateMode.Normal; + + _animPlayable = new AnimPlayable(); + _animPlayable.Create(_animator); + + // 娣诲姞鍒楄〃鍔ㄤ綔 + for (int i = 0; i < _animations.Length; i++) + { + var wrapper = _animations[i]; + if (wrapper == null || wrapper.Clip == null) + continue; + + wrapper.Clip.wrapMode = wrapper.Mode; + _animPlayable.AddAnimation(wrapper.Clip.name, wrapper.Clip, wrapper.Layer); + } + } + public void OnEnable() + { + _animPlayable.PlayGraph(); + + if (PlayAutomatically) + { + var wrapper = GetDefaultWrapper(); + if (wrapper != null) + { + Play(wrapper.Clip.name, 0f); + } + } + + _animPlayable.Update(float.MaxValue); + } + public void OnDisable() + { + _animPlayable.StopGraph(); + } + public void OnDestroy() + { + _animPlayable.Destroy(); + } + public void Update() + { + _animPlayable.Update(Time.deltaTime); + } + + /// + /// 鑾峰彇鍔ㄧ敾鐘舵 + /// + public AnimState GetState(string name) + { + return _animPlayable.GetAnimState(name); + } + + /// + /// 鍔ㄧ敾鏄惁鍦ㄦ挱鏀句腑 + /// + public bool IsPlaying(string name) + { + return _animPlayable.IsPlaying(name); + } + + /// + /// 鏄惁鍖呭惈鍔ㄧ敾鐗囨 + /// + public bool IsContains(string name) + { + return _animPlayable.IsContains(name); + } + + /// + /// 鎾斁鍔ㄧ敾 + /// + public void Play(string name, float fadeLength = 0.25f) + { + _animPlayable.Play(name, fadeLength); + } + + /// + /// 鍋滄鍔ㄧ敾 + /// + public void Stop(string name) + { + _animPlayable.Stop(name); + } + + private AnimationWrapper GetDefaultWrapper() + { + for (int i = 0; i < _animations.Length; i++) + { + var wrapper = _animations[i]; + if (wrapper == null || wrapper.Clip == null) + continue; + + return wrapper; + } + return null; + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimBehaviour.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimBehaviour.cs.meta new file mode 100644 index 0000000..18eabca --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimBehaviour.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ef52174816df6104587b15c5b250201a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimMixer.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimMixer.cs new file mode 100644 index 0000000..4ee3b0d --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimMixer.cs @@ -0,0 +1,196 @@ +锘縰sing System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Playables; +using UnityEngine.Animations; + +namespace MotionFramework.Experimental.Animation +{ + public sealed class AnimMixer : AnimNode + { + private const float HIDE_DURATION = 0.25f; + private readonly List _states = new List(10); + private AnimationMixerPlayable _mixer; + private bool _isQuiting = false; + + /// + /// 鍔ㄧ敾灞傜骇 + /// + public int Layer { private set; get; } + + + public AnimMixer(PlayableGraph graph, int layer) : base(graph) + { + Layer = layer; + + _mixer = AnimationMixerPlayable.Create(graph); + SetSourcePlayable(_mixer); + } + public override void Update(float deltaTime) + { + base.Update(deltaTime); + + for (int i = 0; i < _states.Count; i++) + { + var state = _states[i]; + if (state != null) + state.Update(deltaTime); + } + + bool isAllDone = true; + for (int i = 0; i < _states.Count; i++) + { + var state = _states[i]; + if (state != null) + { + if (state.IsDone == false) + isAllDone = false; + } + } + + // 褰撳瓙鑺傜偣閮藉凡缁忓畬鎴愮殑鏃跺欐柇寮杩炴帴 + if (isAllDone && _isQuiting == false) + { + _isQuiting = true; + StartWeightFade(0, HIDE_DURATION); + } + if (_isQuiting) + { + if (Mathf.Approximately(Weight, 0f)) + DisconnectMixer(); + } + } + + /// + /// 鎾斁鎸囧畾鍔ㄧ敾 + /// + public void Play(AnimState animState, float fadeDuration) + { + // 閲嶆柊婵娲绘贩鍚堝櫒 + _isQuiting = false; + StartWeightFade(1f, 0); + + if (IsContains(animState) == false) + { + // 浼樺厛鎻掑叆鍒颁竴涓┖浣 + int index = _states.FindIndex(s => s == null); + if (index == -1) + { + // Increase input count + int inputCount = _mixer.GetInputCount(); + _mixer.SetInputCount(inputCount + 1); + + animState.Connect(_mixer, inputCount); + _states.Add(animState); + } + else + { + animState.Connect(_mixer, index); + _states[index] = animState; + } + } + + for (int i = 0; i < _states.Count; i++) + { + var state = _states[i]; + if (state == null) + continue; + + if (state == animState) + { + state.StartWeightFade(1f, fadeDuration); + state.PlayNode(); + } + else + { + state.StartWeightFade(0f, fadeDuration); + state.PauseNode(); + } + } + } + + /// + /// 鍋滄鎸囧畾鍔ㄧ敾锛屾仮澶嶄负鍒濆鐘舵 + /// + public void Stop(string name) + { + AnimState state = FindState(name); + if (state == null) + return; + + state.PauseNode(); + state.ResetNode(); + } + + /// + /// 鏆傚仠鎵鏈夊姩鐢 + /// + public void PauseAll() + { + for (int i = 0; i < _states.Count; i++) + { + var state = _states[i]; + if (state == null) + continue; + state.PauseNode(); + } + } + + /// + /// 鏄惁鍖呭惈璇ュ姩鐢 + /// + public bool IsContains(AnimNode node) + { + foreach (var state in _states) + { + if (state == node) + return true; + } + return false; + } + + /// + /// 绉婚櫎涓涓姩鐢 + /// + public void RemoveState(string name) + { + var state = FindState(name); + if (state == null) + return; + + _states[state.InputPort] = null; + state.Destroy(); + } + + /// + /// 鑾峰彇鎸囧畾鐨勫姩鐢 + /// + /// 濡傛灉娌℃湁杩斿洖NULL + private AnimState FindState(string name) + { + foreach (var state in _states) + { + if (state != null && state.Name == name) + return state; + } + + MotionLog.Warning($"Animation state doesn't exist : {name}"); + return null; + } + + private void DisconnectMixer() + { + for (int i = 0; i < _states.Count; i++) + { + var state = _states[i]; + if (state == null) + continue; + + state.Disconnect(); + _states[i] = null; + } + + Disconnect(); + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimMixer.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimMixer.cs.meta new file mode 100644 index 0000000..7842188 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimMixer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b33204afd07c00c4f8b425276778b8bf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimNode.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimNode.cs new file mode 100644 index 0000000..5be232b --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimNode.cs @@ -0,0 +1,221 @@ +锘縰sing System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Playables; +using UnityEngine.Animations; + +namespace MotionFramework.Experimental.Animation +{ + public abstract class AnimNode + { + private readonly PlayableGraph _graph; + private Playable _source; + private Playable _parent; + + private float _fadeSpeed = 0f; + private float _fadeWeight = 0f; + private bool _isFading = false; + + + /// + /// 鏄惁宸茬粡杩炴帴 + /// + public bool IsConnect { get; private set; } = false; + + /// + /// 杈撳叆绔彛 + /// + public int InputPort { private set; get; } + + /// + /// 鏄惁宸茬粡瀹屾垚 + /// If the duration of the playable is set, when the time of the playable reaches its duration during playback this flag will be set to true. + /// + public bool IsDone + { + get + { + return _source.IsDone(); + } + } + + /// + /// 鏄惁鏈夋晥 + /// if the Playable is properly constructed by the PlayableGraph and has not been destroyed, false otherwise. + /// + public bool IsValid + { + get + { + return _source.IsValid(); + } + } + + /// + /// 鏄惁姝e湪鎾斁涓 + /// + public bool IsPlaying + { + get + { + return _source.GetPlayState() == PlayState.Playing; + } + } + + /// + /// 鏃堕棿杞 + /// + public float Time + { + set + { + _source.SetTime(value); + } + get + { + return (float)_source.GetTime(); + } + } + + /// + /// 鎾斁閫熷害 + /// + public float Speed + { + set + { + _source.SetSpeed(value); + } + get + { + return (float)_source.GetSpeed(); + } + } + + /// + /// 鏉冮噸鍊 + /// + public float Weight + { + set + { + _parent.SetInputWeight(InputPort, value); + } + get + { + return _parent.GetInputWeight(InputPort); + } + } + + + public AnimNode(PlayableGraph graph) + { + _graph = graph; + } + public virtual void Update(float deltaTime) + { + if (_isFading) + { + Weight = Mathf.MoveTowards(Weight, _fadeWeight, _fadeSpeed * deltaTime); + if (Mathf.Approximately(Weight, _fadeWeight)) + { + _isFading = false; + } + } + } + public virtual void Destroy() + { + if (IsValid) + { + _graph.DestroySubgraph(_source); + } + } + public virtual void PlayNode() + { + // NOTE : When playing, the local time of this Playable will be updated during the evaluation of the PlayableGraph. + _source.Play(); + + // NOTE : Changes a flag indicating that a playable has completed its operation. + // Playable that reach the end of their duration are automatically marked as done. + _source.SetDone(false); + } + public virtual void PauseNode() + { + // NOTE : When paused, the local time of this Playable will not be updated during the evaluation of the PlayableGraph. + _source.Pause(); + + // NOTE : Changes a flag indicating that a playable has completed its operation. + // Playable that reach the end of their duration are automatically marked as done. + _source.SetDone(true); + } + public virtual void ResetNode() + { + _fadeSpeed = 0; + _fadeWeight = 0; + _isFading = false; + + Time = 0; + Speed = 1; + Weight = 0; + } + + /// + /// 杩炴帴鍒扮埗鑺傜偣 + /// + /// 鐖惰妭鐐瑰璞 + /// 鐖惰妭鐐逛笂鐨勮緭鍏ョ鍙 + public void Connect(Playable parent, int parentInputPort) + { + if (IsConnect) + throw new System.Exception("AnimNode is connected."); + + _parent = parent; + InputPort = parentInputPort; + + // 閲嶇疆鑺傜偣 + ResetNode(); + + // 杩炴帴 + _graph.Connect(_source, 0, parent, parentInputPort); + IsConnect = true; + } + + /// + /// 鍚岀埗鑺傜偣鏂紑杩炴帴 + /// + public void Disconnect() + { + if (IsConnect == false) + throw new System.Exception("AnimNode is disconnected."); + + // 鏂紑 + _graph.Disconnect(_parent, InputPort); + IsConnect = false; + } + + /// + /// 寮濮嬫潈閲嶅艰繃娓 + /// + /// 鐩爣鏉冮噸鍊 + /// 杩囨浮鏃堕棿 + public void StartWeightFade(float destWeight, float fadeDuration) + { + if (fadeDuration <= 0) + { + Weight = destWeight; + _isFading = false; + return; + } + + //娉ㄦ剰锛氫繚鎸佺粺涓鐨勬笎鍙橀熷害 + _fadeSpeed = 1f / fadeDuration; + _fadeWeight = destWeight; + _isFading = true; + } + + protected void SetSourcePlayable(Playable playable) + { + _source = playable; + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimNode.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimNode.cs.meta new file mode 100644 index 0000000..1f91ab9 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimNode.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b6928afd60ab2ed489e492e00d9ddaba +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimPlayable.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimPlayable.cs new file mode 100644 index 0000000..19a3280 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimPlayable.cs @@ -0,0 +1,228 @@ +锘縰sing System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Playables; +using UnityEngine.Animations; + +namespace MotionFramework.Experimental.Animation +{ + public class AnimPlayable + { + private readonly List _states = new List(10); + private readonly List _mixers = new List(10); + + private PlayableGraph _graph; + private AnimationPlayableOutput _output; + private AnimationLayerMixerPlayable _mixerRoot; + + public void Create(Animator animator) + { + string name = animator.gameObject.name; + _graph = PlayableGraph.Create(name); + _graph.SetTimeUpdateMode(DirectorUpdateMode.Manual); + + _mixerRoot = AnimationLayerMixerPlayable.Create(_graph); + _output = AnimationPlayableOutput.Create(_graph, name, animator); + _output.SetSourcePlayable(_mixerRoot); + } + public void Update(float deltaTime) + { + _graph.Evaluate(deltaTime); + + // 鏇存柊鎵鏈夊眰绾 + for (int i = 0; i < _mixers.Count; i++) + { + var mixer = _mixers[i]; + if(mixer.IsConnect) + mixer.Update(deltaTime); + } + } + public void Destroy() + { + _graph.Destroy(); + } + + /// + /// Play the graph + /// + public void PlayGraph() + { + _graph.Play(); + } + + /// + /// Stop the graph + /// + public void StopGraph() + { + _graph.Stop(); + } + + /// + /// 妫娴嬪姩鐢绘槸鍚︽鍦ㄦ挱鏀 + /// + /// 鍔ㄧ敾鍚嶇О + public bool IsPlaying(string name) + { + AnimState state = GetAnimState(name); + if (state == null) + return false; + + return state.IsConnect && state.IsPlaying; + } + + /// + /// 鎾斁涓涓姩鐢 + /// + /// 鍔ㄧ敾鍚嶇О + /// 铻嶅悎鏃堕棿 + public void Play(string name, float fadeLength) + { + var animState = GetAnimState(name); + if (animState == null) + { + MotionLog.Warning($"Not found animation {name}"); + return; + } + + int layer = animState.Layer; + var animMixer = GetAnimMixer(layer); + if (animMixer == null) + animMixer = CreateAnimMixer(layer); + + if(animMixer.IsConnect == false) + animMixer.Connect(_mixerRoot, animMixer.Layer); + + animMixer.Play(animState, fadeLength); + } + + /// + /// 鍋滄涓涓姩鐢 + /// + /// 鍔ㄧ敾鍚嶇О + public void Stop(string name) + { + var animState = GetAnimState(name); + if (animState == null) + { + MotionLog.Warning($"Not found animation {name}"); + return; + } + + if (animState.IsConnect == false) + return; + + var animMixer = GetAnimMixer(animState.Layer); + if (animMixer == null) + throw new System.Exception("Should never get here."); + + animMixer.Stop(animState.Name); + } + + /// + /// 娣诲姞涓涓姩鐢荤墖娈 + /// + /// 鍔ㄧ敾鍚嶇О + /// 鍔ㄧ敾鐗囨 + /// 鍔ㄧ敾灞傜骇 + public bool AddAnimation(string name, AnimationClip clip, int layer = 0) + { + if (string.IsNullOrEmpty(name)) + throw new System.ArgumentException("Name is null or empty."); + if (clip == null) + throw new System.ArgumentNullException(); + if (layer < 0) + throw new System.Exception("Layer must be greater than zero."); + + if (IsContains(name)) + { + MotionLog.Warning($"Animation already exists : {name}"); + return false; + } + + AnimState stateNode = new AnimState(_graph, clip, name, layer); + _states.Add(stateNode); + return true; + } + + /// + /// 绉婚櫎涓涓姩鐢荤墖娈 + /// + /// 鍔ㄧ敾鍚嶇О + public bool RemoveAnimation(string name) + { + if (IsContains(name) == false) + { + MotionLog.Warning($"Not found Animation : {name}"); + return false; + } + + AnimState animState = GetAnimState(name); + AnimMixer animMixer = GetAnimMixer(animState.Layer); + if(animMixer != null) + animMixer.RemoveState(animState.Name); + + animState.Destroy(); + _states.Remove(animState); + return true; + } + + /// + /// 鑾峰彇涓涓姩鐢荤姸鎬 + /// + /// 鍔ㄧ敾鍚嶇О + public AnimState GetAnimState(string name) + { + for (int i = 0; i < _states.Count; i++) + { + if (_states[i].Name == name) + return _states[i]; + } + return null; + } + + /// + /// 鏄惁鍖呭惈涓涓姩鐢荤姸鎬 + /// + /// 鍔ㄧ敾鍚嶇О + public bool IsContains(string name) + { + for (int i = 0; i < _states.Count; i++) + { + if (_states[i].Name == name) + return true; + } + return false; + } + + private AnimMixer GetAnimMixer(int layer) + { + for (int i = 0; i < _mixers.Count; i++) + { + if (_mixers[i].Layer == layer) + return _mixers[i]; + } + return null; + } + private AnimMixer CreateAnimMixer(int layer) + { + // Increase input count + int inputCount = _mixerRoot.GetInputCount(); + if(layer == 0 && inputCount == 0) + { + _mixerRoot.SetInputCount(1); + } + else + { + if (layer > inputCount - 1) + { + _mixerRoot.SetInputCount(layer + 1); + } + } + + var animMixer = new AnimMixer(_graph, layer); + _mixers.Add(animMixer); + return animMixer; + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimPlayable.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimPlayable.cs.meta new file mode 100644 index 0000000..36714b0 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimPlayable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 772b8a9edd8466646bab12d6f5ba1084 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimState.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimState.cs new file mode 100644 index 0000000..6da393a --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimState.cs @@ -0,0 +1,99 @@ +锘縰sing System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Playables; +using UnityEngine.Animations; + +namespace MotionFramework.Experimental.Animation +{ + public sealed class AnimState : AnimNode + { + public readonly string Name; + private readonly AnimationClip _clip; + public AnimationClipPlayable _clipPlayable; + + /// + /// 鍔ㄧ敾灞傜骇 + /// + public int Layer = 0; + + /// + /// 鍔ㄧ敾闀垮害 + /// + public float ClipLength + { + get + { + if (_clip == null) + return 0f; + if (Speed == 0f) + return Mathf.Infinity; + return _clip.length / Speed; + } + } + + /// + /// 褰掍竴鍖栨椂闂磋酱 + /// + public float NormalizedTime + { + set + { + if (_clip == null) + return; + Time = _clip.length * value; + } + + get + { + if (_clip == null) + return 1f; + return Time / _clip.length; + } + } + + /// + /// 鍔ㄧ敾妯″紡 + /// + public WrapMode WrapMode + { + set + { + if (_clip != null) + _clip.wrapMode = value; + } + get + { + if (_clip == null) + return WrapMode.Default; + return _clip.wrapMode; + } + } + + public AnimState(PlayableGraph graph, AnimationClip clip, string name, int layer) : base(graph) + { + _clip = clip; + Name = name; + Layer = layer; + + _clipPlayable = AnimationClipPlayable.Create(graph, clip); + _clipPlayable.SetApplyFootIK(false); + _clipPlayable.SetApplyPlayableIK(false); + SetSourcePlayable(_clipPlayable); + + if (clip.wrapMode == WrapMode.Once) + { + _clipPlayable.SetDuration(clip.length); + } + } + public override void PlayNode() + { + if (_clip.wrapMode == WrapMode.Once || _clip.wrapMode == WrapMode.ClampForever) + { + Time = 0; + } + + base.PlayNode(); + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimState.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimState.cs.meta new file mode 100644 index 0000000..71a052f --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/AnimState.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 606e5729d04cc8742a38f58e595c02f9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/EAnimStates.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/EAnimStates.cs new file mode 100644 index 0000000..bec94d9 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/EAnimStates.cs @@ -0,0 +1,12 @@ +锘縰sing System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace MotionFramework.Experimental.Animation +{ + public enum EAnimStates + { + Playing, + Paused, + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/EAnimStates.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/EAnimStates.cs.meta new file mode 100644 index 0000000..3b2e4c8 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Animation/EAnimStates.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5660d9e37e5c2a44f818506c9fe76624 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera.meta new file mode 100644 index 0000000..bdaf9de --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera.meta @@ -0,0 +1,3 @@ +锘縡ileFormatVersion: 2 +guid: 27404a5600794902a08f7d7710e766b3 +timeCreated: 1716521294 \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/CameraControl.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/CameraControl.meta new file mode 100644 index 0000000..eb2e9f7 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/CameraControl.meta @@ -0,0 +1,3 @@ +锘縡ileFormatVersion: 2 +guid: 436369bf8c5b45a084984e639d160e1d +timeCreated: 1716536171 \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/CameraControl/CameraControlComponent.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/CameraControl/CameraControlComponent.cs new file mode 100644 index 0000000..c0f2526 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/CameraControl/CameraControlComponent.cs @@ -0,0 +1,236 @@ +锘縰sing DG.Tweening; +using UnityEngine; +using NaughtyAttributes; +using UnityEngine.EventSystems; + +namespace Framework.Scripts.Runtime.Engine.Engine.Camera.CameraControl +{ + public class CameraControlComponent : ICameraController + { + public enum CameraEnum + { + TopView, + FrontView + } + + //鐩告満璺熼殢鐨勭洰鏍囩墿浣擄紝涓鑸槸涓涓┖鐗╀綋 + [SerializeField] private GameObject target; + + [HorizontalLine(color: EColor.Blue)] [SerializeField] [Label("鍚敤鏃嬭浆")] + private bool enableMouseFunctions = true; + + [SerializeField] [Label("鍚敤榧犳爣纰板埌UI绂佺敤鑴氭湰")] + private bool enableMouseOverUI = true; + + [SerializeField] private CameraEnum cameraEnum; + + private float middleSpeed = 2; + + private int MouseWheelSensitivity = 1; //婊氳疆鐏垫晱搴﹁缃 + + private int MouseZoomMin = 10; //鐩告満璺濈鏈灏忓 + + private int MouseZoomMax = 9999; //鐩告満璺濈鏈澶у + + private float xSpeed = 250.0f; //鏃嬭浆瑙嗚鏃剁浉鏈簒杞磋浆閫 + + private float ySpeed = 120.0f; //鏃嬭浆瑙嗚鏃剁浉鏈簓杞磋浆閫 + + private float Distance = 20; //鐩告満鍜宼arget涔嬮棿鐨勮窛绂伙紝鍥犱负鐩告満鐨刏杞存绘槸鎸囧悜target锛屼篃灏辨槸鐩告満z杞存柟鍚戜笂鐨勮窛绂 + + //[BoxGroup("鍙傛暟")][SerializeField][Label("瑙掑害鏈灏忛檺鍒")] private int yMinLimit = -360; + //[BoxGroup("鍙傛暟")][SerializeField][Label("瑙掑害鏈澶ч檺鍒")] private int yMaxLimit = 360; + + private Vector2 minMaxSlider; + + private float x = 0.0f; //瀛樺偍鐩告満鐨別uler瑙 + private float y = 0.0f; //瀛樺偍鐩告満鐨別uler瑙 + private Vector3 targetOnScreenPosition; //鐩爣鐨勫睆骞曞潗鏍囷紝绗笁涓间负z杞磋窛绂 + + private Quaternion storeRotation; //瀛樺偍鐩告満鐨勫Э鎬佸洓鍏冩暟 + private Vector3 CameraTargetPosition; //target鐨勪綅缃 + private Vector3 initPosition; //骞崇Щ鏃剁敤浜庡瓨鍌ㄥ钩绉荤殑璧风偣浣嶇疆 + private Vector3 cameraX; //鐩告満鐨剎杞存柟鍚戝悜閲 + private Vector3 cameraY; //鐩告満鐨剏杞存柟鍚戝悜閲 + private Vector3 cameraZ; //鐩告満鐨剒杞存柟鍚戝悜閲 + + private Vector3 initScreenPos; //涓敭鍒氭寜涓嬫椂榧犳爣鐨勫睆骞曞潗鏍囷紙绗笁涓煎叾瀹炴病浠涔堢敤锛 + private Vector3 curScreenPos; //褰撳墠榧犳爣鐨勫睆骞曞潗鏍囷紙绗笁涓煎叾瀹炴病浠涔堢敤锛 + + + private Vector2 jilu; + + private Transform cameraTransform; + + public void Init(Transform cam, Transform target) + { + cameraTransform = cam; + this.target = target.gameObject; + + cameraEnum = CameraEnum.FrontView; + Vector3 angles = cameraTransform.eulerAngles; + x = angles.y; + y = angles.x; + CameraTargetPosition = target.transform.position; + + Distance = Vector3.Distance(cameraTransform.position, target.transform.position); + + // 缁欐憚鍍忔満涓涓垵濮嬬殑浣嶇疆鍜岃搴 + SetCameraPositionAndRotation(); + } + + public void MoveTargetTo(Vector3 newPosition, float newfloat) + { + target.transform.DOMove(newPosition, 2).OnUpdate(() => + { + Vector3 mPosition = storeRotation * new Vector3(0.0F, 0.0F, -Distance) + target.transform.position; + cameraTransform.position = mPosition; + CameraTargetPosition = target.transform.position; + } + ); + } + + void SetCameraPositionAndRotation() + { + //Vector3 position = rotation * new Vector3(0.0f, 0.0f, -11) + target.transform.position; + + x += Input.GetAxis("Mouse X") * xSpeed * 0.02f; + y -= Input.GetAxis("Mouse Y") * ySpeed * 0.02f; + + y = ClampAngle(y, minMaxSlider.x, minMaxSlider.y); + + storeRotation = Quaternion.Euler(y, x, 0); + var position = storeRotation * new Vector3(0.0f, 0.0f, -Distance) + CameraTargetPosition; + + cameraTransform.rotation = storeRotation; + cameraTransform.position = position; + } + + + //灏哸ngle闄愬埗鍦╩in~max涔嬮棿 + static float ClampAngle(float angle, float min, float max) + { + if (angle < -360) + angle += 360; + if (angle > 360) + angle -= 360; + return Mathf.Clamp(angle, min, max); + } + + + public GameObject GetTarget() + { + return target; + } + + public void UpdateValue(Vector2 minMax) + { + minMaxSlider = minMax; + } + + + public void ControlCamera() + { + if (enableMouseOverUI) + { + if (EventSystem.current.IsPointerOverGameObject()) + { + return; + } + } + + if (enableMouseFunctions) + { + //榧犳爣鍙抽敭鏃嬭浆鍔熻兘 + if (Input.GetMouseButton(1)) + { + //濡傛灉鏄《瑙嗗浘锛屽彧鑳藉乏鍙虫棆杞紝涓嶈兘涓婁笅 + if (cameraEnum == CameraEnum.FrontView) + { + x += Input.GetAxis("Mouse X") * xSpeed * 0.02f; + y -= Input.GetAxis("Mouse Y") * ySpeed * 0.02f; + + y = ClampAngle(y, minMaxSlider.x, minMaxSlider.y); + + storeRotation = Quaternion.Euler(y, x, 0); + var position = storeRotation * new Vector3(0.0f, 0.0f, -Distance) + CameraTargetPosition; + + Debug.Log(storeRotation); + cameraTransform.rotation = storeRotation; + cameraTransform.position = position; + } + else + { + x += Input.GetAxis("Mouse X") * xSpeed * 0.02f; + //y -= Input.GetAxis("Mouse Y") * ySpeed * 0.02f; + + //y = ClampAngle(y, minMaxSlider.x, minMaxSlider.y); + + storeRotation = Quaternion.Euler(90, x, 0); + var position = storeRotation * new Vector3(0.0f, 0.0f, -Distance) + CameraTargetPosition; + + cameraTransform.rotation = storeRotation; + cameraTransform.position = position; + } + } + else if (Input.GetAxis("Mouse ScrollWheel") != 0) //榧犳爣婊氳疆缂╂斁鍔熻兘 + { + if (Distance >= MouseZoomMin && Distance <= MouseZoomMax) + { + Distance -= Input.GetAxis("Mouse ScrollWheel") * MouseWheelSensitivity; + } + + if (Distance < MouseZoomMin) + { + Distance = MouseZoomMin; + } + + if (Distance > MouseZoomMax) + { + Distance = MouseZoomMax; + } + + cameraTransform.position = storeRotation * new Vector3(0.0F, 0.0F, -Distance) + CameraTargetPosition; + } + + //榧犳爣涓敭骞崇Щ + if (Input.GetMouseButtonDown(2)) + { + cameraX = cameraTransform.right; + cameraY = cameraTransform.up; + cameraZ = cameraTransform.forward; + + initScreenPos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, targetOnScreenPosition.z); + Debug.Log("downOnce"); + + //targetOnScreenPosition.z涓虹洰鏍囩墿浣撳埌鐩告満xmidbuttonDownPositiony骞抽潰鐨勬硶绾胯窛绂 + if (UnityEngine.Camera.main != null) targetOnScreenPosition = UnityEngine.Camera.main.WorldToScreenPoint(CameraTargetPosition); + initPosition = CameraTargetPosition; + } + + if (Input.GetMouseButton(2)) + { + curScreenPos = new Vector3(Input.mousePosition.x, Input.mousePosition.y, targetOnScreenPosition.z); + //0.01杩欎釜绯绘暟鏄帶鍒跺钩绉荤殑閫熷害锛岃鏍规嵁鐩告満鍜岀洰鏍囩墿浣撶殑distance鏉ョ伒娲婚夋嫨 + Vector3 vv = initPosition - (0.01f * middleSpeed) * ((curScreenPos.x - initScreenPos.x) * cameraX + + (curScreenPos.y - initScreenPos.y) * cameraY); + target.transform.position = new Vector3(vv.x, vv.y, vv.z); + + //閲嶆柊璁$畻浣嶇疆 + Vector3 mPosition = storeRotation * new Vector3(0.0F, 0.0F, -Distance) + target.transform.position; + cameraTransform.position = mPosition; + + // //鐢ㄨ繖涓細璁╃浉鏈虹殑骞崇Щ鍙樺緱鏇村钩婊戯紝浣嗘槸鍙兘鍦ㄤ綘buttonup鏃舵湭浣跨浉鏈虹Щ鍔ㄥ埌搴斿埌鐨勪綅缃紝瀵艰嚧鍐嶈繘琛屾棆杞笌缂╂斁鎿嶄綔鏃跺嚭鐜扮煭鏆傛姈鍔 + //transform.position=Vector3.Lerp(transform.position,mPosition,Time.deltaTime*moveSpeed); + } + + if (Input.GetMouseButtonUp(2)) + { + Debug.Log("upOnce"); + //骞崇Щ缁撴潫鎶奵ameraTargetPosition鐨勪綅缃洿鏂颁竴涓嬶紝涓嶇劧浼氬奖鍝嶇缉鏀句笌鏃嬭浆鍔熻兘 + CameraTargetPosition = target.transform.position; + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/CameraControl/CameraControlComponent.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/CameraControl/CameraControlComponent.cs.meta new file mode 100644 index 0000000..32c640f --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/CameraControl/CameraControlComponent.cs.meta @@ -0,0 +1,3 @@ +锘縡ileFormatVersion: 2 +guid: f83adf796757446ba4c3b2d84fc9012e +timeCreated: 1716536226 \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/CameraControl/ICameraController.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/CameraControl/ICameraController.cs new file mode 100644 index 0000000..6bc10dc --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/CameraControl/ICameraController.cs @@ -0,0 +1,4 @@ +锘縫ublic interface ICameraController +{ + void ControlCamera(); +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/CameraControl/ICameraController.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/CameraControl/ICameraController.cs.meta new file mode 100644 index 0000000..85f8039 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/CameraControl/ICameraController.cs.meta @@ -0,0 +1,3 @@ +锘縡ileFormatVersion: 2 +guid: 117f0a495e484ef0b45eb7155a72b5ef +timeCreated: 1716536177 \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/Raycast.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/Raycast.meta new file mode 100644 index 0000000..fe7db5b --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/Raycast.meta @@ -0,0 +1,3 @@ +锘縡ileFormatVersion: 2 +guid: fde27b4e1f5e4fa3ab0b3e7f1249b66a +timeCreated: 1716536117 \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/Raycast/CameraRaycastComponent.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/Raycast/CameraRaycastComponent.cs new file mode 100644 index 0000000..02b0ea4 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/Raycast/CameraRaycastComponent.cs @@ -0,0 +1,37 @@ +锘縰sing System; +using MotionFramework; +using UnityEngine; + +namespace Framework.Scripts.Runtime.Engine.Engine.Camera +{ + + public class CameraRaycastComponent : IRaycastable + { + public LayerMask RaycastLayerMask = ~0; + public float RaycastDistance = 100f; + + public event Action OnRaycastHit; + private UnityEngine.Camera camera; + + public void Init() + { + camera=UnityEngine.Camera.main; + } + + public void PerformRaycast() + { + + if (camera == null) + { + Debug.LogError("娌℃湁鎵惧埌涓绘憚鍍忔満"); + return; + } + + Ray ray = camera.ScreenPointToRay(Input.mousePosition); + if (Physics.Raycast(ray, out RaycastHit hit, RaycastDistance, RaycastLayerMask)) + { + OnRaycastHit?.Invoke(hit); + } + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/Raycast/CameraRaycastComponent.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/Raycast/CameraRaycastComponent.cs.meta new file mode 100644 index 0000000..9cfa49f --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/Raycast/CameraRaycastComponent.cs.meta @@ -0,0 +1,3 @@ +锘縡ileFormatVersion: 2 +guid: e00183c47e5a46dbb1eafcfd793004f2 +timeCreated: 1716530957 \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/Raycast/IRaycastable.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/Raycast/IRaycastable.cs new file mode 100644 index 0000000..75954df --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/Raycast/IRaycastable.cs @@ -0,0 +1,11 @@ +锘縰sing System; +using UnityEngine; + +public interface IRaycastable +{ + + + event Action OnRaycastHit; + + void PerformRaycast(); +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/Raycast/IRaycastable.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/Raycast/IRaycastable.cs.meta new file mode 100644 index 0000000..9c75210 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Camera/Raycast/IRaycastable.cs.meta @@ -0,0 +1,3 @@ +锘縡ileFormatVersion: 2 +guid: 5ff7acc217c44ea0adf9478b454b7e1d +timeCreated: 1716536124 \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Console.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console.meta new file mode 100644 index 0000000..516553d --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e64000d37ca5cca4eb4908b53f9be554 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/ConsoleAttribute.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/ConsoleAttribute.cs new file mode 100644 index 0000000..957b41c --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/ConsoleAttribute.cs @@ -0,0 +1,25 @@ +锘 +using System; + +namespace MotionFramework.Console +{ + [AttributeUsage(AttributeTargets.Class)] + public class ConsoleAttribute : Attribute + { + /// + /// 鏍囬鍚嶇О + /// + public string Title; + + /// + /// 鏄剧ず椤哄簭 + /// + public int Order; + + public ConsoleAttribute(string title, int order) + { + Title = title; + Order = order; + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/ConsoleAttribute.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/ConsoleAttribute.cs.meta new file mode 100644 index 0000000..fb8d1d2 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/ConsoleAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f02d224d0e39bf24db2e41f0f982b510 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/ConsoleGUI.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/ConsoleGUI.cs new file mode 100644 index 0000000..f42fc44 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/ConsoleGUI.cs @@ -0,0 +1,139 @@ +锘 +using System; +using System.Collections; +using System.Collections.Generic; +using MotionFramework.Utility; +using UnityEngine; + +namespace MotionFramework.Console +{ + public static class ConsoleGUI + { + private static bool _initGlobalStyle = false; + + public static GUIStyle HorizontalScrollbarStyle { private set; get; } + public static GUIStyle HorizontalScrollbarThumbStyle { private set; get; } + public static GUIStyle VerticalScrollbarStyle { private set; get; } + public static GUIStyle VerticalScrollbarThumbStyle { private set; get; } + public static GUIStyle XStyle { private set; get; } + public static GUIStyle ToolbarStyle { private set; get; } + public static GUIStyle ButtonStyle { private set; get; } + public static GUIStyle ToogleStyle1 { private set; get; } + public static GUIStyle ToogleStyle2 { private set; get; } + public static GUIStyle TextFieldStyle { private set; get; } + public static GUIStyle LableStyle { private set; get; } + public static GUIStyle RichLabelStyle { private set; get; } + public static int RichLabelFontSize { private set; get; } + + private static GUIStyle _cachedHorizontalScrollbarThumb; + private static GUIStyle _cachedVerticalScrollbarThumb; + + /// + /// 鍒涘缓涓浜涢珮搴﹀拰瀛椾綋澶у皬鍥哄畾鐨勬帶浠舵牱寮 + /// 鎺у埗鍙扮殑鏍囧噯鍒嗚鲸鐜囦负 : 1920X1080 + /// + internal static void InitGlobalStyle() + { + if (_initGlobalStyle == false) + { + _initGlobalStyle = true; + + float scale; + if (Screen.height > Screen.width) + { + // 绔栧睆Portrait + scale = Screen.width / 1080f; + } + else + { + // 妯睆Landscape + scale = Screen.width / 1920f; + } + + HorizontalScrollbarStyle = new GUIStyle(GUI.skin.horizontalScrollbar); + HorizontalScrollbarStyle.fixedHeight = (int)(30 * scale); + HorizontalScrollbarThumbStyle = new GUIStyle(GUI.skin.horizontalScrollbarThumb); + HorizontalScrollbarThumbStyle.fixedHeight = (int)(30 * scale); + + VerticalScrollbarStyle = new GUIStyle(GUI.skin.verticalScrollbar); + VerticalScrollbarStyle.fixedWidth = (int)(30 * scale); + VerticalScrollbarThumbStyle = new GUIStyle(GUI.skin.verticalScrollbarThumb); + VerticalScrollbarThumbStyle.fixedWidth = (int)(30 * scale); + + XStyle = new GUIStyle(GUI.skin.button); + XStyle.fontSize = (int)(38 * scale); + XStyle.fixedWidth = (int)(40 * scale); + XStyle.fixedHeight = (int)(40 * scale); + + ToolbarStyle = new GUIStyle(GUI.skin.button); + ToolbarStyle.fontSize = (int)(28 * scale); + ToolbarStyle.fixedHeight = (int)(40 * scale); + + ButtonStyle = new GUIStyle(GUI.skin.button); + ButtonStyle.fontSize = (int)(28 * scale); + ButtonStyle.fixedHeight = (int)(40 * scale); + + ToogleStyle1 = new GUIStyle(GUI.skin.button); + ToogleStyle1.fontSize = (int)(26 * scale); + ToogleStyle1.fixedHeight = (int)(35 * scale); + + ToogleStyle2 = new GUIStyle(GUI.skin.box); + ToogleStyle2.fontSize = (int)(26 * scale); + ToogleStyle2.fixedHeight = (int)(35 * scale); + + TextFieldStyle = new GUIStyle(GUI.skin.textField); + TextFieldStyle.fontSize = (int)(22 * scale); + TextFieldStyle.fixedHeight = (int)(30 * scale); + + LableStyle = new GUIStyle(GUI.skin.label); + LableStyle.fontSize = (int)(24 * scale); + + RichLabelStyle = GUIStyle.none; + RichLabelStyle.richText = true; + RichLabelFontSize = (int)(24 * scale); + } + } + + public static Vector2 BeginScrollView(Vector2 pos, float offset = 0f) + { + // 璁剧疆婊戝姩鏉$毊鑲 + _cachedHorizontalScrollbarThumb = GUI.skin.horizontalScrollbarThumb; + _cachedVerticalScrollbarThumb = GUI.skin.verticalScrollbarThumb; + GUI.skin.horizontalScrollbarThumb = HorizontalScrollbarThumbStyle; + GUI.skin.verticalScrollbarThumb = VerticalScrollbarThumbStyle; + + float scrollWidth = Screen.safeArea.width - VerticalScrollbarStyle.fixedWidth; + float scrollHeight = Screen.safeArea.height - ToolbarStyle.fixedHeight * 2 - offset; + return GUILayout.BeginScrollView(pos, HorizontalScrollbarStyle, VerticalScrollbarStyle, GUILayout.Width(scrollWidth), GUILayout.Height(scrollHeight)); + } + public static void EndScrollView() + { + GUILayout.EndScrollView(); + + // 杩樺師婊戝姩鏉$毊鑲 + GUI.skin.horizontalScrollbarThumb = _cachedHorizontalScrollbarThumb; + GUI.skin.verticalScrollbarThumb = _cachedVerticalScrollbarThumb; + } + public static bool Toggle(string name, bool checkFlag) + { + GUIStyle style = checkFlag ? ToogleStyle1 : ToogleStyle2; + if (GUILayout.Button(name, style)) + { + checkFlag = !checkFlag; + } + return checkFlag; + } + public static void Lable(string text) + { + GUILayout.Label($"{text}", RichLabelStyle); + } + public static void RedLable(string text) + { + GUILayout.Label($"{text}", RichLabelStyle); + } + public static void YellowLable(string text) + { + GUILayout.Label($"{text}", RichLabelStyle); + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/ConsoleGUI.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/ConsoleGUI.cs.meta new file mode 100644 index 0000000..3711222 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/ConsoleGUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5fd3df705aafda04ba9590b482ab54a4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/DeveloperConsole.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/DeveloperConsole.cs new file mode 100644 index 0000000..35e96a7 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/DeveloperConsole.cs @@ -0,0 +1,170 @@ +锘 +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using MotionFramework.Utility; + +namespace MotionFramework.Console +{ + /// + /// 鎺у埗鍙 + /// + public static class DeveloperConsole + { + private class WindowWrapper : IComparer, IComparable + { + public Type ClassType; + public string Title; + public int Priority; + public IConsoleWindow Instance; + + public int CompareTo(WindowWrapper other) + { + return Compare(this, other); + } + public int Compare(WindowWrapper a, WindowWrapper b) + { + return a.Priority.CompareTo(b.Priority); + } + } + + /// + /// 鎺у埗鍙拌妭鐐瑰垪琛 + /// + private readonly static List _wrappers = new List(); + + // FPS鐩稿叧 + private static FPSCounter _fpsCounter = null; + private static int _lastFrame = 0; + + // GUI鐩稿叧 + private static bool _visible = false; + private static int _showIndex = 0; + private static Texture _bgTexture; + private static string[] _toolbarTitles; + + /// + /// 鍒濆鍖栨帶鍒跺彴 + /// + /// 鎵╁睍鐨勬帶鍒跺彴绐楀彛鎵鍦ㄧ殑绋嬪簭闆 + public static void Initialize(bool showFPS = true, string assemblyName = AssemblyUtility.UnityDefaultAssemblyName) + { + if (showFPS) + { + _fpsCounter = new FPSCounter(); + } + + // 鍔犺浇鑳屾櫙绾圭悊 + string textureName = "console_background"; + _bgTexture = Resources.Load(textureName); + if (_bgTexture == null) + UnityEngine.Debug.LogWarning($"Not found {textureName} texture in Resources folder."); + + // 鑾峰彇鎵鏈夋帶鍒跺彴绐楀彛绫 + List types = AssemblyUtility.GetAssignableAttributeTypes(AssemblyUtility.MotionFrameworkAssemblyName, typeof(IConsoleWindow), typeof(ConsoleAttribute)); + List temps = AssemblyUtility.GetAssignableAttributeTypes(assemblyName, typeof(IConsoleWindow), typeof(ConsoleAttribute)); + types.AddRange(temps); + for (int i = 0; i < types.Count; i++) + { + ConsoleAttribute attribute = (ConsoleAttribute)Attribute.GetCustomAttribute(types[i], typeof(ConsoleAttribute)); + WindowWrapper wrapper = new WindowWrapper() + { + ClassType = types[i], + Title = attribute.Title, + Priority = attribute.Order, + }; + _wrappers.Add(wrapper); + } + + // 鏍规嵁浼樺厛绾ф帓搴 + _wrappers.Sort(); + + // 鍒涘缓瀹炰緥绫 + for (int i = 0; i < _wrappers.Count; i++) + { + WindowWrapper wrapper = _wrappers[i]; + wrapper.Instance = (IConsoleWindow)Activator.CreateInstance(wrapper.ClassType); + } + + // 鏍囬鍒楄〃 + List titles = new List(); + for (int i = 0; i < _wrappers.Count; i++) + { + titles.Add(_wrappers[i].Title); + } + _toolbarTitles = titles.ToArray(); + } + + /// + /// 缁樺埗鎺у埗鍙 + /// 娉ㄦ剰锛氳鎺ュ彛蹇呴』鍦∣nGUI鍑芥暟鍐呰皟鐢 + /// + public static void Draw() + { + if (_fpsCounter != null) + { + if (_lastFrame != Time.frameCount) + { + _lastFrame = Time.frameCount; + _fpsCounter.Update(); + } + } + + // 娉ㄦ剰锛欸UI鎺ュ彛鍙兘鍦∣nGUI鍐呴儴浣跨敤 + ConsoleGUI.InitGlobalStyle(); + + float posX = Screen.safeArea.x; + float posY = Screen.height - Screen.safeArea.height - Screen.safeArea.y; + + if (_visible == false) + { + float wdith = ConsoleGUI.XStyle.fixedWidth; + float height = ConsoleGUI.XStyle.fixedHeight; + + // 鏄剧ず鎸夐挳 + if (GUI.Button(new Rect(posX + 10, posY + 10, wdith, height), "X", ConsoleGUI.XStyle)) + _visible = true; + + // FPS + if (_fpsCounter != null) + { + int fps = _fpsCounter.GetFPS(); + string text = $"{fps}"; + GUI.Label(new Rect(posX + wdith * 1.5f, posY + 5, wdith * 2, height * 2), text, ConsoleGUI.RichLabelStyle); + } + } + else + { + Rect windowRect = new Rect(posX, posY, Screen.safeArea.width, Screen.safeArea.height); + GUI.Window(0, windowRect, DrawWindow, string.Empty); + } + } + private static void DrawWindow(int windowID) + { + // 缁樺埗鑳屾櫙 + if (_visible && _bgTexture != null) + GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), _bgTexture, ScaleMode.StretchToFill, true); + + GUILayout.BeginHorizontal(); + { + // 闅愯棌鎸夐挳 + if (GUILayout.Button("X", ConsoleGUI.ButtonStyle, GUILayout.Width(ConsoleGUI.ButtonStyle.fixedHeight))) + _visible = false; + + // 缁樺埗鎸夐挳鏍 + _showIndex = GUILayout.Toolbar(_showIndex, _toolbarTitles, ConsoleGUI.ToolbarStyle); + } + GUILayout.EndHorizontal(); + + // 缁樺埗閫変腑绐楀彛 + for (int i = 0; i < _wrappers.Count; i++) + { + if (_showIndex != i) + continue; + WindowWrapper wrapper = _wrappers[i]; + wrapper.Instance.OnGUI(); + } + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/DeveloperConsole.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/DeveloperConsole.cs.meta new file mode 100644 index 0000000..893a338 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/DeveloperConsole.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 08697fd1e8d875c4888cba0db1280b60 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/FPSCounter.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/FPSCounter.cs new file mode 100644 index 0000000..caffd26 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/FPSCounter.cs @@ -0,0 +1,42 @@ +锘縰sing UnityEngine; + +namespace MotionFramework.Console +{ + public class FPSCounter + { + private const float UpdateInterval = 1.0f; + + private bool _isStart = false; + private float _lastInterval; + private int _frames; + private float _ms; + private float _fps; + + public void Update() + { + if (_isStart == false) + { + _isStart = true; + _lastInterval = Time.realtimeSinceStartup; + } + + ++_frames; + float timeNow = Time.realtimeSinceStartup; + if (timeNow > _lastInterval + UpdateInterval) + { + _fps = _frames / (timeNow - _lastInterval); + _ms = 1000.0f / Mathf.Max(_fps, 0.00001f); + _frames = 0; + _lastInterval = timeNow; + } + } + public int GetFPS() + { + return Mathf.CeilToInt(_fps); + } + public float GetMS() + { + return _ms; + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/FPSCounter.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/FPSCounter.cs.meta new file mode 100644 index 0000000..73007d6 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/FPSCounter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 269834f2912e01245a28761bc1787ffc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/IConsoleWindow.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/IConsoleWindow.cs new file mode 100644 index 0000000..23bcdd5 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/IConsoleWindow.cs @@ -0,0 +1,9 @@ +锘 + +namespace MotionFramework.Console +{ + public interface IConsoleWindow + { + void OnGUI(); + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/IConsoleWindow.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/IConsoleWindow.cs.meta new file mode 100644 index 0000000..85d5c50 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Console/IConsoleWindow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e825e215c03a3a54d9ee86a64d99c51a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Network.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Network.meta new file mode 100644 index 0000000..bbca743 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Network.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a5df74ec92889b640bf662d3a2991bb2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference.meta new file mode 100644 index 0000000..8336da5 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8fe81b14a1faa17408f8bcc7b18f11f6 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference/IReference.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference/IReference.cs new file mode 100644 index 0000000..8ccc922 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference/IReference.cs @@ -0,0 +1,9 @@ +锘 + +namespace MotionFramework.Reference +{ + public interface IReference + { + void OnRelease(); + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference/IReference.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference/IReference.cs.meta new file mode 100644 index 0000000..8aa5c26 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference/IReference.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7b7a4e9d2f217d14fa3fd2c5a2de2f8c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference/ReferenceCollector.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference/ReferenceCollector.cs new file mode 100644 index 0000000..f2ba97f --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference/ReferenceCollector.cs @@ -0,0 +1,90 @@ +锘 +using System; +using System.Collections; +using System.Collections.Generic; + +namespace MotionFramework.Reference +{ + internal class ReferenceCollector + { + private readonly Stack _collector; + + /// + /// 寮曠敤绫诲瀷 + /// + public Type ClassType { private set; get; } + + /// + /// 鍐呴儴缂撳瓨鎬绘暟 + /// + public int Count + { + get { return _collector.Count; } + } + + /// + /// 澶栭儴浣跨敤鎬绘暟 + /// + public int SpawnCount { private set; get; } + + + public ReferenceCollector(Type type, int capacity) + { + ClassType = type; + + // 鍒涘缓缂撳瓨姹 + _collector = new Stack(capacity); + + // 妫娴嬫槸鍚︾户鎵夸簡涓撳睘鎺ュ彛 + Type temp = type.GetInterface(nameof(IReference)); + if (temp == null) + throw new Exception($"{type.Name} must inherit from {nameof(IReference)}"); + } + + /// + /// 鐢宠寮曠敤瀵硅薄 + /// + public IReference Spawn() + { + IReference item; + if (_collector.Count > 0) + { + item = _collector.Pop(); + } + else + { + item = Activator.CreateInstance(ClassType) as IReference; + } + SpawnCount++; + return item; + } + + /// + /// 鍥炴敹寮曠敤瀵硅薄 + /// + public void Release(IReference item) + { + if (item == null) + return; + + if (item.GetType() != ClassType) + throw new Exception($"Invalid type {item.GetType()}"); + + if (_collector.Contains(item)) + throw new Exception($"The item {item.GetType()} already exists."); + + SpawnCount--; + item.OnRelease(); + _collector.Push(item); + } + + /// + /// 娓呯┖闆嗗悎 + /// + public void Clear() + { + _collector.Clear(); + SpawnCount = 0; + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference/ReferenceCollector.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference/ReferenceCollector.cs.meta new file mode 100644 index 0000000..685ef11 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference/ReferenceCollector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0c5b53630547ac94d9281a9abb0814c5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference/ReferencePool.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference/ReferencePool.cs new file mode 100644 index 0000000..53aeddf --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference/ReferencePool.cs @@ -0,0 +1,115 @@ +锘 +using System; +using System.Collections; +using System.Collections.Generic; + +namespace MotionFramework.Reference +{ + /// + /// 寮曠敤姹 + /// + public static class ReferencePool + { + private static readonly Dictionary _collectors = new Dictionary(); + + /// + /// 瀵硅薄姹犲垵濮嬪閲 + /// + public static int InitCapacity { get; set; } = 100; + + /// + /// 瀵硅薄姹犵殑鏁伴噺 + /// + public static int Count + { + get + { + return _collectors.Count; + } + } + + + /// + /// 娓呴櫎鎵鏈夊璞℃睜 + /// + public static void ClearAll() + { + _collectors.Clear(); + } + + /// + /// 鐢宠寮曠敤瀵硅薄 + /// + public static IReference Spawn(Type type) + { + if (_collectors.ContainsKey(type) == false) + { + _collectors.Add(type, new ReferenceCollector(type, InitCapacity)); + } + return _collectors[type].Spawn(); + } + + /// + /// 鐢宠寮曠敤瀵硅薄 + /// + public static T Spawn() where T : class, IReference, new() + { + Type type = typeof(T); + return Spawn(type) as T; + } + + /// + /// 鍥炴敹寮曠敤瀵硅薄 + /// + public static void Release(IReference item) + { + Type type = item.GetType(); + if (_collectors.ContainsKey(type) == false) + { + _collectors.Add(type, new ReferenceCollector(type, InitCapacity)); + } + _collectors[type].Release(item); + } + + /// + /// 鎵归噺鍥炴敹鍒楄〃闆嗗悎 + /// + public static void Release(List items) where T : class, IReference, new() + { + Type type = typeof(T); + if (_collectors.ContainsKey(type) == false) + { + _collectors.Add(type, new ReferenceCollector(type, InitCapacity)); + } + + for (int i = 0; i < items.Count; i++) + { + _collectors[type].Release(items[i]); + } + } + + /// + /// 鎵归噺鍥炴敹鏁扮粍闆嗗悎 + /// + public static void Release(T[] items) where T : class, IReference, new() + { + Type type = typeof(T); + if (_collectors.ContainsKey(type) == false) + { + _collectors.Add(type, new ReferenceCollector(type, InitCapacity)); + } + + for (int i = 0; i < items.Length; i++) + { + _collectors[type].Release(items[i]); + } + } + + #region 璋冭瘯涓撳睘鏂规硶 + internal static Dictionary GetAllCollectors + { + get { return _collectors; } + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference/ReferencePool.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference/ReferencePool.cs.meta new file mode 100644 index 0000000..f73181e --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Reference/ReferencePool.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3f4f4ee7b0e49ee459b54961143b5847 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility.meta new file mode 100644 index 0000000..a1d45cb --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3f00e9242af88e04b905a41cfdf8c50d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/AssemblyUtility.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/AssemblyUtility.cs new file mode 100644 index 0000000..022f5af --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/AssemblyUtility.cs @@ -0,0 +1,141 @@ +锘 +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Reflection; + +namespace MotionFramework.Utility +{ + public static class AssemblyUtility + { + public const string MotionFrameworkAssemblyName = "MotionFramework"; + public const string MotionFrameworkAssemblyEditorName = "MotionFramework.Editor"; + public const string UnityDefaultAssemblyName = "Assembly-CSharp"; + public const string UnityDefaultAssemblyEditorName = "Assembly-CSharp-Editor"; + + + private static readonly Dictionary> _cache = new Dictionary>(); + + static AssemblyUtility() + { + _cache.Clear(); + } + + /// + /// 鑾峰彇绋嬪簭闆 + /// + public static Assembly GetAssembly(string assemblyName) + { + Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); + foreach (Assembly assembly in assemblies) + { + if (assembly.GetName().Name == assemblyName) + return assembly; + } + return null; + } + + /// + /// 鑾峰彇绋嬪簭闆嗛噷鐨勬墍鏈夌被鍨 + /// + private static List GetTypes(string assemblyName) + { + if (_cache.ContainsKey(assemblyName)) + return _cache[assemblyName]; + + Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); + foreach (Assembly assembly in assemblies) + { + if (assembly.GetName().Name == assemblyName) + { + List types = assembly.GetTypes().ToList(); + _cache.Add(assemblyName, types); + return types; + } + } + + // 娉ㄦ剰锛氬鏋滄病鏈夋壘鍒扮▼搴忛泦杩斿洖绌哄垪琛 + UnityEngine.Debug.LogWarning($"Not found assembly : {assemblyName}"); + return new List(); + } + + /// + /// 鑾峰彇甯︾户鎵垮叧绯荤殑鎵鏈夌被鐨勭被鍨 + /// 鐖剁被绫诲瀷 + /// + public static List GetAssignableTypes(string assemblyName, System.Type parentType) + { + List result = new List(); + List cacheTypes = GetTypes(assemblyName); + for (int i = 0; i < cacheTypes.Count; i++) + { + Type type = cacheTypes[i]; + + // 鍒ゆ柇缁ф壙鍏崇郴 + if (parentType.IsAssignableFrom(type)) + { + if (type.Name == parentType.Name) + continue; + result.Add(type); + } + } + return result; + } + + /// + /// 鑾峰彇甯﹀睘鎬ф爣绛剧殑鎵鏈夌被鐨勭被鍨 + /// 灞炴х被鍨 + /// + public static List GetAttributeTypes(string assemblyName, System.Type attributeType) + { + List result = new List(); + List cacheTypes = GetTypes(assemblyName); + for (int i = 0; i < cacheTypes.Count; i++) + { + System.Type type = cacheTypes[i]; + + // 鍒ゆ柇灞炴ф爣绛 + if (Attribute.IsDefined(type, attributeType)) + { + result.Add(type); + } + } + return result; + } + + /// + /// 鑾峰彇甯︾户鎵垮叧绯诲拰灞炴ф爣绛剧殑鎵鏈夌被鐨勭被鍨 + /// + /// 鐖剁被绫诲瀷 + /// 灞炴х被鍨 + public static List GetAssignableAttributeTypes(string assemblyName, System.Type parentType, System.Type attributeType, bool checkError = true) + { + List result = new List(); + List cacheTypes = GetTypes(assemblyName); + for (int i = 0; i < cacheTypes.Count; i++) + { + Type type = cacheTypes[i]; + + // 鍒ゆ柇灞炴ф爣绛 + if (Attribute.IsDefined(type, attributeType)) + { + // 鍒ゆ柇缁ф壙鍏崇郴 + if (parentType.IsAssignableFrom(type)) + { + if (type.Name == parentType.Name) + continue; + result.Add(type); + } + else + { + if(checkError) + throw new Exception($"class {type} must inherit from {parentType}."); + } + } + } + return result; + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/AssemblyUtility.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/AssemblyUtility.cs.meta new file mode 100644 index 0000000..dfba33a --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/AssemblyUtility.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6f5e6f29b65bf0449a7d33dbe1c04380 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/FileUtility.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/FileUtility.cs new file mode 100644 index 0000000..2c7e6f2 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/FileUtility.cs @@ -0,0 +1,71 @@ +锘 +using System; +using System.Text; +using System.IO; + +namespace MotionFramework.Utility +{ + public static class FileUtility + { + /// + /// 璇诲彇鏂囦欢 + /// + public static string ReadFile(string filePath) + { + if (File.Exists(filePath) == false) + return string.Empty; + return File.ReadAllText(filePath, Encoding.UTF8); + } + + /// + /// 鍒涘缓鏂囦欢 + /// + public static void CreateFile(string filePath, string content) + { + // 鍒犻櫎鏃ф枃浠 + if (File.Exists(filePath)) + File.Delete(filePath); + + // 鍒涘缓鏂囦欢澶硅矾寰 + CreateFileDirectory(filePath); + + // 鍒涘缓鏂版枃浠 + byte[] bytes = Encoding.UTF8.GetBytes(content); + using (FileStream fs = File.Create(filePath)) + { + fs.Write(bytes, 0, bytes.Length); + fs.Flush(); + fs.Close(); + } + } + + /// + /// 鍒涘缓鏂囦欢鐨勬枃浠跺す璺緞 + /// + public static void CreateFileDirectory(string filePath) + { + // 鑾峰彇鏂囦欢鐨勬枃浠跺す璺緞 + string directory = Path.GetDirectoryName(filePath); + CreateDirectory(directory); + } + + /// + /// 鍒涘缓鏂囦欢澶硅矾寰 + /// + public static void CreateDirectory(string directory) + { + // If the directory doesn't exist, create it. + if (Directory.Exists(directory) == false) + Directory.CreateDirectory(directory); + } + + /// + /// 鑾峰彇鏂囦欢澶у皬锛堝瓧鑺傛暟锛 + /// + public static long GetFileSize(string filePath) + { + FileInfo fileInfo = new FileInfo(filePath); + return fileInfo.Length; + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/FileUtility.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/FileUtility.cs.meta new file mode 100644 index 0000000..32d5c5d --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/FileUtility.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b11b6a7c3e2ac3b42934279f2611bd51 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/HashUtility.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/HashUtility.cs new file mode 100644 index 0000000..73669e3 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/HashUtility.cs @@ -0,0 +1,170 @@ +锘 +using System; +using System.Text; +using System.IO; +using System.Security.Cryptography; + +namespace MotionFramework.Utility +{ + public static class HashUtility + { + private static string ToString(byte[] hashBytes) + { + string result = BitConverter.ToString(hashBytes); + result = result.Replace("-", ""); + return result.ToLower(); + } + + #region SHA1 + /// + /// 鑾峰彇瀛楃涓茬殑Hash鍊 + /// + public static string StringSHA1(string str) + { + byte[] buffer = Encoding.UTF8.GetBytes(str); + return BytesSHA1(buffer); + } + + /// + /// 鑾峰彇鏂囦欢鐨凥ash鍊 + /// + public static string FileSHA1(string filePath) + { + try + { + using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read)) + { + return StreamSHA1(fs); + } + } + catch (Exception e) + { + MotionLog.Exception(e.ToString()); + return string.Empty; + } + } + + /// + /// 鑾峰彇鏁版嵁娴佺殑Hash鍊 + /// + public static string StreamSHA1(Stream stream) + { + // 璇存槑锛氬垱寤虹殑鏄疭HA1绫荤殑瀹炰緥锛岀敓鎴愮殑鏄160浣嶇殑鏁e垪鐮 + HashAlgorithm hash = HashAlgorithm.Create(); + byte[] hashBytes = hash.ComputeHash(stream); + return ToString(hashBytes); + } + + /// + /// 鑾峰彇瀛楄妭鏁扮粍鐨凥ash鍊 + /// + public static string BytesSHA1(byte[] buffer) + { + // 璇存槑锛氬垱寤虹殑鏄疭HA1绫荤殑瀹炰緥锛岀敓鎴愮殑鏄160浣嶇殑鏁e垪鐮 + HashAlgorithm hash = HashAlgorithm.Create(); + byte[] hashBytes = hash.ComputeHash(buffer); + return ToString(hashBytes); + } + #endregion + + #region MD5 + /// + /// 鑾峰彇瀛楃涓茬殑MD5 + /// + public static string StringMD5(string str) + { + byte[] buffer = Encoding.UTF8.GetBytes(str); + return BytesMD5(buffer); + } + + /// + /// 鑾峰彇鏂囦欢鐨凪D5 + /// + public static string FileMD5(string filePath) + { + try + { + using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read)) + { + return StreamMD5(fs); + } + } + catch (Exception e) + { + MotionLog.Exception(e.ToString()); + return string.Empty; + } + } + + /// + /// 鑾峰彇鏁版嵁娴佺殑MD5 + /// + public static string StreamMD5(Stream stream) + { + MD5CryptoServiceProvider provider = new MD5CryptoServiceProvider(); + byte[] hashBytes = provider.ComputeHash(stream); + return ToString(hashBytes); + } + + /// + /// 鑾峰彇瀛楄妭鏁扮粍鐨凪D5 + /// + public static string BytesMD5(byte[] buffer) + { + MD5CryptoServiceProvider provider = new MD5CryptoServiceProvider(); + byte[] hashBytes = provider.ComputeHash(buffer); + return ToString(hashBytes); + } + #endregion + + #region CRC32 + /// + /// 鑾峰彇瀛楃涓茬殑CRC32 + /// + public static string StringCRC32(string str) + { + byte[] buffer = Encoding.UTF8.GetBytes(str); + return BytesCRC32(buffer); + } + + /// + /// 鑾峰彇鏂囦欢鐨凜RC32 + /// + public static string FileCRC32(string filePath) + { + try + { + using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read)) + { + return StreamCRC32(fs); + } + } + catch (Exception e) + { + MotionLog.Exception(e.ToString()); + return string.Empty; + } + } + + /// + /// 鑾峰彇鏁版嵁娴佺殑CRC32 + /// + public static string StreamCRC32(Stream stream) + { + CRC32Algorithm hash = new CRC32Algorithm(); + byte[] hashBytes = hash.ComputeHash(stream); + return ToString(hashBytes); + } + + /// + /// 鑾峰彇瀛楄妭鏁扮粍鐨凜RC32 + /// + public static string BytesCRC32(byte[] buffer) + { + CRC32Algorithm hash = new CRC32Algorithm(); + byte[] hashBytes = hash.ComputeHash(buffer); + return ToString(hashBytes); + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/HashUtility.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/HashUtility.cs.meta new file mode 100644 index 0000000..418d44e --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/HashUtility.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 24be65499552d3e46a4b8611ae81b9f9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc.meta new file mode 100644 index 0000000..034f325 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3123d2179297db341a92247c7ed04a4d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/BitMask32.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/BitMask32.cs new file mode 100644 index 0000000..2f14121 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/BitMask32.cs @@ -0,0 +1,70 @@ +锘 +using System; + +namespace MotionFramework.Utility +{ + public struct BitMask32 + { + private int _mask; + + public static implicit operator int(BitMask32 mask) { return mask._mask; } + public static implicit operator BitMask32(int mask) { return new BitMask32(mask); } + + public BitMask32(int mask) + { + _mask = mask; + } + + /// + /// 鎵撳紑浣 + /// + public void Open(int bit) + { + if (bit < 0 || bit > 31) + throw new ArgumentOutOfRangeException(); + else + _mask |= 1 << bit; + } + + /// + /// 鍏抽棴浣 + /// + public void Close(int bit) + { + if (bit < 0 || bit > 31) + throw new ArgumentOutOfRangeException(); + else + _mask &= ~(1 << bit); + } + + /// + /// 浣嶅彇鍙 + /// + public void Reverse(int bit) + { + if (bit < 0 || bit > 31) + throw new ArgumentOutOfRangeException(); + else + _mask ^= 1 << bit; + } + + /// + /// 鎵鏈変綅鍙栧弽 + /// + public void Inverse() + { + _mask = ~_mask; + } + + /// + /// 姣斿浣嶅 + /// + public bool Test(int bit) + { + if (bit < 0 || bit > 31) + throw new ArgumentOutOfRangeException(); + else + return (_mask & (1 << bit)) != 0; + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/BitMask32.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/BitMask32.cs.meta new file mode 100644 index 0000000..05ee12f --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/BitMask32.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 229afadde794cc744a32a2ec829a67f9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/BitMask64.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/BitMask64.cs new file mode 100644 index 0000000..3649afc --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/BitMask64.cs @@ -0,0 +1,74 @@ +锘//-------------------------------------------------- +// Motion Framework +// Copyright漏2020-2020 浣曞啝宄 +// Licensed under the MIT license +//-------------------------------------------------- +using System; + +namespace MotionFramework.Utility +{ + public struct BitMask64 + { + private long _mask; + + public static implicit operator long(BitMask64 mask) { return mask._mask; } + public static implicit operator BitMask64(long mask) { return new BitMask64(mask); } + + public BitMask64(long mask) + { + _mask = mask; + } + + /// + /// 鎵撳紑浣 + /// + public void Open(int bit) + { + if (bit < 0 || bit > 63) + throw new ArgumentOutOfRangeException(); + else + _mask |= 1L << bit; + } + + /// + /// 鍏抽棴浣 + /// + public void Close(int bit) + { + if (bit < 0 || bit > 63) + throw new ArgumentOutOfRangeException(); + else + _mask &= ~(1L << bit); + } + + /// + /// 浣嶅彇鍙 + /// + public void Reverse(int bit) + { + if (bit < 0 || bit > 63) + throw new ArgumentOutOfRangeException(); + else + _mask ^= 1L << bit; + } + + /// + /// 鎵鏈変綅鍙栧弽 + /// + public void Inverse() + { + _mask = ~_mask; + } + + /// + /// 姣斿浣嶅 + /// + public bool Test(int bit) + { + if (bit < 0 || bit > 63) + throw new ArgumentOutOfRangeException(); + else + return (_mask & (1L << bit)) != 0; + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/BitMask64.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/BitMask64.cs.meta new file mode 100644 index 0000000..3ea476a --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/BitMask64.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 292cc03e5ad0d724188fbfa83506e5e0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/CRC32Algorithm.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/CRC32Algorithm.cs new file mode 100644 index 0000000..eacad0b --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/CRC32Algorithm.cs @@ -0,0 +1,247 @@ +锘//-------------------------------------------------- +// This is .NET safe implementation of Crc32 algorithm. +// Copyright漏2016-2017 Max Vysokikh +// Copyright漏2020-2020 浣曞啝宄 +// Licensed under the MIT license +//-------------------------------------------------- +using System; +using System.Security.Cryptography; + +namespace MotionFramework.Utility +{ + internal class SafeProxy + { + private const uint Poly = 0xedb88320u; + private readonly uint[] _table = new uint[16 * 256]; + + internal SafeProxy() + { + Init(Poly); + } + public void Init(uint poly) + { + var table = _table; + for (uint i = 0; i < 256; i++) + { + uint res = i; + for (int t = 0; t < 16; t++) + { + for (int k = 0; k < 8; k++) res = (res & 1) == 1 ? poly ^ (res >> 1) : (res >> 1); + table[(t * 256) + i] = res; + } + } + } + public uint Append(uint crc, byte[] input, int offset, int length) + { + uint crcLocal = uint.MaxValue ^ crc; + + uint[] table = _table; + while (length >= 16) + { + var a = table[(3 * 256) + input[offset + 12]] + ^ table[(2 * 256) + input[offset + 13]] + ^ table[(1 * 256) + input[offset + 14]] + ^ table[(0 * 256) + input[offset + 15]]; + + var b = table[(7 * 256) + input[offset + 8]] + ^ table[(6 * 256) + input[offset + 9]] + ^ table[(5 * 256) + input[offset + 10]] + ^ table[(4 * 256) + input[offset + 11]]; + + var c = table[(11 * 256) + input[offset + 4]] + ^ table[(10 * 256) + input[offset + 5]] + ^ table[(9 * 256) + input[offset + 6]] + ^ table[(8 * 256) + input[offset + 7]]; + + var d = table[(15 * 256) + ((byte)crcLocal ^ input[offset])] + ^ table[(14 * 256) + ((byte)(crcLocal >> 8) ^ input[offset + 1])] + ^ table[(13 * 256) + ((byte)(crcLocal >> 16) ^ input[offset + 2])] + ^ table[(12 * 256) + ((crcLocal >> 24) ^ input[offset + 3])]; + + crcLocal = d ^ c ^ b ^ a; + offset += 16; + length -= 16; + } + + while (--length >= 0) + crcLocal = table[(byte)(crcLocal ^ input[offset++])] ^ crcLocal >> 8; + + return crcLocal ^ uint.MaxValue; + } + } + + /// + /// Implementation of CRC-32. + /// This class supports several convenient static methods returning the CRC as UInt32. + /// + public class CRC32Algorithm : HashAlgorithm + { + private uint _currentCrc; + + /// + /// Initializes a new instance of the class. + /// + public CRC32Algorithm() + { +#if !NETCORE13 + HashSizeValue = 32; +#endif + } + + /// + /// Resets internal state of the algorithm. Used internally. + /// + public override void Initialize() + { + _currentCrc = 0; + } + + /// + /// Appends CRC-32 from given buffer + /// + protected override void HashCore(byte[] input, int offset, int length) + { + _currentCrc = AppendInternal(_currentCrc, input, offset, length); + } + + /// + /// Computes CRC-32 from + /// + protected override byte[] HashFinal() + { + if(BitConverter.IsLittleEndian) + return new[] { (byte)_currentCrc, (byte)(_currentCrc >> 8), (byte)(_currentCrc >> 16), (byte)(_currentCrc >> 24) }; + else + return new[] { (byte)(_currentCrc >> 24), (byte)(_currentCrc >> 16), (byte)(_currentCrc >> 8), (byte)_currentCrc }; + } + + + /// + /// Computes CRC-32 from multiple buffers. + /// Call this method multiple times to chain multiple buffers. + /// + /// + /// Initial CRC value for the algorithm. It is zero for the first buffer. + /// Subsequent buffers should have their initial value set to CRC value returned by previous call to this method. + /// + /// Input buffer with data to be checksummed. + /// Offset of the input data within the buffer. + /// Length of the input data in the buffer. + /// Accumulated CRC-32 of all buffers processed so far. + public static uint Append(uint initial, byte[] input, int offset, int length) + { + if (input == null) + throw new ArgumentNullException("input"); + if (offset < 0 || length < 0 || offset + length > input.Length) + throw new ArgumentOutOfRangeException("length"); + return AppendInternal(initial, input, offset, length); + } + + /// + /// Computes CRC-32 from multiple buffers. + /// Call this method multiple times to chain multiple buffers. + /// + /// + /// Initial CRC value for the algorithm. It is zero for the first buffer. + /// Subsequent buffers should have their initial value set to CRC value returned by previous call to this method. + /// + /// Input buffer containing data to be checksummed. + /// Accumulated CRC-32 of all buffers processed so far. + public static uint Append(uint initial, byte[] input) + { + if (input == null) + throw new ArgumentNullException(); + return AppendInternal(initial, input, 0, input.Length); + } + + /// + /// Computes CRC-32 from input buffer. + /// + /// Input buffer with data to be checksummed. + /// Offset of the input data within the buffer. + /// Length of the input data in the buffer. + /// CRC-32 of the data in the buffer. + public static uint Compute(byte[] input, int offset, int length) + { + return Append(0, input, offset, length); + } + + /// + /// Computes CRC-32 from input buffer. + /// + /// Input buffer containing data to be checksummed. + /// CRC-32 of the buffer. + public static uint Compute(byte[] input) + { + return Append(0, input); + } + + /// + /// Computes CRC-32 from input buffer and writes it after end of data (buffer should have 4 bytes reserved space for it). Can be used in conjunction with + /// + /// Input buffer with data to be checksummed. + /// Offset of the input data within the buffer. + /// Length of the input data in the buffer. + /// CRC-32 of the data in the buffer. + public static uint ComputeAndWriteToEnd(byte[] input, int offset, int length) + { + if (length + 4 > input.Length) + throw new ArgumentOutOfRangeException("length", "Length of data should be less than array length - 4 bytes of CRC data"); + var crc = Append(0, input, offset, length); + var r = offset + length; + input[r] = (byte)crc; + input[r + 1] = (byte)(crc >> 8); + input[r + 2] = (byte)(crc >> 16); + input[r + 3] = (byte)(crc >> 24); + return crc; + } + + /// + /// Computes CRC-32 from input buffer - 4 bytes and writes it as last 4 bytes of buffer. Can be used in conjunction with + /// + /// Input buffer with data to be checksummed. + /// CRC-32 of the data in the buffer. + public static uint ComputeAndWriteToEnd(byte[] input) + { + if (input.Length < 4) + throw new ArgumentOutOfRangeException("input", "Input array should be 4 bytes at least"); + return ComputeAndWriteToEnd(input, 0, input.Length - 4); + } + + /// + /// Validates correctness of CRC-32 data in source buffer with assumption that CRC-32 data located at end of buffer in reverse bytes order. Can be used in conjunction with + /// + /// Input buffer with data to be checksummed. + /// Offset of the input data within the buffer. + /// Length of the input data in the buffer with CRC-32 bytes. + /// Is checksum valid. + public static bool IsValidWithCrcAtEnd(byte[] input, int offset, int lengthWithCrc) + { + return Append(0, input, offset, lengthWithCrc) == 0x2144DF1C; + } + + /// + /// Validates correctness of CRC-32 data in source buffer with assumption that CRC-32 data located at end of buffer in reverse bytes order. Can be used in conjunction with + /// + /// Input buffer with data to be checksummed. + /// Is checksum valid. + public static bool IsValidWithCrcAtEnd(byte[] input) + { + if (input.Length < 4) + throw new ArgumentOutOfRangeException("input", "Input array should be 4 bytes at least"); + return Append(0, input, 0, input.Length) == 0x2144DF1C; + } + + + private static readonly SafeProxy _proxy = new SafeProxy(); + private static uint AppendInternal(uint initial, byte[] input, int offset, int length) + { + if (length > 0) + { + return _proxy.Append(initial, input, offset, length); + } + else + return initial; + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/CRC32Algorithm.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/CRC32Algorithm.cs.meta new file mode 100644 index 0000000..943b229 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/CRC32Algorithm.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6b096abda3d32ea44b9870c8fa2a6560 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateDouble.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateDouble.cs new file mode 100644 index 0000000..1b9de2c --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateDouble.cs @@ -0,0 +1,110 @@ +锘//-------------------------------------------------- +// Motion Framework +// Copyright漏2020-2020 浣曞啝宄 +// Licensed under the MIT license +//-------------------------------------------------- +using System; +using UnityEngine; + +namespace MotionFramework.Utility +{ + [Serializable] + public struct ObfuscateDouble : IFormattable, IEquatable, IComparable, IComparable, IComparable + { + private static long GlobalSeed = DateTime.Now.Ticks; + + [SerializeField] + private long _seed; + [SerializeField] + private long _data; + + public ObfuscateDouble(double value) + { + _seed = GlobalSeed++; + _data = 0; + Value = value; + } + internal double Value + { + get + { + var v = _data ^ _seed; + return ConvertValue(v); + } + set + { + var v = ConvertValue(value); + _data = v ^ _seed; + } + } + + public override int GetHashCode() + { + return Value.GetHashCode(); + } + public override string ToString() + { + return Value.ToString(); + } + public override bool Equals(object obj) + { + return obj is ObfuscateDouble && Equals((ObfuscateDouble)obj); + } + + public string ToString(string format) + { + return Value.ToString(format); + } + public string ToString(IFormatProvider provider) + { + return Value.ToString(provider); + } + public string ToString(string format, IFormatProvider provider) + { + return Value.ToString(format, provider); + } + + public bool Equals(ObfuscateDouble obj) + { + return obj.Value.Equals(Value); + } + public int CompareTo(ObfuscateDouble other) + { + return Value.CompareTo(other.Value); + } + public int CompareTo(double other) + { + return Value.CompareTo(other); + } + public int CompareTo(object obj) + { + return Value.CompareTo(obj); + } + + #region 杩愮畻绗﹂噸杞 + public static implicit operator double(ObfuscateDouble value) + { + return value.Value; + } + public static implicit operator ObfuscateDouble(double value) + { + return new ObfuscateDouble(value); + } + public static explicit operator ObfuscateDouble(ObfuscateFloat value) + { + return (float)value; + } + #endregion + + unsafe static long ConvertValue(double value) + { + double* ptr = &value; + return *((long*)ptr); + } + unsafe static double ConvertValue(long value) + { + long* ptr = &value; + return *((double*)ptr); + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateDouble.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateDouble.cs.meta new file mode 100644 index 0000000..6c11a0f --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateDouble.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1b8a64fba6ba07a45b9c3f5355dd76bc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateFloat.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateFloat.cs new file mode 100644 index 0000000..d65215b --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateFloat.cs @@ -0,0 +1,106 @@ +锘//-------------------------------------------------- +// Motion Framework +// Copyright漏2020-2020 浣曞啝宄 +// Licensed under the MIT license +//-------------------------------------------------- +using System; +using UnityEngine; + +namespace MotionFramework.Utility +{ + [Serializable] + public struct ObfuscateFloat : IFormattable, IEquatable, IComparable, IComparable, IComparable + { + private static int GlobalSeed = (int)DateTime.Now.Ticks; + + [SerializeField] + private int _seed; + [SerializeField] + private int _data; + + public ObfuscateFloat(float value) + { + _seed = GlobalSeed++; + _data = 0; + Value = value; + } + internal float Value + { + get + { + var v = _data ^ _seed; + return ConvertValue(v); + } + set + { + var v = ConvertValue(value); + _data = v ^ _seed; + } + } + + public override int GetHashCode() + { + return Value.GetHashCode(); + } + public override string ToString() + { + return Value.ToString(); + } + public override bool Equals(object obj) + { + return obj is ObfuscateFloat && Equals((ObfuscateFloat)obj); + } + + public string ToString(string format) + { + return Value.ToString(format); + } + public string ToString(IFormatProvider provider) + { + return Value.ToString(provider); + } + public string ToString(string format, IFormatProvider provider) + { + return Value.ToString(format, provider); + } + + public bool Equals(ObfuscateFloat obj) + { + return obj.Value.Equals(Value); + } + public int CompareTo(ObfuscateFloat other) + { + return Value.CompareTo(other.Value); + } + public int CompareTo(float other) + { + return Value.CompareTo(other); + } + public int CompareTo(object obj) + { + return Value.CompareTo(obj); + } + + #region 杩愮畻绗﹂噸杞 + public static implicit operator float(ObfuscateFloat value) + { + return value.Value; + } + public static implicit operator ObfuscateFloat(float value) + { + return new ObfuscateFloat(value); + } + #endregion + + unsafe static int ConvertValue(float value) + { + float* ptr = &value; + return *((int*)ptr); + } + unsafe static float ConvertValue(int value) + { + int* ptr = &value; + return *((float*)ptr); + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateFloat.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateFloat.cs.meta new file mode 100644 index 0000000..d858503 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateFloat.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3b3ab743f82f4314587e8def6386768f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateInt.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateInt.cs new file mode 100644 index 0000000..ab1c1be --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateInt.cs @@ -0,0 +1,110 @@ +锘//-------------------------------------------------- +// Motion Framework +// Copyright漏2020-2020 浣曞啝宄 +// Licensed under the MIT license +//-------------------------------------------------- +using System; +using UnityEngine; + +namespace MotionFramework.Utility +{ + [Serializable] + public struct ObfuscateInt : IFormattable, IEquatable, IComparable, IComparable, IComparable + { + private static int GlobalSeed = (int)DateTime.Now.Ticks; + + [SerializeField] + private int _seed; + [SerializeField] + private int _data; + + public ObfuscateInt(int value) + { + _seed = GlobalSeed++; + _data = 0; + Value = value; + } + internal int Value + { + get + { + var v = _data ^ _seed; + return v; + } + set + { + _data = value ^ _seed; + } + } + + public override int GetHashCode() + { + return Value.GetHashCode(); + } + public override string ToString() + { + return Value.ToString(); + } + public override bool Equals(object obj) + { + return obj is ObfuscateInt && Equals((ObfuscateInt)obj); + } + + public string ToString(string format) + { + return Value.ToString(format); + } + public string ToString(IFormatProvider provider) + { + return Value.ToString(provider); + } + public string ToString(string format, IFormatProvider provider) + { + return Value.ToString(format, provider); + } + + public bool Equals(ObfuscateInt obj) + { + return Value.Equals(obj.Value); + } + public int CompareTo(ObfuscateInt other) + { + return Value.CompareTo(other.Value); + } + public int CompareTo(int other) + { + return Value.CompareTo(other); + } + public int CompareTo(object obj) + { + return Value.CompareTo(obj); + } + + #region 杩愮畻绗﹂噸杞 + public static implicit operator int(ObfuscateInt value) + { + return value.Value; + } + public static implicit operator ObfuscateInt(int value) + { + return new ObfuscateInt(value); + } + public static implicit operator ObfuscateFloat(ObfuscateInt value) + { + return value.Value; + } + public static implicit operator ObfuscateDouble(ObfuscateInt value) + { + return value.Value; + } + public static ObfuscateInt operator ++(ObfuscateInt value) + { + return value.Value + 1; + } + public static ObfuscateInt operator --(ObfuscateInt value) + { + return value.Value - 1; + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateInt.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateInt.cs.meta new file mode 100644 index 0000000..476707b --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateInt.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 490fab43fb3ac0749afa102b9ba57dc8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateLong.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateLong.cs new file mode 100644 index 0000000..d6d50fb --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateLong.cs @@ -0,0 +1,102 @@ +锘//-------------------------------------------------- +// Motion Framework +// Copyright漏2020-2020 浣曞啝宄 +// Licensed under the MIT license +//-------------------------------------------------- +using System; +using UnityEngine; + +namespace MotionFramework.Utility +{ + [Serializable] + public struct ObfuscateLong : IFormattable, IEquatable, IComparable, IComparable, IComparable + { + private static long GlobalSeed = DateTime.Now.Ticks; + + [SerializeField] + private long _seed; + [SerializeField] + private long _data; + + public ObfuscateLong(long value) + { + _seed = GlobalSeed++; + _data = 0; + Value = value; + } + internal long Value + { + get + { + var v = _data ^ _seed; + return v; + } + set + { + _data = value ^ _seed; + } + } + + public override int GetHashCode() + { + return Value.GetHashCode(); + } + public override string ToString() + { + return Value.ToString(); + } + public override bool Equals(object obj) + { + return obj is ObfuscateLong && Equals((ObfuscateLong)obj); + } + + public string ToString(string format) + { + return Value.ToString(format); + } + public string ToString(IFormatProvider provider) + { + return Value.ToString(provider); + } + public string ToString(string format, IFormatProvider provider) + { + return Value.ToString(format, provider); + } + + public bool Equals(ObfuscateLong obj) + { + return Value.Equals(obj.Value); + } + public int CompareTo(ObfuscateLong other) + { + return Value.CompareTo(other.Value); + } + public int CompareTo(long other) + { + return Value.CompareTo(other); + } + public int CompareTo(object obj) + { + return Value.CompareTo(obj); + } + + #region 杩愮畻绗﹂噸杞 + public static implicit operator long(ObfuscateLong value) + { + return value.Value; + } + public static implicit operator ObfuscateLong(long value) + { + return new ObfuscateLong(value); + } + public static ObfuscateLong operator ++(ObfuscateLong value) + { + return value.Value + 1; + } + public static ObfuscateLong operator --(ObfuscateLong value) + { + return value.Value - 1; + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateLong.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateLong.cs.meta new file mode 100644 index 0000000..a185a9a --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/ObfuscateLong.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 64d0fb04b6975a44180f9068d44b7973 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/Timer.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/Timer.cs new file mode 100644 index 0000000..87ac739 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/Timer.cs @@ -0,0 +1,203 @@ +锘 + +namespace MotionFramework.Utility +{ + /// + /// 缁煎悎璁℃椂鍣 + /// + public sealed class Timer + { + /// + /// 寤惰繜鍚庯紝瑙﹀彂涓娆 + /// + public static Timer CreateOnceTimer(float delay) + { + return new Timer(delay, -1, -1, 1); + } + + /// + /// 寤惰繜鍚庯紝姘镐箙鎬х殑闂撮殧瑙﹀彂 + /// + /// 寤惰繜鏃堕棿 + /// 闂撮殧鏃堕棿 + public static Timer CreatePepeatTimer(float delay, float interval) + { + return new Timer(delay, interval, -1, -1); + } + + /// + /// 寤惰繜鍚庯紝鍦ㄤ竴娈垫椂闂村唴闂撮殧瑙﹀彂 + /// + /// 寤惰繜鏃堕棿 + /// 闂撮殧鏃堕棿 + /// 瑙﹀彂鍛ㄦ湡 + public static Timer CreatePepeatTimer(float delay, float interval, float duration) + { + return new Timer(delay, interval, duration, -1); + } + + /// + /// 寤惰繜鍚庯紝闂撮殧瑙﹀彂涓瀹氭鏁 + /// + /// 寤惰繜鏃堕棿 + /// 闂撮殧鏃堕棿 + /// 鏈澶цЕ鍙戞鏁 + public static Timer CreatePepeatTimer(float delay, float interval, long maxTriggerCount) + { + return new Timer(delay, interval, -1, maxTriggerCount); + } + + /// + /// 寤惰繜鍚庯紝鍦ㄤ竴娈垫椂闂村唴瑙﹀彂 + /// + /// 寤惰繜鏃堕棿 + /// 瑙﹀彂鍛ㄦ湡 + public static Timer CreateDurationTimer(float delay, float duration) + { + return new Timer(delay, -1, duration, -1); + } + + /// + /// 寤惰繜鍚庯紝姘镐箙瑙﹀彂 + /// + public static Timer CreateForeverTimer(float delay) + { + return new Timer(delay, -1, -1, -1); + } + + + private readonly float _intervalTime; + private readonly float _durationTime; + private readonly long _maxTriggerCount; + + // 闇瑕侀噸缃殑鍙橀噺 + private float _delayTimer = 0; + private float _durationTimer = 0; + private float _intervalTimer = 0; + private long _triggerCount = 0; + + /// + /// 寤惰繜鏃堕棿 + /// + public float DelayTime { private set; get; } + + /// + /// 鏄惁宸茬粡缁撴潫 + /// + public bool IsOver { private set; get; } + + /// + /// 鏄惁宸茬粡鏆傚仠 + /// + public bool IsPause { private set; get; } + + /// + /// 寤惰繜鍓╀綑鏃堕棿 + /// + public float Remaining + { + get + { + if (IsOver) + return 0f; + else + return System.Math.Max(0f, DelayTime - _delayTimer); + } + } + + /// + /// 璁℃椂鍣 + /// + /// 寤惰繜鏃堕棿 + /// 闂撮殧鏃堕棿 + /// 杩愯鏃堕棿 + /// 鏈澶цЕ鍙戞鏁 + public Timer(float delay, float interval, float duration, long maxTriggerCount) + { + DelayTime = delay; + _intervalTime = interval; + _durationTime = duration; + _maxTriggerCount = maxTriggerCount; + } + + /// + /// 鏆傚仠璁℃椂鍣 + /// + public void Pause() + { + IsPause = true; + } + + /// + /// 鎭㈠璁℃椂鍣 + /// + public void Resume() + { + IsPause = false; + } + + /// + /// 缁撴潫璁℃椂鍣 + /// + public void Kill() + { + IsOver = true; + } + + /// + /// 閲嶇疆璁℃椂鍣 + /// + public void Reset() + { + _delayTimer = 0; + _durationTimer = 0; + _intervalTimer = 0; + _triggerCount = 0; + IsOver = false; + IsPause = false; + } + + /// + /// 鏇存柊璁℃椂鍣 + /// + public bool Update(float deltaTime) + { + if (IsOver || IsPause) + return false; + + _delayTimer += deltaTime; + if (_delayTimer < DelayTime) + return false; + + if(_intervalTime > 0) + _intervalTimer += deltaTime; + if (_durationTime > 0) + _durationTimer += deltaTime; + + // 妫娴嬮棿闅旀墽琛 + if (_intervalTime > 0) + { + if (_intervalTimer < _intervalTime) + return false; + _intervalTimer = 0; + } + + // 妫娴嬬粨鏉熸潯浠 + if (_durationTime > 0) + { + if (_durationTimer >= _durationTime) + Kill(); + } + + // 妫娴嬬粨鏉熸潯浠 + if (_maxTriggerCount > 0) + { + _triggerCount++; + if (_triggerCount >= _maxTriggerCount) + Kill(); + } + + return true; + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/Timer.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/Timer.cs.meta new file mode 100644 index 0000000..0131730 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/Misc/Timer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2c8072e60d9a07e4ba0634322357d446 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/ProfilerUtility.cs b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/ProfilerUtility.cs new file mode 100644 index 0000000..75607d8 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/ProfilerUtility.cs @@ -0,0 +1,56 @@ +锘//-------------------------------------------------- +// Motion Framework +// Copyright漏2021-2021 浣曞啝宄 +// Licensed under the MIT license +//-------------------------------------------------- +using System; +using System.Text; +using System.Diagnostics; + +namespace MotionFramework.Utility +{ + public static class ProfilerUtility + { + private static string _watchName; + private static long _limitMilliseconds; + private static Stopwatch _watch; + + /// + /// 寮鍚ц兘娴嬭瘯 + /// + /// 娴嬭瘯鍚嶇О + /// 鏋侀檺姣鏁 + [Conditional("DEBUG")] + public static void BeginWatch(string name, long limitMilliseconds = long.MaxValue) + { + if (_watch != null) + { + UnityEngine.Debug.LogError($"Last watch is not end : {_watchName}"); + } + + _watchName = name; + _limitMilliseconds = limitMilliseconds; + _watch = new Stopwatch(); + _watch.Start(); + } + + /// + /// 缁撴潫鎬ц兘娴嬭瘯 + /// 璇存槑锛氬綋鑰楄垂鐨勬绉掓暟瓒呰繃鏋侀檺鍊煎垯杈撳嚭涓鸿鍛 + /// + [Conditional("DEBUG")] + public static void EndWatch() + { + if (_watch != null) + { + _watch.Stop(); + string logInfo = $"[Profiler] {_watchName} took {_watch.ElapsedMilliseconds} ms"; + if (_watch.ElapsedMilliseconds > _limitMilliseconds) + UnityEngine.Debug.LogWarning(logInfo); + else + UnityEngine.Debug.Log(logInfo); + _watch = null; + } + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/ProfilerUtility.cs.meta b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/ProfilerUtility.cs.meta new file mode 100644 index 0000000..f42bfa3 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Engine/Engine.Utility/ProfilerUtility.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1ec9a246cc4236d4e83d331746929371 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Module.meta b/Assets/Framework/Scripts/Runtime/Module.meta new file mode 100644 index 0000000..45619d2 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: af1f88536c0900042ae072d86f818806 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Module/Extension.meta b/Assets/Framework/Scripts/Runtime/Module/Extension.meta new file mode 100644 index 0000000..13113d9 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Extension.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e19b500d8bb26ff4d9a183fd9bc8074d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Module/Extension/UnityEngine_Object_Extension.cs b/Assets/Framework/Scripts/Runtime/Module/Extension/UnityEngine_Object_Extension.cs new file mode 100644 index 0000000..e6b3f08 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Extension/UnityEngine_Object_Extension.cs @@ -0,0 +1,12 @@ +锘 + +namespace UnityEngine +{ + public static partial class UnityEngine_Object_Extension + { + public static bool IsDestroyed(this UnityEngine.Object o) + { + return o == null; + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Module/Extension/UnityEngine_Object_Extension.cs.meta b/Assets/Framework/Scripts/Runtime/Module/Extension/UnityEngine_Object_Extension.cs.meta new file mode 100644 index 0000000..0b71066 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Extension/UnityEngine_Object_Extension.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e3170b32d0ce75e42b20609930ba11d3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Module/Extension/UnityEngine_RectTransform_Extension.cs b/Assets/Framework/Scripts/Runtime/Module/Extension/UnityEngine_RectTransform_Extension.cs new file mode 100644 index 0000000..13de7ef --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Extension/UnityEngine_RectTransform_Extension.cs @@ -0,0 +1,39 @@ +锘 + +namespace UnityEngine +{ + public static partial class UnityEngine_RectTransform_Extension + { + public static void SetSizeDeltaWidth(this RectTransform thisObj, float width) + { + Vector2 size = thisObj.sizeDelta; + size.x = width; + thisObj.sizeDelta = size; + } + public static void SetSizeDeltaHeight(this RectTransform thisObj, float height) + { + Vector2 size = thisObj.sizeDelta; + size.y = height; + thisObj.sizeDelta = size; + } + + public static void SetAnchoredPositionX(this RectTransform thisObj, float pos) + { + Vector3 temp = thisObj.anchoredPosition; + temp.x = pos; + thisObj.anchoredPosition = temp; + } + public static void SetAnchoredPositionY(this RectTransform thisObj, float pos) + { + Vector3 temp = thisObj.anchoredPosition; + temp.y = pos; + thisObj.anchoredPosition = temp; + } + public static void SetAnchoredPositionZ(this RectTransform thisObj, float pos) + { + Vector3 temp = thisObj.anchoredPosition; + temp.z = pos; + thisObj.anchoredPosition = temp; + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Module/Extension/UnityEngine_RectTransform_Extension.cs.meta b/Assets/Framework/Scripts/Runtime/Module/Extension/UnityEngine_RectTransform_Extension.cs.meta new file mode 100644 index 0000000..809f9cf --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Extension/UnityEngine_RectTransform_Extension.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6c25fcc6e8919cf47863078ddf756562 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Module/Extension/UnityEngine_Transform_Extension.cs b/Assets/Framework/Scripts/Runtime/Module/Extension/UnityEngine_Transform_Extension.cs new file mode 100644 index 0000000..7bbf1b6 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Extension/UnityEngine_Transform_Extension.cs @@ -0,0 +1,97 @@ +锘 +using System.Collections; +using System.Collections.Generic; + +namespace UnityEngine +{ + public static partial class UnityEngine_Transform_Extension + { + private static readonly Queue _childStack = new Queue(1000); + + /// + /// 鑾峰彇绗竴涓瓙鐗╀綋 + /// + /// 婵娲绘潯浠 + public static Transform GetFirstChild(this Transform root, bool findActiveObject = true) + { + if (root == null || root.childCount == 0) + return null; + + if(findActiveObject == false) + return root.GetChild(0); + + for (int i = 0; i < root.childCount; i++) + { + Transform target = root.GetChild(i); + if (target.gameObject.activeSelf) + return target; + } + return null; + } + + /// + /// 鑾峰彇鏈鍚庝竴涓瓙鐗╀綋 + /// + /// 婵娲绘潯浠 + public static Transform GetLastChild(this Transform root, bool findActiveObject = true) + { + if (root == null || root.childCount == 0) + return null; + + if (findActiveObject == false) + return root.GetChild(root.childCount - 1); + + for (int i = root.childCount - 1; i >= 0; i--) + { + Transform target = root.GetChild(i); + if (target.gameObject.activeSelf) + return target; + } + return null; + } + + /// + /// 骞垮害浼樺厛鎼滅储鏌ユ壘瀛愮墿浣 + /// + public static Transform BFSearch(this Transform root, string childName) + { + if (root == null) return null; + + _childStack.Clear(); + _childStack.Enqueue(root); + + while (_childStack.Count != 0) + { + root = _childStack.Dequeue(); + for (int i = 0; i < root.childCount; i++) + { + Transform child = root.GetChild(i); + if (child.name == childName) + { + return child; + } + else + { + if (child.childCount != 0) + _childStack.Enqueue(child); + } + } + } + + // 娌℃湁鍙戠幇杩斿洖绌 + return null; + } + + /// + /// 骞垮害浼樺厛鎼滅储鏌ユ壘瀛愮墿浣撶殑缁勪欢 + /// + public static T BFSearch(this Transform root, string childName) where T : UnityEngine.Component + { + Transform trans = root.BFSearch(childName); + if (trans == null) + return null; + + return trans.GetComponent(); + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Module/Extension/UnityEngine_Transform_Extension.cs.meta b/Assets/Framework/Scripts/Runtime/Module/Extension/UnityEngine_Transform_Extension.cs.meta new file mode 100644 index 0000000..89c09bf --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Extension/UnityEngine_Transform_Extension.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c1aa7402103ca844392136411ac36564 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Camera.meta b/Assets/Framework/Scripts/Runtime/Module/Module.Camera.meta new file mode 100644 index 0000000..2a4ecce --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Camera.meta @@ -0,0 +1,3 @@ +锘縡ileFormatVersion: 2 +guid: dbb1c5e121a54b458a7eb19a04f06766 +timeCreated: 1716788984 \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Camera/CameraManager.cs b/Assets/Framework/Scripts/Runtime/Module/Module.Camera/CameraManager.cs new file mode 100644 index 0000000..f485507 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Camera/CameraManager.cs @@ -0,0 +1,98 @@ +using System; +using Framework.Scripts.Runtime.Engine.Engine.Camera; +using Framework.Scripts.Runtime.Engine.Engine.Camera.CameraControl; +using MotionFramework; +using MotionFramework.Event; +using NaughtyAttributes; +using UnityEngine; + +namespace Framework.Scripts.Runtime.Module.Module.Camera +{ + public class CameraManager : MonoBehaviour + { + private CameraRaycastComponent _raycastComponent; + private CameraControlComponent _cameraControlComponent; + + + [SerializeField] [Label("鎽勫儚澶存帶鍒")] public bool showCamControl; + [SerializeField] [Label("灏勭嚎")] public bool showCamRay; + + [ShowIf("showCamControl")] [BoxGroup("鍙傛暟")] [SerializeField] [Label("榧犳爣涓棿绉诲姩閫熷害")] + private float middleSpeed = 2; + + [ShowIf("showCamControl")] [MinMaxSlider(-90, 90)] [BoxGroup("鍙傛暟")] [SerializeField] [Label("瑙掑害鏈澶ч檺鍒")] + private Vector2 minMaxSlider; + + [ShowIf("showCamControl")] [BoxGroup("鍙傛暟")] [SerializeField] [Label("婊氳疆鐏垫晱搴﹁缃")] + private int MouseWheelSensitivity = 1; //婊氳疆鐏垫晱搴﹁缃 + + [ShowIf("showCamControl")] [BoxGroup("鍙傛暟")] [SerializeField] [Label("鐩告満璺濈鏈灏忓")] + private int MouseZoomMin = 10; //鐩告満璺濈鏈灏忓 + + [ShowIf("showCamControl")] [BoxGroup("鍙傛暟")] [SerializeField] [Label("鐩告満璺濈鏈澶у")] + private int MouseZoomMax = 9999; //鐩告満璺濈鏈澶у + + [ShowIf("showCamControl")] [BoxGroup("鍙傛暟")] [SerializeField] [Label("鏃嬭浆瑙嗚鏃剁浉鏈簒杞磋浆閫")] + private float xSpeed = 250.0f; //鏃嬭浆瑙嗚鏃剁浉鏈簒杞磋浆閫 + + [ShowIf("showCamControl")] [BoxGroup("鍙傛暟")] [SerializeField] [Label("鏃嬭浆瑙嗚鏃剁浉鏈簓杞磋浆閫")] + private float ySpeed = 120.0f; //鏃嬭浆瑙嗚鏃剁浉鏈簓杞磋浆閫 + + [ShowIf("showCamControl")] [BoxGroup("鍙傛暟")] [SerializeField] [Label("鐩告満鍜宼arget涔嬮棿鐨勮窛绂")] + private float Distance = 20; //鐩告満鍜宼arget涔嬮棿鐨勮窛绂伙紝鍥犱负鐩告満鐨刏杞存绘槸鎸囧悜target锛屼篃灏辨槸鐩告満z杞存柟鍚戜笂鐨勮窛绂 + + [SerializeField] private Transform MainCam; + [SerializeField] private Transform MainCamTarget; + + void Awake() + { + // 涓虹粍浠惰祴鍊硷紝鍙互閫氳繃鏌ユ壘瀵硅薄鎴栬呯洿鎺ヨ祴鍊肩殑鏂瑰紡 + _raycastComponent = new CameraRaycastComponent(); + _cameraControlComponent = new CameraControlComponent(); + + if (_raycastComponent == null || _cameraControlComponent == null) + { + Debug.LogError("缂哄皯蹇呰鐨勭粍浠"); + } + } + + private void OnEnable() + { + _raycastComponent.OnRaycastHit += HandleRaycastHit; + } + + private void Start() + { + _cameraControlComponent.Init(MainCam, MainCamTarget); + _raycastComponent.Init(); + } + + private void OnDisable() + { + _raycastComponent.OnRaycastHit -= HandleRaycastHit; + } + + // 澶勭悊灏勭嚎鍛戒腑浜嬩欢骞舵墦鍗扮墿浣撳悕绉 + void HandleRaycastHit(RaycastHit hit) + { + Debug.Log("灏勭嚎妫娴嬪埌鐗╀綋--->" + hit.collider.name); + } + void Update() + { + // 璋冪敤灏勭嚎鍔熻兘 + if (showCamRay) + { + if (Input.GetMouseButtonDown(0)) // 姣斿褰撴寜涓嬮紶鏍囧乏閿椂 + { + _raycastComponent?.PerformRaycast(); + } + } + + + + _cameraControlComponent.UpdateValue(minMaxSlider); + // 璋冪敤闀滃ご鎺у埗鍔熻兘 + _cameraControlComponent?.ControlCamera(); + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Camera/CameraManager.cs.meta b/Assets/Framework/Scripts/Runtime/Module/Module.Camera/CameraManager.cs.meta new file mode 100644 index 0000000..574f9da --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Camera/CameraManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 464bdf08dc492614ca26cb9f6e6e5bf7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Console.meta b/Assets/Framework/Scripts/Runtime/Module/Module.Console.meta new file mode 100644 index 0000000..8b4905e --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Console.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: feec152563c6ce5438d22c11c0a66856 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Console/ApplicationWindow.cs b/Assets/Framework/Scripts/Runtime/Module/Module.Console/ApplicationWindow.cs new file mode 100644 index 0000000..a206175 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Console/ApplicationWindow.cs @@ -0,0 +1,141 @@ +锘 +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Profiling; + +namespace MotionFramework.Console +{ + [ConsoleAttribute("搴旂敤璇︽儏", 102)] + internal class ApplicationWindow : IConsoleWindow + { + // GUI鐩稿叧 + private Vector2 _scrollPos = Vector2.zero; + private int _timeScaleLevel = 5; + + void IConsoleWindow.OnGUI() + { + int space = 15; + + _scrollPos = ConsoleGUI.BeginScrollView(_scrollPos); + + // 鏃堕棿缂╂斁鐩稿叧 + GUILayout.Space(space); + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Reset", ConsoleGUI.ButtonStyle, GUILayout.Width(100))) + { + _timeScaleLevel = 5; + SetTimeScale(_timeScaleLevel); + } + if (GUILayout.Button("+", ConsoleGUI.ButtonStyle, GUILayout.Width(100))) + { + _timeScaleLevel++; + _timeScaleLevel = Mathf.Clamp(_timeScaleLevel, 0, 9); + SetTimeScale(_timeScaleLevel); + } + if (GUILayout.Button("-", ConsoleGUI.ButtonStyle, GUILayout.Width(100))) + { + _timeScaleLevel--; + _timeScaleLevel = Mathf.Clamp(_timeScaleLevel, 0, 9); + SetTimeScale(_timeScaleLevel); + } + GUILayout.EndHorizontal(); + + GUILayout.Space(space); + ConsoleGUI.Lable($"Elapse Time : {GetElapseTime()}"); + ConsoleGUI.Lable($"Time Scale : {Time.timeScale}"); + + GUILayout.Space(space); + ConsoleGUI.Lable($"Unity Version : {Application.unityVersion}"); + ConsoleGUI.Lable($"Unity Pro License : {Application.HasProLicense()}"); + ConsoleGUI.Lable($"Application Version : {Application.version}"); + ConsoleGUI.Lable($"Application Install Path : {Application.dataPath}"); + ConsoleGUI.Lable($"Application Persistent Path : {Application.persistentDataPath}"); + + GUILayout.Space(space); + ConsoleGUI.Lable($"OS : {SystemInfo.operatingSystem}"); + ConsoleGUI.Lable($"OS Memory : {SystemInfo.systemMemorySize / 1024f:f1}GB"); + ConsoleGUI.Lable($"CPU : {SystemInfo.processorType}"); + ConsoleGUI.Lable($"CPU Core : {SystemInfo.processorCount}"); + + GUILayout.Space(space); + ConsoleGUI.Lable($"Device UID : {SystemInfo.deviceUniqueIdentifier}"); + ConsoleGUI.Lable($"Device Model : {SystemInfo.deviceModel}"); + ConsoleGUI.Lable($"Device Name : {SystemInfo.deviceName}"); + ConsoleGUI.Lable($"Device Type : {SystemInfo.deviceType}"); + + GUILayout.Space(space); + ConsoleGUI.Lable($"Graphics Device Name : {SystemInfo.graphicsDeviceName}"); + ConsoleGUI.Lable($"Graphics Device Type : {SystemInfo.graphicsDeviceType}"); + ConsoleGUI.Lable($"Graphics Memory : {SystemInfo.graphicsMemorySize / 1024f:f1}GB"); + ConsoleGUI.Lable($"Graphics Shader Level : {SystemInfo.graphicsShaderLevel}"); + ConsoleGUI.Lable($"Multi-threaded Rendering : {SystemInfo.graphicsMultiThreaded}"); + ConsoleGUI.Lable($"Max Cubemap Size : {SystemInfo.maxCubemapSize}"); + ConsoleGUI.Lable($"Max Texture Size : {SystemInfo.maxTextureSize}"); + + GUILayout.Space(space); + ConsoleGUI.Lable($"Supports Accelerometer : {SystemInfo.supportsAccelerometer}"); //鍔犻熻纭欢 + ConsoleGUI.Lable($"Supports Gyroscope : {SystemInfo.supportsGyroscope}"); //闄铻轰华纭欢 + ConsoleGUI.Lable($"Supports Audio : {SystemInfo.supportsAudio}"); //闊抽纭欢 + ConsoleGUI.Lable($"Supports GPS : {SystemInfo.supportsLocationService}"); //GPS纭欢 + + GUILayout.Space(space); + ConsoleGUI.Lable($"Screen DPI : {Screen.dpi}"); + ConsoleGUI.Lable($"Game Resolution : {Screen.width} x {Screen.height}"); + ConsoleGUI.Lable($"Device Resolution : {Screen.currentResolution.width} x {Screen.currentResolution.height}"); + ConsoleGUI.Lable($"Graphics Quality : {QualitySettings.names[QualitySettings.GetQualityLevel()]}"); + + GUILayout.Space(space); + ConsoleGUI.Lable($"Total Memory : {GetTotalMemory() / 1048576}MB"); + ConsoleGUI.Lable($" - Unity Memory : {Profiler.GetTotalReservedMemoryLong() / 1048576}MB"); + ConsoleGUI.Lable($" - Mono Memory : {Profiler.GetMonoHeapSizeLong() / 1048576}MB"); + ConsoleGUI.Lable($" - GfxDriver Memory : {Profiler.GetAllocatedMemoryForGraphicsDriver() / 1048576}MB"); + + GUILayout.Space(space); + ConsoleGUI.Lable($"Battery Level : {SystemInfo.batteryLevel}"); + ConsoleGUI.Lable($"Battery Status : {SystemInfo.batteryStatus}"); + ConsoleGUI.Lable($"Network Status : {GetNetworkState()}"); + + ConsoleGUI.EndScrollView(); + } + + private long GetTotalMemory() + { + // Total: Unity+Mono+GfxDriver锛堟湭鍖呭惈Audio+Video锛 + return Profiler.GetTotalReservedMemoryLong() + Profiler.GetMonoHeapSizeLong() + Profiler.GetAllocatedMemoryForGraphicsDriver(); + } + private string GetNetworkState() + { + string internetState = string.Empty; + if (Application.internetReachability == NetworkReachability.NotReachable) + internetState = "not reachable"; + else if (Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork) + internetState = "carrier data network"; + else if (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork) + internetState = "local area network"; + return internetState; + } + private string GetElapseTime() + { + int day = (int)(Time.realtimeSinceStartup / 86400f); + int hour = (int)((Time.realtimeSinceStartup % 86400f) / 3600f); + int sec = (int)(((Time.realtimeSinceStartup % 86400f) % 3600f) / 60f); + return $"{day}澶﹞hour}灏忔椂{sec}鍒"; + } + private void SetTimeScale(int timeScaleLevel) + { + if (timeScaleLevel == 5) + { + Time.timeScale = 1f; + } + else if (timeScaleLevel > 5) + { + Time.timeScale = timeScaleLevel - 4; + } + else + { + Time.timeScale = timeScaleLevel / 5f; + } + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Console/ApplicationWindow.cs.meta b/Assets/Framework/Scripts/Runtime/Module/Module.Console/ApplicationWindow.cs.meta new file mode 100644 index 0000000..c127a56 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Console/ApplicationWindow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f845ed2fd036eb14b83b46b3054946b7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Console/GameLogWindow.cs b/Assets/Framework/Scripts/Runtime/Module/Module.Console/GameLogWindow.cs new file mode 100644 index 0000000..1e214c6 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Console/GameLogWindow.cs @@ -0,0 +1,136 @@ +锘 +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using MotionFramework.Reference; + +namespace MotionFramework.Console +{ + [ConsoleAttribute("娓告垙鏃ュ織", 101)] + internal class GameLogWindow : IConsoleWindow + { + private class LogWrapper : IReference + { + public LogType Type; + public string Log; + public void OnRelease() + { + Log = string.Empty; + } + } + + /// + /// 鏃ュ織鏈澶ф樉绀烘暟閲 + /// + private const int LOG_MAX_COUNT = 2000; + + /// + /// 鏃ュ織闆嗗悎 + /// + private List _logs = new List(); + + private int _totalCount = 0; + private int _logCount = 0; + private int _warningCount = 0; + private int _errorCount = 0; + + // GUI鐩稿叧 + private bool _showLog = true; + private bool _showWarning = true; + private bool _showError = true; + private Vector2 _scrollPos = Vector2.zero; + + // 杩囨护鐨勫叧閿瓧 + private string _filterKey = string.Empty; + + + public GameLogWindow() + { + // 娉ㄥ唽UnityEngine鏃ュ織绯荤粺 + Application.logMessageReceived += HandleUnityEngineLog; + } + void IConsoleWindow.OnGUI() + { + GUILayout.BeginHorizontal(); + if (GUILayout.Button("Clear", ConsoleGUI.ButtonStyle, GUILayout.Width(100))) + { + _totalCount = 0; + _logCount = 0; + _warningCount = 0; + _errorCount = 0; + _logs.Clear(); + } + _showLog = ConsoleGUI.Toggle($"Log ({_logCount})", _showLog); + _showWarning = ConsoleGUI.Toggle($"Warning ({_warningCount})", _showWarning); + _showError = ConsoleGUI.Toggle($"Error ({_errorCount})", _showError); + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + { + GUILayout.Label("鎼滅储鍏抽敭瀛 : ", ConsoleGUI.LableStyle, GUILayout.Width(200)); + _filterKey = GUILayout.TextField(_filterKey, ConsoleGUI.TextFieldStyle, GUILayout.Width(500)); + } + GUILayout.EndHorizontal(); + + float offset = ConsoleGUI.ToolbarStyle.fixedHeight * 3; + _scrollPos = ConsoleGUI.BeginScrollView(_scrollPos, offset); + for (int i = 0; i < _logs.Count; i++) + { + LogWrapper wrapper = _logs[i]; + + // 鍙悳绱㈠叧閿瓧 + if (string.IsNullOrEmpty(_filterKey) == false) + { + if (wrapper.Log.Contains(_filterKey) == false) + continue; + } + + if (wrapper.Type == LogType.Log) + { + if (_showLog) + ConsoleGUI.Lable(wrapper.Log); + } + else if (wrapper.Type == LogType.Warning) + { + if (_showWarning) + ConsoleGUI.YellowLable(wrapper.Log); + } + else if (wrapper.Type == LogType.Assert || wrapper.Type == LogType.Error || wrapper.Type == LogType.Exception) + { + if (_showError) + ConsoleGUI.RedLable(wrapper.Log); + } + } + ConsoleGUI.EndScrollView(); + } + + private void HandleUnityEngineLog(string logString, string stackTrace, LogType type) + { + LogWrapper wrapper = ReferencePool.Spawn(); + wrapper.Type = type; + + _totalCount++; + if (type == LogType.Assert || type == LogType.Error || type == LogType.Exception) + wrapper.Log = $"[{_totalCount}] " + logString + "\n" + stackTrace; + else + wrapper.Log = $"[{_totalCount}] " + logString; + + if (type == LogType.Log) + _logCount++; + else if (type == LogType.Warning) + _warningCount++; + else if (type == LogType.Assert || type == LogType.Error || type == LogType.Exception) + _errorCount++; + else + throw new NotImplementedException(type.ToString()); + + _logs.Add(wrapper); + if (_logs.Count > LOG_MAX_COUNT) + { + ReferencePool.Release(_logs[0]); + _logs.RemoveAt(0); + } + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Console/GameLogWindow.cs.meta b/Assets/Framework/Scripts/Runtime/Module/Module.Console/GameLogWindow.cs.meta new file mode 100644 index 0000000..f82d748 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Console/GameLogWindow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2e2a9baee29a8494597fadc3354720c8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Console/GameModuleWindow.cs b/Assets/Framework/Scripts/Runtime/Module/Module.Console/GameModuleWindow.cs new file mode 100644 index 0000000..edf1316 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Console/GameModuleWindow.cs @@ -0,0 +1,21 @@ +锘 +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace MotionFramework.Console +{ + [ConsoleAttribute("娓告垙妯″潡", 100)] + internal class GameModuleWindow : IConsoleWindow + { + // GUI鐩稿叧 + private Vector2 _scrollPos = Vector2.zero; + + void IConsoleWindow.OnGUI() + { + _scrollPos = ConsoleGUI.BeginScrollView(_scrollPos); + MotionEngine.DrawModulesGUIContent(); + ConsoleGUI.EndScrollView(); + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Console/GameModuleWindow.cs.meta b/Assets/Framework/Scripts/Runtime/Module/Module.Console/GameModuleWindow.cs.meta new file mode 100644 index 0000000..dcdcf61 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Console/GameModuleWindow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e7131d9ae7fe6fd488878a650f1e4dd9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Console/ReferencePoolWindow.cs b/Assets/Framework/Scripts/Runtime/Module/Module.Console/ReferencePoolWindow.cs new file mode 100644 index 0000000..c1a5f4a --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Console/ReferencePoolWindow.cs @@ -0,0 +1,29 @@ +锘 +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using MotionFramework.Reference; + +namespace MotionFramework.Console +{ + [ConsoleAttribute("寮曠敤姹", 103)] + internal class ReferencePoolWindow : IConsoleWindow + { + // GUI鐩稿叧 + private Vector2 _scrollPos = Vector2.zero; + + void IConsoleWindow.OnGUI() + { + var pools = ReferencePool.GetAllCollectors; + ConsoleGUI.Lable($"姹犳绘暟锛歿pools.Count}"); + + float offset = ConsoleGUI.LableStyle.fontSize; + _scrollPos = ConsoleGUI.BeginScrollView(_scrollPos, offset); + foreach (var pair in pools) + { + ConsoleGUI.Lable($"[{pair.Value.ClassType.FullName}] CacheCount = {pair.Value.Count} SpwanCount = {pair.Value.SpawnCount}"); + } + ConsoleGUI.EndScrollView(); + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Console/ReferencePoolWindow.cs.meta b/Assets/Framework/Scripts/Runtime/Module/Module.Console/ReferencePoolWindow.cs.meta new file mode 100644 index 0000000..9a3e9a2 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Console/ReferencePoolWindow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eca1ecc037913874781860f709eb6b58 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Event.meta b/Assets/Framework/Scripts/Runtime/Module/Module.Event.meta new file mode 100644 index 0000000..68f66a4 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Event.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9e413da6ee0aaba4ea399ba2cc2ed42a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Event/EventGroup.cs b/Assets/Framework/Scripts/Runtime/Module/Module.Event/EventGroup.cs new file mode 100644 index 0000000..0676062 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Event/EventGroup.cs @@ -0,0 +1,49 @@ +锘 +using System; +using System.Collections; +using System.Collections.Generic; + +namespace MotionFramework.Event +{ + public class EventGroup + { + private readonly Dictionary>> _cachedListener = new Dictionary>>(); + + /// + /// 娣诲姞涓涓洃鍚 + /// + public void AddListener(System.Action listener) where TEvent : IEventMessage + { + System.Type eventType = typeof(TEvent); + if (_cachedListener.ContainsKey(eventType) == false) + _cachedListener.Add(eventType, new List>()); + + if (_cachedListener[eventType].Contains(listener) == false) + { + _cachedListener[eventType].Add(listener); + EventManager.Instance.AddListener(eventType, listener); + } + else + { + MotionLog.Warning($"Event listener is exist : {eventType}"); + } + } + + /// + /// 绉婚櫎鎵鏈夌紦瀛樼殑鐩戝惉 + /// + public void RemoveAllListener() + { + foreach (var pair in _cachedListener) + { + System.Type eventType = pair.Key; + for (int i = 0; i < pair.Value.Count; i++) + { + EventManager.Instance.RemoveListener(eventType, pair.Value[i]); + } + pair.Value.Clear(); + } + _cachedListener.Clear(); + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Event/EventGroup.cs.meta b/Assets/Framework/Scripts/Runtime/Module/Module.Event/EventGroup.cs.meta new file mode 100644 index 0000000..977a481 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Event/EventGroup.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dcc5e4008d087434eb5db1390d8e4e6a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Event/EventManager.cs b/Assets/Framework/Scripts/Runtime/Module/Module.Event/EventManager.cs new file mode 100644 index 0000000..88f2ead --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Event/EventManager.cs @@ -0,0 +1,198 @@ +锘 +using System; +using System.Collections; +using System.Collections.Generic; +using MotionFramework.Console; +using MotionFramework.Reference; + +namespace MotionFramework.Event +{ + /// + /// 浜嬩欢绠$悊鍣 + /// + public sealed class EventManager : ModuleSingleton, IModule + { + private class PostWrapper : IReference + { + public int PostFrame; + public int EventID; + public IEventMessage Message; + + public void OnRelease() + { + PostFrame = 0; + EventID = 0; + Message = null; + } + } + + private readonly Dictionary>> _listeners = new Dictionary>>(1000); + private readonly List _postWrappers = new List(1000); + + void IModule.OnCreate(System.Object param) + { + } + void IModule.OnUpdate() + { + for (int i = _postWrappers.Count - 1; i >= 0; i--) + { + var wrapper = _postWrappers[i]; + if (UnityEngine.Time.frameCount > wrapper.PostFrame) + { + SendMessage(wrapper.EventID, wrapper.Message); + _postWrappers.RemoveAt(i); + ReferencePool.Release(wrapper); + } + } + } + void IModule.OnDestroy() + { + DestroySingleton(); + } + void IModule.OnGUI() + { + ConsoleGUI.Lable($"[{nameof(EventManager)}] Listener total count : {GetAllListenerCount()}"); + } + + + /// + /// 娣诲姞鐩戝惉 + /// + public void AddListener(System.Action listener) where TEvent : IEventMessage + { + AddListener(typeof(TEvent), listener); + } + + /// + /// 娣诲姞鐩戝惉 + /// + public void AddListener(System.Type eventType, System.Action listener) + { + int eventId = eventType.GetHashCode(); + AddListener(eventId, listener); + } + + /// + /// 娣诲姞鐩戝惉 + /// + public void AddListener(int eventId, System.Action listener) + { + if (_listeners.ContainsKey(eventId) == false) + _listeners.Add(eventId, new LinkedList>()); + if (_listeners[eventId].Contains(listener) == false) + _listeners[eventId].AddLast(listener); + } + + + /// + /// 绉婚櫎鐩戝惉 + /// + public void RemoveListener(System.Action listener) where TEvent : IEventMessage + { + RemoveListener(typeof(TEvent), listener); + } + + /// + /// 绉婚櫎鐩戝惉 + /// + public void RemoveListener(System.Type eventType, System.Action listener) + { + int eventId = eventType.GetHashCode(); + RemoveListener(eventId, listener); + } + + /// + /// 绉婚櫎鐩戝惉 + /// + public void RemoveListener(int eventId, System.Action listener) + { + if (_listeners.ContainsKey(eventId)) + { + if (_listeners[eventId].Contains(listener)) + _listeners[eventId].Remove(listener); + } + } + + + /// + /// 瀹炴椂骞挎挱浜嬩欢 + /// + public void SendMessage(IEventMessage message) + { + int eventId = message.GetType().GetHashCode(); + SendMessage(eventId, message); + } + + /// + /// 瀹炴椂骞挎挱浜嬩欢 + /// + public void SendMessage(int eventId, IEventMessage message) + { + if (_listeners.ContainsKey(eventId) == false) + return; + + LinkedList> listeners = _listeners[eventId]; + if (listeners.Count > 0) + { + var currentNode = listeners.Last; + while (currentNode != null) + { + currentNode.Value.Invoke(message); + currentNode = currentNode.Previous; + } + } + + // 鍥炴敹寮曠敤瀵硅薄 + IReference refClass = message as IReference; + if (refClass != null) + ReferencePool.Release(refClass); + } + + /// + /// 寤惰繜骞挎挱浜嬩欢 + /// + public void PostMessage(IEventMessage message) + { + int eventId = message.GetType().GetHashCode(); + PostMessage(eventId, message); + } + + /// + /// 寤惰繜骞挎挱浜嬩欢 + /// + public void PostMessage(int eventId, IEventMessage message) + { + var wrapper = ReferencePool.Spawn(); + wrapper.PostFrame = UnityEngine.Time.frameCount; + wrapper.EventID = eventId; + wrapper.Message = message; + _postWrappers.Add(wrapper); + } + + + /// + /// 娓呯┖鎵鏈夌洃鍚 + /// + public void ClearListeners() + { + foreach (int eventId in _listeners.Keys) + { + _listeners[eventId].Clear(); + } + _listeners.Clear(); + } + + /// + /// 鑾峰彇鐩戝惉鑰呮绘暟 + /// + private int GetAllListenerCount() + { + int count = 0; + foreach (var list in _listeners) + { + count += list.Value.Count; + } + return count; + } + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Event/EventManager.cs.meta b/Assets/Framework/Scripts/Runtime/Module/Module.Event/EventManager.cs.meta new file mode 100644 index 0000000..94f7a3c --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Event/EventManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a2a39e0393e22c44b8416d1445c9bb2c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Event/IEventMessage.cs b/Assets/Framework/Scripts/Runtime/Module/Module.Event/IEventMessage.cs new file mode 100644 index 0000000..539df73 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Event/IEventMessage.cs @@ -0,0 +1,8 @@ +锘 + +namespace MotionFramework.Event +{ + public interface IEventMessage + { + } +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Event/IEventMessage.cs.meta b/Assets/Framework/Scripts/Runtime/Module/Module.Event/IEventMessage.cs.meta new file mode 100644 index 0000000..794ffc4 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Event/IEventMessage.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7dcd12aabf986c6468f748911b1af65a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Network.meta b/Assets/Framework/Scripts/Runtime/Module/Module.Network.meta new file mode 100644 index 0000000..90c17e4 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Network.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6c5ceeac7fb64f545b513c267da9847f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Network/Modbus.meta b/Assets/Framework/Scripts/Runtime/Module/Module.Network/Modbus.meta new file mode 100644 index 0000000..2a6e3c7 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Network/Modbus.meta @@ -0,0 +1,3 @@ +锘縡ileFormatVersion: 2 +guid: e8a64ba3ed244e69bebc5f482f2e842f +timeCreated: 1716534367 \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Network/WebRequest.meta b/Assets/Framework/Scripts/Runtime/Module/Module.Network/WebRequest.meta new file mode 100644 index 0000000..653a0ef --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Network/WebRequest.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b17e44baf4e346b47b8686607fa1d3e9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Network/WebRequest/WebRequestManager.cs b/Assets/Framework/Scripts/Runtime/Module/Module.Network/WebRequest/WebRequestManager.cs new file mode 100644 index 0000000..9d9202a --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Network/WebRequest/WebRequestManager.cs @@ -0,0 +1,275 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading; +using Cysharp.Threading.Tasks; +using UnityEngine; +using UnityEngine.Networking; + +namespace MotionFramework.Scripts.Runtime.Engine.Engine.Network.WebRequest +{ + /// + /// WebRequest 管理器 + /// + public sealed class WebRequestManager : ModuleSingleton, IModule + { + /// + /// Get获取内容 + /// - + /// + /// + /// + /// + public async UniTask GetTextAsync(string url, Action onProgress = null, CancellationToken cancellationToken = default) + { + using (UnityWebRequest request = UnityWebRequest.Get(url)) + { + await SendRequestWithProgress(request, onProgress, cancellationToken); + if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.ProtocolError) + { + Debug.LogError($"异常: {request.error}"); + return null; + } + return request.downloadHandler.text; + } + } + + /// + /// 获取图片 + /// + /// + /// + /// + /// + public async UniTask GetImageAsync(string url, Action onProgress = null, CancellationToken cancellationToken = default) + { + using (UnityWebRequest request = UnityWebRequestTexture.GetTexture(url)) + { + await SendRequestWithProgress(request, onProgress, cancellationToken); + if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.ProtocolError) + { + Debug.LogError($"异常: {request.error}"); + return null; + } + return DownloadHandlerTexture.GetContent(request); + } + } + + /// + /// 获取视频 + /// + /// + /// + /// + /// + /// + public async UniTask GetVideoAsync(string url, string localPath, Action onProgress = null, CancellationToken cancellationToken = default) + { + using (UnityWebRequest request = UnityWebRequest.Get(url)) + { + await SendRequestWithProgress(request, onProgress, cancellationToken); + if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.ProtocolError) + { + Debug.LogError($"异常: {request.error}"); + return null; + } + File.WriteAllBytes(localPath, request.downloadHandler.data); + return localPath; + } + } + + /// + /// 获取文件 + /// + /// + /// + /// + /// + public async UniTask GetFileAsync(string url, Action onProgress = null, CancellationToken cancellationToken = default) + { + using (UnityWebRequest request = UnityWebRequest.Get(url)) + { + await SendRequestWithProgress(request, onProgress, cancellationToken); + if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.ProtocolError) + { + Debug.LogError($"异常: {request.error}"); + return null; + } + return request.downloadHandler.data; + } + } + + /// + /// 获取内容 + /// + /// + /// + /// + /// + /// + public async UniTask PostTextAsync(string url, string jsonData, Action onProgress = null, CancellationToken cancellationToken = default) + { + using (UnityWebRequest request = new UnityWebRequest(url, UnityWebRequest.kHttpVerbPOST)) + { + byte[] bodyRaw = new System.Text.UTF8Encoding().GetBytes(jsonData); + request.uploadHandler = new UploadHandlerRaw(bodyRaw); + request.downloadHandler = new DownloadHandlerBuffer(); + request.SetRequestHeader("Content-Type", "application/json"); + + await SendRequestWithProgress(request, onProgress, cancellationToken); + if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.ProtocolError) + { + Debug.LogError($"异常: {request.error}"); + return null; + } + return request.downloadHandler.text; + } + } + + /// + /// 获取图片 + /// + /// + /// + /// + /// + /// + public async UniTask PostImageAsync(string url, string jsonData, Action onProgress = null, CancellationToken cancellationToken = default) + { + using (UnityWebRequest request = new UnityWebRequest(url, UnityWebRequest.kHttpVerbPOST)) + { + byte[] bodyRaw = new System.Text.UTF8Encoding().GetBytes(jsonData); + request.uploadHandler = new UploadHandlerRaw(bodyRaw); + request.downloadHandler = new DownloadHandlerTexture(); + request.SetRequestHeader("Content-Type", "application/json"); + + await SendRequestWithProgress(request, onProgress, cancellationToken); + if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.ProtocolError) + { + Debug.LogError($"异常: {request.error}"); + return null; + } + return DownloadHandlerTexture.GetContent(request); + } + } + + /// + /// 获取视频 + /// + /// + /// + /// + /// + /// + /// + public async UniTask PostVideoAsync(string url, string jsonData, string localPath, Action onProgress = null, CancellationToken cancellationToken = default) + { + using (UnityWebRequest request = new UnityWebRequest(url, UnityWebRequest.kHttpVerbPOST)) + { + byte[] bodyRaw = new System.Text.UTF8Encoding().GetBytes(jsonData); + request.uploadHandler = new UploadHandlerRaw(bodyRaw); + request.downloadHandler = new DownloadHandlerBuffer(); + request.SetRequestHeader("Content-Type", "application/json"); + + await SendRequestWithProgress(request, onProgress, cancellationToken); + if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.ProtocolError) + { + Debug.LogError($"异常: {request.error}"); + return null; + } + File.WriteAllBytes(localPath, request.downloadHandler.data); + return localPath; + } + } + + /// + /// 获取文件 + /// + /// + /// + /// + /// + /// + public async UniTask PostFileAsync(string url, string jsonData, Action onProgress = null, CancellationToken cancellationToken = default) + { + using (UnityWebRequest request = new UnityWebRequest(url, UnityWebRequest.kHttpVerbPOST)) + { + byte[] bodyRaw = new System.Text.UTF8Encoding().GetBytes(jsonData); + request.uploadHandler = new UploadHandlerRaw(bodyRaw); + request.downloadHandler = new DownloadHandlerBuffer(); + request.SetRequestHeader("Content-Type", "application/json"); + + await SendRequestWithProgress(request, onProgress, cancellationToken); + if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.ProtocolError) + { + Debug.LogError($"异常: {request.error}"); + return null; + } + return request.downloadHandler.data; + } + } + + /// + /// 提交表单 + /// + /// + /// + /// + /// + /// + public async UniTask PostFormAsync(string url, Dictionary formFields, Action onProgress = null, CancellationToken cancellationToken = default) + { + using (UnityWebRequest request = UnityWebRequest.Post(url, formFields)) + { + await SendRequestWithProgress(request, onProgress, cancellationToken); + if (request.result == UnityWebRequest.Result.ConnectionError || request.result == UnityWebRequest.Result.ProtocolError) + { + Debug.LogError($"异常: {request.error}"); + return null; + } + return request.downloadHandler.text; + } + } + + /// + /// 进度 + /// + /// + /// + /// + /// + private async UniTask SendRequestWithProgress(UnityWebRequest request, Action onProgress, CancellationToken cancellationToken) + { + // 正确使用await来启动异步请求 + var operation = request.SendWebRequest(); + + // 循环检查请求是否完成,并更新进度 + while (!operation.isDone) + { + onProgress?.Invoke(request.downloadProgress); + + //Debug.Log($"Progress: {request.downloadProgress * 100:F2}%"); + await UniTask.Delay(100, cancellationToken: cancellationToken); // 每100毫秒更新一次进度 + } + onProgress?.Invoke(1.0f); + // 最后一次进度更新,确保进度显示为100% + Debug.Log("Progress: 100%"); + } + + public void OnCreate(object createParam) + { + } + + public void OnUpdate() + { + } + + public void OnDestroy() + { + } + + public void OnGUI() + { + } + } +} diff --git a/Assets/Framework/Scripts/Runtime/Module/Module.Network/WebRequest/WebRequestManager.cs.meta b/Assets/Framework/Scripts/Runtime/Module/Module.Network/WebRequest/WebRequestManager.cs.meta new file mode 100644 index 0000000..4b92f49 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/Module/Module.Network/WebRequest/WebRequestManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: aa2cd41eb7446a9459bcb7936a3ffc0c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/Scripts/Runtime/MotionFramework.asmdef b/Assets/Framework/Scripts/Runtime/MotionFramework.asmdef new file mode 100644 index 0000000..55ac0cc --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/MotionFramework.asmdef @@ -0,0 +1,17 @@ +{ + "name": "MotionFramework", + "references": [ + "GUID:e34a5702dd353724aa315fb8011f08c3", + "GUID:f51ebe6a0ceec4240a699833d6309b23", + "GUID:776d03a35f1b52c4a9aed9f56d7b4229" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": true, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/Framework/Scripts/Runtime/MotionFramework.asmdef.meta b/Assets/Framework/Scripts/Runtime/MotionFramework.asmdef.meta new file mode 100644 index 0000000..54a5436 --- /dev/null +++ b/Assets/Framework/Scripts/Runtime/MotionFramework.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c58e12c45b50087489b06b9aa0148fe7 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty.meta b/Assets/Framework/ThirdParty.meta new file mode 100644 index 0000000..069ed10 --- /dev/null +++ b/Assets/Framework/ThirdParty.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 07ea96dc00e098546ae77cd28d3ae981 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes.meta b/Assets/Framework/ThirdParty/NaughtyAttributes.meta new file mode 100644 index 0000000..678100d --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a34e0186d3442384c924bd8c6ecfbada +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/README.html b/Assets/Framework/ThirdParty/NaughtyAttributes/README.html new file mode 100644 index 0000000..5df2d2d --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/README.html @@ -0,0 +1,1648 @@ + + + + + README.md - Grip + + + + + + +
+
+ + + +
+
+
+
+ +

+ + README.md +

+ +
+

+NaughtyAttributes

+

Unity 2018.3+ +openupm +License: MIT

+

NaughtyAttributes is an extension for the Unity Inspector.

+

It expands the range of attributes that Unity provides so that you can create powerful inspectors without the need of custom editors or property drawers. It also provides attributes that can be applied to non-serialized fields or functions.

+

Most of the attributes are implemented using Unity's CustomPropertyDrawer, so they will work in your custom editors. If you want all of the attributes to work in your custom editors, however, you must inherit from NaughtyInspector and use the NaughtyEditorGUI.PropertyField_Layout function instead of EditorGUILayout.PropertyField.

+

+System Requirements

+

Unity 2018.3.0 or later versions. Feel free to try older version. Don't forget to include the NaughtyAttributes namespace.

+

+Installation

+
    +
  1. The package is available on the openupm registry. You can install it via openupm-cli.
  2. +
+
openupm add com.dbrizov.naughtyattributes
+
+
    +
  1. You can also install via git url by adding this entry in your manifest.json +
  2. +
+
"com.dbrizov.naughtyattributes": "https://github.com/dbrizov/NaughtyAttributes.git#upm"
+
+
    +
  1. You can also download it from the Asset Store +
  2. +
+

+Documentation

+ +

+Support

+

NaughtyAttributes is an open-source project that I am developing in my free time. If you like it you can support me by donating.

+ +

+Overview

+

+Drawer Attributes

+

Provide special draw options to serialized fields. +A field can have only one DrawerAttribute. If a field has more than one, only the bottom one will be used.

+

+AnimatorParam

+

Select an Animator paramater via dropdown interface.

+
public class NaughtyComponent : MonoBehaviour
+{
+	public Animator someAnimator;
+
+	[AnimatorParam("someAnimator")]
+	public int paramHash;
+
+	[AnimatorParam("someAnimator")]
+	public string paramName;
+}
+

inspector

+

+Button

+

A method can be marked as a button. A button appears in the inspector and executes the method if clicked. +Works both with instance and static methods.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[Button]
+	private void MethodOne() { }
+
+	[Button("Button Text")]
+	private void MethodTwo() { }
+}
+

inspector

+

+CurveRange

+

Set bounds and modify curve color for AnimationCurves

+
public class NaughtyComponent : MonoBehaviour
+{
+	[CurveRange(-1, -1, 1, 1)]
+	public AnimationCurve curve;
+	
+	[CurveRange(EColor.Orange)]
+	public AnimationCurve curve1;
+	
+	[CurveRange(0, 0, 5, 5, EColor.Red)]
+	public AnimationCurve curve2;
+}
+

inspector

+

+Dropdown

+

Provides an interface for dropdown value selection.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[Dropdown("intValues")]
+	public int intValue;
+
+	[Dropdown("StringValues")]
+	public string stringValue;
+
+	[Dropdown("GetVectorValues")]
+	public Vector3 vectorValue;
+
+	private int[] intValues = new int[] { 1, 2, 3, 4, 5 };
+
+	private List<string> StringValues { get { return new List<string>() { "A", "B", "C", "D", "E" }; } }
+
+	private DropdownList<Vector3> GetVectorValues()
+	{
+		return new DropdownList<Vector3>()
+		{
+			{ "Right",   Vector3.right },
+			{ "Left",    Vector3.left },
+			{ "Up",      Vector3.up },
+			{ "Down",    Vector3.down },
+			{ "Forward", Vector3.forward },
+			{ "Back",    Vector3.back }
+		};
+	}
+}
+

inspector

+

+EnumFlags

+

Provides dropdown interface for setting enum flags.

+
public enum Direction
+{
+	None = 0,
+	Right = 1 << 0,
+	Left = 1 << 1,
+	Up = 1 << 2,
+	Down = 1 << 3
+}
+
+public class NaughtyComponent : MonoBehaviour
+{
+	[EnumFlags]
+	public Direction flags;
+}
+

inspector

+

+Expandable

+

Make scriptable objects expandable.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[Expandable]
+	public ScriptableObject scriptableObject;
+}
+

inspector

+

+HorizontalLine

+
public class NaughtyComponent : MonoBehaviour
+{
+	[HorizontalLine(color: EColor.Red)]
+	public int red;
+
+	[HorizontalLine(color: EColor.Green)]
+	public int green;
+
+	[HorizontalLine(color: EColor.Blue)]
+	public int blue;
+}
+

inspector

+

+InfoBox

+

Used for providing additional information.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[InfoBox("This is my int", EInfoBoxType.Normal)]
+	public int myInt;
+
+	[InfoBox("This is my float", EInfoBoxType.Warning)]
+	public float myFloat;
+
+	[InfoBox("This is my vector", EInfoBoxType.Error)]
+	public Vector3 myVector;
+}
+

inspector

+

+InputAxis

+

Select an input axis via dropdown interface.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[InputAxis]
+	public string inputAxis;
+}
+

inspector

+

+MinMaxSlider

+

A double slider. The min value is saved to the X property, and the max value is saved to the Y property of a Vector2 field.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[MinMaxSlider(0.0f, 100.0f)]
+	public Vector2 minMaxSlider;
+}
+

inspector

+

+ProgressBar

+
public class NaughtyComponent : MonoBehaviour
+{
+	[ProgressBar("Health", 300, EColor.Red)]
+	public int health = 250;
+
+	[ProgressBar("Mana", 100, EColor.Blue)]
+	public int mana = 25;
+
+	[ProgressBar("Stamina", 200, EColor.Green)]
+	public int stamina = 150;
+}
+

inspector

+

+ReorderableList

+

Provides array type fields with an interface for easy reordering of elements.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[ReorderableList]
+	public int[] intArray;
+
+	[ReorderableList]
+	public List<float> floatArray;
+}
+

inspector

+

+ReadOnly

+

Makes a field read only.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[ReadOnly]
+	public Vector3 forwardVector = Vector3.forward;
+}
+

inspector

+

+ResizableTextArea

+

A resizable text area where you can see the whole text. +Unlike Unity's Multiline and TextArea attributes where you can see only 3 rows of a given text, and in order to see it or modify it you have to manually scroll down to the desired row.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[ResizableTextArea]
+	public string resizableTextArea;
+}
+

inspector

+

+Scene

+

Select a scene from the build settings via dropdown interface.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[Scene]
+	public string bootScene; // scene name
+
+	[Scene]
+	public int tutorialScene; // scene index
+}
+

inspector

+

+ShowAssetPreview

+

Shows the texture preview of a given asset (Sprite, Prefab...).

+
public class NaughtyComponent : MonoBehaviour
+{
+	[ShowAssetPreview]
+	public Sprite sprite;
+
+	[ShowAssetPreview(128, 128)]
+	public GameObject prefab;
+}
+

inspector

+

+ShowNativeProperty

+

Shows native C# properties in the inspector. +All native properties are displayed at the bottom of the inspector after the non-serialized fields and before the method buttons. +It supports only certain types (bool, int, long, float, double, string, Vector2, Vector3, Vector4, Color, Bounds, Rect, UnityEngine.Object).

+
public class NaughtyComponent : MonoBehaviour
+{
+	public List<Transform> transforms;
+
+	[ShowNativeProperty]
+	public int TransformsCount => transforms.Count;
+}
+

inspector

+

+ShowNonSerializedField

+

Shows non-serialized fields in the inspector. +All non-serialized fields are displayed at the bottom of the inspector before the method buttons. +Keep in mind that if you change a non-static non-serialized field in the code - the value in the inspector will be updated after you press Play in the editor. +There is no such issue with static non-serialized fields because their values are updated at compile time. +It supports only certain types (bool, int, long, float, double, string, Vector2, Vector3, Vector4, Color, Bounds, Rect, UnityEngine.Object).

+
public class NaughtyComponent : MonoBehaviour
+{
+	[ShowNonSerializedField]
+	private int myInt = 10;
+
+	[ShowNonSerializedField]
+	private const float PI = 3.14159f;
+
+	[ShowNonSerializedField]
+	private static readonly Vector3 CONST_VECTOR = Vector3.one;
+}
+

inspector

+

+Tag

+

Select a tag via dropdown interface.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[Tag]
+	public string tagField;
+}
+

inspector

+

+Meta Attributes

+

Give the fields meta data. A field can have more than one meta attributes.

+

+BoxGroup

+

Surrounds grouped fields with a box.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[BoxGroup("Integers")]
+	public int firstInt;
+	[BoxGroup("Integers")]
+	public int secondInt;
+
+	[BoxGroup("Floats")]
+	public float firstFloat;
+	[BoxGroup("Floats")]
+	public float secondFloat;
+}
+

inspector

+

+Foldout

+

Makes a foldout group.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[Foldout("Integers")]
+	public int firstInt;
+	[Foldout("Integers")]
+	public int secondInt;
+}
+

inspector

+

+EnableIf / DisableIf

+
public class NaughtyComponent : MonoBehaviour
+{
+	public bool enableMyInt;
+
+	[EnableIf("enableMyInt")]
+	public int myInt;
+
+	[EnableIf("Enabled")]
+	public float myFloat;
+
+	[EnableIf("NotEnabled")]
+	public Vector3 myVector;
+
+	public bool Enabled() { return true; }
+
+	public bool NotEnabled => false;
+}
+

inspector

+

You can have more than one condition.

+
public class NaughtyComponent : MonoBehaviour
+{
+	public bool flag0;
+	public bool flag1;
+
+	[EnableIf(EConditionOperator.And, "flag0", "flag1")]
+	public int enabledIfAll;
+
+	[EnableIf(EConditionOperator.Or, "flag0", "flag1")]
+	public int enabledIfAny;
+}
+

+ShowIf / HideIf

+
public class NaughtyComponent : MonoBehaviour
+{
+	public bool showInt;
+
+	[ShowIf("showInt")]
+	public int myInt;
+
+	[ShowIf("AlwaysShow")]
+	public float myFloat;
+
+	[ShowIf("NeverShow")]
+	public Vector3 myVector;
+
+	public bool AlwaysShow() { return true; }
+
+	public bool NeverShow => false;
+}
+

inspector

+

You can have more than one condition.

+
public class NaughtyComponent : MonoBehaviour
+{
+	public bool flag0;
+	public bool flag1;
+
+	[ShowIf(EConditionOperator.And, "flag0", "flag1")]
+	public int showIfAll;
+
+	[ShowIf(EConditionOperator.Or, "flag0", "flag1")]
+	public int showIfAny;
+}
+

+Label

+

Override default field label.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[Label("Short Name")]
+	public string veryVeryLongName;
+
+	[Label("RGB")]
+	public Vector3 vectorXYZ;
+}
+

inspector

+

+OnValueChanged

+

Detects a value change and executes a callback. +Keep in mind that the event is detected only when the value is changed from the inspector. +If you want a runtime event, you should probably use an event/delegate and subscribe to it.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[OnValueChanged("OnValueChangedCallback")]
+	public int myInt;
+
+	private void OnValueChangedCallback()
+	{
+		Debug.Log(myInt);
+	}
+}
+

+Validator Attributes

+

Used for validating the fields. A field can have infinite number of validator attributes.

+

+MinValue / MaxValue

+

Clamps integer and float fields.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[MinValue(0), MaxValue(10)]
+	public int myInt;
+
+	[MinValue(0.0f)]
+	public float myFloat;
+}
+

inspector

+

+Required

+

Used to remind the developer that a given reference type field is required.

+
public class NaughtyComponent : MonoBehaviour
+{
+	[Required]
+	public Transform myTransform;
+
+	[Required("Custom required text")]
+	public GameObject myGameObject;
+}
+

inspector

+

+ValidateInput

+

The most powerful ValidatorAttribute.

+
public class _NaughtyComponent : MonoBehaviour
+{
+	[ValidateInput("IsNotNull")]
+	public Transform myTransform;
+
+	[ValidateInput("IsGreaterThanZero", "myInteger must be greater than zero")]
+	public int myInt;
+
+	private bool IsNotNull(Transform tr)
+	{
+		return tr != null;
+	}
+
+	private bool IsGreaterThanZero(int value)
+	{
+		return value > 0;
+	}
+}
+

inspector

+ +
+
+
+
+
+ + + +
+
 
+
+ + \ No newline at end of file diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/README.html.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/README.html.meta new file mode 100644 index 0000000..42c42d4 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/README.html.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f1c5c604e6d27cc4d86e81f45c704e11 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples.meta new file mode 100644 index 0000000..db0978e --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b1e9ff0668650a54da2c458e80a90032 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene.meta new file mode 100644 index 0000000..91002d8 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: afb4c815411c28b449e61fbaa1a8bfa3 +folderAsset: yes +timeCreated: 1507995550 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/DemoScene.unity b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/DemoScene.unity new file mode 100644 index 0000000..3c13413 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/DemoScene.unity @@ -0,0 +1,2415 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.44657874, g: 0.49641258, b: 0.5748172, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 0 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 0 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 0 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 4890085278179872738, guid: 98ee975b74776234986f4d35f14c4ccc, + type: 2} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + accuratePlacement: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &106181862 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 106181863} + m_Layer: 0 + m_Name: ===== Drawer Attributes ===== + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &106181863 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 106181862} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &114650323 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 114650324} + - component: {fileID: 114650325} + - component: {fileID: 114650326} + m_Layer: 0 + m_Name: EnableIf_DisableIf + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &114650324 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 114650323} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 24 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &114650325 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 114650323} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bed506d8be3a10f45bec4bf2237bec87, type: 3} + m_Name: + m_EditorClassIdentifier: + enable1: 0 + enable2: 0 + enum1: 0 + enum2: 0 + enableIfAll: + enableIfAny: + enableIfEnum: + enableIfEnumFlag: + enableIfEnumFlagMulti: + nest1: + enable1: 1 + enable2: 0 + enum1: 0 + enum2: 0 + enableIfAll: 1 + enableIfAny: 2 + enableIfEnum: 0 + enableIfEnumFlag: 0 + enableIfEnumFlagMulti: 0 + nest2: + enable1: 1 + enable2: 1 + enum1: 0 + enum2: 0 + enableIfAll: {x: 0.25, y: 0.75} + enableIfAny: {x: 0.25, y: 0.75} + enableIfEnum: {x: 0.25, y: 0.75} + enableIfEnumFlag: {x: 0, y: 0} + enableIfEnumFlagMulti: {x: 0, y: 0} +--- !u!114 &114650326 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 114650323} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0e48a088cb96287448c3be58932bfcb7, type: 3} + m_Name: + m_EditorClassIdentifier: + disable1: 0 + disable2: 0 + enum1: 0 + enum2: 0 + disableIfAll: + disableIfAny: + disableIfEnum: + disableIfEnumFlag: + disableIfEnumFlagMulti: + nest1: + disable1: 1 + disable2: 0 + enum1: 0 + enum2: 0 + disableIfAll: 1 + disableIfAny: 2 + disableIfEnum: 3 + disableIfEnumFlag: 0 + disableIfEnumFlagMulti: 0 + nest2: + disable1: 1 + disable2: 1 + enum1: 0 + enum2: 0 + enableIfAll: {x: 0.25, y: 0.75} + enableIfAny: {x: 0.25, y: 0.75} + enableIfEnum: {x: 0.25, y: 0.75} + disableIfEnumFlag: {x: 0, y: 0} + disableIfEnumFlagMulti: {x: 0, y: 0} +--- !u!1 &155697335 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 155697336} + - component: {fileID: 155697337} + m_Layer: 0 + m_Name: InputAxis + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &155697336 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 155697335} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 9 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &155697337 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 155697335} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e0cc8a31c22090847b75538c0ed2d2fc, type: 3} + m_Name: + m_EditorClassIdentifier: + inputAxis0: + nest1: + inputAxis1: Horizontal + nest2: + inputAxis2: Vertical +--- !u!1 &237121640 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 237121641} + - component: {fileID: 237121642} + m_Layer: 0 + m_Name: ReadOnly + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &237121641 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 237121640} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 28 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &237121642 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 237121640} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5443d37a05e188846bda9b05b067184e, type: 3} + m_Name: + m_EditorClassIdentifier: + readOnlyInt: 5 + nest1: + readOnlyFloat: 3.14 + nest2: + readOnlyString: +--- !u!1 &369789276 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 369789277} + - component: {fileID: 369789278} + m_Layer: 0 + m_Name: Required + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &369789277 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 369789276} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 31 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &369789278 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 369789276} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9c8c10b2234650d42b2a8efad6b413db, type: 3} + m_Name: + m_EditorClassIdentifier: + trans0: {fileID: 0} + nest1: + trans1: {fileID: 0} + nest2: + trans2: {fileID: 0} +--- !u!1 &572382748 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 572382749} + - component: {fileID: 572382751} + m_Layer: 0 + m_Name: Foldout + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &572382749 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 572382748} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 23 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &572382751 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 572382748} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3b437215d92efa74ea85ff726ca0dd09, type: 3} + m_Name: + m_EditorClassIdentifier: + int0: 0 + int1: 0 + float0: 0 + float1: 0 + slider0: {x: 0.25, y: 0.75} + slider1: {x: 0.25, y: 0.75} + str0: + str1: + trans0: {fileID: 0} + trans1: {fileID: 0} +--- !u!1 &607441873 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 607441874} + - component: {fileID: 607441875} + m_Layer: 0 + m_Name: MinMaxSlider + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &607441874 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 607441873} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 11 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &607441875 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 607441873} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fd67fbde6acdd6a44944f12e507067c5, type: 3} + m_Name: + m_EditorClassIdentifier: + minMaxSlider0: {x: 0, y: 0.5} + nest1: + minMaxSlider1: {x: 0.25, y: 0.75} + nest2: + minMaxSlider2: {x: 6, y: 11} +--- !u!1 &706445688 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 706445689} + - component: {fileID: 706445690} + m_Layer: 0 + m_Name: NaughtyComponent + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &706445689 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 706445688} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &706445690 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 706445688} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9c928ea15ae74a44089beb2e534c1a35, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &732714203 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 732714204} + m_Layer: 0 + m_Name: ===== Meta Attributes ===== + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &732714204 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 732714203} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 21 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &779670086 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 779670087} + - component: {fileID: 779670088} + m_Layer: 0 + m_Name: Dropdown + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &779670087 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 779670086} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &779670088 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 779670086} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3855e37cd6b01194e8166573c7c4b37d, type: 3} + m_Name: + m_EditorClassIdentifier: + intValue: 1 + nest1: + stringValue: A + nest2: + vectorValue: {x: 1, y: 0, z: 0} +--- !u!1 &892661554 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 892661555} + - component: {fileID: 892661556} + m_Layer: 0 + m_Name: Scene + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &892661555 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 892661554} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 15 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &892661556 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 892661554} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 281a85803caf74a459439020a0840fa4, type: 3} + m_Name: + m_EditorClassIdentifier: + scene0: DemoScene + nest1: + scene1: DemoScene + nest2: + scene2: 0 +--- !u!1 &933563384 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 933563385} + - component: {fileID: 933563386} + m_Layer: 0 + m_Name: ShowAssetPreview + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &933563385 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 933563384} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 16 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &933563386 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 933563384} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 705c14aa9ecaa274289972381f471367, type: 3} + m_Name: + m_EditorClassIdentifier: + sprite0: {fileID: 21300000, guid: 005888ede18a58e4db8d069cfa3007cb, type: 3} + prefab0: {fileID: 1981131855061102, guid: 7ec354ef3daae7641b7a3fa5e1fe0c81, type: 3} + nest1: + sprite1: {fileID: 21300000, guid: 005888ede18a58e4db8d069cfa3007cb, type: 3} + prefab1: {fileID: 1981131855061102, guid: 7ec354ef3daae7641b7a3fa5e1fe0c81, type: 3} + nest2: + sprite2: {fileID: 21300000, guid: 005888ede18a58e4db8d069cfa3007cb, type: 3} + prefab2: {fileID: 1981131855061102, guid: 7ec354ef3daae7641b7a3fa5e1fe0c81, + type: 3} +--- !u!1 &948946033 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 948946034} + - component: {fileID: 948946035} + m_Layer: 0 + m_Name: ProgressBar + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &948946034 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 948946033} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 12 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &948946035 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 948946033} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 96ca4c27fc649764b9d1625f1740cb9e, type: 3} + m_Name: + m_EditorClassIdentifier: + health: 50 + nest1: + mana: 25 + nest2: + stamina: 75 + elixir: 50 + maxElixir: 100 +--- !u!1 &993534225 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 993534226} + - component: {fileID: 993534227} + m_Layer: 0 + m_Name: Layer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &993534226 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 993534225} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 10 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &993534227 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 993534225} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 460459d6ac76acd4d872f94cf444e6fa, type: 3} + m_Name: + m_EditorClassIdentifier: + layerNumber0: 5 + layerName0: UI + nest1: + layerNumber1: 0 + layerName1: Default + nest2: + layerNumber2: 4 + layerName2: Water +--- !u!1 &1139446979 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1139446980} + - component: {fileID: 1139446981} + m_Layer: 0 + m_Name: HorizontalLine + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1139446980 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1139446979} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 7 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1139446981 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1139446979} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5cc6d3f8d4a53374887b3d620a6972e3, type: 3} + m_Name: + m_EditorClassIdentifier: + line0: 0 + nest1: + line1: 0 + nest2: + line2: 0 +--- !u!1 &1148579783 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1148579784} + m_Layer: 0 + m_Name: Tests + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1148579784 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1148579783} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 106181863} + - {fileID: 1178133860} + - {fileID: 2043059161} + - {fileID: 2082563173} + - {fileID: 779670087} + - {fileID: 2015414598} + - {fileID: 1622801696} + - {fileID: 1139446980} + - {fileID: 1552114400} + - {fileID: 155697336} + - {fileID: 993534226} + - {fileID: 607441874} + - {fileID: 948946034} + - {fileID: 1747151588} + - {fileID: 1202167595} + - {fileID: 892661555} + - {fileID: 933563385} + - {fileID: 1989156459} + - {fileID: 1194502638} + - {fileID: 1609261820} + - {fileID: 1380469385} + - {fileID: 732714204} + - {fileID: 1784643785} + - {fileID: 572382749} + - {fileID: 114650324} + - {fileID: 1524906391} + - {fileID: 1293624596} + - {fileID: 1871127830} + - {fileID: 237121641} + - {fileID: 1641427334} + - {fileID: 1706612702} + - {fileID: 369789277} + - {fileID: 1463483878} + m_Father: {fileID: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1178133859 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1178133860} + - component: {fileID: 1178133862} + - component: {fileID: 1178133861} + m_Layer: 0 + m_Name: AnimatorParam + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1178133860 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1178133859} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1178133861 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1178133859} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9bff20ccdde00fc49a62bad6a4ef9982, type: 3} + m_Name: + m_EditorClassIdentifier: + animator0: {fileID: 1178133862} + hash0: 1943738498 + name0: Float0 + nest1: + animator1: {fileID: 1178133862} + hash1: 726565755 + name1: Float0 + nest2: + animator2: {fileID: 1178133862} + hash1: -392453409 + name1: Trigger0 +--- !u!95 &1178133862 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1178133859} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 63ee86efd213bf34285c95f33e79dc6c, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!1 &1194502637 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1194502638} + - component: {fileID: 1194502639} + m_Layer: 0 + m_Name: ShowNonSerializedField + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1194502638 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194502637} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 18 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1194502639 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1194502637} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 913d67a695253f744bdc776625b9b948, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &1202167594 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1202167595} + - component: {fileID: 1202167596} + m_Layer: 0 + m_Name: ResizableTextArea + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1202167595 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1202167594} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 14 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1202167596 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1202167594} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fb4f4bb2e3e063340a24f4bb24528bb5, type: 3} + m_Name: + m_EditorClassIdentifier: + text0: '1 + + 2 + + 3' + nest1: + text1: '1 + + 2 + + 3 + + 4 + + 5' + nest2: + text2: '1 + + 2 + + 3 + + 4 + + 5 + + 6 + + 7' +--- !u!1 &1293624595 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1293624596} + - component: {fileID: 1293624597} + m_Layer: 0 + m_Name: Label + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1293624596 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1293624595} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 26 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1293624597 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1293624595} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7488af014527ebf42af5c4fc4d5f4f5b, type: 3} + m_Name: + m_EditorClassIdentifier: + int0: 0 + nest1: + int1: 0 + nest2: + vector2: {x: 0.25, y: 0.75} +--- !u!1 &1380469384 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1380469385} + - component: {fileID: 1380469386} + m_Layer: 0 + m_Name: Tag + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1380469385 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380469384} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 20 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1380469386 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1380469384} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8bcc0d5613b48fb43bd36c9d37e99900, type: 3} + m_Name: + m_EditorClassIdentifier: + tag0: + nest1: + tag1: MainCamera + nest2: + tag2: Player +--- !u!1 &1444377589 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1444377591} + - component: {fileID: 1444377590} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &1444377590 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1444377589} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &1444377591 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1444377589} + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &1463483877 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1463483878} + - component: {fileID: 1463483879} + m_Layer: 0 + m_Name: ValidateInput + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1463483878 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1463483877} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 32 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1463483879 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1463483877} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 94adafcfe59aa344c9b5596b2cc6ecd0, type: 3} + m_Name: + m_EditorClassIdentifier: + int0: 0 + nest1: + int1: 0 + nest2: + int2: 0 + inheritedNest: + int1: 0 + nest2: + int2: 0 +--- !u!1 &1524906390 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1524906391} + - component: {fileID: 1524906392} + - component: {fileID: 1524906393} + m_Layer: 0 + m_Name: ShowIf_HideIf + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1524906391 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1524906390} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 25 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1524906392 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1524906390} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4fdbfcfbf5b056a4bac491fe21569572, type: 3} + m_Name: + m_EditorClassIdentifier: + show1: 0 + show2: 0 + enum1: 0 + enum2: 0 + showIfAll: + showIfAny: + showIfEnum: + showIfEnumFlag: + showIfEnumFlagMulti: + nest1: + show1: 1 + show2: 0 + enum1: 0 + enum2: 0 + showIfAll: 0 + showIfAny: 0 + showIfEnum: 0 + showIfEnumFlag: 0 + showIfEnumFlagMulti: 0 + nest2: + show1: 1 + show2: 1 + enum1: 0 + enum2: 0 + showIfAll: {x: 0.25, y: 0.75} + showIfAny: {x: 0.25, y: 0.75} + showIfEnum: {x: 0.25, y: 0.75} + showIfEnumFlag: {x: 0, y: 0} + showIfEnumFlagMulti: {x: 0, y: 0} +--- !u!114 &1524906393 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1524906390} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3cf166cb519e666419bb79b0c50c5ee1, type: 3} + m_Name: + m_EditorClassIdentifier: + hide1: 0 + hide2: 0 + enum1: 0 + enum2: 0 + hideIfAll: + hideIfAny: + hideIfEnum: + hideIfEnumFlag: + hideIfEnumFlagMulti: + nest1: + hide1: 1 + hide2: 0 + enum1: 0 + enum2: 0 + hideIfAll: 0 + hideIfAny: 0 + hideIfEnum: 0 + hideIfEnumFlag: 0 + hideIfEnumFlagMulti: 0 + nest2: + hide1: 1 + hide2: 1 + enum1: 0 + enum2: 0 + hideIfAll: {x: 0.25, y: 0.75} + hideIfAny: {x: 0.25, y: 0.75} + hideIfEnum: {x: 0.25, y: 0.75} + hideIfEnumFlag: {x: 0, y: 0} + hideIfEnumFlagMulti: {x: 0, y: 0} +--- !u!1 &1552114399 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1552114400} + - component: {fileID: 1552114401} + m_Layer: 0 + m_Name: InfoBox + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1552114400 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1552114399} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 8 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1552114401 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1552114399} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0dcb08e489c17644e9eacaa1ec5fe781, type: 3} + m_Name: + m_EditorClassIdentifier: + normal: 0 + nest1: + warning: 0 + nest2: + error: 0 +--- !u!1 &1591883662 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1591883666} + - component: {fileID: 1591883665} + - component: {fileID: 1591883664} + - component: {fileID: 1591883663} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1591883663 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1591883662} + m_Enabled: 1 +--- !u!124 &1591883664 +Behaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1591883662} + m_Enabled: 1 +--- !u!20 &1591883665 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1591883662} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1591883666 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1591883662} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1609261819 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1609261820} + - component: {fileID: 1609261821} + m_Layer: 0 + m_Name: 'SortingLayer ' + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1609261820 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1609261819} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 19 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1609261821 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1609261819} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8ed73e666d447964d93c4840f05423dc, type: 3} + m_Name: + m_EditorClassIdentifier: + layerNumber0: 0 + layerName0: Default + nest1: + layerNumber1: 0 + layerName1: Default + nest2: + layerNumber2: 0 + layerName2: Default +--- !u!1 &1622801695 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1622801696} + - component: {fileID: 1622801697} + m_Layer: 0 + m_Name: Expandable + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1622801696 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1622801695} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 6 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1622801697 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1622801695} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 64c4c9aee2b494d44be9bb0b7f12ed7c, type: 3} + m_Name: + m_EditorClassIdentifier: + precedingField: 5 + obj0: {fileID: 11400000, guid: 9cf80899b80517945a2d2390fb48877f, type: 2} + nest1: + obj1: {fileID: 11400000, guid: 9cf80899b80517945a2d2390fb48877f, type: 2} + nest2: + obj2: {fileID: 11400000, guid: 9cf80899b80517945a2d2390fb48877f, type: 2} +--- !u!1 &1641427333 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1641427334} + m_Layer: 0 + m_Name: ===== Validator Attributes ===== + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1641427334 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1641427333} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 29 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1706612701 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1706612702} + - component: {fileID: 1706612703} + m_Layer: 0 + m_Name: MinValue_MaxValue + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1706612702 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1706612701} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 30 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1706612703 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1706612701} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 450a05787c54e6b4fa88ffe223bcee87, type: 3} + m_Name: + m_EditorClassIdentifier: + min0Int: 0 + max0Int: 0 + range01Float: 0 + range01Vector2: {x: 0, y: 0} + range01Vector3: {x: 0, y: 0, z: 0} + range01Vector4: {x: 0, y: 0, z: 0, w: 0} + min0Vector2Int: {x: 0, y: 0} + max100Vector2Int: {x: 0, y: 0} + min0Vector3Int: {x: 0, y: 0, z: 0} + max100Vector3Int: {x: 0, y: 0, z: 0} + nest1: + min0Int: 0 + max0Int: 0 + range01Float: 0 + range01Vector2: {x: 0, y: 0} + range01Vector3: {x: 0, y: 0, z: 0} + range01Vector4: {x: 0, y: 0, z: 0, w: 0} + min0Vector2Int: {x: 0, y: 0} + max100Vector2Int: {x: 0, y: 0} + min0Vector3Int: {x: 0, y: 0, z: 0} + max100Vector3Int: {x: 0, y: 0, z: 0} + nest2: + min0Int: 0 + max0Int: 0 + range01Float: 0 + range01Vector2: {x: 0, y: 0} + range01Vector3: {x: 0, y: 0, z: 0} + range01Vector4: {x: 0, y: 0, z: 0, w: 0} + min0Vector2Int: {x: 0, y: 0} + max100Vector2Int: {x: 0, y: 0} + min0Vector3Int: {x: 0, y: 0, z: 0} + max100Vector3Int: {x: 0, y: 0, z: 0} +--- !u!1 &1747151587 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1747151588} + - component: {fileID: 1747151589} + m_Layer: 0 + m_Name: ReorderableList + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1747151588 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1747151587} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 13 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1747151589 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1747151587} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c93fde7cd79390148ac576c3a159a77b, type: 3} + m_Name: + m_EditorClassIdentifier: + intArray: 020000000300000001000000 + vectorList: + - {x: 2, y: 2, z: 2} + - {x: 3, y: 3, z: 3} + - {x: 1, y: 1, z: 1} + structList: + - Int: 2 + Float: 2 + Vector: {x: 2, y: 2, z: 2} + - Int: 3 + Float: 3 + Vector: {x: 3, y: 3, z: 3} + - Int: 1 + Float: 1 + Vector: {x: 1, y: 1, z: 1} + gameObjectsList: [] + transformsList: [] + monoBehavioursList: [] +--- !u!1 &1784643784 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1784643785} + - component: {fileID: 1784643786} + m_Layer: 0 + m_Name: BoxGroup + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1784643785 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1784643784} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 22 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1784643786 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1784643784} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3920f5ea384951b4990e4d9e8032d12e, type: 3} + m_Name: + m_EditorClassIdentifier: + int0: 0 + int1: 0 + float0: 0 + float1: 0 + slider0: {x: 0.25, y: 0.75} + slider1: {x: 0.25, y: 0.75} + str0: + str1: + trans0: {fileID: 0} + trans1: {fileID: 0} +--- !u!1 &1871127829 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1871127830} + - component: {fileID: 1871127831} + m_Layer: 0 + m_Name: OnValueChanged + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1871127830 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1871127829} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 27 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1871127831 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1871127829} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ff1df679e5b32f64bb106752c63933fa, type: 3} + m_Name: + m_EditorClassIdentifier: + int0: 0 + nest1: + int1: 0 + nest2: + int2: 0 +--- !u!1 &1989156458 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1989156459} + - component: {fileID: 1989156460} + m_Layer: 0 + m_Name: ShowNativeProperty + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1989156459 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1989156458} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 17 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &1989156460 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1989156458} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b5a73795d25dd334e90a5a347c6079d9, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &2015414597 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2015414598} + - component: {fileID: 2015414599} + m_Layer: 0 + m_Name: EnumFlags + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2015414598 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2015414597} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 5 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2015414599 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2015414597} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7b7f6b84ce0d7674d8a386fde729279c, type: 3} + m_Name: + m_EditorClassIdentifier: + flags0: 0 + nest1: + flags1: 6 + nest2: + flags2: -1 +--- !u!1 &2043059160 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2043059161} + - component: {fileID: 2043059162} + m_Layer: 0 + m_Name: Button + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2043059161 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2043059160} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2043059162 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2043059160} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b592f12a9f69ac3408f6f870762232c7, type: 3} + m_Name: + m_EditorClassIdentifier: + myInt: 0 +--- !u!1 &2082563172 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2082563173} + - component: {fileID: 2082563174} + m_Layer: 0 + m_Name: CurveRange + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2082563173 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2082563172} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1148579784} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2082563174 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2082563172} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6587b100d001e7e46b9aaae7f1180b40, type: 3} + m_Name: + m_EditorClassIdentifier: + curves: + - serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 0 + - serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 0 + - serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 2 + outSlope: 2 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 0 + - serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 2 + outSlope: 2 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 0 + - serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 0 + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: -1 + value: -1 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curve1: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + curve2: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 10 + value: 10 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + nest1: + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + nest2: + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 5 + value: 5 + inSlope: 1 + outSlope: 1 + tangentMode: 34 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/DemoScene.unity.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/DemoScene.unity.meta new file mode 100644 index 0000000..819f1ec --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/DemoScene.unity.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 07845a5477be2b149a6f1cb32b5a3a5b +timeCreated: 1507998788 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/DemoSceneSettings.lighting b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/DemoSceneSettings.lighting new file mode 100644 index 0000000..a88ae38 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/DemoSceneSettings.lighting @@ -0,0 +1,63 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!850595691 &4890085278179872738 +LightingSettings: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: DemoSceneSettings + serializedVersion: 2 + m_GIWorkflowMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 1 + m_RealtimeEnvironmentLighting: 1 + m_BounceScale: 1 + m_AlbedoBoost: 1 + m_IndirectOutputScale: 1 + m_UsingShadowmask: 1 + m_BakeBackend: 0 + m_LightmapMaxSize: 1024 + m_BakeResolution: 40 + m_Padding: 2 + m_TextureCompression: 1 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAO: 0 + m_MixedBakeMode: 2 + m_LightmapsBakeMode: 1 + m_FilterMode: 1 + m_LightmapParameters: {fileID: 0} + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_RealtimeResolution: 2 + m_ForceWhiteAlbedo: 0 + m_ForceUpdates: 0 + m_FinalGather: 0 + m_FinalGatherRayCount: 256 + m_FinalGatherFiltering: 1 + m_PVRCulling: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 500 + m_PVREnvironmentSampleCount: 500 + m_PVREnvironmentReferencePointCount: 2048 + m_LightProbeSampleCountMultiplier: 4 + m_PVRBounces: 2 + m_PVRRussianRouletteStartBounce: 2 + m_PVREnvironmentMIS: 0 + m_PVRFilteringMode: 2 + m_PVRDenoiserTypeDirect: 0 + m_PVRDenoiserTypeIndirect: 0 + m_PVRDenoiserTypeAO: 0 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/DemoSceneSettings.lighting.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/DemoSceneSettings.lighting.meta new file mode 100644 index 0000000..3af7b5e --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/DemoSceneSettings.lighting.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 98ee975b74776234986f4d35f14c4ccc +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets.meta new file mode 100644 index 0000000..931e8f8 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 53a462744f22ca549927c5e6ea797362 +folderAsset: yes +timeCreated: 1509089305 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/Cube.prefab b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/Cube.prefab new file mode 100644 index 0000000..64055f6 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/Cube.prefab @@ -0,0 +1,93 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1981131855061102 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4344736110947706} + - component: {fileID: 33062901823624450} + - component: {fileID: 65233182844289960} + - component: {fileID: 23099360439063292} + m_Layer: 0 + m_Name: Cube + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4344736110947706 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1981131855061102} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!33 &33062901823624450 +MeshFilter: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1981131855061102} + m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0} +--- !u!65 &65233182844289960 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1981131855061102} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1, y: 1, z: 1} + m_Center: {x: 0, y: 0, z: 0} +--- !u!23 &23099360439063292 +MeshRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1981131855061102} + m_Enabled: 1 + m_CastShadows: 1 + m_ReceiveShadows: 1 + m_DynamicOccludee: 1 + m_MotionVectors: 1 + m_LightProbeUsage: 1 + m_ReflectionProbeUsage: 1 + m_RenderingLayerMask: 1 + m_RendererPriority: 0 + m_Materials: + - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} + m_StaticBatchInfo: + firstSubMesh: 0 + subMeshCount: 0 + m_StaticBatchRoot: {fileID: 0} + m_ProbeAnchor: {fileID: 0} + m_LightProbeVolumeOverride: {fileID: 0} + m_ScaleInLightmap: 1 + m_PreserveUVs: 1 + m_IgnoreNormalsForChartDetection: 0 + m_ImportantGI: 0 + m_StitchLightmapSeams: 0 + m_SelectedEditorRenderState: 3 + m_MinimumChartSize: 4 + m_AutoUVMaxDistance: 0.5 + m_AutoUVMaxAngle: 89 + m_LightmapParameters: {fileID: 0} + m_SortingLayerID: 0 + m_SortingLayer: 0 + m_SortingOrder: 0 diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/Cube.prefab.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/Cube.prefab.meta new file mode 100644 index 0000000..f493507 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/Cube.prefab.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 7ec354ef3daae7641b7a3fa5e1fe0c81 +timeCreated: 1509089337 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 100100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimation.anim b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimation.anim new file mode 100644 index 0000000..9536161 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimation.anim @@ -0,0 +1,169 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: DummyAnimation + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: {x: 0, y: 0, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + - serializedVersion: 3 + time: 1 + value: {x: 0, y: 0, z: 0} + inSlope: {x: 0, y: 0, z: 0} + outSlope: {x: 0, y: 0, z: 0} + tangentMode: 0 + weightedMode: 0 + inWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + outWeight: {x: 0.33333334, y: 0.33333334, z: 0.33333334} + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + path: + m_ScaleCurves: [] + m_FloatCurves: [] + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 1 + script: {fileID: 0} + typeID: 4 + customType: 0 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.x + path: + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.y + path: + classID: 4 + script: {fileID: 0} + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_LocalPosition.z + path: + classID: 4 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 1 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimation.anim.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimation.anim.meta new file mode 100644 index 0000000..d66e3b6 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimation.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 31fbd6c92d19aaa48910857627a54a25 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimatorController.controller b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimatorController.controller new file mode 100644 index 0000000..bb64cae --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimatorController.controller @@ -0,0 +1,120 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1102 &-1567792821050049497 +AnimatorState: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: DummyAnimation + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 31fbd6c92d19aaa48910857627a54a25, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: DummyAnimatorController + serializedVersion: 5 + m_AnimatorParameters: + - m_Name: Float0 + m_Type: 1 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + - m_Name: Float1 + m_Type: 1 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + - m_Name: Int0 + m_Type: 3 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + - m_Name: Int1 + m_Type: 3 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + - m_Name: Bool0 + m_Type: 4 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + - m_Name: Bool1 + m_Type: 4 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + - m_Name: Trigger0 + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + - m_Name: Trigger1 + m_Type: 9 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 945276690032550857} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &945276690032550857 +AnimatorStateMachine: + serializedVersion: 5 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: -1567792821050049497} + m_Position: {x: 390, y: 80, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: -1567792821050049497} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimatorController.controller.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimatorController.controller.meta new file mode 100644 index 0000000..2ce8a9c --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/DummyAnimatorController.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 63ee86efd213bf34285c95f33e79dc6c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/NaughtyScriptableObject.asset b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/NaughtyScriptableObject.asset new file mode 100644 index 0000000..353dc47 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/NaughtyScriptableObject.asset @@ -0,0 +1,17 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 753bdb918c6038142acddbd7aae6958f, type: 3} + m_Name: NaughtyScriptableObject + m_EditorClassIdentifier: + listA: + - {fileID: 11400000, guid: 149474eb879a6a641b560ca17d48712f, type: 2} + - {fileID: 11400000, guid: 149474eb879a6a641b560ca17d48712f, type: 2} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/NaughtyScriptableObject.asset.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/NaughtyScriptableObject.asset.meta new file mode 100644 index 0000000..dbcb741 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/NaughtyScriptableObject.asset.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 9cf80899b80517945a2d2390fb48877f +timeCreated: 1518639643 +licenseType: Free +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObjectA.asset b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObjectA.asset new file mode 100644 index 0000000..3907d95 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObjectA.asset @@ -0,0 +1,17 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 19472ac11eae27a4b804f354ca7d9c00, type: 3} + m_Name: TestScriptableObjectA + m_EditorClassIdentifier: + listB: + - {fileID: 11400000, guid: 05371aa7630d3ef44ac0106af06cd73c, type: 2} + - {fileID: 11400000, guid: 05371aa7630d3ef44ac0106af06cd73c, type: 2} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObjectA.asset.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObjectA.asset.meta new file mode 100644 index 0000000..3143872 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObjectA.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 149474eb879a6a641b560ca17d48712f +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObjectB.asset b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObjectB.asset new file mode 100644 index 0000000..79f5b60 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObjectB.asset @@ -0,0 +1,15 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c2b396aeebc9d984da298eee313896bc, type: 3} + m_Name: TestScriptableObjectB + m_EditorClassIdentifier: + slider: {x: 3, y: 7} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObjectB.asset.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObjectB.asset.meta new file mode 100644 index 0000000..7645ee1 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/TestScriptableObjectB.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 05371aa7630d3ef44ac0106af06cd73c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/icon-github.png b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/icon-github.png new file mode 100644 index 0000000..228b09a Binary files /dev/null and b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/icon-github.png differ diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/icon-github.png.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/icon-github.png.meta new file mode 100644 index 0000000..c92bc5d --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Samples/DemoScene/TestAssets/icon-github.png.meta @@ -0,0 +1,127 @@ +fileFormatVersion: 2 +guid: 005888ede18a58e4db8d069cfa3007cb +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 10 + mipmaps: + mipMapMode: 0 + enableMipMap: 0 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: -1 + aniso: -1 + mipBias: -100 + wrapU: 1 + wrapV: 1 + wrapW: -1 + nPOTScale: 0 + lightmap: 0 + compressionQuality: 50 + spriteMode: 1 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 8 + textureShape: 1 + singleChannelComponent: 0 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 1 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: 5e97eb03825dee720800000000000000 + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts.meta new file mode 100644 index 0000000..238d7e9 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 66686847ee1fa044bb15dfe473666178 +folderAsset: yes +timeCreated: 1507995546 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core.meta new file mode 100644 index 0000000..a055450 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 1f67e408a6d0adf4ab29d095ccd8b116 +folderAsset: yes +timeCreated: 1507998942 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes.meta new file mode 100644 index 0000000..132a3c2 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c76425e719cd4424d868674bcfb233f2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/AllowNestingAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/AllowNestingAttribute.cs new file mode 100644 index 0000000..c73cd8d --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/AllowNestingAttribute.cs @@ -0,0 +1,9 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class AllowNestingAttribute : DrawerAttribute + { + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/AllowNestingAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/AllowNestingAttribute.cs.meta new file mode 100644 index 0000000..343dfec --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/AllowNestingAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 95b49d3abe880c044adbe7faf6b7b4ec +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/AnimatorParamAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/AnimatorParamAttribute.cs new file mode 100644 index 0000000..214cd66 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/AnimatorParamAttribute.cs @@ -0,0 +1,24 @@ +锘縰sing System; +using UnityEngine; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class AnimatorParamAttribute : DrawerAttribute + { + public string AnimatorName { get; private set; } + public AnimatorControllerParameterType? AnimatorParamType { get; private set; } + + public AnimatorParamAttribute(string animatorName) + { + AnimatorName = animatorName; + AnimatorParamType = null; + } + + public AnimatorParamAttribute(string animatorName, AnimatorControllerParameterType animatorParamType) + { + AnimatorName = animatorName; + AnimatorParamType = animatorParamType; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/AnimatorParamAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/AnimatorParamAttribute.cs.meta new file mode 100644 index 0000000..db61add --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/AnimatorParamAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7373332cb77b42744a415d6b4add445d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/CurveRangeAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/CurveRangeAttribute.cs new file mode 100644 index 0000000..45dcd71 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/CurveRangeAttribute.cs @@ -0,0 +1,30 @@ +锘縰sing System; +using UnityEngine; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class CurveRangeAttribute : DrawerAttribute + { + public Vector2 Min { get; private set; } + public Vector2 Max { get; private set; } + public EColor Color { get; private set; } + + public CurveRangeAttribute(Vector2 min, Vector2 max, EColor color = EColor.Clear) + { + Min = min; + Max = max; + Color = color; + } + + public CurveRangeAttribute(EColor color) + : this(Vector2.zero, Vector2.one, color) + { + } + + public CurveRangeAttribute(float minX, float minY, float maxX, float maxY, EColor color = EColor.Clear) + : this(new Vector2(minX, minY), new Vector2(maxX, maxY), color) + { + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/CurveRangeAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/CurveRangeAttribute.cs.meta new file mode 100644 index 0000000..93b60ab --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/CurveRangeAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bbdf3fb8882c7514c9a01108122cda7e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/DrawerAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/DrawerAttribute.cs new file mode 100644 index 0000000..90d4f2d --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/DrawerAttribute.cs @@ -0,0 +1,11 @@ +锘縰sing UnityEngine; + +namespace NaughtyAttributes +{ + /// + /// Base class for all drawer attributes + /// + public class DrawerAttribute : PropertyAttribute, INaughtyAttribute + { + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/DrawerAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/DrawerAttribute.cs.meta new file mode 100644 index 0000000..aa54215 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/DrawerAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9df37fdebccf65c4da5b0a14f6dad5f5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/DropdownAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/DropdownAttribute.cs new file mode 100644 index 0000000..3d95064 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/DropdownAttribute.cs @@ -0,0 +1,57 @@ +锘縰sing System.Collections; +using System; +using System.Collections.Generic; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class DropdownAttribute : DrawerAttribute + { + public string ValuesName { get; private set; } + + public DropdownAttribute(string valuesName) + { + ValuesName = valuesName; + } + } + + public interface IDropdownList : IEnumerable> + { + } + + public class DropdownList : IDropdownList + { + private List> _values; + + public DropdownList() + { + _values = new List>(); + } + + public void Add(string displayName, T value) + { + _values.Add(new KeyValuePair(displayName, value)); + } + + public IEnumerator> GetEnumerator() + { + return _values.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public static explicit operator DropdownList(DropdownList target) + { + DropdownList result = new DropdownList(); + foreach (var kvp in target) + { + result.Add(kvp.Key, kvp.Value); + } + + return result; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/DropdownAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/DropdownAttribute.cs.meta new file mode 100644 index 0000000..b25926d --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/DropdownAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2cb864a1092cec04f8a4dbb556e8ed31 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/EnumFlagsAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/EnumFlagsAttribute.cs new file mode 100644 index 0000000..2fcb134 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/EnumFlagsAttribute.cs @@ -0,0 +1,9 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class EnumFlagsAttribute : DrawerAttribute + { + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/EnumFlagsAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/EnumFlagsAttribute.cs.meta new file mode 100644 index 0000000..25a52af --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/EnumFlagsAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e8b31eb6d7299e54d89dcabc4cad0e6a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/Expandable.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/Expandable.cs new file mode 100644 index 0000000..b4e8ebd --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/Expandable.cs @@ -0,0 +1,9 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class ExpandableAttribute : DrawerAttribute + { + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/Expandable.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/Expandable.cs.meta new file mode 100644 index 0000000..8fa04e4 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/Expandable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 60926d6ca7f9ced469e9248ff1192da6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/HorizontalLineAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/HorizontalLineAttribute.cs new file mode 100644 index 0000000..50d59a8 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/HorizontalLineAttribute.cs @@ -0,0 +1,20 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)] + public class HorizontalLineAttribute : DrawerAttribute + { + public const float DefaultHeight = 2.0f; + public const EColor DefaultColor = EColor.Gray; + + public float Height { get; private set; } + public EColor Color { get; private set; } + + public HorizontalLineAttribute(float height = DefaultHeight, EColor color = DefaultColor) + { + Height = height; + Color = color; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/HorizontalLineAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/HorizontalLineAttribute.cs.meta new file mode 100644 index 0000000..ecfd258 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/HorizontalLineAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2fdd6f99acca2fd42a4f3162d585ce95 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/InfoBoxAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/InfoBoxAttribute.cs new file mode 100644 index 0000000..8867d97 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/InfoBoxAttribute.cs @@ -0,0 +1,24 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + public enum EInfoBoxType + { + Normal, + Warning, + Error + } + + [AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)] + public class InfoBoxAttribute : DrawerAttribute + { + public string Text { get; private set; } + public EInfoBoxType Type { get; private set; } + + public InfoBoxAttribute(string text, EInfoBoxType type = EInfoBoxType.Normal) + { + Text = text; + Type = type; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/InfoBoxAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/InfoBoxAttribute.cs.meta new file mode 100644 index 0000000..8748a6e --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/InfoBoxAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: afd1d6323740c734893fa8397c53113b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/InputAxisAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/InputAxisAttribute.cs new file mode 100644 index 0000000..416a107 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/InputAxisAttribute.cs @@ -0,0 +1,9 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class InputAxisAttribute : DrawerAttribute + { + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/InputAxisAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/InputAxisAttribute.cs.meta new file mode 100644 index 0000000..da3b2c4 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/InputAxisAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 85033978c18810f46af271bbe94cf4aa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/LayerAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/LayerAttribute.cs new file mode 100644 index 0000000..87c1bce --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/LayerAttribute.cs @@ -0,0 +1,9 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class LayerAttribute : DrawerAttribute + { + } +} \ No newline at end of file diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/LayerAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/LayerAttribute.cs.meta new file mode 100644 index 0000000..93d97f7 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/LayerAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 668d19ebe071176448d1af816a9a0ce0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/MinMaxSliderAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/MinMaxSliderAttribute.cs new file mode 100644 index 0000000..f76d602 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/MinMaxSliderAttribute.cs @@ -0,0 +1,17 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class MinMaxSliderAttribute : DrawerAttribute + { + public float MinValue { get; private set; } + public float MaxValue { get; private set; } + + public MinMaxSliderAttribute(float minValue, float maxValue) + { + MinValue = minValue; + MaxValue = maxValue; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/MinMaxSliderAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/MinMaxSliderAttribute.cs.meta new file mode 100644 index 0000000..03e5dcf --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/MinMaxSliderAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4aaa73f574deaa54187cb54aae571b24 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/ProgressBarAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/ProgressBarAttribute.cs new file mode 100644 index 0000000..72b7ea8 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/ProgressBarAttribute.cs @@ -0,0 +1,37 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class ProgressBarAttribute : DrawerAttribute + { + public string Name { get; private set; } + public float MaxValue { get; set; } + public string MaxValueName { get; private set; } + public EColor Color { get; private set; } + + public ProgressBarAttribute(string name, float maxValue, EColor color = EColor.Blue) + { + Name = name; + MaxValue = maxValue; + Color = color; + } + + public ProgressBarAttribute(string name, string maxValueName, EColor color = EColor.Blue) + { + Name = name; + MaxValueName = maxValueName; + Color = color; + } + + public ProgressBarAttribute(float maxValue, EColor color = EColor.Blue) + : this("", maxValue, color) + { + } + + public ProgressBarAttribute(string maxValueName, EColor color = EColor.Blue) + : this("", maxValueName, color) + { + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/ProgressBarAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/ProgressBarAttribute.cs.meta new file mode 100644 index 0000000..11029f0 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/ProgressBarAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e19e4db6f4d08f849aa8ea8155cd2760 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/ResizableTextAreaAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/ResizableTextAreaAttribute.cs new file mode 100644 index 0000000..e84e664 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/ResizableTextAreaAttribute.cs @@ -0,0 +1,9 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class ResizableTextAreaAttribute : DrawerAttribute + { + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/ResizableTextAreaAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/ResizableTextAreaAttribute.cs.meta new file mode 100644 index 0000000..cc11d00 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/ResizableTextAreaAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 56d9a4b795ef4a94d86b94e55fb81240 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/SceneAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/SceneAttribute.cs new file mode 100644 index 0000000..0cc044b --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/SceneAttribute.cs @@ -0,0 +1,9 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class SceneAttribute : DrawerAttribute + { + } +} \ No newline at end of file diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/SceneAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/SceneAttribute.cs.meta new file mode 100644 index 0000000..f22649b --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/SceneAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e054de18423364f4688b72a0f2a472b6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs new file mode 100644 index 0000000..dd628ff --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs @@ -0,0 +1,20 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class ShowAssetPreviewAttribute : DrawerAttribute + { + public const int DefaultWidth = 64; + public const int DefaultHeight = 64; + + public int Width { get; private set; } + public int Height { get; private set; } + + public ShowAssetPreviewAttribute(int width = DefaultWidth, int height = DefaultHeight) + { + Width = width; + Height = height; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs.meta new file mode 100644 index 0000000..4893b92 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/ShowAssetPreviewAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4b7dd9b44abc0054cb5cd68d74be2c1a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/SortingLayerAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/SortingLayerAttribute.cs new file mode 100644 index 0000000..0df4964 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/SortingLayerAttribute.cs @@ -0,0 +1,9 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class SortingLayerAttribute : DrawerAttribute + { + } +} \ No newline at end of file diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/SortingLayerAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/SortingLayerAttribute.cs.meta new file mode 100644 index 0000000..d4cfaf8 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/SortingLayerAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b7564ee02deb3974a85d8617eea098fb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/TagAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/TagAttribute.cs new file mode 100644 index 0000000..296d8d3 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/TagAttribute.cs @@ -0,0 +1,9 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class TagAttribute : DrawerAttribute + { + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/TagAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/TagAttribute.cs.meta new file mode 100644 index 0000000..618033c --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes/TagAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8903399bbd7c9d745a7b9188ab6c8320 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase.meta new file mode 100644 index 0000000..3096ac4 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5cf879ed72221e740a7aa02ef9c366a7 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ButtonAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ButtonAttribute.cs new file mode 100644 index 0000000..5deef56 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ButtonAttribute.cs @@ -0,0 +1,33 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + public enum EButtonEnableMode + { + /// + /// Button should be active always + /// + Always, + /// + /// Button should be active only in editor + /// + Editor, + /// + /// Button should be active only in playmode + /// + Playmode + } + + [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)] + public class ButtonAttribute : SpecialCaseDrawerAttribute + { + public string Text { get; private set; } + public EButtonEnableMode SelectedEnableMode { get; private set; } + + public ButtonAttribute(string text = null, EButtonEnableMode enabledMode = EButtonEnableMode.Always) + { + this.Text = text; + this.SelectedEnableMode = enabledMode; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ButtonAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ButtonAttribute.cs.meta new file mode 100644 index 0000000..cc7be5c --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ButtonAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e8fe363a25ec5e24a9dd510bb0b4a0d4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ReorderableListAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ReorderableListAttribute.cs new file mode 100644 index 0000000..91af2ea --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ReorderableListAttribute.cs @@ -0,0 +1,9 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class ReorderableListAttribute : SpecialCaseDrawerAttribute + { + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ReorderableListAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ReorderableListAttribute.cs.meta new file mode 100644 index 0000000..add3c4a --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ReorderableListAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6189b48f4055e6c47aa132632d898fa6 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNativePropertyAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNativePropertyAttribute.cs new file mode 100644 index 0000000..10d0336 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNativePropertyAttribute.cs @@ -0,0 +1,9 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] + public class ShowNativePropertyAttribute : SpecialCaseDrawerAttribute + { + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNativePropertyAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNativePropertyAttribute.cs.meta new file mode 100644 index 0000000..5aed9a2 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNativePropertyAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a8e9b7b71c94a1f459336a24cfe04b1b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNonSerializedFieldAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNonSerializedFieldAttribute.cs new file mode 100644 index 0000000..a4303dd --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNonSerializedFieldAttribute.cs @@ -0,0 +1,9 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class ShowNonSerializedFieldAttribute : SpecialCaseDrawerAttribute + { + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNonSerializedFieldAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNonSerializedFieldAttribute.cs.meta new file mode 100644 index 0000000..84d5624 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/ShowNonSerializedFieldAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8ea09f60df536734184a8920ff8bda6f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/SpecialCaseDrawerAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/SpecialCaseDrawerAttribute.cs new file mode 100644 index 0000000..204f9c6 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/SpecialCaseDrawerAttribute.cs @@ -0,0 +1,8 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + public class SpecialCaseDrawerAttribute : Attribute, INaughtyAttribute + { + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/SpecialCaseDrawerAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/SpecialCaseDrawerAttribute.cs.meta new file mode 100644 index 0000000..3b4bd25 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/DrawerAttributes_SpecialCase/SpecialCaseDrawerAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 95a59093f8ed1af48a8be75fa3050a3c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/INaughtyAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/INaughtyAttribute.cs new file mode 100644 index 0000000..bd16238 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/INaughtyAttribute.cs @@ -0,0 +1,8 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + public interface INaughtyAttribute + { + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/INaughtyAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/INaughtyAttribute.cs.meta new file mode 100644 index 0000000..e2dd9d9 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/INaughtyAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: edda855906d15e541b46efd812fd70f3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes.meta new file mode 100644 index 0000000..547f24d --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 64c95d02a2004854585e8d923d6680d0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/BoxGroupAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/BoxGroupAttribute.cs new file mode 100644 index 0000000..bb6380a --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/BoxGroupAttribute.cs @@ -0,0 +1,15 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class BoxGroupAttribute : MetaAttribute, IGroupAttribute + { + public string Name { get; private set; } + + public BoxGroupAttribute(string name = "") + { + Name = name; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/BoxGroupAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/BoxGroupAttribute.cs.meta new file mode 100644 index 0000000..d68d8de --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/BoxGroupAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 07da8af1e3be52c4789678bf4138ae11 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/DisableIfAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/DisableIfAttribute.cs new file mode 100644 index 0000000..c8fd6e3 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/DisableIfAttribute.cs @@ -0,0 +1,26 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] + public class DisableIfAttribute : EnableIfAttributeBase + { + public DisableIfAttribute(string condition) + : base(condition) + { + Inverted = true; + } + + public DisableIfAttribute(EConditionOperator conditionOperator, params string[] conditions) + : base(conditionOperator, conditions) + { + Inverted = true; + } + + public DisableIfAttribute(string enumName, object enumValue) + : base(enumName, enumValue as Enum) + { + Inverted = true; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/DisableIfAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/DisableIfAttribute.cs.meta new file mode 100644 index 0000000..b91dc52 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/DisableIfAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 52a0d5c249ac8fd42a4fb4d61bc2f797 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttribute.cs new file mode 100644 index 0000000..c801413 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttribute.cs @@ -0,0 +1,26 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] + public class EnableIfAttribute : EnableIfAttributeBase + { + public EnableIfAttribute(string condition) + : base(condition) + { + Inverted = false; + } + + public EnableIfAttribute(EConditionOperator conditionOperator, params string[] conditions) + : base(conditionOperator, conditions) + { + Inverted = false; + } + + public EnableIfAttribute(string enumName, object enumValue) + : base(enumName, enumValue as Enum) + { + Inverted = false; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttribute.cs.meta new file mode 100644 index 0000000..f3a696c --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a616ae826c8ebae45a89d6a8cb68a843 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttributeBase.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttributeBase.cs new file mode 100644 index 0000000..cebc67a --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttributeBase.cs @@ -0,0 +1,39 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + public abstract class EnableIfAttributeBase : MetaAttribute + { + public string[] Conditions { get; private set; } + public EConditionOperator ConditionOperator { get; private set; } + public bool Inverted { get; protected set; } + + /// + /// If this not null, [0] is name of an enum variable. + /// + public Enum EnumValue { get; private set; } + + public EnableIfAttributeBase(string condition) + { + ConditionOperator = EConditionOperator.And; + Conditions = new string[1] { condition }; + } + + public EnableIfAttributeBase(EConditionOperator conditionOperator, params string[] conditions) + { + ConditionOperator = conditionOperator; + Conditions = conditions; + } + + public EnableIfAttributeBase(string enumName, Enum enumValue) + : this(enumName) + { + if (enumValue == null) + { + throw new ArgumentNullException(nameof(enumValue), "This parameter must be an enum value."); + } + + EnumValue = enumValue; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttributeBase.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttributeBase.cs.meta new file mode 100644 index 0000000..45fd5eb --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/EnableIfAttributeBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8ba6385cd022e164b89ead1937173ddc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/FoldoutAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/FoldoutAttribute.cs new file mode 100644 index 0000000..f1b81bd --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/FoldoutAttribute.cs @@ -0,0 +1,15 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class FoldoutAttribute : MetaAttribute, IGroupAttribute + { + public string Name { get; private set; } + + public FoldoutAttribute(string name) + { + Name = name; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/FoldoutAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/FoldoutAttribute.cs.meta new file mode 100644 index 0000000..e39736b --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/FoldoutAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 95f184555d5079243b2d25b35a641a74 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/HideIfAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/HideIfAttribute.cs new file mode 100644 index 0000000..88a0850 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/HideIfAttribute.cs @@ -0,0 +1,26 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] + public class HideIfAttribute : ShowIfAttributeBase + { + public HideIfAttribute(string condition) + : base(condition) + { + Inverted = true; + } + + public HideIfAttribute(EConditionOperator conditionOperator, params string[] conditions) + : base(conditionOperator, conditions) + { + Inverted = true; + } + + public HideIfAttribute(string enumName, object enumValue) + : base(enumName, enumValue as Enum) + { + Inverted = true; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/HideIfAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/HideIfAttribute.cs.meta new file mode 100644 index 0000000..888cf89 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/HideIfAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9ab2d0fcfb13a214ea6ef7629c96a761 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/IGroupAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/IGroupAttribute.cs new file mode 100644 index 0000000..b30ac9a --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/IGroupAttribute.cs @@ -0,0 +1,8 @@ +锘縰sing UnityEngine; + +namespace NaughtyAttributes +{ + public interface IGroupAttribute + { + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/IGroupAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/IGroupAttribute.cs.meta new file mode 100644 index 0000000..47db85d --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/IGroupAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7c437b9ac50575347a7b12520f37f9a2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/LabelAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/LabelAttribute.cs new file mode 100644 index 0000000..3098273 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/LabelAttribute.cs @@ -0,0 +1,15 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class LabelAttribute : MetaAttribute + { + public string Label { get; private set; } + + public LabelAttribute(string label) + { + Label = label; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/LabelAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/LabelAttribute.cs.meta new file mode 100644 index 0000000..9488d54 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/LabelAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 79e0e0c0a7c25ea4fbe8eecaa4d559a0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/MetaAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/MetaAttribute.cs new file mode 100644 index 0000000..9436bf3 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/MetaAttribute.cs @@ -0,0 +1,8 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + public class MetaAttribute : Attribute, INaughtyAttribute + { + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/MetaAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/MetaAttribute.cs.meta new file mode 100644 index 0000000..a7be132 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/MetaAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a482b4e0fbf0f4547a5d522182a68d24 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/OnValueChangedAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/OnValueChangedAttribute.cs new file mode 100644 index 0000000..8358af9 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/OnValueChangedAttribute.cs @@ -0,0 +1,15 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = true, Inherited = true)] + public class OnValueChangedAttribute : MetaAttribute + { + public string CallbackName { get; private set; } + + public OnValueChangedAttribute(string callbackName) + { + CallbackName = callbackName; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/OnValueChangedAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/OnValueChangedAttribute.cs.meta new file mode 100644 index 0000000..4a92c4b --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/OnValueChangedAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e16a27c5576022b4bbe997c7db9051f0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/ReadOnlyAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/ReadOnlyAttribute.cs new file mode 100644 index 0000000..95110f6 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/ReadOnlyAttribute.cs @@ -0,0 +1,10 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class ReadOnlyAttribute : MetaAttribute + { + + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/ReadOnlyAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/ReadOnlyAttribute.cs.meta new file mode 100644 index 0000000..24ec846 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/ReadOnlyAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e57264747ba93b94fbff12733de29499 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttribute.cs new file mode 100644 index 0000000..fce3763 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttribute.cs @@ -0,0 +1,26 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] + public class ShowIfAttribute : ShowIfAttributeBase + { + public ShowIfAttribute(string condition) + : base(condition) + { + Inverted = false; + } + + public ShowIfAttribute(EConditionOperator conditionOperator, params string[] conditions) + : base(conditionOperator, conditions) + { + Inverted = false; + } + + public ShowIfAttribute(string enumName, object enumValue) + : base(enumName, enumValue as Enum) + { + Inverted = false; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttribute.cs.meta new file mode 100644 index 0000000..4556ac2 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1ada427cfd2c9b04989d6d18dea27985 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttributeBase.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttributeBase.cs new file mode 100644 index 0000000..1ead58b --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttributeBase.cs @@ -0,0 +1,39 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + public class ShowIfAttributeBase : MetaAttribute + { + public string[] Conditions { get; private set; } + public EConditionOperator ConditionOperator { get; private set; } + public bool Inverted { get; protected set; } + + /// + /// If this not null, [0] is name of an enum variable. + /// + public Enum EnumValue { get; private set; } + + public ShowIfAttributeBase(string condition) + { + ConditionOperator = EConditionOperator.And; + Conditions = new string[1] { condition }; + } + + public ShowIfAttributeBase(EConditionOperator conditionOperator, params string[] conditions) + { + ConditionOperator = conditionOperator; + Conditions = conditions; + } + + public ShowIfAttributeBase(string enumName, Enum enumValue) + : this(enumName) + { + if (enumValue == null) + { + throw new ArgumentNullException(nameof(enumValue), "This parameter must be an enum value."); + } + + EnumValue = enumValue; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttributeBase.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttributeBase.cs.meta new file mode 100644 index 0000000..e82a9ad --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/MetaAttributes/ShowIfAttributeBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0532b1c4d8a9ccf4b9f98f0bbe4a6747 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/NaughtyAttributes.Core.asmdef b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/NaughtyAttributes.Core.asmdef new file mode 100644 index 0000000..569e4e6 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/NaughtyAttributes.Core.asmdef @@ -0,0 +1,12 @@ +{ + "name": "NaughtyAttributes.Core", + "references": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [] +} \ No newline at end of file diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/NaughtyAttributes.Core.asmdef.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/NaughtyAttributes.Core.asmdef.meta new file mode 100644 index 0000000..731749c --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/NaughtyAttributes.Core.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 776d03a35f1b52c4a9aed9f56d7b4229 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/Utility.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/Utility.meta new file mode 100644 index 0000000..80be476 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/Utility.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6d61a3a977073c740ae13a3683ed22a1 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/Utility/EColor.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/Utility/EColor.cs new file mode 100644 index 0000000..ab50f1d --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/Utility/EColor.cs @@ -0,0 +1,56 @@ +锘縰sing UnityEngine; + +namespace NaughtyAttributes +{ + public enum EColor + { + Clear, + White, + Black, + Gray, + Red, + Pink, + Orange, + Yellow, + Green, + Blue, + Indigo, + Violet + } + + public static class EColorExtensions + { + public static Color GetColor(this EColor color) + { + switch (color) + { + case EColor.Clear: + return new Color32(0, 0, 0, 0); + case EColor.White: + return new Color32(255, 255, 255, 255); + case EColor.Black: + return new Color32(0, 0, 0, 255); + case EColor.Gray: + return new Color32(128, 128, 128, 255); + case EColor.Red: + return new Color32(255, 0, 63, 255); + case EColor.Pink: + return new Color32(255, 152, 203, 255); + case EColor.Orange: + return new Color32(255, 128, 0, 255); + case EColor.Yellow: + return new Color32(255, 211, 0, 255); + case EColor.Green: + return new Color32(98, 200, 79, 255); + case EColor.Blue: + return new Color32(0, 135, 189, 255); + case EColor.Indigo: + return new Color32(75, 0, 130, 255); + case EColor.Violet: + return new Color32(128, 0, 255, 255); + default: + return new Color32(0, 0, 0, 255); + } + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/Utility/EColor.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/Utility/EColor.cs.meta new file mode 100644 index 0000000..0f32c5e --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/Utility/EColor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 059f8674a8065924ea9c678298b5cd63 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/Utility/EConditionOperator.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/Utility/EConditionOperator.cs new file mode 100644 index 0000000..d0894f5 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/Utility/EConditionOperator.cs @@ -0,0 +1,10 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + public enum EConditionOperator + { + And, + Or + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/Utility/EConditionOperator.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/Utility/EConditionOperator.cs.meta new file mode 100644 index 0000000..60e3264 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/Utility/EConditionOperator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3c227b6c19fc67b46ad294d95818f85a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes.meta new file mode 100644 index 0000000..d5aba48 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bf91d63e37bed3e4cbf75d576fc03a21 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MaxValueAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MaxValueAttribute.cs new file mode 100644 index 0000000..3410e74 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MaxValueAttribute.cs @@ -0,0 +1,20 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class MaxValueAttribute : ValidatorAttribute + { + public float MaxValue { get; private set; } + + public MaxValueAttribute(float maxValue) + { + MaxValue = maxValue; + } + + public MaxValueAttribute(int maxValue) + { + MaxValue = maxValue; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MaxValueAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MaxValueAttribute.cs.meta new file mode 100644 index 0000000..b02fdbc --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MaxValueAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a748250af5ccfd7499cfb444aafb8a03 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MinValueAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MinValueAttribute.cs new file mode 100644 index 0000000..956ca7a --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MinValueAttribute.cs @@ -0,0 +1,20 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class MinValueAttribute : ValidatorAttribute + { + public float MinValue { get; private set; } + + public MinValueAttribute(float minValue) + { + MinValue = minValue; + } + + public MinValueAttribute(int minValue) + { + MinValue = minValue; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MinValueAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MinValueAttribute.cs.meta new file mode 100644 index 0000000..9d90191 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/MinValueAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 40133bac7c8d42b4d837138430a503e0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/RequiredAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/RequiredAttribute.cs new file mode 100644 index 0000000..61e3618 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/RequiredAttribute.cs @@ -0,0 +1,15 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class RequiredAttribute : ValidatorAttribute + { + public string Message { get; private set; } + + public RequiredAttribute(string message = null) + { + Message = message; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/RequiredAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/RequiredAttribute.cs.meta new file mode 100644 index 0000000..7f87cfc --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/RequiredAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b0cdf49d1687849458b1a8d4786553d4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidateInputAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidateInputAttribute.cs new file mode 100644 index 0000000..2b738c3 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidateInputAttribute.cs @@ -0,0 +1,17 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + [AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)] + public class ValidateInputAttribute : ValidatorAttribute + { + public string CallbackName { get; private set; } + public string Message { get; private set; } + + public ValidateInputAttribute(string callbackName, string message = null) + { + CallbackName = callbackName; + Message = message; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidateInputAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidateInputAttribute.cs.meta new file mode 100644 index 0000000..0addd1a --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidateInputAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6c4171d68fb5bc0448d3ac298973e82c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidatorAttribute.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidatorAttribute.cs new file mode 100644 index 0000000..db5dcb5 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidatorAttribute.cs @@ -0,0 +1,8 @@ +锘縰sing System; + +namespace NaughtyAttributes +{ + public class ValidatorAttribute : Attribute, INaughtyAttribute + { + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidatorAttribute.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidatorAttribute.cs.meta new file mode 100644 index 0000000..f5daea8 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Core/ValidatorAttributes/ValidatorAttribute.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0f3c43bed2dbc5249b6c6ec7859c2020 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor.meta new file mode 100644 index 0000000..8110aa8 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: b76068e69df25a94ab378b0b6829c4f0 +folderAsset: yes +timeCreated: 1507995613 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/DecoratorDrawers.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/DecoratorDrawers.meta new file mode 100644 index 0000000..79b2c37 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/DecoratorDrawers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d3041a2296f3b1749b3ef18e695adee4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/HorizontalLineDecoratorDrawer.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/HorizontalLineDecoratorDrawer.cs new file mode 100644 index 0000000..2953c61 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/HorizontalLineDecoratorDrawer.cs @@ -0,0 +1,23 @@ +锘縰sing UnityEngine; +using UnityEditor; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(HorizontalLineAttribute))] + public class HorizontalLineDecoratorDrawer : DecoratorDrawer + { + public override float GetHeight() + { + HorizontalLineAttribute lineAttr = (HorizontalLineAttribute)attribute; + return EditorGUIUtility.singleLineHeight + lineAttr.Height; + } + + public override void OnGUI(Rect position) + { + Rect rect = EditorGUI.IndentedRect(position); + rect.y += EditorGUIUtility.singleLineHeight / 3.0f; + HorizontalLineAttribute lineAttr = (HorizontalLineAttribute)attribute; + NaughtyEditorGUI.HorizontalLine(rect, lineAttr.Height, lineAttr.Color.GetColor()); + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/HorizontalLineDecoratorDrawer.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/HorizontalLineDecoratorDrawer.cs.meta new file mode 100644 index 0000000..719f6d8 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/HorizontalLineDecoratorDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3ec99f3a124f20e40b8f5edfeb1ecced +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/InfoBoxDecoratorDrawer.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/InfoBoxDecoratorDrawer.cs new file mode 100644 index 0000000..83cdbd2 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/InfoBoxDecoratorDrawer.cs @@ -0,0 +1,59 @@ +锘縰sing UnityEditor; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(InfoBoxAttribute))] + public class InfoBoxDecoratorDrawer : DecoratorDrawer + { + public override float GetHeight() + { + return GetHelpBoxHeight(); + } + + public override void OnGUI(Rect rect) + { + InfoBoxAttribute infoBoxAttribute = (InfoBoxAttribute)attribute; + + float indentLength = NaughtyEditorGUI.GetIndentLength(rect); + Rect infoBoxRect = new Rect( + rect.x + indentLength, + rect.y, + rect.width - indentLength, + GetHelpBoxHeight()); + + DrawInfoBox(infoBoxRect, infoBoxAttribute.Text, infoBoxAttribute.Type); + } + + private float GetHelpBoxHeight() + { + InfoBoxAttribute infoBoxAttribute = (InfoBoxAttribute)attribute; + float minHeight = EditorGUIUtility.singleLineHeight * 2.0f; + float desiredHeight = GUI.skin.box.CalcHeight(new GUIContent(infoBoxAttribute.Text), EditorGUIUtility.currentViewWidth); + float height = Mathf.Max(minHeight, desiredHeight); + + return height; + } + + private void DrawInfoBox(Rect rect, string infoText, EInfoBoxType infoBoxType) + { + MessageType messageType = MessageType.None; + switch (infoBoxType) + { + case EInfoBoxType.Normal: + messageType = MessageType.Info; + break; + + case EInfoBoxType.Warning: + messageType = MessageType.Warning; + break; + + case EInfoBoxType.Error: + messageType = MessageType.Error; + break; + } + + NaughtyEditorGUI.HelpBox(rect, infoText, messageType); + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/InfoBoxDecoratorDrawer.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/InfoBoxDecoratorDrawer.cs.meta new file mode 100644 index 0000000..5f50ace --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/DecoratorDrawers/InfoBoxDecoratorDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e9c18b0e698717442b7631c5066d667f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/NaughtyAttributes.Editor.asmdef b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/NaughtyAttributes.Editor.asmdef new file mode 100644 index 0000000..e1aafc2 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/NaughtyAttributes.Editor.asmdef @@ -0,0 +1,16 @@ +{ + "name": "NaughtyAttributes.Editor", + "references": [ + "NaughtyAttributes.Core" + ], + "optionalUnityReferences": [], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [] +} \ No newline at end of file diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/NaughtyAttributes.Editor.asmdef.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/NaughtyAttributes.Editor.asmdef.meta new file mode 100644 index 0000000..70dc9f2 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/NaughtyAttributes.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f88fb04354076c646a4107a491394033 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs new file mode 100644 index 0000000..03adaee --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs @@ -0,0 +1,221 @@ +锘縰sing System.Collections.Generic; +using System.Linq; +using System.Reflection; +using UnityEditor; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + [CanEditMultipleObjects] + [CustomEditor(typeof(UnityEngine.Object), true)] + public class NaughtyInspector : UnityEditor.Editor + { + private List _serializedProperties = new List(); + private IEnumerable _nonSerializedFields; + private IEnumerable _nativeProperties; + private IEnumerable _methods; + private Dictionary _foldouts = new Dictionary(); + + protected virtual void OnEnable() + { + _nonSerializedFields = ReflectionUtility.GetAllFields( + target, f => f.GetCustomAttributes(typeof(ShowNonSerializedFieldAttribute), true).Length > 0); + + _nativeProperties = ReflectionUtility.GetAllProperties( + target, p => p.GetCustomAttributes(typeof(ShowNativePropertyAttribute), true).Length > 0); + + _methods = ReflectionUtility.GetAllMethods( + target, m => m.GetCustomAttributes(typeof(ButtonAttribute), true).Length > 0); + } + + protected virtual void OnDisable() + { + ReorderableListPropertyDrawer.Instance.ClearCache(); + } + + public override void OnInspectorGUI() + { + GetSerializedProperties(ref _serializedProperties); + + bool anyNaughtyAttribute = _serializedProperties.Any(p => PropertyUtility.GetAttribute(p) != null); + if (!anyNaughtyAttribute) + { + DrawDefaultInspector(); + } + else + { + DrawSerializedProperties(); + } + + DrawNonSerializedFields(); + DrawNativeProperties(); + DrawButtons(); + } + + protected void GetSerializedProperties(ref List outSerializedProperties) + { + outSerializedProperties.Clear(); + using (var iterator = serializedObject.GetIterator()) + { + if (iterator.NextVisible(true)) + { + do + { + outSerializedProperties.Add(serializedObject.FindProperty(iterator.name)); + } + while (iterator.NextVisible(false)); + } + } + } + + protected void DrawSerializedProperties() + { + serializedObject.Update(); + + // Draw non-grouped serialized properties + foreach (var property in GetNonGroupedProperties(_serializedProperties)) + { + if (property.name.Equals("m_Script", System.StringComparison.Ordinal)) + { + using (new EditorGUI.DisabledScope(disabled: true)) + { + EditorGUILayout.PropertyField(property); + } + } + else + { + NaughtyEditorGUI.PropertyField_Layout(property, includeChildren: true); + } + } + + // Draw grouped serialized properties + foreach (var group in GetGroupedProperties(_serializedProperties)) + { + IEnumerable visibleProperties = group.Where(p => PropertyUtility.IsVisible(p)); + if (!visibleProperties.Any()) + { + continue; + } + + NaughtyEditorGUI.BeginBoxGroup_Layout(group.Key); + foreach (var property in visibleProperties) + { + NaughtyEditorGUI.PropertyField_Layout(property, includeChildren: true); + } + + NaughtyEditorGUI.EndBoxGroup_Layout(); + } + + // Draw foldout serialized properties + foreach (var group in GetFoldoutProperties(_serializedProperties)) + { + IEnumerable visibleProperties = group.Where(p => PropertyUtility.IsVisible(p)); + if (!visibleProperties.Any()) + { + continue; + } + + if (!_foldouts.ContainsKey(group.Key)) + { + _foldouts[group.Key] = new SavedBool($"{target.GetInstanceID()}.{group.Key}", false); + } + + _foldouts[group.Key].Value = EditorGUILayout.Foldout(_foldouts[group.Key].Value, group.Key, true); + if (_foldouts[group.Key].Value) + { + foreach (var property in visibleProperties) + { + NaughtyEditorGUI.PropertyField_Layout(property, true); + } + } + } + + serializedObject.ApplyModifiedProperties(); + } + + protected void DrawNonSerializedFields(bool drawHeader = false) + { + if (_nonSerializedFields.Any()) + { + if (drawHeader) + { + EditorGUILayout.Space(); + EditorGUILayout.LabelField("Non-Serialized Fields", GetHeaderGUIStyle()); + NaughtyEditorGUI.HorizontalLine( + EditorGUILayout.GetControlRect(false), HorizontalLineAttribute.DefaultHeight, HorizontalLineAttribute.DefaultColor.GetColor()); + } + + foreach (var field in _nonSerializedFields) + { + NaughtyEditorGUI.NonSerializedField_Layout(serializedObject.targetObject, field); + } + } + } + + protected void DrawNativeProperties(bool drawHeader = false) + { + if (_nativeProperties.Any()) + { + if (drawHeader) + { + EditorGUILayout.Space(); + EditorGUILayout.LabelField("Native Properties", GetHeaderGUIStyle()); + NaughtyEditorGUI.HorizontalLine( + EditorGUILayout.GetControlRect(false), HorizontalLineAttribute.DefaultHeight, HorizontalLineAttribute.DefaultColor.GetColor()); + } + + foreach (var property in _nativeProperties) + { + NaughtyEditorGUI.NativeProperty_Layout(serializedObject.targetObject, property); + } + } + } + + protected void DrawButtons(bool drawHeader = false) + { + if (_methods.Any()) + { + if (drawHeader) + { + EditorGUILayout.Space(); + EditorGUILayout.LabelField("Buttons", GetHeaderGUIStyle()); + NaughtyEditorGUI.HorizontalLine( + EditorGUILayout.GetControlRect(false), HorizontalLineAttribute.DefaultHeight, HorizontalLineAttribute.DefaultColor.GetColor()); + } + + foreach (var method in _methods) + { + NaughtyEditorGUI.Button(serializedObject.targetObject, method); + } + } + } + + private static IEnumerable GetNonGroupedProperties(IEnumerable properties) + { + return properties.Where(p => PropertyUtility.GetAttribute(p) == null); + } + + private static IEnumerable> GetGroupedProperties(IEnumerable properties) + { + return properties + .Where(p => PropertyUtility.GetAttribute(p) != null) + .GroupBy(p => PropertyUtility.GetAttribute(p).Name); + } + + private static IEnumerable> GetFoldoutProperties(IEnumerable properties) + { + return properties + .Where(p => PropertyUtility.GetAttribute(p) != null) + .GroupBy(p => PropertyUtility.GetAttribute(p).Name); + } + + private static GUIStyle GetHeaderGUIStyle() + { + GUIStyle style = new GUIStyle(EditorStyles.centeredGreyMiniLabel); + style.fontStyle = FontStyle.Bold; + style.alignment = TextAnchor.UpperCenter; + + return style; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs.meta new file mode 100644 index 0000000..b63e99f --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/NaughtyInspector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1b9b53879f7c93b42835c3ad9e0d0a66 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers.meta new file mode 100644 index 0000000..7d7dbed --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4327d74fca5deaa4c83c483fe468d274 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AllowNestingPropertyDrawer.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AllowNestingPropertyDrawer.cs new file mode 100644 index 0000000..6c39132 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AllowNestingPropertyDrawer.cs @@ -0,0 +1,16 @@ +锘縰sing UnityEngine; +using UnityEditor; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(AllowNestingAttribute))] + public class AllowNestingPropertyDrawer : PropertyDrawerBase + { + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + EditorGUI.PropertyField(rect, property, label, true); + EditorGUI.EndProperty(); + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AllowNestingPropertyDrawer.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AllowNestingPropertyDrawer.cs.meta new file mode 100644 index 0000000..f2f2145 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AllowNestingPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a3175e7041b8f4348bd652485a78e7b1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AnimatorParamPropertyDrawer.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AnimatorParamPropertyDrawer.cs new file mode 100644 index 0000000..cf3da38 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AnimatorParamPropertyDrawer.cs @@ -0,0 +1,173 @@ +锘縰sing System.Collections.Generic; +using System.Reflection; +using UnityEditor; +using UnityEditor.Animations; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(AnimatorParamAttribute))] + public class AnimatorParamPropertyDrawer : PropertyDrawerBase + { + private const string InvalidAnimatorControllerWarningMessage = "Target animator controller is null"; + private const string InvalidTypeWarningMessage = "{0} must be an int or a string"; + + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + AnimatorParamAttribute animatorParamAttribute = PropertyUtility.GetAttribute(property); + bool validAnimatorController = GetAnimatorController(property, animatorParamAttribute.AnimatorName) != null; + bool validPropertyType = property.propertyType == SerializedPropertyType.Integer || property.propertyType == SerializedPropertyType.String; + + return (validAnimatorController && validPropertyType) + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + AnimatorParamAttribute animatorParamAttribute = PropertyUtility.GetAttribute(property); + + AnimatorController animatorController = GetAnimatorController(property, animatorParamAttribute.AnimatorName); + if (animatorController == null) + { + DrawDefaultPropertyAndHelpBox(rect, property, InvalidAnimatorControllerWarningMessage, MessageType.Warning); + return; + } + + int parametersCount = animatorController.parameters.Length; + List animatorParameters = new List(parametersCount); + for (int i = 0; i < parametersCount; i++) + { + AnimatorControllerParameter parameter = animatorController.parameters[i]; + if (animatorParamAttribute.AnimatorParamType == null || parameter.type == animatorParamAttribute.AnimatorParamType) + { + animatorParameters.Add(parameter); + } + } + + switch (property.propertyType) + { + case SerializedPropertyType.Integer: + DrawPropertyForInt(rect, property, label, animatorParameters); + break; + case SerializedPropertyType.String: + DrawPropertyForString(rect, property, label, animatorParameters); + break; + default: + DrawDefaultPropertyAndHelpBox(rect, property, string.Format(InvalidTypeWarningMessage, property.name), MessageType.Warning); + break; + } + + EditorGUI.EndProperty(); + } + + private static void DrawPropertyForInt(Rect rect, SerializedProperty property, GUIContent label, List animatorParameters) + { + int paramNameHash = property.intValue; + int index = 0; + + for (int i = 0; i < animatorParameters.Count; i++) + { + if (paramNameHash == animatorParameters[i].nameHash) + { + index = i + 1; // +1 because the first option is reserved for (None) + break; + } + } + + string[] displayOptions = GetDisplayOptions(animatorParameters); + + int newIndex = EditorGUI.Popup(rect, label.text, index, displayOptions); + int newValue = newIndex == 0 ? 0 : animatorParameters[newIndex - 1].nameHash; + + if (property.intValue != newValue) + { + property.intValue = newValue; + } + } + + private static void DrawPropertyForString(Rect rect, SerializedProperty property, GUIContent label, List animatorParameters) + { + string paramName = property.stringValue; + int index = 0; + + for (int i = 0; i < animatorParameters.Count; i++) + { + if (paramName.Equals(animatorParameters[i].name, System.StringComparison.Ordinal)) + { + index = i + 1; // +1 because the first option is reserved for (None) + break; + } + } + + string[] displayOptions = GetDisplayOptions(animatorParameters); + + int newIndex = EditorGUI.Popup(rect, label.text, index, displayOptions); + string newValue = newIndex == 0 ? null : animatorParameters[newIndex - 1].name; + + if (!property.stringValue.Equals(newValue, System.StringComparison.Ordinal)) + { + property.stringValue = newValue; + } + } + + private static string[] GetDisplayOptions(List animatorParams) + { + string[] displayOptions = new string[animatorParams.Count + 1]; + displayOptions[0] = "(None)"; + + for (int i = 0; i < animatorParams.Count; i++) + { + displayOptions[i + 1] = animatorParams[i].name; + } + + return displayOptions; + } + + private static AnimatorController GetAnimatorController(SerializedProperty property, string animatorName) + { + object target = PropertyUtility.GetTargetObjectWithProperty(property); + + FieldInfo animatorFieldInfo = ReflectionUtility.GetField(target, animatorName); + if (animatorFieldInfo != null && + animatorFieldInfo.FieldType == typeof(Animator)) + { + Animator animator = animatorFieldInfo.GetValue(target) as Animator; + if (animator != null) + { + AnimatorController animatorController = animator.runtimeAnimatorController as AnimatorController; + return animatorController; + } + } + + PropertyInfo animatorPropertyInfo = ReflectionUtility.GetProperty(target, animatorName); + if (animatorPropertyInfo != null && + animatorPropertyInfo.PropertyType == typeof(Animator)) + { + Animator animator = animatorPropertyInfo.GetValue(target) as Animator; + if (animator != null) + { + AnimatorController animatorController = animator.runtimeAnimatorController as AnimatorController; + return animatorController; + } + } + + MethodInfo animatorGetterMethodInfo = ReflectionUtility.GetMethod(target, animatorName); + if (animatorGetterMethodInfo != null && + animatorGetterMethodInfo.ReturnType == typeof(Animator) && + animatorGetterMethodInfo.GetParameters().Length == 0) + { + Animator animator = animatorGetterMethodInfo.Invoke(target, null) as Animator; + if (animator != null) + { + AnimatorController animatorController = animator.runtimeAnimatorController as AnimatorController; + return animatorController; + } + } + + return null; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AnimatorParamPropertyDrawer.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AnimatorParamPropertyDrawer.cs.meta new file mode 100644 index 0000000..4c3a7e6 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/AnimatorParamPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 98ff8cb1bcefae740a68d9a5c5ee3563 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/CurveRangePropertyDrawer.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/CurveRangePropertyDrawer.cs new file mode 100644 index 0000000..8f5a6c5 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/CurveRangePropertyDrawer.cs @@ -0,0 +1,47 @@ +锘縰sing UnityEngine; +using UnityEditor; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(CurveRangeAttribute))] + public class CurveRangePropertyDrawer : PropertyDrawerBase + { + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + float propertyHeight = property.propertyType == SerializedPropertyType.AnimationCurve + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + + return propertyHeight; + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + // Check user error + if (property.propertyType != SerializedPropertyType.AnimationCurve) + { + string message = string.Format("Field {0} is not an AnimationCurve", property.name); + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + return; + } + + var curveRangeAttribute = (CurveRangeAttribute)attribute; + var curveRanges = new Rect( + curveRangeAttribute.Min.x, + curveRangeAttribute.Min.y, + curveRangeAttribute.Max.x - curveRangeAttribute.Min.x, + curveRangeAttribute.Max.y - curveRangeAttribute.Min.y); + + EditorGUI.CurveField( + rect, + property, + curveRangeAttribute.Color == EColor.Clear ? Color.green : curveRangeAttribute.Color.GetColor(), + curveRanges, + label); + + EditorGUI.EndProperty(); + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/CurveRangePropertyDrawer.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/CurveRangePropertyDrawer.cs.meta new file mode 100644 index 0000000..adea11e --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/CurveRangePropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 798b8c99fbc072a4b83ee387e472a2bd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/DropdownPropertyDrawer.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/DropdownPropertyDrawer.cs new file mode 100644 index 0000000..9018486 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/DropdownPropertyDrawer.cs @@ -0,0 +1,177 @@ +锘縰sing UnityEngine; +using UnityEditor; +using System.Collections; +using System.Reflection; +using System; +using System.Collections.Generic; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(DropdownAttribute))] + public class DropdownPropertyDrawer : PropertyDrawerBase + { + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + DropdownAttribute dropdownAttribute = (DropdownAttribute)attribute; + object values = GetValues(property, dropdownAttribute.ValuesName); + FieldInfo fieldInfo = ReflectionUtility.GetField(PropertyUtility.GetTargetObjectWithProperty(property), property.name); + + float propertyHeight = AreValuesValid(values, fieldInfo) + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + + return propertyHeight; + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + DropdownAttribute dropdownAttribute = (DropdownAttribute)attribute; + object target = PropertyUtility.GetTargetObjectWithProperty(property); + + object valuesObject = GetValues(property, dropdownAttribute.ValuesName); + FieldInfo dropdownField = ReflectionUtility.GetField(target, property.name); + + if (AreValuesValid(valuesObject, dropdownField)) + { + if (valuesObject is IList && dropdownField.FieldType == GetElementType(valuesObject)) + { + // Selected value + object selectedValue = dropdownField.GetValue(target); + + // Values and display options + IList valuesList = (IList)valuesObject; + object[] values = new object[valuesList.Count]; + string[] displayOptions = new string[valuesList.Count]; + + for (int i = 0; i < values.Length; i++) + { + object value = valuesList[i]; + values[i] = value; + displayOptions[i] = value == null ? "" : value.ToString(); + } + + // Selected value index + int selectedValueIndex = Array.IndexOf(values, selectedValue); + if (selectedValueIndex < 0) + { + selectedValueIndex = 0; + } + + NaughtyEditorGUI.Dropdown( + rect, property.serializedObject, target, dropdownField, label.text, selectedValueIndex, values, displayOptions); + } + else if (valuesObject is IDropdownList) + { + // Current value + object selectedValue = dropdownField.GetValue(target); + + // Current value index, values and display options + int index = -1; + int selectedValueIndex = -1; + List values = new List(); + List displayOptions = new List(); + IDropdownList dropdown = (IDropdownList)valuesObject; + + using (IEnumerator> dropdownEnumerator = dropdown.GetEnumerator()) + { + while (dropdownEnumerator.MoveNext()) + { + index++; + + KeyValuePair current = dropdownEnumerator.Current; + if (current.Value?.Equals(selectedValue) == true) + { + selectedValueIndex = index; + } + + values.Add(current.Value); + + if (current.Key == null) + { + displayOptions.Add(""); + } + else if (string.IsNullOrWhiteSpace(current.Key)) + { + displayOptions.Add(""); + } + else + { + displayOptions.Add(current.Key); + } + } + } + + if (selectedValueIndex < 0) + { + selectedValueIndex = 0; + } + + NaughtyEditorGUI.Dropdown( + rect, property.serializedObject, target, dropdownField, label.text, selectedValueIndex, values.ToArray(), displayOptions.ToArray()); + } + } + else + { + string message = string.Format("Invalid values with name '{0}' provided to '{1}'. Either the values name is incorrect or the types of the target field and the values field/property/method don't match", + dropdownAttribute.ValuesName, dropdownAttribute.GetType().Name); + + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + } + + EditorGUI.EndProperty(); + } + + private object GetValues(SerializedProperty property, string valuesName) + { + object target = PropertyUtility.GetTargetObjectWithProperty(property); + + FieldInfo valuesFieldInfo = ReflectionUtility.GetField(target, valuesName); + if (valuesFieldInfo != null) + { + return valuesFieldInfo.GetValue(target); + } + + PropertyInfo valuesPropertyInfo = ReflectionUtility.GetProperty(target, valuesName); + if (valuesPropertyInfo != null) + { + return valuesPropertyInfo.GetValue(target); + } + + MethodInfo methodValuesInfo = ReflectionUtility.GetMethod(target, valuesName); + if (methodValuesInfo != null && + methodValuesInfo.ReturnType != typeof(void) && + methodValuesInfo.GetParameters().Length == 0) + { + return methodValuesInfo.Invoke(target, null); + } + + return null; + } + + private bool AreValuesValid(object values, FieldInfo dropdownField) + { + if (values == null || dropdownField == null) + { + return false; + } + + if ((values is IList && dropdownField.FieldType == GetElementType(values)) || + (values is IDropdownList)) + { + return true; + } + + return false; + } + + private Type GetElementType(object values) + { + Type valuesType = values.GetType(); + Type elementType = ReflectionUtility.GetListElementType(valuesType); + + return elementType; + } + } +} \ No newline at end of file diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/DropdownPropertyDrawer.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/DropdownPropertyDrawer.cs.meta new file mode 100644 index 0000000..fecae2c --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/DropdownPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dd080b36769bcd94d909fc0431cf25e0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/EnumFlagsPropertyDrawer.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/EnumFlagsPropertyDrawer.cs new file mode 100644 index 0000000..df2da6d --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/EnumFlagsPropertyDrawer.cs @@ -0,0 +1,38 @@ +锘縰sing UnityEngine; +using UnityEditor; +using System; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(EnumFlagsAttribute))] + public class EnumFlagsPropertyDrawer : PropertyDrawerBase + { + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + Enum targetEnum = PropertyUtility.GetTargetObjectOfProperty(property) as Enum; + + return (targetEnum != null) + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + Enum targetEnum = PropertyUtility.GetTargetObjectOfProperty(property) as Enum; + if (targetEnum != null) + { + Enum enumNew = EditorGUI.EnumFlagsField(rect, label.text, targetEnum); + property.intValue = (int)Convert.ChangeType(enumNew, targetEnum.GetType()); + } + else + { + string message = attribute.GetType().Name + " can be used only on enums"; + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + } + + EditorGUI.EndProperty(); + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/EnumFlagsPropertyDrawer.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/EnumFlagsPropertyDrawer.cs.meta new file mode 100644 index 0000000..c0081d2 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/EnumFlagsPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b750e1461c1126d4399459b90b31e75e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ExpandablePropertyDrawer.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ExpandablePropertyDrawer.cs new file mode 100644 index 0000000..705e17a --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ExpandablePropertyDrawer.cs @@ -0,0 +1,195 @@ +锘縰sing UnityEngine; +using UnityEditor; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(ExpandableAttribute))] + public class ExpandablePropertyDrawer : PropertyDrawerBase + { + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + if (property.objectReferenceValue == null) + { + return GetPropertyHeight(property); + } + + System.Type propertyType = PropertyUtility.GetPropertyType(property); + if (typeof(ScriptableObject).IsAssignableFrom(propertyType)) + { + ScriptableObject scriptableObject = property.objectReferenceValue as ScriptableObject; + if (scriptableObject == null) + { + return GetPropertyHeight(property); + } + + if (property.isExpanded) + { + using (SerializedObject serializedObject = new SerializedObject(scriptableObject)) + { + float totalHeight = EditorGUIUtility.singleLineHeight; + + using (var iterator = serializedObject.GetIterator()) + { + if (iterator.NextVisible(true)) + { + do + { + SerializedProperty childProperty = serializedObject.FindProperty(iterator.name); + if (childProperty.name.Equals("m_Script", System.StringComparison.Ordinal)) + { + continue; + } + + bool visible = PropertyUtility.IsVisible(childProperty); + if (!visible) + { + continue; + } + + float height = GetPropertyHeight(childProperty); + totalHeight += height; + } + while (iterator.NextVisible(false)); + } + } + + totalHeight += EditorGUIUtility.standardVerticalSpacing; + return totalHeight; + } + } + else + { + return GetPropertyHeight(property); + } + } + else + { + return GetPropertyHeight(property) + GetHelpBoxHeight(); + } + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + if (property.objectReferenceValue == null) + { + EditorGUI.PropertyField(rect, property, label, false); + } + else + { + System.Type propertyType = PropertyUtility.GetPropertyType(property); + if (typeof(ScriptableObject).IsAssignableFrom(propertyType)) + { + ScriptableObject scriptableObject = property.objectReferenceValue as ScriptableObject; + if (scriptableObject == null) + { + EditorGUI.PropertyField(rect, property, label, false); + } + else + { + // Draw a foldout + Rect foldoutRect = new Rect() + { + x = rect.x, + y = rect.y, + width = EditorGUIUtility.labelWidth, + height = EditorGUIUtility.singleLineHeight + }; + + property.isExpanded = EditorGUI.Foldout(foldoutRect, property.isExpanded, label, toggleOnLabelClick: true); + + // Draw the scriptable object field + Rect propertyRect = new Rect() + { + x = rect.x, + y = rect.y, + width = rect.width, + height = EditorGUIUtility.singleLineHeight + }; + + EditorGUI.PropertyField(propertyRect, property, label, false); + + // Draw the child properties + if (property.isExpanded) + { + DrawChildProperties(rect, property); + } + } + } + else + { + string message = $"{typeof(ExpandableAttribute).Name} can only be used on scriptable objects"; + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + } + } + + property.serializedObject.ApplyModifiedProperties(); + EditorGUI.EndProperty(); + } + + private void DrawChildProperties(Rect rect, SerializedProperty property) + { + ScriptableObject scriptableObject = property.objectReferenceValue as ScriptableObject; + if (scriptableObject == null) + { + return; + } + + Rect boxRect = new Rect() + { + x = 0.0f, + y = rect.y + EditorGUIUtility.singleLineHeight, + width = rect.width * 2.0f, + height = rect.height - EditorGUIUtility.singleLineHeight + }; + + GUI.Box(boxRect, GUIContent.none); + + using (new EditorGUI.IndentLevelScope()) + { + SerializedObject serializedObject = new SerializedObject(scriptableObject); + serializedObject.Update(); + + using (var iterator = serializedObject.GetIterator()) + { + float yOffset = EditorGUIUtility.singleLineHeight; + + if (iterator.NextVisible(true)) + { + do + { + SerializedProperty childProperty = serializedObject.FindProperty(iterator.name); + if (childProperty.name.Equals("m_Script", System.StringComparison.Ordinal)) + { + continue; + } + + bool visible = PropertyUtility.IsVisible(childProperty); + if (!visible) + { + continue; + } + + float childHeight = GetPropertyHeight(childProperty); + Rect childRect = new Rect() + { + x = rect.x, + y = rect.y + yOffset, + width = rect.width, + height = childHeight + }; + + NaughtyEditorGUI.PropertyField(childRect, childProperty, true); + + yOffset += childHeight; + } + while (iterator.NextVisible(false)); + } + } + + serializedObject.ApplyModifiedProperties(); + } + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ExpandablePropertyDrawer.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ExpandablePropertyDrawer.cs.meta new file mode 100644 index 0000000..d5925fe --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ExpandablePropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d1ddb7194615bdc4e8b2088c8d165d8b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/InputAxisPropertyDrawer.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/InputAxisPropertyDrawer.cs new file mode 100644 index 0000000..1fbcfeb --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/InputAxisPropertyDrawer.cs @@ -0,0 +1,77 @@ +锘縰sing System.Collections.Generic; +using System.IO; +using System.Linq; +using UnityEditor; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(InputAxisAttribute))] + public class InputAxisPropertyDrawer : PropertyDrawerBase + { + private static readonly string AssetPath = Path.Combine("ProjectSettings", "InputManager.asset"); + private const string AxesPropertyPath = "m_Axes"; + private const string NamePropertyPath = "m_Name"; + + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + return (property.propertyType == SerializedPropertyType.String) + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + if (property.propertyType == SerializedPropertyType.String) + { + var inputManagerAsset = AssetDatabase.LoadAssetAtPath(AssetPath, typeof(object)); + var inputManager = new SerializedObject(inputManagerAsset); + + var axesProperty = inputManager.FindProperty(AxesPropertyPath); + var axesSet = new HashSet(); + axesSet.Add("(None)"); + + for (var i = 0; i < axesProperty.arraySize; i++) + { + var axis = axesProperty.GetArrayElementAtIndex(i).FindPropertyRelative(NamePropertyPath).stringValue; + axesSet.Add(axis); + } + + var axes = axesSet.ToArray(); + + string propertyString = property.stringValue; + int index = 0; + // check if there is an entry that matches the entry and get the index + // we skip index 0 as that is a special custom case + for (int i = 1; i < axes.Length; i++) + { + if (axes[i].Equals(propertyString, System.StringComparison.Ordinal)) + { + index = i; + break; + } + } + + // Draw the popup box with the current selected index + int newIndex = EditorGUI.Popup(rect, label.text, index, axes); + + // Adjust the actual string value of the property based on the selection + string newValue = newIndex > 0 ? axes[newIndex] : string.Empty; + + if (!property.stringValue.Equals(newValue, System.StringComparison.Ordinal)) + { + property.stringValue = newValue; + } + } + else + { + string message = string.Format("{0} supports only string fields", typeof(InputAxisAttribute).Name); + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + } + + EditorGUI.EndProperty(); + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/InputAxisPropertyDrawer.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/InputAxisPropertyDrawer.cs.meta new file mode 100644 index 0000000..08f8f46 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/InputAxisPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0de9d3dfe2d466a458be838edf361645 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/LayerPropertyDrawer.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/LayerPropertyDrawer.cs new file mode 100644 index 0000000..d789eb9 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/LayerPropertyDrawer.cs @@ -0,0 +1,88 @@ +锘縰sing UnityEngine; +using UnityEditor; +using System; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(LayerAttribute))] + public class LayerPropertyDrawer : PropertyDrawerBase + { + private const string TypeWarningMessage = "{0} must be an int or a string"; + + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + bool validPropertyType = property.propertyType == SerializedPropertyType.String || property.propertyType == SerializedPropertyType.Integer; + + return validPropertyType + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + switch (property.propertyType) + { + case SerializedPropertyType.String: + DrawPropertyForString(rect, property, label, GetLayers()); + break; + case SerializedPropertyType.Integer: + DrawPropertyForInt(rect, property, label, GetLayers()); + break; + default: + string message = string.Format(TypeWarningMessage, property.name); + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + break; + } + + EditorGUI.EndProperty(); + } + + private string[] GetLayers() + { + return UnityEditorInternal.InternalEditorUtility.layers; + } + + private static void DrawPropertyForString(Rect rect, SerializedProperty property, GUIContent label, string[] layers) + { + int index = IndexOf(layers, property.stringValue); + int newIndex = EditorGUI.Popup(rect, label.text, index, layers); + string newLayer = layers[newIndex]; + + if (!property.stringValue.Equals(newLayer, StringComparison.Ordinal)) + { + property.stringValue = layers[newIndex]; + } + } + + private static void DrawPropertyForInt(Rect rect, SerializedProperty property, GUIContent label, string[] layers) + { + int index = 0; + string layerName = LayerMask.LayerToName(property.intValue); + for (int i = 0; i < layers.Length; i++) + { + if (layerName.Equals(layers[i], StringComparison.Ordinal)) + { + index = i; + break; + } + } + + int newIndex = EditorGUI.Popup(rect, label.text, index, layers); + string newLayerName = layers[newIndex]; + int newLayerNumber = LayerMask.NameToLayer(newLayerName); + + if (property.intValue != newLayerNumber) + { + property.intValue = newLayerNumber; + } + } + + private static int IndexOf(string[] layers, string layer) + { + var index = Array.IndexOf(layers, layer); + return Mathf.Clamp(index, 0, layers.Length - 1); + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/LayerPropertyDrawer.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/LayerPropertyDrawer.cs.meta new file mode 100644 index 0000000..4b2ac86 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/LayerPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7278ba0893ab7d940b5f944e5b1cf1a7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs new file mode 100644 index 0000000..7866c56 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs @@ -0,0 +1,108 @@ +锘縰sing UnityEditor; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(MinMaxSliderAttribute))] + public class MinMaxSliderPropertyDrawer : PropertyDrawerBase + { + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + return (property.propertyType == SerializedPropertyType.Vector2 || property.propertyType == SerializedPropertyType.Vector2Int) + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + MinMaxSliderAttribute minMaxSliderAttribute = (MinMaxSliderAttribute)attribute; + + if (property.propertyType == SerializedPropertyType.Vector2 || property.propertyType == SerializedPropertyType.Vector2Int) + { + EditorGUI.BeginProperty(rect, label, property); + + float indentLength = NaughtyEditorGUI.GetIndentLength(rect); + float labelWidth = EditorGUIUtility.labelWidth + NaughtyEditorGUI.HorizontalSpacing; + float floatFieldWidth = EditorGUIUtility.fieldWidth; + float sliderWidth = rect.width - labelWidth - 2.0f * floatFieldWidth; + float sliderPadding = 5.0f; + + Rect labelRect = new Rect( + rect.x, + rect.y, + labelWidth, + rect.height); + + Rect sliderRect = new Rect( + rect.x + labelWidth + floatFieldWidth + sliderPadding - indentLength, + rect.y, + sliderWidth - 2.0f * sliderPadding + indentLength, + rect.height); + + Rect minFloatFieldRect = new Rect( + rect.x + labelWidth - indentLength, + rect.y, + floatFieldWidth + indentLength, + rect.height); + + Rect maxFloatFieldRect = new Rect( + rect.x + labelWidth + floatFieldWidth + sliderWidth - indentLength, + rect.y, + floatFieldWidth + indentLength, + rect.height); + + // Draw the label + EditorGUI.LabelField(labelRect, label.text); + + // Draw the slider + EditorGUI.BeginChangeCheck(); + + if (property.propertyType == SerializedPropertyType.Vector2) + { + Vector2 sliderValue = property.vector2Value; + EditorGUI.MinMaxSlider(sliderRect, ref sliderValue.x, ref sliderValue.y, minMaxSliderAttribute.MinValue, minMaxSliderAttribute.MaxValue); + + sliderValue.x = EditorGUI.FloatField(minFloatFieldRect, sliderValue.x); + sliderValue.x = Mathf.Clamp(sliderValue.x, minMaxSliderAttribute.MinValue, Mathf.Min(minMaxSliderAttribute.MaxValue, sliderValue.y)); + + sliderValue.y = EditorGUI.FloatField(maxFloatFieldRect, sliderValue.y); + sliderValue.y = Mathf.Clamp(sliderValue.y, Mathf.Max(minMaxSliderAttribute.MinValue, sliderValue.x), minMaxSliderAttribute.MaxValue); + + if (EditorGUI.EndChangeCheck()) + { + property.vector2Value = sliderValue; + } + } + else if (property.propertyType == SerializedPropertyType.Vector2Int) + { + Vector2Int sliderValue = property.vector2IntValue; + float xValue = sliderValue.x; + float yValue = sliderValue.y; + EditorGUI.MinMaxSlider(sliderRect, ref xValue, ref yValue, minMaxSliderAttribute.MinValue, minMaxSliderAttribute.MaxValue); + + sliderValue.x = EditorGUI.IntField(minFloatFieldRect, (int)xValue); + sliderValue.x = (int)Mathf.Clamp(sliderValue.x, minMaxSliderAttribute.MinValue, Mathf.Min(minMaxSliderAttribute.MaxValue, sliderValue.y)); + + sliderValue.y = EditorGUI.IntField(maxFloatFieldRect, (int)yValue); + sliderValue.y = (int)Mathf.Clamp(sliderValue.y, Mathf.Max(minMaxSliderAttribute.MinValue, sliderValue.x), minMaxSliderAttribute.MaxValue); + + if (EditorGUI.EndChangeCheck()) + { + property.vector2IntValue = sliderValue; + } + } + + EditorGUI.EndProperty(); + } + else + { + string message = minMaxSliderAttribute.GetType().Name + " can be used only on Vector2 or Vector2Int fields"; + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + } + + EditorGUI.EndProperty(); + } + } +} \ No newline at end of file diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs.meta new file mode 100644 index 0000000..4613ffe --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/MinMaxSliderPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 27011af81554b5b4489b155f09275475 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs new file mode 100644 index 0000000..84d8823 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs @@ -0,0 +1,154 @@ +锘縰sing UnityEngine; +using UnityEditor; +using System.Reflection; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(ProgressBarAttribute))] + public class ProgressBarPropertyDrawer : PropertyDrawerBase + { + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + ProgressBarAttribute progressBarAttribute = PropertyUtility.GetAttribute(property); + var maxValue = GetMaxValue(property, progressBarAttribute); + + return IsNumber(property) && IsNumber(maxValue) + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + if (!IsNumber(property)) + { + string message = string.Format("Field {0} is not a number", property.name); + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + return; + } + + ProgressBarAttribute progressBarAttribute = PropertyUtility.GetAttribute(property); + var value = property.propertyType == SerializedPropertyType.Integer ? property.intValue : property.floatValue; + var valueFormatted = property.propertyType == SerializedPropertyType.Integer ? value.ToString() : string.Format("{0:0.00}", value); + var maxValue = GetMaxValue(property, progressBarAttribute); + + if (maxValue != null && IsNumber(maxValue)) + { + var fillPercentage = value / CastToFloat(maxValue); + var barLabel = (!string.IsNullOrEmpty(progressBarAttribute.Name) ? "[" + progressBarAttribute.Name + "] " : "") + valueFormatted + "/" + maxValue; + var barColor = progressBarAttribute.Color.GetColor(); + var labelColor = Color.white; + + var indentLength = NaughtyEditorGUI.GetIndentLength(rect); + Rect barRect = new Rect() + { + x = rect.x + indentLength, + y = rect.y, + width = rect.width - indentLength, + height = EditorGUIUtility.singleLineHeight + }; + + DrawBar(barRect, Mathf.Clamp01(fillPercentage), barLabel, barColor, labelColor); + } + else + { + string message = string.Format( + "The provided dynamic max value for the progress bar is not correct. Please check if the '{0}' is correct, or the return type is float/int", + nameof(progressBarAttribute.MaxValueName)); + + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + } + + EditorGUI.EndProperty(); + } + + private object GetMaxValue(SerializedProperty property, ProgressBarAttribute progressBarAttribute) + { + if (string.IsNullOrEmpty(progressBarAttribute.MaxValueName)) + { + return progressBarAttribute.MaxValue; + } + else + { + object target = PropertyUtility.GetTargetObjectWithProperty(property); + + FieldInfo valuesFieldInfo = ReflectionUtility.GetField(target, progressBarAttribute.MaxValueName); + if (valuesFieldInfo != null) + { + return valuesFieldInfo.GetValue(target); + } + + PropertyInfo valuesPropertyInfo = ReflectionUtility.GetProperty(target, progressBarAttribute.MaxValueName); + if (valuesPropertyInfo != null) + { + return valuesPropertyInfo.GetValue(target); + } + + MethodInfo methodValuesInfo = ReflectionUtility.GetMethod(target, progressBarAttribute.MaxValueName); + if (methodValuesInfo != null && + (methodValuesInfo.ReturnType == typeof(float) || methodValuesInfo.ReturnType == typeof(int)) && + methodValuesInfo.GetParameters().Length == 0) + { + return methodValuesInfo.Invoke(target, null); + } + + return null; + } + } + + private void DrawBar(Rect rect, float fillPercent, string label, Color barColor, Color labelColor) + { + if (Event.current.type != EventType.Repaint) + { + return; + } + + var fillRect = new Rect(rect.x, rect.y, rect.width * fillPercent, rect.height); + + EditorGUI.DrawRect(rect, new Color(0.13f, 0.13f, 0.13f)); + EditorGUI.DrawRect(fillRect, barColor); + + // set alignment and cache the default + var align = GUI.skin.label.alignment; + GUI.skin.label.alignment = TextAnchor.UpperCenter; + + // set the color and cache the default + var c = GUI.contentColor; + GUI.contentColor = labelColor; + + // calculate the position + var labelRect = new Rect(rect.x, rect.y - 2, rect.width, rect.height); + + // draw~ + EditorGUI.DropShadowLabel(labelRect, label); + + // reset color and alignment + GUI.contentColor = c; + GUI.skin.label.alignment = align; + } + + private bool IsNumber(SerializedProperty property) + { + bool isNumber = property.propertyType == SerializedPropertyType.Float || property.propertyType == SerializedPropertyType.Integer; + return isNumber; + } + + private bool IsNumber(object obj) + { + return (obj is float) || (obj is int); + } + + private float CastToFloat(object obj) + { + if (obj is int) + { + return (int)obj; + } + else + { + return (float)obj; + } + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs.meta new file mode 100644 index 0000000..dfb90f1 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ProgressBarPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0bcbc424b10864b4eb6e3bcfb276cdf9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/PropertyDrawerBase.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/PropertyDrawerBase.cs new file mode 100644 index 0000000..36afd85 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/PropertyDrawerBase.cs @@ -0,0 +1,94 @@ +锘縰sing UnityEditor; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + public abstract class PropertyDrawerBase : PropertyDrawer + { + public sealed override void OnGUI(Rect rect, SerializedProperty property, GUIContent label) + { + // Check if visible + bool visible = PropertyUtility.IsVisible(property); + if (!visible) + { + return; + } + + // Validate + ValidatorAttribute[] validatorAttributes = PropertyUtility.GetAttributes(property); + foreach (var validatorAttribute in validatorAttributes) + { + validatorAttribute.GetValidator().ValidateProperty(property); + } + + // Check if enabled and draw + EditorGUI.BeginChangeCheck(); + bool enabled = PropertyUtility.IsEnabled(property); + + using (new EditorGUI.DisabledScope(disabled: !enabled)) + { + OnGUI_Internal(rect, property, PropertyUtility.GetLabel(property)); + } + + // Call OnValueChanged callbacks + if (EditorGUI.EndChangeCheck()) + { + PropertyUtility.CallOnValueChangedCallbacks(property); + } + } + + protected abstract void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label); + + sealed override public float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + bool visible = PropertyUtility.IsVisible(property); + if (!visible) + { + return 0.0f; + } + + return GetPropertyHeight_Internal(property, label); + } + + protected virtual float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + return EditorGUI.GetPropertyHeight(property, includeChildren: true); + } + + protected float GetPropertyHeight(SerializedProperty property) + { + SpecialCaseDrawerAttribute specialCaseAttribute = PropertyUtility.GetAttribute(property); + if (specialCaseAttribute != null) + { + return specialCaseAttribute.GetDrawer().GetPropertyHeight(property); + } + + return EditorGUI.GetPropertyHeight(property, includeChildren: true); + } + + public virtual float GetHelpBoxHeight() + { + return EditorGUIUtility.singleLineHeight * 2.0f; + } + + public void DrawDefaultPropertyAndHelpBox(Rect rect, SerializedProperty property, string message, MessageType messageType) + { + float indentLength = NaughtyEditorGUI.GetIndentLength(rect); + Rect helpBoxRect = new Rect( + rect.x + indentLength, + rect.y, + rect.width - indentLength, + GetHelpBoxHeight()); + + NaughtyEditorGUI.HelpBox(helpBoxRect, message, MessageType.Warning, context: property.serializedObject.targetObject); + + Rect propertyRect = new Rect( + rect.x, + rect.y + GetHelpBoxHeight(), + rect.width, + GetPropertyHeight(property)); + + EditorGUI.PropertyField(propertyRect, property, true); + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/PropertyDrawerBase.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/PropertyDrawerBase.cs.meta new file mode 100644 index 0000000..71a80b6 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/PropertyDrawerBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 574f5fa6033f26342816a8a5f39749e5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs new file mode 100644 index 0000000..6a78fa1 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs @@ -0,0 +1,80 @@ +锘縰sing UnityEngine; +using UnityEditor; +using System.Text.RegularExpressions; +using System; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(ResizableTextAreaAttribute))] + public class ResizableTextAreaPropertyDrawer : PropertyDrawerBase + { + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + if (property.propertyType == SerializedPropertyType.String) + { + float labelHeight = EditorGUIUtility.singleLineHeight; + float textAreaHeight = GetTextAreaHeight(property.stringValue); + return labelHeight + textAreaHeight; + } + else + { + return GetPropertyHeight(property) + GetHelpBoxHeight(); + } + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + if (property.propertyType == SerializedPropertyType.String) + { + Rect labelRect = new Rect() + { + x = rect.x, + y = rect.y, + width = rect.width, + height = EditorGUIUtility.singleLineHeight + }; + + EditorGUI.LabelField(labelRect, label.text); + + EditorGUI.BeginChangeCheck(); + + Rect textAreaRect = new Rect() + { + x = labelRect.x, + y = labelRect.y + EditorGUIUtility.singleLineHeight, + width = labelRect.width, + height = GetTextAreaHeight(property.stringValue) + }; + + string textAreaValue = EditorGUI.TextArea(textAreaRect, property.stringValue); + + if (EditorGUI.EndChangeCheck()) + { + property.stringValue = textAreaValue; + } + } + else + { + string message = typeof(ResizableTextAreaAttribute).Name + " can only be used on string fields"; + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + } + + EditorGUI.EndProperty(); + } + + private int GetNumberOfLines(string text) + { + string content = Regex.Replace(text, @"\r\n|\n\r|\r|\n", Environment.NewLine); + string[] lines = content.Split(new string[] { Environment.NewLine }, StringSplitOptions.None); + return lines.Length; + } + + private float GetTextAreaHeight(string text) + { + float height = (EditorGUIUtility.singleLineHeight - 3.0f) * GetNumberOfLines(text) + 3.0f; + return height; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs.meta new file mode 100644 index 0000000..4b1e4a5 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ResizableTextAreaPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6e27ffd9a96b58c46bb74cc93de3e06f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ScenePropertyDrawer.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ScenePropertyDrawer.cs new file mode 100644 index 0000000..9b0dfb3 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ScenePropertyDrawer.cs @@ -0,0 +1,99 @@ +锘縰sing UnityEngine; +using UnityEditor; +using System.Linq; +using System.Text.RegularExpressions; +using System; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(SceneAttribute))] + public class ScenePropertyDrawer : PropertyDrawerBase + { + private const string SceneListItem = "{0} ({1})"; + private const string ScenePattern = @".+\/(.+)\.unity"; + private const string TypeWarningMessage = "{0} must be an int or a string"; + private const string BuildSettingsWarningMessage = "No scenes in the build settings"; + + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + bool validPropertyType = property.propertyType == SerializedPropertyType.String || property.propertyType == SerializedPropertyType.Integer; + bool anySceneInBuildSettings = GetScenes().Length > 0; + + return (validPropertyType && anySceneInBuildSettings) + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + string[] scenes = GetScenes(); + bool anySceneInBuildSettings = scenes.Length > 0; + if (!anySceneInBuildSettings) + { + DrawDefaultPropertyAndHelpBox(rect, property, BuildSettingsWarningMessage, MessageType.Warning); + return; + } + + string[] sceneOptions = GetSceneOptions(scenes); + switch (property.propertyType) + { + case SerializedPropertyType.String: + DrawPropertyForString(rect, property, label, scenes, sceneOptions); + break; + case SerializedPropertyType.Integer: + DrawPropertyForInt(rect, property, label, sceneOptions); + break; + default: + string message = string.Format(TypeWarningMessage, property.name); + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + break; + } + + EditorGUI.EndProperty(); + } + + private string[] GetScenes() + { + return EditorBuildSettings.scenes + .Where(scene => scene.enabled) + .Select(scene => Regex.Match(scene.path, ScenePattern).Groups[1].Value) + .ToArray(); + } + + private string[] GetSceneOptions(string[] scenes) + { + return scenes.Select((s, i) => string.Format(SceneListItem, s, i)).ToArray(); + } + + private static void DrawPropertyForString(Rect rect, SerializedProperty property, GUIContent label, string[] scenes, string[] sceneOptions) + { + int index = IndexOf(scenes, property.stringValue); + int newIndex = EditorGUI.Popup(rect, label.text, index, sceneOptions); + string newScene = scenes[newIndex]; + + if (!property.stringValue.Equals(newScene, StringComparison.Ordinal)) + { + property.stringValue = scenes[newIndex]; + } + } + + private static void DrawPropertyForInt(Rect rect, SerializedProperty property, GUIContent label, string[] sceneOptions) + { + int index = property.intValue; + int newIndex = EditorGUI.Popup(rect, label.text, index, sceneOptions); + + if (property.intValue != newIndex) + { + property.intValue = newIndex; + } + } + + private static int IndexOf(string[] scenes, string scene) + { + var index = Array.IndexOf(scenes, scene); + return Mathf.Clamp(index, 0, scenes.Length - 1); + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ScenePropertyDrawer.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ScenePropertyDrawer.cs.meta new file mode 100644 index 0000000..a416544 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ScenePropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7f5ed440d4f429e42a5da7bc5df48fd8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs new file mode 100644 index 0000000..ee3d10b --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs @@ -0,0 +1,110 @@ +锘縰sing UnityEngine; +using UnityEditor; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(ShowAssetPreviewAttribute))] + public class ShowAssetPreviewPropertyDrawer : PropertyDrawerBase + { + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + if (property.propertyType == SerializedPropertyType.ObjectReference) + { + Texture2D previewTexture = GetAssetPreview(property); + if (previewTexture != null) + { + return GetPropertyHeight(property) + GetAssetPreviewSize(property).y; + } + else + { + return GetPropertyHeight(property); + } + } + else + { + return GetPropertyHeight(property) + GetHelpBoxHeight(); + } + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + if (property.propertyType == SerializedPropertyType.ObjectReference) + { + Rect propertyRect = new Rect() + { + x = rect.x, + y = rect.y, + width = rect.width, + height = EditorGUIUtility.singleLineHeight + }; + + EditorGUI.PropertyField(propertyRect, property, label); + + Texture2D previewTexture = GetAssetPreview(property); + if (previewTexture != null) + { + Rect previewRect = new Rect() + { + x = rect.x + NaughtyEditorGUI.GetIndentLength(rect), + y = rect.y + EditorGUIUtility.singleLineHeight, + width = rect.width, + height = GetAssetPreviewSize(property).y + }; + + GUI.Label(previewRect, previewTexture); + } + } + else + { + string message = property.name + " doesn't have an asset preview"; + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + } + + EditorGUI.EndProperty(); + } + + private Texture2D GetAssetPreview(SerializedProperty property) + { + if (property.propertyType == SerializedPropertyType.ObjectReference) + { + if (property.objectReferenceValue != null) + { + Texture2D previewTexture = AssetPreview.GetAssetPreview(property.objectReferenceValue); + return previewTexture; + } + + return null; + } + + return null; + } + + private Vector2 GetAssetPreviewSize(SerializedProperty property) + { + Texture2D previewTexture = GetAssetPreview(property); + if (previewTexture == null) + { + return Vector2.zero; + } + else + { + int targetWidth = ShowAssetPreviewAttribute.DefaultWidth; + int targetHeight = ShowAssetPreviewAttribute.DefaultHeight; + + ShowAssetPreviewAttribute showAssetPreviewAttribute = PropertyUtility.GetAttribute(property); + if (showAssetPreviewAttribute != null) + { + targetWidth = showAssetPreviewAttribute.Width; + targetHeight = showAssetPreviewAttribute.Height; + } + + int width = Mathf.Clamp(targetWidth, 0, previewTexture.width); + int height = Mathf.Clamp(targetHeight, 0, previewTexture.height); + + return new Vector2(width, height); + } + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs.meta new file mode 100644 index 0000000..5a4d16d --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/ShowAssetPreviewPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 24dee3fc91cfe94438de1e3c158f187f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/SortingLayerPropertyDrawer.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/SortingLayerPropertyDrawer.cs new file mode 100644 index 0000000..8822715 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/SortingLayerPropertyDrawer.cs @@ -0,0 +1,91 @@ +锘縰sing UnityEngine; +using UnityEditor; +using System; +using System.Reflection; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(SortingLayerAttribute))] + public class SortingLayerPropertyDrawer : PropertyDrawerBase + { + private const string TypeWarningMessage = "{0} must be an int or a string"; + + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + bool validPropertyType = property.propertyType == SerializedPropertyType.String || property.propertyType == SerializedPropertyType.Integer; + + return validPropertyType + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + switch (property.propertyType) + { + case SerializedPropertyType.String: + DrawPropertyForString(rect, property, label, GetLayers()); + break; + case SerializedPropertyType.Integer: + DrawPropertyForInt(rect, property, label, GetLayers()); + break; + default: + string message = string.Format(TypeWarningMessage, property.name); + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + break; + } + + EditorGUI.EndProperty(); + } + + private string[] GetLayers() + { + Type internalEditorUtilityType = typeof(UnityEditorInternal.InternalEditorUtility); + PropertyInfo sortingLayersProperty = internalEditorUtilityType.GetProperty("sortingLayerNames", BindingFlags.Static | BindingFlags.NonPublic); + return (string[])sortingLayersProperty.GetValue(null, new object[0]); + } + + private static void DrawPropertyForString(Rect rect, SerializedProperty property, GUIContent label, string[] layers) + { + int index = IndexOf(layers, property.stringValue); + int newIndex = EditorGUI.Popup(rect, label.text, index, layers); + string newLayer = layers[newIndex]; + + if (!property.stringValue.Equals(newLayer, StringComparison.Ordinal)) + { + property.stringValue = layers[newIndex]; + } + } + + private static void DrawPropertyForInt(Rect rect, SerializedProperty property, GUIContent label, string[] layers) + { + int index = 0; + string layerName = SortingLayer.IDToName(property.intValue); + for (int i = 0; i < layers.Length; i++) + { + if (layerName.Equals(layers[i], StringComparison.Ordinal)) + { + index = i; + break; + } + } + + int newIndex = EditorGUI.Popup(rect, label.text, index, layers); + string newLayerName = layers[newIndex]; + int newLayerNumber = SortingLayer.NameToID(newLayerName); + + if (property.intValue != newLayerNumber) + { + property.intValue = newLayerNumber; + } + } + + private static int IndexOf(string[] layers, string layer) + { + var index = Array.IndexOf(layers, layer); + return Mathf.Clamp(index, 0, layers.Length - 1); + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/SortingLayerPropertyDrawer.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/SortingLayerPropertyDrawer.cs.meta new file mode 100644 index 0000000..d99bdf9 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/SortingLayerPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b0ed20ed34d732246a98cde96351fccb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TagPropertyDrawer.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TagPropertyDrawer.cs new file mode 100644 index 0000000..7a00a40 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TagPropertyDrawer.cs @@ -0,0 +1,62 @@ +锘縰sing System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + [CustomPropertyDrawer(typeof(TagAttribute))] + public class TagPropertyDrawer : PropertyDrawerBase + { + protected override float GetPropertyHeight_Internal(SerializedProperty property, GUIContent label) + { + return (property.propertyType == SerializedPropertyType.String) + ? GetPropertyHeight(property) + : GetPropertyHeight(property) + GetHelpBoxHeight(); + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(rect, label, property); + + if (property.propertyType == SerializedPropertyType.String) + { + // generate the taglist + custom tags + List tagList = new List(); + tagList.Add("(None)"); + tagList.Add("Untagged"); + tagList.AddRange(UnityEditorInternal.InternalEditorUtility.tags); + + string propertyString = property.stringValue; + int index = 0; + // check if there is an entry that matches the entry and get the index + // we skip index 0 as that is a special custom case + for (int i = 1; i < tagList.Count; i++) + { + if (tagList[i].Equals(propertyString, System.StringComparison.Ordinal)) + { + index = i; + break; + } + } + + // Draw the popup box with the current selected index + int newIndex = EditorGUI.Popup(rect, label.text, index, tagList.ToArray()); + + // Adjust the actual string value of the property based on the selection + string newValue = newIndex > 0 ? tagList[newIndex] : string.Empty; + + if (!property.stringValue.Equals(newValue, System.StringComparison.Ordinal)) + { + property.stringValue = newValue; + } + } + else + { + string message = string.Format("{0} supports only string fields", typeof(TagAttribute).Name); + DrawDefaultPropertyAndHelpBox(rect, property, message, MessageType.Warning); + } + + EditorGUI.EndProperty(); + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TagPropertyDrawer.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TagPropertyDrawer.cs.meta new file mode 100644 index 0000000..75f76c5 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers/TagPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3df4c068c970ab6498df7a60efbde311 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase.meta new file mode 100644 index 0000000..88cd458 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 750a102004a7e4f46a2046a3d74cae19 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/ReorderableListPropertyDrawer.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/ReorderableListPropertyDrawer.cs new file mode 100644 index 0000000..fea369d --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/ReorderableListPropertyDrawer.cs @@ -0,0 +1,205 @@ +锘縰sing UnityEngine; +using UnityEditor; +using UnityEditorInternal; +using System.Collections.Generic; + +namespace NaughtyAttributes.Editor +{ + public class ReorderableListPropertyDrawer : SpecialCasePropertyDrawerBase + { + public static readonly ReorderableListPropertyDrawer Instance = new ReorderableListPropertyDrawer(); + + private readonly Dictionary _reorderableListsByPropertyName = new Dictionary(); + + private GUIStyle _labelStyle; + + private GUIStyle GetLabelStyle() + { + if (_labelStyle == null) + { + _labelStyle = new GUIStyle(EditorStyles.boldLabel); + _labelStyle.richText = true; + } + + return _labelStyle; + } + + private string GetPropertyKeyName(SerializedProperty property) + { + return property.serializedObject.targetObject.GetInstanceID() + "." + property.name; + } + + protected override float GetPropertyHeight_Internal(SerializedProperty property) + { + if (property.isArray) + { + string key = GetPropertyKeyName(property); + + if (_reorderableListsByPropertyName.TryGetValue(key, out ReorderableList reorderableList) == false) + { + return 0; + } + + return reorderableList.GetHeight(); + } + + return EditorGUI.GetPropertyHeight(property, true); + } + + protected override void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label) + { + if (property.isArray) + { + string key = GetPropertyKeyName(property); + + ReorderableList reorderableList = null; + if (!_reorderableListsByPropertyName.ContainsKey(key)) + { + reorderableList = new ReorderableList(property.serializedObject, property, true, true, true, true) + { + drawHeaderCallback = (Rect r) => + { + EditorGUI.LabelField(r, string.Format("{0}: {1}", label.text, property.arraySize), GetLabelStyle()); + HandleDragAndDrop(r, reorderableList); + }, + + drawElementCallback = (Rect r, int index, bool isActive, bool isFocused) => + { + SerializedProperty element = property.GetArrayElementAtIndex(index); + r.y += 1.0f; + r.x += 10.0f; + r.width -= 10.0f; + + EditorGUI.PropertyField(new Rect(r.x, r.y, r.width, EditorGUIUtility.singleLineHeight), element, true); + }, + + elementHeightCallback = (int index) => + { + return EditorGUI.GetPropertyHeight(property.GetArrayElementAtIndex(index)) + 4.0f; + } + }; + + _reorderableListsByPropertyName[key] = reorderableList; + } + + reorderableList = _reorderableListsByPropertyName[key]; + + if (rect == default) + { + reorderableList.DoLayoutList(); + } + else + { + reorderableList.DoList(rect); + } + } + else + { + string message = typeof(ReorderableListAttribute).Name + " can be used only on arrays or lists"; + NaughtyEditorGUI.HelpBox_Layout(message, MessageType.Warning, context: property.serializedObject.targetObject); + EditorGUILayout.PropertyField(property, true); + } + } + + public void ClearCache() + { + _reorderableListsByPropertyName.Clear(); + } + + private Object GetAssignableObject(Object obj, ReorderableList list) + { + System.Type listType = PropertyUtility.GetPropertyType(list.serializedProperty); + System.Type elementType = ReflectionUtility.GetListElementType(listType); + + if (elementType == null) + { + return null; + } + + System.Type objType = obj.GetType(); + + if (elementType.IsAssignableFrom(objType)) + { + return obj; + } + + if (objType == typeof(GameObject)) + { + if (typeof(Transform).IsAssignableFrom(elementType)) + { + Transform transform = ((GameObject)obj).transform; + if (elementType == typeof(RectTransform)) + { + RectTransform rectTransform = transform as RectTransform; + return rectTransform; + } + else + { + return transform; + } + } + else if (typeof(MonoBehaviour).IsAssignableFrom(elementType)) + { + return ((GameObject)obj).GetComponent(elementType); + } + } + + return null; + } + + private void HandleDragAndDrop(Rect rect, ReorderableList list) + { + var currentEvent = Event.current; + var usedEvent = false; + + switch (currentEvent.type) + { + case EventType.DragExited: + if (GUI.enabled) + { + HandleUtility.Repaint(); + } + + break; + + case EventType.DragUpdated: + case EventType.DragPerform: + if (rect.Contains(currentEvent.mousePosition) && GUI.enabled) + { + // Check each single object, so we can add multiple objects in a single drag. + bool didAcceptDrag = false; + Object[] references = DragAndDrop.objectReferences; + foreach (Object obj in references) + { + Object assignableObject = GetAssignableObject(obj, list); + if (assignableObject != null) + { + DragAndDrop.visualMode = DragAndDropVisualMode.Copy; + if (currentEvent.type == EventType.DragPerform) + { + list.serializedProperty.arraySize++; + int arrayEnd = list.serializedProperty.arraySize - 1; + list.serializedProperty.GetArrayElementAtIndex(arrayEnd).objectReferenceValue = assignableObject; + didAcceptDrag = true; + } + } + } + + if (didAcceptDrag) + { + GUI.changed = true; + DragAndDrop.AcceptDrag(); + usedEvent = true; + } + } + + break; + } + + if (usedEvent) + { + currentEvent.Use(); + } + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/ReorderableListPropertyDrawer.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/ReorderableListPropertyDrawer.cs.meta new file mode 100644 index 0000000..4ff1a66 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/ReorderableListPropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bf36691a6d456564db2fcbfa8726b3f3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/SpecialCasePropertyDrawerBase.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/SpecialCasePropertyDrawerBase.cs new file mode 100644 index 0000000..0490b50 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/SpecialCasePropertyDrawerBase.cs @@ -0,0 +1,74 @@ +锘縰sing System; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + public abstract class SpecialCasePropertyDrawerBase + { + public void OnGUI(Rect rect, SerializedProperty property) + { + // Check if visible + bool visible = PropertyUtility.IsVisible(property); + if (!visible) + { + return; + } + + // Validate + ValidatorAttribute[] validatorAttributes = PropertyUtility.GetAttributes(property); + foreach (var validatorAttribute in validatorAttributes) + { + validatorAttribute.GetValidator().ValidateProperty(property); + } + + // Check if enabled and draw + EditorGUI.BeginChangeCheck(); + bool enabled = PropertyUtility.IsEnabled(property); + + using (new EditorGUI.DisabledScope(disabled: !enabled)) + { + OnGUI_Internal(rect, property, PropertyUtility.GetLabel(property)); + } + + // Call OnValueChanged callbacks + if (EditorGUI.EndChangeCheck()) + { + PropertyUtility.CallOnValueChangedCallbacks(property); + } + } + + public float GetPropertyHeight(SerializedProperty property) + { + return GetPropertyHeight_Internal(property); + } + + protected abstract void OnGUI_Internal(Rect rect, SerializedProperty property, GUIContent label); + protected abstract float GetPropertyHeight_Internal(SerializedProperty property); + } + + public static class SpecialCaseDrawerAttributeExtensions + { + private static Dictionary _drawersByAttributeType; + + static SpecialCaseDrawerAttributeExtensions() + { + _drawersByAttributeType = new Dictionary(); + _drawersByAttributeType[typeof(ReorderableListAttribute)] = ReorderableListPropertyDrawer.Instance; + } + + public static SpecialCasePropertyDrawerBase GetDrawer(this SpecialCaseDrawerAttribute attr) + { + SpecialCasePropertyDrawerBase drawer; + if (_drawersByAttributeType.TryGetValue(attr.GetType(), out drawer)) + { + return drawer; + } + else + { + return null; + } + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/SpecialCasePropertyDrawerBase.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/SpecialCasePropertyDrawerBase.cs.meta new file mode 100644 index 0000000..c60287c --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyDrawers_SpecialCase/SpecialCasePropertyDrawerBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 771776453ad34b045a41dea54856fa12 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators.meta new file mode 100644 index 0000000..949d96d --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 41caedece93df91439d624dc9d124424 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/MaxValuePropertyValidator.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/MaxValuePropertyValidator.cs new file mode 100644 index 0000000..0e7d3b7 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/MaxValuePropertyValidator.cs @@ -0,0 +1,53 @@ +锘縰sing UnityEngine; +using UnityEditor; + +namespace NaughtyAttributes.Editor +{ + public class MaxValuePropertyValidator : PropertyValidatorBase + { + public override void ValidateProperty(SerializedProperty property) + { + MaxValueAttribute maxValueAttribute = PropertyUtility.GetAttribute(property); + + if (property.propertyType == SerializedPropertyType.Integer) + { + if (property.intValue > maxValueAttribute.MaxValue) + { + property.intValue = (int)maxValueAttribute.MaxValue; + } + } + else if (property.propertyType == SerializedPropertyType.Float) + { + if (property.floatValue > maxValueAttribute.MaxValue) + { + property.floatValue = maxValueAttribute.MaxValue; + } + } + else if (property.propertyType == SerializedPropertyType.Vector2) + { + property.vector2Value = Vector2.Min(property.vector2Value, new Vector2(maxValueAttribute.MaxValue, maxValueAttribute.MaxValue)); + } + else if (property.propertyType == SerializedPropertyType.Vector3) + { + property.vector3Value = Vector3.Min(property.vector3Value, new Vector3(maxValueAttribute.MaxValue, maxValueAttribute.MaxValue, maxValueAttribute.MaxValue)); + } + else if (property.propertyType == SerializedPropertyType.Vector4) + { + property.vector4Value = Vector4.Min(property.vector4Value, new Vector4(maxValueAttribute.MaxValue, maxValueAttribute.MaxValue, maxValueAttribute.MaxValue, maxValueAttribute.MaxValue)); + } + else if (property.propertyType == SerializedPropertyType.Vector2Int) + { + property.vector2IntValue = Vector2Int.Min(property.vector2IntValue, new Vector2Int((int)maxValueAttribute.MaxValue, (int)maxValueAttribute.MaxValue)); + } + else if (property.propertyType == SerializedPropertyType.Vector3Int) + { + property.vector3IntValue = Vector3Int.Min(property.vector3IntValue, new Vector3Int((int)maxValueAttribute.MaxValue, (int)maxValueAttribute.MaxValue, (int)maxValueAttribute.MaxValue)); + } + else + { + string warning = maxValueAttribute.GetType().Name + " can be used only on int, float, Vector or VectorInt fields"; + Debug.LogWarning(warning, property.serializedObject.targetObject); + } + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/MaxValuePropertyValidator.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/MaxValuePropertyValidator.cs.meta new file mode 100644 index 0000000..3e809ac --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/MaxValuePropertyValidator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 627b8e9e7bda6fa408c6f47fb8285665 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/MinValuePropertyValidator.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/MinValuePropertyValidator.cs new file mode 100644 index 0000000..80df069 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/MinValuePropertyValidator.cs @@ -0,0 +1,53 @@ +锘縰sing UnityEngine; +using UnityEditor; + +namespace NaughtyAttributes.Editor +{ + public class MinValuePropertyValidator : PropertyValidatorBase + { + public override void ValidateProperty(SerializedProperty property) + { + MinValueAttribute minValueAttribute = PropertyUtility.GetAttribute(property); + + if (property.propertyType == SerializedPropertyType.Integer) + { + if (property.intValue < minValueAttribute.MinValue) + { + property.intValue = (int)minValueAttribute.MinValue; + } + } + else if (property.propertyType == SerializedPropertyType.Float) + { + if (property.floatValue < minValueAttribute.MinValue) + { + property.floatValue = minValueAttribute.MinValue; + } + } + else if (property.propertyType == SerializedPropertyType.Vector2) + { + property.vector2Value = Vector2.Max(property.vector2Value, new Vector2(minValueAttribute.MinValue, minValueAttribute.MinValue)); + } + else if (property.propertyType == SerializedPropertyType.Vector3) + { + property.vector3Value = Vector3.Max(property.vector3Value, new Vector3(minValueAttribute.MinValue, minValueAttribute.MinValue, minValueAttribute.MinValue)); + } + else if (property.propertyType == SerializedPropertyType.Vector4) + { + property.vector4Value = Vector4.Max(property.vector4Value, new Vector4(minValueAttribute.MinValue, minValueAttribute.MinValue, minValueAttribute.MinValue, minValueAttribute.MinValue)); + } + else if (property.propertyType == SerializedPropertyType.Vector2Int) + { + property.vector2IntValue = Vector2Int.Max(property.vector2IntValue, new Vector2Int((int)minValueAttribute.MinValue, (int)minValueAttribute.MinValue)); + } + else if (property.propertyType == SerializedPropertyType.Vector3Int) + { + property.vector3IntValue = Vector3Int.Max(property.vector3IntValue, new Vector3Int((int)minValueAttribute.MinValue, (int)minValueAttribute.MinValue, (int)minValueAttribute.MinValue)); + } + else + { + string warning = minValueAttribute.GetType().Name + " can be used only on int, float, Vector or VectorInt fields"; + Debug.LogWarning(warning, property.serializedObject.targetObject); + } + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/MinValuePropertyValidator.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/MinValuePropertyValidator.cs.meta new file mode 100644 index 0000000..b3bb871 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/MinValuePropertyValidator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 03dd23f6c0598074fb1b721dcd8fe023 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/PropertyValidatorBase.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/PropertyValidatorBase.cs new file mode 100644 index 0000000..1c0411f --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/PropertyValidatorBase.cs @@ -0,0 +1,38 @@ +锘縰sing System; +using System.Collections.Generic; +using UnityEditor; + +namespace NaughtyAttributes.Editor +{ + public abstract class PropertyValidatorBase + { + public abstract void ValidateProperty(SerializedProperty property); + } + + public static class ValidatorAttributeExtensions + { + private static Dictionary _validatorsByAttributeType; + + static ValidatorAttributeExtensions() + { + _validatorsByAttributeType = new Dictionary(); + _validatorsByAttributeType[typeof(MinValueAttribute)] = new MinValuePropertyValidator(); + _validatorsByAttributeType[typeof(MaxValueAttribute)] = new MaxValuePropertyValidator(); + _validatorsByAttributeType[typeof(RequiredAttribute)] = new RequiredPropertyValidator(); + _validatorsByAttributeType[typeof(ValidateInputAttribute)] = new ValidateInputPropertyValidator(); + } + + public static PropertyValidatorBase GetValidator(this ValidatorAttribute attr) + { + PropertyValidatorBase validator; + if (_validatorsByAttributeType.TryGetValue(attr.GetType(), out validator)) + { + return validator; + } + else + { + return null; + } + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/PropertyValidatorBase.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/PropertyValidatorBase.cs.meta new file mode 100644 index 0000000..97fe581 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/PropertyValidatorBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f332c8e1c3627d742aa9158af7b02ccc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/RequiredPropertyValidator.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/RequiredPropertyValidator.cs new file mode 100644 index 0000000..1133650 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/RequiredPropertyValidator.cs @@ -0,0 +1,31 @@ +锘縰sing UnityEditor; + +namespace NaughtyAttributes.Editor +{ + public class RequiredPropertyValidator : PropertyValidatorBase + { + public override void ValidateProperty(SerializedProperty property) + { + RequiredAttribute requiredAttribute = PropertyUtility.GetAttribute(property); + + if (property.propertyType == SerializedPropertyType.ObjectReference) + { + if (property.objectReferenceValue == null) + { + string errorMessage = property.name + " is required"; + if (!string.IsNullOrEmpty(requiredAttribute.Message)) + { + errorMessage = requiredAttribute.Message; + } + + NaughtyEditorGUI.HelpBox_Layout(errorMessage, MessageType.Error, context: property.serializedObject.targetObject); + } + } + else + { + string warning = requiredAttribute.GetType().Name + " works only on reference types"; + NaughtyEditorGUI.HelpBox_Layout(warning, MessageType.Warning, context: property.serializedObject.targetObject); + } + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/RequiredPropertyValidator.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/RequiredPropertyValidator.cs.meta new file mode 100644 index 0000000..d24143a --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/RequiredPropertyValidator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3a7e657ea45f6414682b5f41be9541b4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/ValidateInputPropertyValidator.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/ValidateInputPropertyValidator.cs new file mode 100644 index 0000000..1252c70 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/ValidateInputPropertyValidator.cs @@ -0,0 +1,76 @@ +using UnityEditor; +using System.Reflection; +using System; + +namespace NaughtyAttributes.Editor +{ + public class ValidateInputPropertyValidator : PropertyValidatorBase + { + public override void ValidateProperty(SerializedProperty property) + { + ValidateInputAttribute validateInputAttribute = PropertyUtility.GetAttribute(property); + object target = PropertyUtility.GetTargetObjectWithProperty(property); + + MethodInfo validationCallback = ReflectionUtility.GetMethod(target, validateInputAttribute.CallbackName); + + if (validationCallback != null && + validationCallback.ReturnType == typeof(bool)) + { + ParameterInfo[] callbackParameters = validationCallback.GetParameters(); + + if (callbackParameters.Length == 0) + { + if (!(bool)validationCallback.Invoke(target, null)) + { + if (string.IsNullOrEmpty(validateInputAttribute.Message)) + { + NaughtyEditorGUI.HelpBox_Layout( + property.name + " is not valid", MessageType.Error, context: property.serializedObject.targetObject); + } + else + { + NaughtyEditorGUI.HelpBox_Layout( + validateInputAttribute.Message, MessageType.Error, context: property.serializedObject.targetObject); + } + } + } + else if (callbackParameters.Length == 1) + { + FieldInfo fieldInfo = ReflectionUtility.GetField(target, property.name); + Type fieldType = fieldInfo.FieldType; + Type parameterType = callbackParameters[0].ParameterType; + + if (fieldType == parameterType) + { + if (!(bool)validationCallback.Invoke(target, new object[] { fieldInfo.GetValue(target) })) + { + if (string.IsNullOrEmpty(validateInputAttribute.Message)) + { + NaughtyEditorGUI.HelpBox_Layout( + property.name + " is not valid", MessageType.Error, context: property.serializedObject.targetObject); + } + else + { + NaughtyEditorGUI.HelpBox_Layout( + validateInputAttribute.Message, MessageType.Error, context: property.serializedObject.targetObject); + } + } + } + else + { + string warning = "The field type is not the same as the callback's parameter type"; + NaughtyEditorGUI.HelpBox_Layout(warning, MessageType.Warning, context: property.serializedObject.targetObject); + } + } + else + { + string warning = + validateInputAttribute.GetType().Name + + " needs a callback with boolean return type and an optional single parameter of the same type as the field"; + + NaughtyEditorGUI.HelpBox_Layout(warning, MessageType.Warning, context: property.serializedObject.targetObject); + } + } + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/ValidateInputPropertyValidator.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/ValidateInputPropertyValidator.cs.meta new file mode 100644 index 0000000..3f6e539 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/PropertyValidators/ValidateInputPropertyValidator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5f6adf84ed53a7840a456e8b4dce38d9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility.meta new file mode 100644 index 0000000..ed16edd --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: acb4475c71a3fe947a81ced84ab89c6d +folderAsset: yes +timeCreated: 1508062761 +licenseType: Free +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/ButtonUtility.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/ButtonUtility.cs new file mode 100644 index 0000000..ca5f4ca --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/ButtonUtility.cs @@ -0,0 +1,55 @@ +锘縰sing UnityEngine; +using System.Reflection; +using System.Collections.Generic; + +namespace NaughtyAttributes.Editor +{ + public static class ButtonUtility + { + public static bool IsEnabled(Object target, MethodInfo method) + { + EnableIfAttributeBase enableIfAttribute = method.GetCustomAttribute(); + if (enableIfAttribute == null) + { + return true; + } + + List conditionValues = PropertyUtility.GetConditionValues(target, enableIfAttribute.Conditions); + if (conditionValues.Count > 0) + { + bool enabled = PropertyUtility.GetConditionsFlag(conditionValues, enableIfAttribute.ConditionOperator, enableIfAttribute.Inverted); + return enabled; + } + else + { + string message = enableIfAttribute.GetType().Name + " needs a valid boolean condition field, property or method name to work"; + Debug.LogWarning(message, target); + + return false; + } + } + + public static bool IsVisible(Object target, MethodInfo method) + { + ShowIfAttributeBase showIfAttribute = method.GetCustomAttribute(); + if (showIfAttribute == null) + { + return true; + } + + List conditionValues = PropertyUtility.GetConditionValues(target, showIfAttribute.Conditions); + if (conditionValues.Count > 0) + { + bool enabled = PropertyUtility.GetConditionsFlag(conditionValues, showIfAttribute.ConditionOperator, showIfAttribute.Inverted); + return enabled; + } + else + { + string message = showIfAttribute.GetType().Name + " needs a valid boolean condition field, property or method name to work"; + Debug.LogWarning(message, target); + + return false; + } + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/ButtonUtility.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/ButtonUtility.cs.meta new file mode 100644 index 0000000..cf4dace --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/ButtonUtility.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a273f81125ec52d4cb5dec2228afda0e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs new file mode 100644 index 0000000..ee17a7a --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs @@ -0,0 +1,380 @@ +using System; +using System.Collections; +using System.Linq; +using System.Reflection; +using UnityEditor; +using UnityEditor.Experimental.SceneManagement; +using UnityEditor.SceneManagement; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + public static class NaughtyEditorGUI + { + public const float IndentLength = 15.0f; + public const float HorizontalSpacing = 2.0f; + + private static GUIStyle _buttonStyle = new GUIStyle(GUI.skin.button) { richText = true }; + + private delegate void PropertyFieldFunction(Rect rect, SerializedProperty property, GUIContent label, bool includeChildren); + + public static void PropertyField(Rect rect, SerializedProperty property, bool includeChildren) + { + PropertyField_Implementation(rect, property, includeChildren, DrawPropertyField); + } + + public static void PropertyField_Layout(SerializedProperty property, bool includeChildren) + { + Rect dummyRect = new Rect(); + PropertyField_Implementation(dummyRect, property, includeChildren, DrawPropertyField_Layout); + } + + private static void DrawPropertyField(Rect rect, SerializedProperty property, GUIContent label, bool includeChildren) + { + EditorGUI.PropertyField(rect, property, label, includeChildren); + } + + private static void DrawPropertyField_Layout(Rect rect, SerializedProperty property, GUIContent label, bool includeChildren) + { + EditorGUILayout.PropertyField(property, label, includeChildren); + } + + private static void PropertyField_Implementation(Rect rect, SerializedProperty property, bool includeChildren, PropertyFieldFunction propertyFieldFunction) + { + SpecialCaseDrawerAttribute specialCaseAttribute = PropertyUtility.GetAttribute(property); + if (specialCaseAttribute != null) + { + specialCaseAttribute.GetDrawer().OnGUI(rect, property); + } + else + { + // Check if visible + bool visible = PropertyUtility.IsVisible(property); + if (!visible) + { + return; + } + + // Validate + ValidatorAttribute[] validatorAttributes = PropertyUtility.GetAttributes(property); + foreach (var validatorAttribute in validatorAttributes) + { + validatorAttribute.GetValidator().ValidateProperty(property); + } + + // Check if enabled and draw + EditorGUI.BeginChangeCheck(); + bool enabled = PropertyUtility.IsEnabled(property); + + using (new EditorGUI.DisabledScope(disabled: !enabled)) + { + propertyFieldFunction.Invoke(rect, property, PropertyUtility.GetLabel(property), includeChildren); + } + + // Call OnValueChanged callbacks + if (EditorGUI.EndChangeCheck()) + { + PropertyUtility.CallOnValueChangedCallbacks(property); + } + } + } + + public static float GetIndentLength(Rect sourceRect) + { + Rect indentRect = EditorGUI.IndentedRect(sourceRect); + float indentLength = indentRect.x - sourceRect.x; + + return indentLength; + } + + public static void BeginBoxGroup_Layout(string label = "") + { + EditorGUILayout.BeginVertical(GUI.skin.box); + if (!string.IsNullOrEmpty(label)) + { + EditorGUILayout.LabelField(label, EditorStyles.boldLabel); + } + } + + public static void EndBoxGroup_Layout() + { + EditorGUILayout.EndVertical(); + } + + /// + /// Creates a dropdown + /// + /// The rect the defines the position and size of the dropdown in the inspector + /// The serialized object that is being updated + /// The target object that contains the dropdown + /// The field of the target object that holds the currently selected dropdown value + /// The label of the dropdown + /// The index of the value from the values array + /// The values of the dropdown + /// The display options for the values + public static void Dropdown( + Rect rect, SerializedObject serializedObject, object target, FieldInfo dropdownField, + string label, int selectedValueIndex, object[] values, string[] displayOptions) + { + EditorGUI.BeginChangeCheck(); + + int newIndex = EditorGUI.Popup(rect, label, selectedValueIndex, displayOptions); + object newValue = values[newIndex]; + + object dropdownValue = dropdownField.GetValue(target); + if (dropdownValue == null || !dropdownValue.Equals(newValue)) + { + Undo.RecordObject(serializedObject.targetObject, "Dropdown"); + + // TODO: Problem with structs, because they are value type. + // The solution is to make boxing/unboxing but unfortunately I don't know the compile time type of the target object + dropdownField.SetValue(target, newValue); + } + } + + public static void Button(UnityEngine.Object target, MethodInfo methodInfo) + { + bool visible = ButtonUtility.IsVisible(target, methodInfo); + if (!visible) + { + return; + } + + if (methodInfo.GetParameters().All(p => p.IsOptional)) + { + ButtonAttribute buttonAttribute = (ButtonAttribute)methodInfo.GetCustomAttributes(typeof(ButtonAttribute), true)[0]; + string buttonText = string.IsNullOrEmpty(buttonAttribute.Text) ? ObjectNames.NicifyVariableName(methodInfo.Name) : buttonAttribute.Text; + + bool buttonEnabled = ButtonUtility.IsEnabled(target, methodInfo); + + EButtonEnableMode mode = buttonAttribute.SelectedEnableMode; + buttonEnabled &= + mode == EButtonEnableMode.Always || + mode == EButtonEnableMode.Editor && !Application.isPlaying || + mode == EButtonEnableMode.Playmode && Application.isPlaying; + + bool methodIsCoroutine = methodInfo.ReturnType == typeof(IEnumerator); + if (methodIsCoroutine) + { + buttonEnabled &= (Application.isPlaying ? true : false); + } + + EditorGUI.BeginDisabledGroup(!buttonEnabled); + + if (GUILayout.Button(buttonText, _buttonStyle)) + { + object[] defaultParams = methodInfo.GetParameters().Select(p => p.DefaultValue).ToArray(); + IEnumerator methodResult = methodInfo.Invoke(target, defaultParams) as IEnumerator; + + if (!Application.isPlaying) + { + // Set target object and scene dirty to serialize changes to disk + EditorUtility.SetDirty(target); + + PrefabStage stage = PrefabStageUtility.GetCurrentPrefabStage(); + if (stage != null) + { + // Prefab mode + EditorSceneManager.MarkSceneDirty(stage.scene); + } + else + { + // Normal scene + EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene()); + } + } + else if (methodResult != null && target is MonoBehaviour behaviour) + { + behaviour.StartCoroutine(methodResult); + } + } + + EditorGUI.EndDisabledGroup(); + } + else + { + string warning = typeof(ButtonAttribute).Name + " works only on methods with no parameters"; + HelpBox_Layout(warning, MessageType.Warning, context: target, logToConsole: true); + } + } + + public static void NativeProperty_Layout(UnityEngine.Object target, PropertyInfo property) + { + object value = property.GetValue(target, null); + + if (value == null) + { + string warning = string.Format("{0} is null. {1} doesn't support reference types with null value", ObjectNames.NicifyVariableName(property.Name), typeof(ShowNativePropertyAttribute).Name); + HelpBox_Layout(warning, MessageType.Warning, context: target); + } + else if (!Field_Layout(value, ObjectNames.NicifyVariableName(property.Name))) + { + string warning = string.Format("{0} doesn't support {1} types", typeof(ShowNativePropertyAttribute).Name, property.PropertyType.Name); + HelpBox_Layout(warning, MessageType.Warning, context: target); + } + } + + public static void NonSerializedField_Layout(UnityEngine.Object target, FieldInfo field) + { + object value = field.GetValue(target); + + if (value == null) + { + string warning = string.Format("{0} is null. {1} doesn't support reference types with null value", ObjectNames.NicifyVariableName(field.Name), typeof(ShowNonSerializedFieldAttribute).Name); + HelpBox_Layout(warning, MessageType.Warning, context: target); + } + else if (!Field_Layout(value, ObjectNames.NicifyVariableName(field.Name))) + { + string warning = string.Format("{0} doesn't support {1} types", typeof(ShowNonSerializedFieldAttribute).Name, field.FieldType.Name); + HelpBox_Layout(warning, MessageType.Warning, context: target); + } + } + + public static void HorizontalLine(Rect rect, float height, Color color) + { + rect.height = height; + EditorGUI.DrawRect(rect, color); + } + + public static void HelpBox(Rect rect, string message, MessageType type, UnityEngine.Object context = null, bool logToConsole = false) + { + EditorGUI.HelpBox(rect, message, type); + + if (logToConsole) + { + DebugLogMessage(message, type, context); + } + } + + public static void HelpBox_Layout(string message, MessageType type, UnityEngine.Object context = null, bool logToConsole = false) + { + EditorGUILayout.HelpBox(message, type); + + if (logToConsole) + { + DebugLogMessage(message, type, context); + } + } + + public static bool Field_Layout(object value, string label) + { + using (new EditorGUI.DisabledScope(disabled: true)) + { + bool isDrawn = true; + Type valueType = value.GetType(); + + if (valueType == typeof(bool)) + { + EditorGUILayout.Toggle(label, (bool)value); + } + else if (valueType == typeof(short)) + { + EditorGUILayout.IntField(label, (short)value); + } + else if (valueType == typeof(ushort)) + { + EditorGUILayout.IntField(label, (ushort)value); + } + else if (valueType == typeof(int)) + { + EditorGUILayout.IntField(label, (int)value); + } + else if (valueType == typeof(uint)) + { + EditorGUILayout.LongField(label, (uint)value); + } + else if (valueType == typeof(long)) + { + EditorGUILayout.LongField(label, (long)value); + } + else if (valueType == typeof(ulong)) + { + EditorGUILayout.TextField(label, ((ulong)value).ToString()); + } + else if (valueType == typeof(float)) + { + EditorGUILayout.FloatField(label, (float)value); + } + else if (valueType == typeof(double)) + { + EditorGUILayout.DoubleField(label, (double)value); + } + else if (valueType == typeof(string)) + { + EditorGUILayout.TextField(label, (string)value); + } + else if (valueType == typeof(Vector2)) + { + EditorGUILayout.Vector2Field(label, (Vector2)value); + } + else if (valueType == typeof(Vector3)) + { + EditorGUILayout.Vector3Field(label, (Vector3)value); + } + else if (valueType == typeof(Vector4)) + { + EditorGUILayout.Vector4Field(label, (Vector4)value); + } + else if (valueType == typeof(Vector2Int)) + { + EditorGUILayout.Vector2IntField(label, (Vector2Int)value); + } + else if (valueType == typeof(Vector3Int)) + { + EditorGUILayout.Vector3IntField(label, (Vector3Int)value); + } + else if (valueType == typeof(Color)) + { + EditorGUILayout.ColorField(label, (Color)value); + } + else if (valueType == typeof(Bounds)) + { + EditorGUILayout.BoundsField(label, (Bounds)value); + } + else if (valueType == typeof(Rect)) + { + EditorGUILayout.RectField(label, (Rect)value); + } + else if (valueType == typeof(RectInt)) + { + EditorGUILayout.RectIntField(label, (RectInt)value); + } + else if (typeof(UnityEngine.Object).IsAssignableFrom(valueType)) + { + EditorGUILayout.ObjectField(label, (UnityEngine.Object)value, valueType, true); + } + else if (valueType.BaseType == typeof(Enum)) + { + EditorGUILayout.EnumPopup(label, (Enum)value); + } + else if (valueType.BaseType == typeof(System.Reflection.TypeInfo)) + { + EditorGUILayout.TextField(label, value.ToString()); + } + else + { + isDrawn = false; + } + + return isDrawn; + } + } + + private static void DebugLogMessage(string message, MessageType type, UnityEngine.Object context) + { + switch (type) + { + case MessageType.None: + case MessageType.Info: + Debug.Log(message, context); + break; + case MessageType.Warning: + Debug.LogWarning(message, context); + break; + case MessageType.Error: + Debug.LogError(message, context); + break; + } + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs.meta new file mode 100644 index 0000000..704d3e5 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/NaughtyEditorGUI.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 6ff27ff7705d6064e935bb2159a1b453 +timeCreated: 1510926159 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/PropertyUtility.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/PropertyUtility.cs new file mode 100644 index 0000000..e42db4b --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/PropertyUtility.cs @@ -0,0 +1,374 @@ +锘縰sing UnityEditor; +using System.Reflection; +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + public static class PropertyUtility + { + public static T GetAttribute(SerializedProperty property) where T : class + { + T[] attributes = GetAttributes(property); + return (attributes.Length > 0) ? attributes[0] : null; + } + + public static T[] GetAttributes(SerializedProperty property) where T : class + { + FieldInfo fieldInfo = ReflectionUtility.GetField(GetTargetObjectWithProperty(property), property.name); + if (fieldInfo == null) + { + return new T[] { }; + } + + return (T[])fieldInfo.GetCustomAttributes(typeof(T), true); + } + + public static GUIContent GetLabel(SerializedProperty property) + { + LabelAttribute labelAttribute = GetAttribute(property); + string labelText = (labelAttribute == null) + ? property.displayName + : labelAttribute.Label; + + GUIContent label = new GUIContent(labelText); + return label; + } + + public static void CallOnValueChangedCallbacks(SerializedProperty property) + { + OnValueChangedAttribute[] onValueChangedAttributes = GetAttributes(property); + if (onValueChangedAttributes.Length == 0) + { + return; + } + + object target = GetTargetObjectWithProperty(property); + property.serializedObject.ApplyModifiedProperties(); // We must apply modifications so that the new value is updated in the serialized object + + foreach (var onValueChangedAttribute in onValueChangedAttributes) + { + MethodInfo callbackMethod = ReflectionUtility.GetMethod(target, onValueChangedAttribute.CallbackName); + if (callbackMethod != null && + callbackMethod.ReturnType == typeof(void) && + callbackMethod.GetParameters().Length == 0) + { + callbackMethod.Invoke(target, new object[] { }); + } + else + { + string warning = string.Format( + "{0} can invoke only methods with 'void' return type and 0 parameters", + onValueChangedAttribute.GetType().Name); + + Debug.LogWarning(warning, property.serializedObject.targetObject); + } + } + } + + public static bool IsEnabled(SerializedProperty property) + { + ReadOnlyAttribute readOnlyAttribute = GetAttribute(property); + if (readOnlyAttribute != null) + { + return false; + } + + EnableIfAttributeBase enableIfAttribute = GetAttribute(property); + if (enableIfAttribute == null) + { + return true; + } + + object target = GetTargetObjectWithProperty(property); + + // deal with enum conditions + if (enableIfAttribute.EnumValue != null) + { + Enum value = GetEnumValue(target, enableIfAttribute.Conditions[0]); + if (value != null) + { + bool matched = value.GetType().GetCustomAttribute() == null + ? enableIfAttribute.EnumValue.Equals(value) + : value.HasFlag(enableIfAttribute.EnumValue); + + return matched != enableIfAttribute.Inverted; + } + + string message = enableIfAttribute.GetType().Name + " needs a valid enum field, property or method name to work"; + Debug.LogWarning(message, property.serializedObject.targetObject); + + return false; + } + + // deal with normal conditions + List conditionValues = GetConditionValues(target, enableIfAttribute.Conditions); + if (conditionValues.Count > 0) + { + bool enabled = GetConditionsFlag(conditionValues, enableIfAttribute.ConditionOperator, enableIfAttribute.Inverted); + return enabled; + } + else + { + string message = enableIfAttribute.GetType().Name + " needs a valid boolean condition field, property or method name to work"; + Debug.LogWarning(message, property.serializedObject.targetObject); + + return false; + } + } + + public static bool IsVisible(SerializedProperty property) + { + ShowIfAttributeBase showIfAttribute = GetAttribute(property); + if (showIfAttribute == null) + { + return true; + } + + object target = GetTargetObjectWithProperty(property); + + // deal with enum conditions + if (showIfAttribute.EnumValue != null) + { + Enum value = GetEnumValue(target, showIfAttribute.Conditions[0]); + if (value != null) + { + bool matched = value.GetType().GetCustomAttribute() == null + ? showIfAttribute.EnumValue.Equals(value) + : value.HasFlag(showIfAttribute.EnumValue); + + return matched != showIfAttribute.Inverted; + } + + string message = showIfAttribute.GetType().Name + " needs a valid enum field, property or method name to work"; + Debug.LogWarning(message, property.serializedObject.targetObject); + + return false; + } + + // deal with normal conditions + List conditionValues = GetConditionValues(target, showIfAttribute.Conditions); + if (conditionValues.Count > 0) + { + bool enabled = GetConditionsFlag(conditionValues, showIfAttribute.ConditionOperator, showIfAttribute.Inverted); + return enabled; + } + else + { + string message = showIfAttribute.GetType().Name + " needs a valid boolean condition field, property or method name to work"; + Debug.LogWarning(message, property.serializedObject.targetObject); + + return false; + } + } + + /// + /// Gets an enum value from reflection. + /// + /// The target object. + /// Name of a field, property, or method that returns an enum. + /// Null if can't find an enum value. + internal static Enum GetEnumValue(object target, string enumName) + { + FieldInfo enumField = ReflectionUtility.GetField(target, enumName); + if (enumField != null && enumField.FieldType.IsSubclassOf(typeof(Enum))) + { + return (Enum)enumField.GetValue(target); + } + + PropertyInfo enumProperty = ReflectionUtility.GetProperty(target, enumName); + if (enumProperty != null && enumProperty.PropertyType.IsSubclassOf(typeof(Enum))) + { + return (Enum)enumProperty.GetValue(target); + } + + MethodInfo enumMethod = ReflectionUtility.GetMethod(target, enumName); + if (enumMethod != null && enumMethod.ReturnType.IsSubclassOf(typeof(Enum))) + { + return (Enum)enumMethod.Invoke(target, null); + } + + return null; + } + + internal static List GetConditionValues(object target, string[] conditions) + { + List conditionValues = new List(); + foreach (var condition in conditions) + { + FieldInfo conditionField = ReflectionUtility.GetField(target, condition); + if (conditionField != null && + conditionField.FieldType == typeof(bool)) + { + conditionValues.Add((bool)conditionField.GetValue(target)); + } + + PropertyInfo conditionProperty = ReflectionUtility.GetProperty(target, condition); + if (conditionProperty != null && + conditionProperty.PropertyType == typeof(bool)) + { + conditionValues.Add((bool)conditionProperty.GetValue(target)); + } + + MethodInfo conditionMethod = ReflectionUtility.GetMethod(target, condition); + if (conditionMethod != null && + conditionMethod.ReturnType == typeof(bool) && + conditionMethod.GetParameters().Length == 0) + { + conditionValues.Add((bool)conditionMethod.Invoke(target, null)); + } + } + + return conditionValues; + } + + internal static bool GetConditionsFlag(List conditionValues, EConditionOperator conditionOperator, bool invert) + { + bool flag; + if (conditionOperator == EConditionOperator.And) + { + flag = true; + foreach (var value in conditionValues) + { + flag = flag && value; + } + } + else + { + flag = false; + foreach (var value in conditionValues) + { + flag = flag || value; + } + } + + if (invert) + { + flag = !flag; + } + + return flag; + } + + public static Type GetPropertyType(SerializedProperty property) + { + object obj = GetTargetObjectOfProperty(property); + Type objType = obj.GetType(); + + return objType; + } + + /// + /// Gets the object the property represents. + /// + /// + /// + public static object GetTargetObjectOfProperty(SerializedProperty property) + { + if (property == null) + { + return null; + } + + string path = property.propertyPath.Replace(".Array.data[", "["); + object obj = property.serializedObject.targetObject; + string[] elements = path.Split('.'); + + foreach (var element in elements) + { + if (element.Contains("[")) + { + string elementName = element.Substring(0, element.IndexOf("[")); + int index = Convert.ToInt32(element.Substring(element.IndexOf("[")).Replace("[", "").Replace("]", "")); + obj = GetValue_Imp(obj, elementName, index); + } + else + { + obj = GetValue_Imp(obj, element); + } + } + + return obj; + } + + /// + /// Gets the object that the property is a member of + /// + /// + /// + public static object GetTargetObjectWithProperty(SerializedProperty property) + { + string path = property.propertyPath.Replace(".Array.data[", "["); + object obj = property.serializedObject.targetObject; + string[] elements = path.Split('.'); + + for (int i = 0; i < elements.Length - 1; i++) + { + string element = elements[i]; + if (element.Contains("[")) + { + string elementName = element.Substring(0, element.IndexOf("[")); + int index = Convert.ToInt32(element.Substring(element.IndexOf("[")).Replace("[", "").Replace("]", "")); + obj = GetValue_Imp(obj, elementName, index); + } + else + { + obj = GetValue_Imp(obj, element); + } + } + + return obj; + } + + private static object GetValue_Imp(object source, string name) + { + if (source == null) + { + return null; + } + + Type type = source.GetType(); + + while (type != null) + { + FieldInfo field = type.GetField(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); + if (field != null) + { + return field.GetValue(source); + } + + PropertyInfo property = type.GetProperty(name, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase); + if (property != null) + { + return property.GetValue(source, null); + } + + type = type.BaseType; + } + + return null; + } + + private static object GetValue_Imp(object source, string name, int index) + { + IEnumerable enumerable = GetValue_Imp(source, name) as IEnumerable; + if (enumerable == null) + { + return null; + } + + IEnumerator enumerator = enumerable.GetEnumerator(); + for (int i = 0; i <= index; i++) + { + if (!enumerator.MoveNext()) + { + return null; + } + } + + return enumerator.Current; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/PropertyUtility.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/PropertyUtility.cs.meta new file mode 100644 index 0000000..dce67c6 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/PropertyUtility.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 312eedcb79c7a5542b87c0b848e3e2fa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/ReflectionUtility.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/ReflectionUtility.cs new file mode 100644 index 0000000..57d28ea --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/ReflectionUtility.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using UnityEngine; + +namespace NaughtyAttributes.Editor +{ + public static class ReflectionUtility + { + public static IEnumerable GetAllFields(object target, Func predicate) + { + if (target == null) + { + Debug.LogError("The target object is null. Check for missing scripts."); + yield break; + } + + List types = GetSelfAndBaseTypes(target); + + for (int i = types.Count - 1; i >= 0; i--) + { + IEnumerable fieldInfos = types[i] + .GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.DeclaredOnly) + .Where(predicate); + + foreach (var fieldInfo in fieldInfos) + { + yield return fieldInfo; + } + } + } + + public static IEnumerable GetAllProperties(object target, Func predicate) + { + if (target == null) + { + Debug.LogError("The target object is null. Check for missing scripts."); + yield break; + } + + List types = GetSelfAndBaseTypes(target); + + for (int i = types.Count - 1; i >= 0; i--) + { + IEnumerable propertyInfos = types[i] + .GetProperties(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.DeclaredOnly) + .Where(predicate); + + foreach (var propertyInfo in propertyInfos) + { + yield return propertyInfo; + } + } + } + + public static IEnumerable GetAllMethods(object target, Func predicate) + { + if (target == null) + { + Debug.LogError("The target object is null. Check for missing scripts."); + yield break; + } + + List types = GetSelfAndBaseTypes(target); + + for (int i = types.Count - 1; i >= 0; i--) + { + IEnumerable methodInfos = types[i] + .GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.DeclaredOnly) + .Where(predicate); + + foreach (var methodInfo in methodInfos) + { + yield return methodInfo; + } + } + } + + public static FieldInfo GetField(object target, string fieldName) + { + return GetAllFields(target, f => f.Name.Equals(fieldName, StringComparison.Ordinal)).FirstOrDefault(); + } + + public static PropertyInfo GetProperty(object target, string propertyName) + { + return GetAllProperties(target, p => p.Name.Equals(propertyName, StringComparison.Ordinal)).FirstOrDefault(); + } + + public static MethodInfo GetMethod(object target, string methodName) + { + return GetAllMethods(target, m => m.Name.Equals(methodName, StringComparison.Ordinal)).FirstOrDefault(); + } + + public static Type GetListElementType(Type listType) + { + if (listType.IsGenericType) + { + return listType.GetGenericArguments()[0]; + } + else + { + return listType.GetElementType(); + } + } + + /// + /// Get type and all base types of target, sorted as following: + /// [target's type, base type, base's base type, ...] + /// + /// + /// + private static List GetSelfAndBaseTypes(object target) + { + List types = new List() + { + target.GetType() + }; + + while (types.Last().BaseType != null) + { + types.Add(types.Last().BaseType); + } + + return types; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/ReflectionUtility.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/ReflectionUtility.cs.meta new file mode 100644 index 0000000..73b6ea9 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/ReflectionUtility.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 1d86c581f02a55f458e36bf7e81e3084 +timeCreated: 1520258793 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/SavedBool.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/SavedBool.cs new file mode 100644 index 0000000..e463f49 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/SavedBool.cs @@ -0,0 +1,34 @@ +using UnityEditor; + +namespace NaughtyAttributes.Editor +{ + internal class SavedBool + { + private bool _value; + private string _name; + + public bool Value + { + get + { + return _value; + } + set + { + if (_value == value) + { + return; + } + + _value = value; + EditorPrefs.SetBool(_name, value); + } + } + + public SavedBool(string name, bool value) + { + _name = name; + _value = EditorPrefs.GetBool(name, value); + } + } +} \ No newline at end of file diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/SavedBool.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/SavedBool.cs.meta new file mode 100644 index 0000000..aebf007 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Editor/Utility/SavedBool.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 18613afe66b0c0344a2be5f430bf965a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test.meta new file mode 100644 index 0000000..6eca4f6 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ce2bd76b5676a434bb8a84254f67f1dc +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/AnimatorParamTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/AnimatorParamTest.cs new file mode 100644 index 0000000..c5a371c --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/AnimatorParamTest.cs @@ -0,0 +1,53 @@ +锘縰sing UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class AnimatorParamTest : MonoBehaviour + { + public Animator animator0; + + [AnimatorParam("animator0")] + public int hash0; + + [AnimatorParam("animator0")] + public string name0; + + public AnimatorParamNest1 nest1; + + [Button("Log 'hash0' and 'name0'")] + private void TestLog() + { + Debug.Log($"hash0 = {hash0}"); + Debug.Log($"name0 = {name0}"); + Debug.Log($"Animator.StringToHash(name0) = {Animator.StringToHash(name0)}"); + } + } + + [System.Serializable] + public class AnimatorParamNest1 + { + public Animator animator1; + private Animator Animator1 => animator1; + + [AnimatorParam("Animator1", AnimatorControllerParameterType.Bool)] + public int hash1; + + [AnimatorParam("Animator1", AnimatorControllerParameterType.Float)] + public string name1; + + public AnimatorParamNest2 nest2; + } + + [System.Serializable] + public class AnimatorParamNest2 + { + public Animator animator2; + private Animator GetAnimator2() => animator2; + + [AnimatorParam("GetAnimator2", AnimatorControllerParameterType.Int)] + public int hash1; + + [AnimatorParam("GetAnimator2", AnimatorControllerParameterType.Trigger)] + public string name1; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/AnimatorParamTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/AnimatorParamTest.cs.meta new file mode 100644 index 0000000..a8daa63 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/AnimatorParamTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9bff20ccdde00fc49a62bad6a4ef9982 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/BoxGroupTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/BoxGroupTest.cs new file mode 100644 index 0000000..789d1f8 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/BoxGroupTest.cs @@ -0,0 +1,32 @@ +锘縰sing UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class BoxGroupTest : MonoBehaviour + { + [BoxGroup("Integers")] + public int int0; + [BoxGroup("Integers")] + public int int1; + + [BoxGroup("Floats")] + public float float0; + [BoxGroup("Floats")] + public float float1; + + [BoxGroup("Sliders")] + [MinMaxSlider(0, 1)] + public Vector2 slider0; + [BoxGroup("Sliders")] + [MinMaxSlider(0, 1)] + public Vector2 slider1; + + public string str0; + public string str1; + + [BoxGroup] + public Transform trans0; + [BoxGroup] + public Transform trans1; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/BoxGroupTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/BoxGroupTest.cs.meta new file mode 100644 index 0000000..0c5ee54 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/BoxGroupTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3920f5ea384951b4990e4d9e8032d12e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ButtonTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ButtonTest.cs new file mode 100644 index 0000000..d7f6f04 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ButtonTest.cs @@ -0,0 +1,39 @@ +using System.Collections; +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ButtonTest : MonoBehaviour + { + public int myInt; + + [Button(enabledMode: EButtonEnableMode.Always)] + private void IncrementMyInt() + { + myInt++; + } + + [Button("Decrement My Int", EButtonEnableMode.Editor)] + private void DecrementMyInt() + { + myInt--; + } + + [Button(enabledMode: EButtonEnableMode.Playmode)] + private void LogMyInt(string prefix = "MyInt = ") + { + Debug.Log(prefix + myInt); + } + + [Button("StartCoroutine")] + private IEnumerator IncrementMyIntCoroutine() + { + int seconds = 5; + for (int i = 0; i < seconds; i++) + { + myInt++; + yield return new WaitForSeconds(1.0f); + } + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ButtonTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ButtonTest.cs.meta new file mode 100644 index 0000000..1d7d58f --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ButtonTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b592f12a9f69ac3408f6f870762232c7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/CurveRangeTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/CurveRangeTest.cs new file mode 100644 index 0000000..f33f2d2 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/CurveRangeTest.cs @@ -0,0 +1,37 @@ +锘縰sing UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class CurveRangeTest : MonoBehaviour + { + [CurveRange(0f, 0f, 1f, 1f, EColor.Yellow)] + public AnimationCurve[] curves; + + [CurveRange(-1, -1, 1, 1, EColor.Red)] + public AnimationCurve curve; + + [CurveRange(EColor.Orange)] + public AnimationCurve curve1; + + [CurveRange(0, 0, 10, 10)] + public AnimationCurve curve2; + + public CurveRangeNest1 nest1; + + [System.Serializable] + public class CurveRangeNest1 + { + [CurveRange(0, 0, 1, 1, EColor.Green)] + public AnimationCurve curve; + + public CurveRangeNest2 nest2; + } + + [System.Serializable] + public class CurveRangeNest2 + { + [CurveRange(0, 0, 5, 5, EColor.Blue)] + public AnimationCurve curve; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/CurveRangeTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/CurveRangeTest.cs.meta new file mode 100644 index 0000000..e43f8f0 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/CurveRangeTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6587b100d001e7e46b9aaae7f1180b40 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/DisableIfTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/DisableIfTest.cs new file mode 100644 index 0000000..6913166 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/DisableIfTest.cs @@ -0,0 +1,120 @@ +锘縰sing System; +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class DisableIfTest : MonoBehaviour + { + public bool disable1; + public bool disable2; + public DisableIfEnum enum1; + [EnumFlags] public DisableIfEnumFlag enum2; + + [DisableIf(EConditionOperator.And, "disable1", "disable2")] + [ReorderableList] + public int[] disableIfAll; + + [DisableIf(EConditionOperator.Or, "disable1", "disable2")] + [ReorderableList] + public int[] disableIfAny; + + [DisableIf("enum1", DisableIfEnum.Case0)] + [ReorderableList] + public int[] disableIfEnum; + + [DisableIf("enum2", DisableIfEnumFlag.Flag0)] + [ReorderableList] + public int[] disableIfEnumFlag; + + [DisableIf("enum2", DisableIfEnumFlag.Flag0 | DisableIfEnumFlag.Flag1)] + [ReorderableList] + public int[] disableIfEnumFlagMulti; + + public DisableIfNest1 nest1; + } + + [System.Serializable] + public class DisableIfNest1 + { + public bool disable1; + public bool disable2; + public DisableIfEnum enum1; + [EnumFlags] public DisableIfEnumFlag enum2; + public bool Disable1 { get { return disable1; } } + public bool Disable2 { get { return disable2; } } + public DisableIfEnum Enum1 { get { return enum1; } } + public DisableIfEnumFlag Enum2 { get { return enum2; } } + + [DisableIf(EConditionOperator.And, "Disable1", "Disable2")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int disableIfAll = 1; + + [DisableIf(EConditionOperator.Or, "Disable1", "Disable2")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int disableIfAny = 2; + + [DisableIf("Enum1", DisableIfEnum.Case1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int disableIfEnum = 3; + + [DisableIf("Enum2", DisableIfEnumFlag.Flag0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int disableIfEnumFlag; + + [DisableIf("Enum2", DisableIfEnumFlag.Flag0 | DisableIfEnumFlag.Flag1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int disableIfEnumFlagMulti; + + public DisableIfNest2 nest2; + } + + [System.Serializable] + public class DisableIfNest2 + { + public bool disable1; + public bool disable2; + public DisableIfEnum enum1; + [EnumFlags] public DisableIfEnumFlag enum2; + public bool GetDisable1() { return disable1; } + public bool GetDisable2() { return disable2; } + public DisableIfEnum GetEnum1() { return enum1; } + public DisableIfEnumFlag GetEnum2() { return enum2; } + + [DisableIf(EConditionOperator.And, "GetDisable1", "GetDisable2")] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 enableIfAll = new Vector2(0.25f, 0.75f); + + [DisableIf(EConditionOperator.Or, "GetDisable1", "GetDisable2")] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 enableIfAny = new Vector2(0.25f, 0.75f); + + [DisableIf("GetEnum1", DisableIfEnum.Case2)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 enableIfEnum = new Vector2(0.25f, 0.75f); + + [DisableIf("GetEnum2", DisableIfEnumFlag.Flag0)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 disableIfEnumFlag; + + [DisableIf("GetEnum2", DisableIfEnumFlag.Flag0 | DisableIfEnumFlag.Flag1)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 disableIfEnumFlagMulti; + } + + [System.Serializable] + public enum DisableIfEnum + { + Case0, + Case1, + Case2 + } + + [Flags] + public enum DisableIfEnumFlag + { + Flag0 = 1, + Flag1 = 2, + Flag2 = 4, + Flag3 = 8 + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/DisableIfTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/DisableIfTest.cs.meta new file mode 100644 index 0000000..c3a1e7a --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/DisableIfTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0e48a088cb96287448c3be58932bfcb7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/DropdownTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/DropdownTest.cs new file mode 100644 index 0000000..723eca8 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/DropdownTest.cs @@ -0,0 +1,45 @@ +using UnityEngine; +using System.Collections.Generic; + +namespace NaughtyAttributes.Test +{ + public class DropdownTest : MonoBehaviour + { + [Dropdown("intValues")] + public int intValue; + +#pragma warning disable 414 + private int[] intValues = new int[] { 1, 2, 3 }; +#pragma warning restore 414 + + public DropdownNest1 nest1; + } + + [System.Serializable] + public class DropdownNest1 + { + [Dropdown("StringValues")] + public string stringValue; + + private List StringValues { get { return new List() { "A", "B", "C" }; } } + + public DropdownNest2 nest2; + } + + [System.Serializable] + public class DropdownNest2 + { + [Dropdown("GetVectorValues")] + public Vector3 vectorValue; + + private DropdownList GetVectorValues() + { + return new DropdownList() + { + { "Right", Vector3.right }, + { "Up", Vector3.up }, + { "Forward", Vector3.forward } + }; + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/DropdownTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/DropdownTest.cs.meta new file mode 100644 index 0000000..ec7fa24 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/DropdownTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3855e37cd6b01194e8166573c7c4b37d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/EnableIfTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/EnableIfTest.cs new file mode 100644 index 0000000..6e744f5 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/EnableIfTest.cs @@ -0,0 +1,120 @@ +using System; +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class EnableIfTest : MonoBehaviour + { + public bool enable1; + public bool enable2; + public EnableIfEnum enum1; + [EnumFlags] public EnableIfEnumFlag enum2; + + [EnableIf(EConditionOperator.And, "enable1", "enable2")] + [ReorderableList] + public int[] enableIfAll; + + [EnableIf(EConditionOperator.Or, "enable1", "enable2")] + [ReorderableList] + public int[] enableIfAny; + + [EnableIf("enum1", EnableIfEnum.Case0)] + [ReorderableList] + public int[] enableIfEnum; + + [EnableIf("enum2", EnableIfEnumFlag.Flag0)] + [ReorderableList] + public int[] enableIfEnumFlag; + + [EnableIf("enum2", EnableIfEnumFlag.Flag0 | EnableIfEnumFlag.Flag1)] + [ReorderableList] + public int[] enableIfEnumFlagMulti; + + public EnableIfNest1 nest1; + } + + [System.Serializable] + public class EnableIfNest1 + { + public bool enable1; + public bool enable2; + public EnableIfEnum enum1; + [EnumFlags] public EnableIfEnumFlag enum2; + public bool Enable1 { get { return enable1; } } + public bool Enable2 { get { return enable2; } } + public EnableIfEnum Enum1 { get { return enum1; } } + public EnableIfEnumFlag Enum2 { get { return enum2; } } + + [EnableIf(EConditionOperator.And, "Enable1", "Enable2")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int enableIfAll; + + [EnableIf(EConditionOperator.Or, "Enable1", "Enable2")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int enableIfAny; + + [EnableIf("Enum1", EnableIfEnum.Case1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int enableIfEnum; + + [EnableIf("Enum2", EnableIfEnumFlag.Flag0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int enableIfEnumFlag; + + [EnableIf("Enum2", EnableIfEnumFlag.Flag0 | EnableIfEnumFlag.Flag1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int enableIfEnumFlagMulti; + + public EnableIfNest2 nest2; + } + + [System.Serializable] + public class EnableIfNest2 + { + public bool enable1; + public bool enable2; + public EnableIfEnum enum1; + [EnumFlags] public EnableIfEnumFlag enum2; + public bool GetEnable1() { return enable1; } + public bool GetEnable2() { return enable2; } + public EnableIfEnum GetEnum1() { return enum1; } + public EnableIfEnumFlag GetEnum2() { return enum2; } + + [EnableIf(EConditionOperator.And, "GetEnable1", "GetEnable2")] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 enableIfAll = new Vector2(0.25f, 0.75f); + + [EnableIf(EConditionOperator.Or, "GetEnable1", "GetEnable2")] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 enableIfAny = new Vector2(0.25f, 0.75f); + + [EnableIf("GetEnum1", EnableIfEnum.Case2)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 enableIfEnum = new Vector2(0.25f, 0.75f); + + [EnableIf("GetEnum2", EnableIfEnumFlag.Flag0)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 enableIfEnumFlag; + + [EnableIf("GetEnum2", EnableIfEnumFlag.Flag0 | EnableIfEnumFlag.Flag1)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 enableIfEnumFlagMulti; + } + + [System.Serializable] + public enum EnableIfEnum + { + Case0, + Case1, + Case2 + } + + [Flags] + public enum EnableIfEnumFlag + { + Flag0 = 1, + Flag1 = 2, + Flag2 = 4, + Flag3 = 8 + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/EnableIfTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/EnableIfTest.cs.meta new file mode 100644 index 0000000..c22fe7b --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/EnableIfTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bed506d8be3a10f45bec4bf2237bec87 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/EnumFlagsTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/EnumFlagsTest.cs new file mode 100644 index 0000000..9472334 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/EnumFlagsTest.cs @@ -0,0 +1,39 @@ +锘縰sing UnityEngine; + +namespace NaughtyAttributes.Test +{ + public enum TestEnum + { + None = 0, + B = 1 << 0, + C = 1 << 1, + D = 1 << 2, + E = 1 << 3, + F = 1 << 4, + All = ~0 + } + + public class EnumFlagsTest : MonoBehaviour + { + [EnumFlags] + public TestEnum flags0; + + public EnumFlagsNest1 nest1; + } + + [System.Serializable] + public class EnumFlagsNest1 + { + [EnumFlags] + public TestEnum flags1; + + public EnumFlagsNest2 nest2; + } + + [System.Serializable] + public class EnumFlagsNest2 + { + [EnumFlags] + public TestEnum flags2; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/EnumFlagsTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/EnumFlagsTest.cs.meta new file mode 100644 index 0000000..b548675 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/EnumFlagsTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7b7f6b84ce0d7674d8a386fde729279c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ExpandableTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ExpandableTest.cs new file mode 100644 index 0000000..8c08b8c --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ExpandableTest.cs @@ -0,0 +1,31 @@ +锘縰sing UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ExpandableTest : MonoBehaviour + { + // See #294 + public int precedingField = 5; + + [Expandable] + public ScriptableObject obj0; + + public ExpandableScriptableObjectNest1 nest1; + } + + [System.Serializable] + public class ExpandableScriptableObjectNest1 + { + [Expandable] + public ScriptableObject obj1; + + public ExpandableScriptableObjectNest2 nest2; + } + + [System.Serializable] + public class ExpandableScriptableObjectNest2 + { + [Expandable] + public ScriptableObject obj2; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ExpandableTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ExpandableTest.cs.meta new file mode 100644 index 0000000..ffa82d1 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ExpandableTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 64c4c9aee2b494d44be9bb0b7f12ed7c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/FoldoutTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/FoldoutTest.cs new file mode 100644 index 0000000..c171cc8 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/FoldoutTest.cs @@ -0,0 +1,32 @@ +锘縰sing UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class FoldoutTest : MonoBehaviour + { + [Foldout("Integers")] + public int int0; + [Foldout("Integers")] + public int int1; + + [Foldout("Floats")] + public float float0; + [Foldout("Floats")] + public float float1; + + [Foldout("Sliders")] + [MinMaxSlider(0, 1)] + public Vector2 slider0; + [Foldout("Sliders")] + [MinMaxSlider(0, 1)] + public Vector2 slider1; + + public string str0; + public string str1; + + [Foldout("Transforms")] + public Transform trans0; + [Foldout("Transforms")] + public Transform trans1; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/FoldoutTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/FoldoutTest.cs.meta new file mode 100644 index 0000000..8c72e06 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/FoldoutTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3b437215d92efa74ea85ff726ca0dd09 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/HideIfTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/HideIfTest.cs new file mode 100644 index 0000000..ec5c7c1 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/HideIfTest.cs @@ -0,0 +1,119 @@ +锘縰sing System; +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class HideIfTest : MonoBehaviour + { + public bool hide1; + public bool hide2; + public HideIfEnum enum1; + [EnumFlags] public HideIfEnumFlag enum2; + + [HideIf(EConditionOperator.And, "hide1", "hide2")] + [ReorderableList] + public int[] hideIfAll; + + [HideIf(EConditionOperator.Or, "hide1", "hide2")] + [ReorderableList] + public int[] hideIfAny; + + [HideIf("enum1", HideIfEnum.Case0)] + [ReorderableList] + public int[] hideIfEnum; + + [HideIf("enum2", HideIfEnumFlag.Flag0)] + [ReorderableList] + public int[] hideIfEnumFlag; + + [HideIf("enum2", HideIfEnumFlag.Flag0 | HideIfEnumFlag.Flag1)] + [ReorderableList] + public int[] hideIfEnumFlagMulti; + + public HideIfNest1 nest1; + } + + [System.Serializable] + public class HideIfNest1 + { + public bool hide1; + public bool hide2; + public HideIfEnum enum1; + [EnumFlags] public HideIfEnumFlag enum2; + public bool Hide1 { get { return hide1; } } + public bool Hide2 { get { return hide2; } } + public HideIfEnum Enum1 { get { return enum1; } } + public HideIfEnumFlag Enum2 { get { return enum2; } } + + [HideIf(EConditionOperator.And, "Hide1", "Hide2")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int hideIfAll; + + [HideIf(EConditionOperator.Or, "Hide1", "Hide2")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int hideIfAny; + + [HideIf("Enum1", HideIfEnum.Case1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int hideIfEnum; + + [HideIf("Enum2", HideIfEnumFlag.Flag0)] + [AllowNesting] + public int hideIfEnumFlag; + + [HideIf("Enum2", HideIfEnumFlag.Flag0 | HideIfEnumFlag.Flag1)] + [AllowNesting] + public int hideIfEnumFlagMulti; + + public HideIfNest2 nest2; + } + + [System.Serializable] + public class HideIfNest2 + { + public bool hide1; + public bool hide2; + public HideIfEnum enum1; + [EnumFlags] public HideIfEnumFlag enum2; + public bool GetHide1() { return hide1; } + public bool GetHide2() { return hide2; } + public HideIfEnum GetEnum1() { return enum1; } + public HideIfEnumFlag GetEnum2() { return enum2; } + + [HideIf(EConditionOperator.And, "GetHide1", "GetHide2")] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 hideIfAll = new Vector2(0.25f, 0.75f); + + [HideIf(EConditionOperator.Or, "GetHide1", "GetHide2")] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 hideIfAny = new Vector2(0.25f, 0.75f); + + [HideIf("GetEnum1", HideIfEnum.Case2)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 hideIfEnum = new Vector2(0.25f, 0.75f); + + [HideIf("GetEnum2", HideIfEnumFlag.Flag0)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 hideIfEnumFlag; + + [HideIf("GetEnum2", HideIfEnumFlag.Flag0 | HideIfEnumFlag.Flag1)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 hideIfEnumFlagMulti; + } + + public enum HideIfEnum + { + Case0, + Case1, + Case2 + } + + [Flags] + public enum HideIfEnumFlag + { + Flag0 = 1, + Flag1 = 2, + Flag2 = 4, + Flag3 = 8 + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/HideIfTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/HideIfTest.cs.meta new file mode 100644 index 0000000..6115ad2 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/HideIfTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3cf166cb519e666419bb79b0c50c5ee1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/HorizontalLineTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/HorizontalLineTest.cs new file mode 100644 index 0000000..2bbe587 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/HorizontalLineTest.cs @@ -0,0 +1,51 @@ +锘縰sing UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class HorizontalLineTest : MonoBehaviour + { + [HorizontalLine(color: EColor.Black)] + [Header("Black")] + [HorizontalLine(color: EColor.Blue)] + [Header("Blue")] + [HorizontalLine(color: EColor.Gray)] + [Header("Gray")] + [HorizontalLine(color: EColor.Green)] + [Header("Green")] + [HorizontalLine(color: EColor.Indigo)] + [Header("Indigo")] + [HorizontalLine(color: EColor.Orange)] + [Header("Orange")] + [HorizontalLine(color: EColor.Pink)] + [Header("Pink")] + [HorizontalLine(color: EColor.Red)] + [Header("Red")] + [HorizontalLine(color: EColor.Violet)] + [Header("Violet")] + [HorizontalLine(color: EColor.White)] + [Header("White")] + [HorizontalLine(color: EColor.Yellow)] + [Header("Yellow")] + [HorizontalLine(10.0f)] + [Header("Thick")] + public int line0; + + public HorizontalLineNest1 nest1; + } + + [System.Serializable] + public class HorizontalLineNest1 + { + [HorizontalLine] + public int line1; + + public HorizontalLineNest2 nest2; + } + + [System.Serializable] + public class HorizontalLineNest2 + { + [HorizontalLine] + public int line2; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/HorizontalLineTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/HorizontalLineTest.cs.meta new file mode 100644 index 0000000..4d7ff37 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/HorizontalLineTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5cc6d3f8d4a53374887b3d620a6972e3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/InfoBoxTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/InfoBoxTest.cs new file mode 100644 index 0000000..a1dd5f8 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/InfoBoxTest.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class InfoBoxTest : MonoBehaviour + { + [InfoBox("Normal", EInfoBoxType.Normal)] + public int normal; + + public InfoBoxNest1 nest1; + } + + [System.Serializable] + public class InfoBoxNest1 + { + [InfoBox("Warning", EInfoBoxType.Warning)] + public int warning; + + public InfoBoxNest2 nest2; + } + + [System.Serializable] + public class InfoBoxNest2 + { + [InfoBox("Error", EInfoBoxType.Error)] + public int error; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/InfoBoxTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/InfoBoxTest.cs.meta new file mode 100644 index 0000000..68dc824 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/InfoBoxTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0dcb08e489c17644e9eacaa1ec5fe781 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/InputAxisTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/InputAxisTest.cs new file mode 100644 index 0000000..2080e30 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/InputAxisTest.cs @@ -0,0 +1,34 @@ +锘縰sing UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class InputAxisTest : MonoBehaviour + { + [InputAxis] + public string inputAxis0; + + public InputAxisNest1 nest1; + + [Button] + private void LogInputAxis0() + { + Debug.Log(inputAxis0); + } + } + + [System.Serializable] + public class InputAxisNest1 + { + [InputAxis] + public string inputAxis1; + + public InputAxisNest2 nest2; + } + + [System.Serializable] + public struct InputAxisNest2 + { + [InputAxis] + public string inputAxis2; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/InputAxisTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/InputAxisTest.cs.meta new file mode 100644 index 0000000..b44a862 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/InputAxisTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e0cc8a31c22090847b75538c0ed2d2fc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/LabelTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/LabelTest.cs new file mode 100644 index 0000000..5f40e6e --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/LabelTest.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class LabelTest : MonoBehaviour + { + [Label("Label 0")] + public int int0; + + public LabelNest1 nest1; + } + + [System.Serializable] + public class LabelNest1 + { + [Label("Label 1")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int int1; + + public LabelNest2 nest2; + } + + [System.Serializable] + public class LabelNest2 + { + [Label("Label 2")] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 vector2; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/LabelTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/LabelTest.cs.meta new file mode 100644 index 0000000..114af72 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/LabelTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7488af014527ebf42af5c4fc4d5f4f5b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/LayerTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/LayerTest.cs new file mode 100644 index 0000000..52ac6fe --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/LayerTest.cs @@ -0,0 +1,46 @@ +锘縰sing UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class LayerTest : MonoBehaviour + { + [Layer] + public int layerNumber0; + + [Layer] + public string layerName0; + + public LayerNest1 nest1; + + [Button] + public void DebugLog() + { + Debug.LogFormat("{0} = {1}", nameof(layerNumber0), layerNumber0); + Debug.LogFormat("{0} = {1}", nameof(layerName0), layerName0); + Debug.LogFormat("LayerToName({0}) = {1}", layerNumber0, LayerMask.LayerToName(layerNumber0)); + Debug.LogFormat("NameToLayer({0}) = {1}", layerName0, LayerMask.NameToLayer(layerName0)); + } + } + + [System.Serializable] + public class LayerNest1 + { + [Layer] + public int layerNumber1; + + [Layer] + public string layerName1; + + public LayerNest2 nest2; + } + + [System.Serializable] + public struct LayerNest2 + { + [Layer] + public int layerNumber2; + + [Layer] + public string layerName2; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/LayerTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/LayerTest.cs.meta new file mode 100644 index 0000000..d66d32c --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/LayerTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 460459d6ac76acd4d872f94cf444e6fa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/MinMaxSliderTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/MinMaxSliderTest.cs new file mode 100644 index 0000000..f1ec981 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/MinMaxSliderTest.cs @@ -0,0 +1,28 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class MinMaxSliderTest : MonoBehaviour + { + [MinMaxSlider(0.0f, 1.0f)] + public Vector2 minMaxSlider0 = new Vector2(0.25f, 0.75f); + + public MinMaxSliderNest1 nest1; + } + + [System.Serializable] + public class MinMaxSliderNest1 + { + [MinMaxSlider(0.0f, 1.0f)] + public Vector2 minMaxSlider1 = new Vector2(0.25f, 0.75f); + + public MinMaxSliderNest2 nest2; + } + + [System.Serializable] + public class MinMaxSliderNest2 + { + [MinMaxSlider(1, 11)] + public Vector2Int minMaxSlider2 = new Vector2Int(6, 11); + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/MinMaxSliderTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/MinMaxSliderTest.cs.meta new file mode 100644 index 0000000..7580a81 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/MinMaxSliderTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fd67fbde6acdd6a44944f12e507067c5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/MinMaxValueTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/MinMaxValueTest.cs new file mode 100644 index 0000000..43d1586 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/MinMaxValueTest.cs @@ -0,0 +1,129 @@ +锘縰sing UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class MinMaxValueTest : MonoBehaviour + { + [MinValue(0)] + public int min0Int; + + [MaxValue(0)] + public int max0Int; + + [MinValue(0), MaxValue(1)] + public float range01Float; + + [MinValue(0), MaxValue(1)] + public Vector2 range01Vector2; + + [MinValue(0), MaxValue(1)] + public Vector3 range01Vector3; + + [MinValue(0), MaxValue(1)] + public Vector4 range01Vector4; + + [MinValue(0)] + public Vector2Int min0Vector2Int; + + [MaxValue(100)] + public Vector2Int max100Vector2Int; + + [MinValue(0)] + public Vector3Int min0Vector3Int; + + [MaxValue(100)] + public Vector3Int max100Vector3Int; + + public MinMaxValueNest1 nest1; + } + + [System.Serializable] + public class MinMaxValueNest1 + { + [MinValue(0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int min0Int; + + [MaxValue(0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int max0Int; + + [MinValue(0), MaxValue(1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public float range01Float; + + [MinValue(0), MaxValue(1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector2 range01Vector2; + + [MinValue(0), MaxValue(1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector3 range01Vector3; + + [MinValue(0), MaxValue(1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector4 range01Vector4; + + [MinValue(0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector2Int min0Vector2Int; + + [MaxValue(100)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector2Int max100Vector2Int; + + [MinValue(0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector3Int min0Vector3Int; + + [MaxValue(100)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector3Int max100Vector3Int; + + public MinMaxValueNest2 nest2; + } + + [System.Serializable] + public class MinMaxValueNest2 + { + [MinValue(0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int min0Int; + + [MaxValue(0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int max0Int; + + [MinValue(0), MaxValue(1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public float range01Float; + + [MinValue(0), MaxValue(1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector2 range01Vector2; + + [MinValue(0), MaxValue(1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector3 range01Vector3; + + [MinValue(0), MaxValue(1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector4 range01Vector4; + + [MinValue(0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector2Int min0Vector2Int; + + [MaxValue(100)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector2Int max100Vector2Int; + + [MinValue(0)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector3Int min0Vector3Int; + + [MaxValue(100)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Vector3Int max100Vector3Int; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/MinMaxValueTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/MinMaxValueTest.cs.meta new file mode 100644 index 0000000..328dee3 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/MinMaxValueTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 450a05787c54e6b4fa88ffe223bcee87 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/NaughtyAttributes.Test.asmdef b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/NaughtyAttributes.Test.asmdef new file mode 100644 index 0000000..910f548 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/NaughtyAttributes.Test.asmdef @@ -0,0 +1,14 @@ +{ + "name": "NaughtyAttributes.Test", + "references": [ + "NaughtyAttributes.Core" + ], + "optionalUnityReferences": [], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [] +} \ No newline at end of file diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/NaughtyAttributes.Test.asmdef.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/NaughtyAttributes.Test.asmdef.meta new file mode 100644 index 0000000..c3d49e7 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/NaughtyAttributes.Test.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: df1dea26b8503004d92d621e88aa9421 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/OnValueChangedTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/OnValueChangedTest.cs new file mode 100644 index 0000000..360df14 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/OnValueChangedTest.cs @@ -0,0 +1,51 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class OnValueChangedTest : MonoBehaviour + { + [OnValueChanged("OnValueChangedMethod1")] + [OnValueChanged("OnValueChangedMethod2")] + public int int0; + + private void OnValueChangedMethod1() + { + Debug.LogFormat("int0: {0}", int0); + } + + private void OnValueChangedMethod2() + { + Debug.LogFormat("int0: {0}", int0); + } + + public OnValueChangedNest1 nest1; + } + + [System.Serializable] + public class OnValueChangedNest1 + { + [OnValueChanged("OnValueChangedMethod")] + [AllowNesting] + public int int1; + + private void OnValueChangedMethod() + { + Debug.LogFormat("int1: {0}", int1); + } + + public OnValueChangedNest2 nest2; + } + + [System.Serializable] + public class OnValueChangedNest2 + { + [OnValueChanged("OnValueChangedMethod")] + [AllowNesting] + public int int2; + + private void OnValueChangedMethod() + { + Debug.LogFormat("int2: {0}", int2); + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/OnValueChangedTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/OnValueChangedTest.cs.meta new file mode 100644 index 0000000..bfd1ab2 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/OnValueChangedTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ff1df679e5b32f64bb106752c63933fa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ProgressBarTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ProgressBarTest.cs new file mode 100644 index 0000000..0534812 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ProgressBarTest.cs @@ -0,0 +1,35 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ProgressBarTest : MonoBehaviour + { + [Header("Constant ProgressBar")] + [ProgressBar("Health", 100, EColor.Red)] + public float health = 50.0f; + + [Header("Nested ProgressBar")] + public ProgressBarNest1 nest1; + + [Header("Dynamic ProgressBar")] + [ProgressBar("Elixir", "maxElixir", color: EColor.Violet)] + public int elixir = 50; + public int maxElixir = 100; + } + + [System.Serializable] + public class ProgressBarNest1 + { + [ProgressBar("Mana", 100, EColor.Blue)] + public float mana = 25.0f; + + public ProgressBarNest2 nest2; + } + + [System.Serializable] + public class ProgressBarNest2 + { + [ProgressBar("Stamina", 100, EColor.Green)] + public float stamina = 75.0f; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ProgressBarTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ProgressBarTest.cs.meta new file mode 100644 index 0000000..db88429 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ProgressBarTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 96ca4c27fc649764b9d1625f1740cb9e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ReadOnlyTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ReadOnlyTest.cs new file mode 100644 index 0000000..d832097 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ReadOnlyTest.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ReadOnlyTest : MonoBehaviour + { + [ReadOnly] + public int readOnlyInt = 5; + + public ReadOnlyNest1 nest1; + } + + [System.Serializable] + public class ReadOnlyNest1 + { + [ReadOnly] + [AllowNesting] + public float readOnlyFloat = 3.14f; + + public ReadOnlyNest2 nest2; + } + + [System.Serializable] + public struct ReadOnlyNest2 + { + [ReadOnly] + [AllowNesting] + public string readOnlyString; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ReadOnlyTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ReadOnlyTest.cs.meta new file mode 100644 index 0000000..d65c60c --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ReadOnlyTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5443d37a05e188846bda9b05b067184e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ReorderableListTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ReorderableListTest.cs new file mode 100644 index 0000000..6b3e439 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ReorderableListTest.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ReorderableListTest : MonoBehaviour + { + [ReorderableList] + public int[] intArray; + + [ReorderableList] + public List vectorList; + + [ReorderableList] + public List structList; + + [ReorderableList] + public GameObject[] gameObjectsList; + + [ReorderableList] + public List transformsList; + + [ReorderableList] + public List monoBehavioursList; + } + + [System.Serializable] + public struct SomeStruct + { + public int Int; + public float Float; + public Vector3 Vector; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ReorderableListTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ReorderableListTest.cs.meta new file mode 100644 index 0000000..b993018 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ReorderableListTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c93fde7cd79390148ac576c3a159a77b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/RequiredTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/RequiredTest.cs new file mode 100644 index 0000000..ea04936 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/RequiredTest.cs @@ -0,0 +1,30 @@ +锘縰sing UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class RequiredTest : MonoBehaviour + { + [Required] + public Transform trans0; + + public RequiredNest1 nest1; + } + + [System.Serializable] + public class RequiredNest1 + { + [Required] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Transform trans1; + + public RequiredNest2 nest2; + } + + [System.Serializable] + public class RequiredNest2 + { + [Required("trans2 is invalid custom message - hohoho")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public Transform trans2; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/RequiredTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/RequiredTest.cs.meta new file mode 100644 index 0000000..bc51260 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/RequiredTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9c8c10b2234650d42b2a8efad6b413db +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ResizableTextAreaTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ResizableTextAreaTest.cs new file mode 100644 index 0000000..aa57a3d --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ResizableTextAreaTest.cs @@ -0,0 +1,28 @@ +锘縰sing UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ResizableTextAreaTest : MonoBehaviour + { + [ResizableTextArea] + public string text0; + + public ResizableTextAreaNest1 nest1; + } + + [System.Serializable] + public class ResizableTextAreaNest1 + { + [ResizableTextArea] + public string text1; + + public ResizableTextAreaNest2 nest2; + } + + [System.Serializable] + public class ResizableTextAreaNest2 + { + [ResizableTextArea] + public string text2; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ResizableTextAreaTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ResizableTextAreaTest.cs.meta new file mode 100644 index 0000000..380566d --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ResizableTextAreaTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: fb4f4bb2e3e063340a24f4bb24528bb5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/SceneTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/SceneTest.cs new file mode 100644 index 0000000..70d37c0 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/SceneTest.cs @@ -0,0 +1,28 @@ +锘縰sing UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class SceneTest : MonoBehaviour + { + [Scene] + public string scene0; + + public SceneNest1 nest1; + } + + [System.Serializable] + public class SceneNest1 + { + [Scene] + public string scene1; + + public SceneNest2 nest2; + } + + [System.Serializable] + public struct SceneNest2 + { + [Scene] + public int scene2; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/SceneTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/SceneTest.cs.meta new file mode 100644 index 0000000..3ceca2f --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/SceneTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 281a85803caf74a459439020a0840fa4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowAssetPreviewTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowAssetPreviewTest.cs new file mode 100644 index 0000000..c20b754 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowAssetPreviewTest.cs @@ -0,0 +1,37 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ShowAssetPreviewTest : MonoBehaviour + { + [ShowAssetPreview] + public Sprite sprite0; + + [ShowAssetPreview(96, 96)] + public GameObject prefab0; + + public ShowAssetPreviewNest1 nest1; + } + + [System.Serializable] + public class ShowAssetPreviewNest1 + { + [ShowAssetPreview] + public Sprite sprite1; + + [ShowAssetPreview(96, 96)] + public GameObject prefab1; + + public ShowAssetPreviewNest2 nest2; + } + + [System.Serializable] + public class ShowAssetPreviewNest2 + { + [ShowAssetPreview] + public Sprite sprite2; + + [ShowAssetPreview(96, 96)] + public GameObject prefab2; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowAssetPreviewTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowAssetPreviewTest.cs.meta new file mode 100644 index 0000000..b636853 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowAssetPreviewTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 705c14aa9ecaa274289972381f471367 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowIfTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowIfTest.cs new file mode 100644 index 0000000..fe19d63 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowIfTest.cs @@ -0,0 +1,119 @@ +using System; +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ShowIfTest : MonoBehaviour + { + public bool show1; + public bool show2; + public ShowIfEnum enum1; + [EnumFlags] public ShowIfEnumFlag enum2; + + [ShowIf(EConditionOperator.And, "show1", "show2")] + [ReorderableList] + public int[] showIfAll; + + [ShowIf(EConditionOperator.Or, "show1", "show2")] + [ReorderableList] + public int[] showIfAny; + + [ShowIf("enum1", ShowIfEnum.Case0)] + [ReorderableList] + public int[] showIfEnum; + + [ShowIf("enum2", ShowIfEnumFlag.Flag0)] + [ReorderableList] + public int[] showIfEnumFlag; + + [ShowIf("enum2", ShowIfEnumFlag.Flag0 | ShowIfEnumFlag.Flag1)] + [ReorderableList] + public int[] showIfEnumFlagMulti; + + public ShowIfNest1 nest1; + } + + [System.Serializable] + public class ShowIfNest1 + { + public bool show1; + public bool show2; + public ShowIfEnum enum1; + [EnumFlags] public ShowIfEnumFlag enum2; + public bool Show1 { get { return show1; } } + public bool Show2 { get { return show2; } } + public ShowIfEnum Enum1 { get { return enum1; } } + public ShowIfEnumFlag Enum2 { get { return enum2; } } + + [ShowIf(EConditionOperator.And, "Show1", "Show2")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int showIfAll; + + [ShowIf(EConditionOperator.Or, "Show1", "Show2")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int showIfAny; + + [ShowIf("Enum1", ShowIfEnum.Case1)] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int showIfEnum; + + [ShowIf("Enum2", ShowIfEnumFlag.Flag0)] + [AllowNesting] + public int showIfEnumFlag; + + [ShowIf("Enum2", ShowIfEnumFlag.Flag0 | ShowIfEnumFlag.Flag1)] + [AllowNesting] + public int showIfEnumFlagMulti; + + public ShowIfNest2 nest2; + } + + [System.Serializable] + public class ShowIfNest2 + { + public bool show1; + public bool show2; + public ShowIfEnum enum1; + [EnumFlags] public ShowIfEnumFlag enum2; + public bool GetShow1() { return show1; } + public bool GetShow2() { return show2; } + public ShowIfEnum GetEnum1() { return enum1; } + public ShowIfEnumFlag GetEnum2() { return enum2; } + + [ShowIf(EConditionOperator.And, "GetShow1", "GetShow2")] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 showIfAll = new Vector2(0.25f, 0.75f); + + [ShowIf(EConditionOperator.Or, "GetShow1", "GetShow2")] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 showIfAny = new Vector2(0.25f, 0.75f); + + [ShowIf("GetEnum1", ShowIfEnum.Case2)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 showIfEnum = new Vector2(0.25f, 0.75f); + + [ShowIf("GetEnum2", ShowIfEnumFlag.Flag0)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 showIfEnumFlag; + + [ShowIf("GetEnum2", ShowIfEnumFlag.Flag0 | ShowIfEnumFlag.Flag1)] + [MinMaxSlider(0.0f, 1.0f)] // AllowNesting attribute is not needed, because the field is already marked with a custom naughty property drawer + public Vector2 showIfEnumFlagMulti; + } + + public enum ShowIfEnum + { + Case0, + Case1, + Case2 + } + + [Flags] + public enum ShowIfEnumFlag + { + Flag0 = 1, + Flag1 = 2, + Flag2 = 4, + Flag3 = 8 + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowIfTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowIfTest.cs.meta new file mode 100644 index 0000000..749d05c --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowIfTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4fdbfcfbf5b056a4bac491fe21569572 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowNativePropertyTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowNativePropertyTest.cs new file mode 100644 index 0000000..6f4b379 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowNativePropertyTest.cs @@ -0,0 +1,79 @@ +锘縰sing UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ShowNativePropertyTest : MonoBehaviour + { + [ShowNativeProperty] + private Transform Transform + { + get + { + return transform; + } + } + + [ShowNativeProperty] + private Transform ParentTransform + { + get + { + return transform.parent; + } + } + + [ShowNativeProperty] + private ushort MyUShort + { + get + { + return ushort.MaxValue; + } + } + + [ShowNativeProperty] + private short MyShort + { + get + { + return short.MaxValue; + } + } + + [ShowNativeProperty] + private ulong MyULong + { + get + { + return ulong.MaxValue; + } + } + + [ShowNativeProperty] + private long MyLong + { + get + { + return long.MaxValue; + } + } + + [ShowNativeProperty] + private uint MyUInt + { + get + { + return uint.MaxValue; + } + } + + [ShowNativeProperty] + private int MyInt + { + get + { + return int.MaxValue; + } + } + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowNativePropertyTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowNativePropertyTest.cs.meta new file mode 100644 index 0000000..19f9e31 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowNativePropertyTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b5a73795d25dd334e90a5a347c6079d9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowNonSerializedFieldTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowNonSerializedFieldTest.cs new file mode 100644 index 0000000..cace150 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowNonSerializedFieldTest.cs @@ -0,0 +1,33 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ShowNonSerializedFieldTest : MonoBehaviour + { +#pragma warning disable 414 + [ShowNonSerializedField] + private ushort myUShort = ushort.MaxValue; + + [ShowNonSerializedField] + private short myShort = short.MaxValue; + + [ShowNonSerializedField] + private uint myUInt = uint.MaxValue; + + [ShowNonSerializedField] + private int myInt = 10; + + [ShowNonSerializedField] + private ulong myULong = ulong.MaxValue; + + [ShowNonSerializedField] + private long myLong = long.MaxValue; + + [ShowNonSerializedField] + private const float PI = 3.14159f; + + [ShowNonSerializedField] + private static readonly Vector3 CONST_VECTOR = Vector3.one; +#pragma warning restore 414 + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowNonSerializedFieldTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowNonSerializedFieldTest.cs.meta new file mode 100644 index 0000000..404ff1b --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ShowNonSerializedFieldTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 913d67a695253f744bdc776625b9b948 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/SortingLayerTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/SortingLayerTest.cs new file mode 100644 index 0000000..e77bfec --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/SortingLayerTest.cs @@ -0,0 +1,46 @@ +锘縰sing UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class SortingLayerTest : MonoBehaviour + { + [SortingLayer] + public int layerNumber0; + + [SortingLayer] + public string layerName0; + + public SortingLayerNest1 nest1; + + [Button] + public void DebugLog() + { + Debug.LogFormat("{0} = {1}", nameof(layerNumber0), layerNumber0); + Debug.LogFormat("{0} = {1}", nameof(layerName0), layerName0); + Debug.LogFormat("LayerToName({0}) = {1}", layerNumber0, SortingLayer.IDToName(layerNumber0)); + Debug.LogFormat("NameToLayer({0}) = {1}", layerName0, SortingLayer.NameToID(layerName0)); + } + } + + [System.Serializable] + public class SortingLayerNest1 + { + [SortingLayer] + public int layerNumber1; + + [SortingLayer] + public string layerName1; + + public SortingLayerNest2 nest2; + } + + [System.Serializable] + public struct SortingLayerNest2 + { + [SortingLayer] + public int layerNumber2; + + [SortingLayer] + public string layerName2; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/SortingLayerTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/SortingLayerTest.cs.meta new file mode 100644 index 0000000..e8cd99c --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/SortingLayerTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8ed73e666d447964d93c4840f05423dc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/TagTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/TagTest.cs new file mode 100644 index 0000000..cb77fb8 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/TagTest.cs @@ -0,0 +1,34 @@ +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class TagTest : MonoBehaviour + { + [Tag] + public string tag0; + + public TagNest1 nest1; + + [Button] + private void LogTag0() + { + Debug.Log(tag0); + } + } + + [System.Serializable] + public class TagNest1 + { + [Tag] + public string tag1; + + public TagNest2 nest2; + } + + [System.Serializable] + public struct TagNest2 + { + [Tag] + public string tag2; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/TagTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/TagTest.cs.meta new file mode 100644 index 0000000..88ea5af --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/TagTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8bcc0d5613b48fb43bd36c9d37e99900 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ValidateInputTest.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ValidateInputTest.cs new file mode 100644 index 0000000..8e7b091 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ValidateInputTest.cs @@ -0,0 +1,52 @@ +锘縰sing UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class ValidateInputTest : MonoBehaviour + { + [ValidateInput("NotZero0", "int0 must not be zero")] + public int int0; + + private bool NotZero0(int value) + { + return value != 0; + } + + public ValidateInputNest1 nest1; + + public ValidateInputInheritedNest inheritedNest; + } + + [System.Serializable] + public class ValidateInputNest1 + { + [ValidateInput("NotZero1")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int int1; + + private bool NotZero1(int value) + { + return value != 0; + } + + public ValidateInputNest2 nest2; + } + + [System.Serializable] + public class ValidateInputNest2 + { + [ValidateInput("NotZero2")] + [AllowNesting] // Because it's nested we need to explicitly allow nesting + public int int2; + + private bool NotZero2(int value) + { + return value != 0; + } + } + + [System.Serializable] + public class ValidateInputInheritedNest : ValidateInputNest1 + { + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ValidateInputTest.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ValidateInputTest.cs.meta new file mode 100644 index 0000000..f57070a --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/ValidateInputTest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 94adafcfe59aa344c9b5596b2cc6ecd0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_NaughtyComponent.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_NaughtyComponent.cs new file mode 100644 index 0000000..aff1dfa --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_NaughtyComponent.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + public class _NaughtyComponent : MonoBehaviour + { + } + + [System.Serializable] + public class MyClass + { + } + + [System.Serializable] + public struct MyStruct + { + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_NaughtyComponent.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_NaughtyComponent.cs.meta new file mode 100644 index 0000000..5702f19 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_NaughtyComponent.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 9c928ea15ae74a44089beb2e534c1a35 +timeCreated: 1507996629 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_NaughtyScriptableObject.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_NaughtyScriptableObject.cs new file mode 100644 index 0000000..c8d80fb --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_NaughtyScriptableObject.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; +using UnityEngine; + +namespace NaughtyAttributes.Test +{ + //[CreateAssetMenu(fileName = "NaughtyScriptableObject", menuName = "NaughtyAttributes/_NaughtyScriptableObject")] + public class _NaughtyScriptableObject : ScriptableObject + { + [Expandable] + public List<_TestScriptableObjectA> listA; + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_NaughtyScriptableObject.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_NaughtyScriptableObject.cs.meta new file mode 100644 index 0000000..eb5d253 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_NaughtyScriptableObject.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 753bdb918c6038142acddbd7aae6958f +timeCreated: 1518639587 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_TestScriptableObjectA.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_TestScriptableObjectA.cs new file mode 100644 index 0000000..ee7b36f --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_TestScriptableObjectA.cs @@ -0,0 +1,12 @@ +锘縰sing UnityEngine; +using System.Collections.Generic; + +namespace NaughtyAttributes.Test +{ + //[CreateAssetMenu(fileName = "TestScriptableObjectA", menuName = "NaughtyAttributes/TestScriptableObjectA")] + public class _TestScriptableObjectA : ScriptableObject + { + [Expandable] + public List<_TestScriptableObjectB> listB; + } +} \ No newline at end of file diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_TestScriptableObjectA.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_TestScriptableObjectA.cs.meta new file mode 100644 index 0000000..5037e5c --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_TestScriptableObjectA.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 19472ac11eae27a4b804f354ca7d9c00 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_TestScriptableObjectB.cs b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_TestScriptableObjectB.cs new file mode 100644 index 0000000..89a474d --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_TestScriptableObjectB.cs @@ -0,0 +1,12 @@ +锘縰sing UnityEngine; +using System.Collections.Generic; + +namespace NaughtyAttributes.Test +{ + //[CreateAssetMenu(fileName = "TestScriptableObjectB", menuName = "NaughtyAttributes/TestScriptableObjectB")] + public class _TestScriptableObjectB : ScriptableObject + { + [MinMaxSlider(0, 10)] + public Vector2Int slider; + } +} \ No newline at end of file diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_TestScriptableObjectB.cs.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_TestScriptableObjectB.cs.meta new file mode 100644 index 0000000..0562e57 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/Scripts/Test/_TestScriptableObjectB.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c2b396aeebc9d984da298eee313896bc +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/package.json b/Assets/Framework/ThirdParty/NaughtyAttributes/package.json new file mode 100644 index 0000000..960db05 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/package.json @@ -0,0 +1,21 @@ +{ + "name": "com.dbrizov.naughtyattributes", + "displayName": "NaughtyAttributes", + "version": "2.1.4", + "unity": "2018.4", + "description": "NaughtyAttributes is an extension for the Unity Inspector.", + "keywords": [ "attribute", "inspector", "editor" ], + "category": "editor extensions", + "dependencies": {}, + "samples": [ + { + "displayName": "Demo Scene", + "description": "Demo Scene", + "path": "Samples/DemoScene" + } + ], + "author": { + "name": "Denis Rizov", + "url": "https://github.com/dbrizov" + } +} diff --git a/Assets/Framework/ThirdParty/NaughtyAttributes/package.json.meta b/Assets/Framework/ThirdParty/NaughtyAttributes/package.json.meta new file mode 100644 index 0000000..6f1fa82 --- /dev/null +++ b/Assets/Framework/ThirdParty/NaughtyAttributes/package.json.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: db9a5ca20403b0344ae64015de8f8c86 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Plugins.meta b/Assets/Plugins.meta new file mode 100644 index 0000000..eb3b54f --- /dev/null +++ b/Assets/Plugins.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 24335843f110e5c4b89023c88a99ee1a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources.meta b/Assets/Resources.meta new file mode 100644 index 0000000..ec84c71 --- /dev/null +++ b/Assets/Resources.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fc523243b4f6e0f40a65d8b6f4677c2e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TestScripts.meta b/Assets/TestScripts.meta new file mode 100644 index 0000000..cac19d7 --- /dev/null +++ b/Assets/TestScripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: af948cddee419074187fe53931f28c3d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: