diff --git a/.gitignore b/.gitignore index 7fee2209..44956dad 100644 --- a/.gitignore +++ b/.gitignore @@ -103,4 +103,16 @@ Sandbox/ #Luban Luban/.cache.meta GenerateDatas/ + +#HybridCLR Assets/HybridCLRData.meta +UserSettings/Search.settings + +#Unity UserSettings +UserSettings/Search.index +UserSettings/Layouts/default-2021.dwlt + +#UnityOnlineServiceData +Assets/UnityOnlineServiceData.meta +Assets/UnityOnlineServiceData + diff --git a/Assets/GameScripts/HotFix/BattleCore/BattleCore.Runtime.asmdef b/Assets/GameScripts/HotFix/BattleCore/BattleCore.Runtime.asmdef index bbd7f47c..9a08beea 100644 --- a/Assets/GameScripts/HotFix/BattleCore/BattleCore.Runtime.asmdef +++ b/Assets/GameScripts/HotFix/BattleCore/BattleCore.Runtime.asmdef @@ -3,7 +3,8 @@ "rootNamespace": "BattleCore.Runtime", "references": [ "GUID:aa06d4cc755c979489c256c1bcca1dfb", - "GUID:d8b63aba1907145bea998dd612889d6b" + "GUID:d8b63aba1907145bea998dd612889d6b", + "GUID:a90b2d3377c5e4a4db95cc44fb82045e" ], "includePlatforms": [], "excludePlatforms": [], diff --git a/Assets/GameScripts/HotFix/GameBase/BaseLogicSys.cs b/Assets/GameScripts/HotFix/GameBase/BaseLogicSys.cs new file mode 100644 index 00000000..4a5860be --- /dev/null +++ b/Assets/GameScripts/HotFix/GameBase/BaseLogicSys.cs @@ -0,0 +1,75 @@ +namespace TEngine +{ + /// + /// 基础LogicSys,生命周期由TEngine实现,推荐给系统实现, + /// 减少多余的Mono,保持系统层面只有一个Update。 + /// 用主Mono来驱动LogicSys的生命周期。 + /// + /// 逻辑系统类型。 + public abstract class BaseLogicSys : ILogicSys where T : new() + { + private static T _instance; + + public static bool HasInstance => _instance != null; + + public static T Instance + { + get + { + if (null == _instance) + { + _instance = new T(); + } + + return _instance; + } + } + + #region virtual function + public virtual bool OnInit() + { + if (null == _instance) + { + _instance = new T(); + } + return true; + } + + public virtual void OnStart() + { + } + + public virtual void OnUpdate() + { + } + + public virtual void OnLateUpdate() + { + } + + public virtual void OnFixedUpdate() + { + } + + public virtual void OnRoleLogout() + { + } + + public virtual void OnDestroy() + { + } + + public virtual void OnDrawGizmos() + { + } + + public virtual void OnApplicationPause(bool pause) + { + } + + public virtual void OnMapChanged() + { + } + #endregion + } +} \ No newline at end of file diff --git a/Assets/GameScripts/HotFix/GameBase/BaseLogicSys.cs.meta b/Assets/GameScripts/HotFix/GameBase/BaseLogicSys.cs.meta new file mode 100644 index 00000000..c43cae84 --- /dev/null +++ b/Assets/GameScripts/HotFix/GameBase/BaseLogicSys.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: fc4ce19b17fd4277951d189b66f503e2 +timeCreated: 1683120353 \ No newline at end of file diff --git a/Assets/GameScripts/HotFix/GameBase/BehaviourSingleton.cs b/Assets/GameScripts/HotFix/GameBase/BehaviourSingleton.cs new file mode 100644 index 00000000..812b41a8 --- /dev/null +++ b/Assets/GameScripts/HotFix/GameBase/BehaviourSingleton.cs @@ -0,0 +1,212 @@ +using System.Collections.Generic; + +namespace TEngine +{ + /// + /// 通过LogicSys来驱动且具备Unity完整生命周期的单例(不继承MonoBehaviour) + /// + /// + public abstract class BehaviourSingleton : BaseBehaviourSingleton where T : BaseBehaviourSingleton, new() + { + private static T _instance; + + public static T Instance + { + get + { + if (null == _instance) + { + _instance = new T(); + Log.Assert(_instance != null); + _instance.Awake(); + RegSingleton(_instance); + } + + return _instance; + } + } + + private static void RegSingleton(BaseBehaviourSingleton inst) + { + BehaviourSingleSystem.Instance.RegSingleton(inst); + } + } + + public class BaseBehaviourSingleton + { + public bool IsStart = false; + + public virtual void Active() + { + } + + public virtual void Awake() + { + } + + public virtual bool IsHaveLateUpdate() + { + return false; + } + + public virtual void Start() + { + } + + public virtual void Update() + { + } + + public virtual void LateUpdate() + { + } + + public virtual void Destroy() + { + } + + public virtual void OnPause() + { + } + + public virtual void OnResume() + { + } + + public virtual void OnDrawGizmos() + { + } + } + + public class BehaviourSingleSystem : BaseLogicSys + { + private readonly List _listInst = new List(); + private readonly List _listStart = new List(); + private readonly List _listUpdate = new List(); + private readonly List _listLateUpdate = new List(); + + public void RegSingleton(BaseBehaviourSingleton inst) + { + Log.Assert(!_listInst.Contains(inst)); + _listInst.Add(inst); + _listStart.Add(inst); + } + + public void UnRegSingleton(BaseBehaviourSingleton inst) + { + if (inst == null) + { + Log.Error($"BaseBehaviourSingleton Is Null"); + return; + } + + Log.Assert(_listInst.Contains(inst)); + if (_listInst.Contains(inst)) + { + _listInst.Remove(inst); + } + + if (_listStart.Contains(inst)) + { + _listStart.Remove(inst); + } + + if (_listUpdate.Contains(inst)) + { + _listUpdate.Remove(inst); + } + + if (_listLateUpdate.Contains(inst)) + { + _listLateUpdate.Remove(inst); + } + + inst.Destroy(); + inst = null; + } + + public override void OnUpdate() + { + var listStart = _listStart; + var listToUpdate = _listUpdate; + var listToLateUpdate = _listLateUpdate; + if (listStart.Count > 0) + { + for (int i = 0; i < listStart.Count; i++) + { + var inst = listStart[i]; + Log.Assert(!inst.IsStart); + + inst.IsStart = true; + inst.Start(); + listToUpdate.Add(inst); + + if (inst.IsHaveLateUpdate()) + { + listToLateUpdate.Add(inst); + } + } + + listStart.Clear(); + } + + var listUpdateCnt = listToUpdate.Count; + for (int i = 0; i < listUpdateCnt; i++) + { + var inst = listToUpdate[i]; + + TProfiler.BeginFirstSample(inst.GetType().FullName); + inst.Update(); + TProfiler.EndFirstSample(); + } + } + + public override void OnLateUpdate() + { + var listLateUpdate = _listLateUpdate; + var listLateUpdateCnt = listLateUpdate.Count; + for (int i = 0; i < listLateUpdateCnt; i++) + { + var inst = listLateUpdate[i]; + + TProfiler.BeginFirstSample(inst.GetType().FullName); + inst.LateUpdate(); + TProfiler.EndFirstSample(); + } + } + + public override void OnDestroy() + { + for (int i = 0; i < _listInst.Count; i++) + { + var inst = _listInst[i]; + inst.Destroy(); + } + } + + public override void OnApplicationPause(bool pause) + { + for (int i = 0; i < _listInst.Count; i++) + { + var inst = _listInst[i]; + if (pause) + { + inst.OnPause(); + } + else + { + inst.OnResume(); + } + } + } + + public override void OnDrawGizmos() + { + for (int i = 0; i < _listInst.Count; i++) + { + var inst = _listInst[i]; + inst.OnDrawGizmos(); + } + } + } +} \ No newline at end of file diff --git a/Assets/GameScripts/HotFix/GameBase/BehaviourSingleton.cs.meta b/Assets/GameScripts/HotFix/GameBase/BehaviourSingleton.cs.meta new file mode 100644 index 00000000..4d688387 --- /dev/null +++ b/Assets/GameScripts/HotFix/GameBase/BehaviourSingleton.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 5c0e9c1c8c9d4ce99a1c991fb62a0256 +timeCreated: 1683120460 \ No newline at end of file diff --git a/Assets/GameScripts/HotFix/GameLogic/Camera.meta b/Assets/GameScripts/HotFix/GameLogic/Camera.meta new file mode 100644 index 00000000..e205f55f --- /dev/null +++ b/Assets/GameScripts/HotFix/GameLogic/Camera.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1d862c80fdc1e684e8ff3b6ae7707b79 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameScripts/HotFix/GameLogic/Camera/CameraUtils.cs b/Assets/GameScripts/HotFix/GameLogic/Camera/CameraUtils.cs new file mode 100644 index 00000000..6afe6eae --- /dev/null +++ b/Assets/GameScripts/HotFix/GameLogic/Camera/CameraUtils.cs @@ -0,0 +1,24 @@ +using TEngine; +using UnityEngine; +#if ENABLE_URP +using UnityEngine.Rendering.Universal; +#endif + +namespace GameLogic +{ + public class CameraUtils + { + public static void AddCameraStack(Camera camera,Camera mainCamera) + { +#if ENABLE_URP + if (mainCamera != null) + { + // 通过脚本的方式,只要能找到 camera 不轮是否跨 base 相机的场景,都可以 Add 进 Stack + mainCamera.GetComponent().cameraStack.Add(GameModule.UI.UICamera); + } +#else + Log.Fatal("Could not add camera stack because had no URP-Render-Pip"); +#endif + } + } +} \ No newline at end of file diff --git a/Assets/GameScripts/HotFix/GameLogic/Camera/CameraUtils.cs.meta b/Assets/GameScripts/HotFix/GameLogic/Camera/CameraUtils.cs.meta new file mode 100644 index 00000000..f6aeea1f --- /dev/null +++ b/Assets/GameScripts/HotFix/GameLogic/Camera/CameraUtils.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6375b5490bbdcc145a24706a6c4e9cb7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/GameScripts/HotFix/GameLogic/GameLogic.asmdef b/Assets/GameScripts/HotFix/GameLogic/GameLogic.asmdef index 38d6f1d6..18273735 100644 --- a/Assets/GameScripts/HotFix/GameLogic/GameLogic.asmdef +++ b/Assets/GameScripts/HotFix/GameLogic/GameLogic.asmdef @@ -5,7 +5,9 @@ "GUID:08c3762f54316454ca6b6fbcb22b40e5", "GUID:a90b2d3377c5e4a4db95cc44fb82045e", "GUID:aa06d4cc755c979489c256c1bcca1dfb", - "GUID:6055be8ebefd69e48b49212b09b47b2f" + "GUID:641632c4f8079b94f963b5284d859a12", + "GUID:6055be8ebefd69e48b49212b09b47b2f", + "GUID:15fc0a57446b3144c949da3e2b9737a9" ], "includePlatforms": [], "excludePlatforms": [], @@ -14,6 +16,12 @@ "precompiledReferences": [], "autoReferenced": true, "defineConstraints": [], - "versionDefines": [], + "versionDefines": [ + { + "name": "com.unity.render-pipelines.universal", + "expression": "", + "define": "ENABLE_URP" + } + ], "noEngineReferences": false } \ No newline at end of file diff --git a/Assets/GameScripts/HotFix/GameProto/ConfigUtility.cs b/Assets/GameScripts/HotFix/GameProto/ConfigUtility.cs new file mode 100644 index 00000000..f75ca3f0 --- /dev/null +++ b/Assets/GameScripts/HotFix/GameProto/ConfigUtility.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using TEngine; + +namespace GameProto +{ + /// + /// 指定Key委托。 + /// + /// 键。 + /// 值。 + public delegate TKey ConvertDictionaryKey(TValue val); + + /// + /// 配置表辅助工具。 + /// + public static class ConfigUtility + { + /// + /// 生成64long的主键。 + /// + /// 键1。 + /// 键2。 + /// 64long的主键。 + public static UInt64 Make64Key(uint key1, uint key2) + { + return ((UInt64)key1 << 32) | key2; + } + + /// + /// 拷贝配置表字典。 + /// + /// 拷贝地址。 + /// 拷贝源。 + /// 指定主键。 + /// 键。 + /// 值。 + /// 是否拷贝成功。 + public static bool CopyConfigDict(ref Dictionary dict,List source, ConvertDictionaryKey convKey) + { + if (source == null) + { + return false; + } + + dict.Clear(); + + bool failed = false; + for (int i = 0; i < source.Count; i++) + { + var data = source[i]; + TKey key = convKey(data); + if (dict.ContainsKey(key)) + { + Log.Fatal("Copy Config Failed: {0} IndexOf {1} Had Repeated Key: {2} ", typeof(TValue).Name, i + 1, key); + failed = true; + break; + } + + dict.Add(key, data); + } + return !failed; + } + } +} \ No newline at end of file diff --git a/Assets/GameScripts/HotFix/GameProto/ConfigUtility.cs.meta b/Assets/GameScripts/HotFix/GameProto/ConfigUtility.cs.meta new file mode 100644 index 00000000..a9c0c92c --- /dev/null +++ b/Assets/GameScripts/HotFix/GameProto/ConfigUtility.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: e278e636820842f293e2a765962ad4f8 +timeCreated: 1683300170 \ No newline at end of file diff --git a/Assets/GameScripts/Main/Launcher/Resources/AssetLoad/UILoadUpdate.prefab b/Assets/GameScripts/Main/Launcher/Resources/AssetLoad/UILoadUpdate.prefab index 37004985..4570b4ea 100644 --- a/Assets/GameScripts/Main/Launcher/Resources/AssetLoad/UILoadUpdate.prefab +++ b/Assets/GameScripts/Main/Launcher/Resources/AssetLoad/UILoadUpdate.prefab @@ -28,6 +28,7 @@ RectTransform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1633508802563447727} m_RootOrder: 0 @@ -104,6 +105,7 @@ RectTransform: 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_ConstrainProportionsScale: 0 m_Children: - {fileID: 947380016692030854} m_Father: {fileID: 1633508802563447727} @@ -229,6 +231,7 @@ RectTransform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 4232232858152633415} m_RootOrder: 0 @@ -309,6 +312,7 @@ RectTransform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1633508802563447727} m_RootOrder: 2 @@ -404,6 +408,7 @@ RectTransform: 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_ConstrainProportionsScale: 0 m_Children: - {fileID: 1183389821019440696} m_Father: {fileID: 1753386200549547019} @@ -505,7 +510,6 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 1753386200549547019} - - component: {fileID: 2395469539571654547} m_Layer: 5 m_Name: TopNode m_TagString: Untagged @@ -523,6 +527,7 @@ RectTransform: 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_ConstrainProportionsScale: 0 m_Children: - {fileID: 4232232858152633415} - {fileID: 3038352660368000718} @@ -535,18 +540,6 @@ RectTransform: m_AnchoredPosition: {x: 0, y: -100} m_SizeDelta: {x: 0, y: 200} m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &2395469539571654547 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4664656392582353123} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: c0a563c3e931db74f94f9991270a2dee, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &7836612998133337201 GameObject: m_ObjectHideFlags: 0 @@ -573,6 +566,7 @@ RectTransform: 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_ConstrainProportionsScale: 0 m_Children: - {fileID: 3254196395727856927} m_Father: {fileID: 2347891492826839465} @@ -612,6 +606,7 @@ RectTransform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1753386200549547019} m_RootOrder: 2 @@ -706,6 +701,7 @@ RectTransform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 947380016692030854} m_RootOrder: 0 @@ -780,6 +776,7 @@ RectTransform: 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_ConstrainProportionsScale: 0 m_Children: - {fileID: 4652061626151979521} - {fileID: 2347891492826839465} @@ -839,6 +836,7 @@ RectTransform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 1753386200549547019} m_RootOrder: 1 diff --git a/Assets/Scenes/main.unity b/Assets/Scenes/main.unity index cc5abde9..5292e98e 100644 --- a/Assets/Scenes/main.unity +++ b/Assets/Scenes/main.unity @@ -150,6 +150,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2061060682} m_RootOrder: 2 @@ -228,6 +229,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2061060682} m_RootOrder: 0 @@ -277,6 +279,7 @@ RectTransform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 828420966} m_RootOrder: 0 @@ -374,6 +377,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 828420966} m_RootOrder: 1 @@ -448,6 +452,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2061060682} m_RootOrder: 10 @@ -492,6 +497,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: - {fileID: 88107082} - {fileID: 110205811} @@ -527,6 +533,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 828420966} m_RootOrder: 2 @@ -543,6 +550,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} m_Name: m_EditorClassIdentifier: + m_SendPointerHoverToParent: 1 m_HorizontalAxis: Horizontal m_VerticalAxis: Vertical m_SubmitButton: Submit @@ -592,6 +600,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2061060682} m_RootOrder: 8 @@ -635,6 +644,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2061060682} m_RootOrder: 4 @@ -680,6 +690,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2061060682} m_RootOrder: 7 @@ -738,6 +749,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2061060682} m_RootOrder: 3 @@ -793,6 +805,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: - {fileID: 2061060682} m_Father: {fileID: 0} @@ -825,6 +838,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2061060682} m_RootOrder: 1 @@ -868,6 +882,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2061060682} m_RootOrder: 9 @@ -964,6 +979,7 @@ Transform: m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: -10} m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 0} m_RootOrder: 0 @@ -995,6 +1011,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2061060682} m_RootOrder: 6 @@ -1047,6 +1064,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: - {fileID: 43232120} - {fileID: 1823887563} @@ -1112,6 +1130,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2061060682} m_RootOrder: 5 @@ -1155,6 +1174,7 @@ Transform: 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_ConstrainProportionsScale: 0 m_Children: [] m_Father: {fileID: 2061060682} m_RootOrder: 11 diff --git a/Assets/TEngine/Editor/ProtoGenTools/ProtoScriptTools.cs b/Assets/TEngine/Editor/ProtoGenTools/ProtoScriptTools.cs new file mode 100644 index 00000000..829a1be5 --- /dev/null +++ b/Assets/TEngine/Editor/ProtoGenTools/ProtoScriptTools.cs @@ -0,0 +1,448 @@ +using System; +using UnityEditor; +using UnityEngine; +using System.Collections.Generic; +using System.IO; +using System.Text; +using System.Xml; +using TEngine; +using TEngine.Editor; +using Debug = UnityEngine.Debug; + +class GenNetScriptWindow : EditorWindow +{ + private static GenNetScriptWindow _window = null; + + //绑定通知协议 + private StringBuilder _strBindNotify; + + //枚举对应协议号 + private readonly Dictionary _dicName2ID = new Dictionary(); + + //xxx.xml下的协议枚举list + private readonly Dictionary> _dicPath2Name = new Dictionary>(); + + //协议号有没有被勾选 + private readonly Dictionary _dicID2Select = new Dictionary(); + + //记录回包协议号 + private readonly Dictionary _dicID2ID = new Dictionary(); + + private Vector2 _scrollPos; + private Vector2 _fileListScrollPos; + + private string _path = @"G:\github\TEngine\Luban\Proto\pb_schemas\"; + private readonly List _filePathList = new List(); + private string _curSelectFile = string.Empty; + + private string _filterFileName = string.Empty; + private string _filterProName = string.Empty; + + [MenuItem("TEngine/协议生成工具|Protobuf Tools")] + static void OpenGenNetScriptWindow() + { + if (!_window) + { + _window = ScriptableObject.CreateInstance(); + _window.maxSize = new Vector2(1000, 800); + _window.minSize = _window.maxSize / 2; + _window.LoadLastPath(); + } + + _window.ShowUtility(); + } + + void OnGUI() + { + EditorGUILayout.PrefixLabel("protoPath"); + _path = EditorGUILayout.TextField(_path); + var r = EditorGUILayout.BeginHorizontal("Button"); + if (GUI.Button(r, GUIContent.none)) + { + ReadPath(); + } + GUILayout.Label("Search"); + EditorGUILayout.EndHorizontal(); + + + //加个文件筛选 + //EditorGUILayout.BeginHorizontal(); + GUILayout.Label("filter file:"); + _filterFileName = GUILayout.TextField(_filterFileName); + //EditorGUILayout.EndHorizontal(); + //显示文件名部分 + if (_filePathList.Count > 0) + { + _fileListScrollPos = EditorGUILayout.BeginScrollView(_fileListScrollPos, GUILayout.Width(r.width), GUILayout.Height(200)); + for (int i = 0; i < _filePathList.Count; ++i) + { + var fileName = Path.GetFileNameWithoutExtension(_filePathList[i]); + if (!string.IsNullOrEmpty(_filterFileName) && fileName.IndexOf(_filterFileName, StringComparison.Ordinal) == -1) + { + continue; + } + if (GUILayout.Button(fileName)) + { + _curSelectFile = _filePathList[i]; + LoadSelectFile(); + } + } + EditorGUILayout.EndScrollView(); + } + GUILayout.Label("-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"); + + if (!string.IsNullOrEmpty(_curSelectFile)) + { + //加个协议筛选 + GUILayout.Label("filter proto:"); + _filterProName = GUILayout.TextField(_filterProName); + + _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos, GUILayout.Width(r.width), GUILayout.Height(200)); + var fileName2 = Path.GetFileNameWithoutExtension(_curSelectFile); + List list; + if (_dicPath2Name.TryGetValue(fileName2, out list)) + { + EditorGUI.indentLevel++; + for (int i = 0; i < list.Count; ++i) + { + var cmdName = list[i]; + //筛选一下,忽略大小写 + if (!string.IsNullOrEmpty(_filterProName) && cmdName.ToLower().IndexOf(_filterProName.ToLower()) == -1) + continue; + var cmdID = _dicName2ID[cmdName]; + EditorGUILayout.BeginHorizontal(GUIStyle.none); + //协议名 + EditorGUILayout.LabelField(cmdName); + //toggle + if (!_dicID2Select.ContainsKey(cmdID)) + _dicID2Select[cmdID] = false; + _dicID2Select[cmdID] = EditorGUILayout.Toggle(cmdID.ToString(),_dicID2Select[cmdID]); + //回包协议号 + if (!_dicID2ID.ContainsKey(cmdID)) + { + if (cmdName.EndsWith("REQ")) + _dicID2ID[cmdID] = cmdID + 1; + else + _dicID2ID[cmdID] = 0; + } + _dicID2ID[cmdID] = EditorGUILayout.IntField(_dicID2ID[cmdID]); + EditorGUILayout.EndHorizontal(); + } + EditorGUI.indentLevel--; + } + + EditorGUILayout.EndScrollView(); + } + + if (!string.IsNullOrEmpty(_curSelectFile)) + { + if (GUILayout.Button("GenSelect")) + { + OnClickGenBtn(false); + } + if (GUILayout.Button("GenAll")) + { + OnClickGenBtn(true); + } + } + + if (GUILayout.Button("导出Proto To Csharp|Export Proto To Csharp")) + { + ExportProto(); + } + } + + #region 加载 + private void LoadLastPath() + { + if (PlayerPrefs.HasKey("GenNetScriptWindow.Path")) + { + _path = PlayerPrefs.GetString("GenNetScriptWindow.Path"); + } + ReadPath(); + } + + private void ReadPath() + { + PlayerPrefs.SetString("GenNetScriptWindow.Path", _path); + _filePathList.Clear(); + _curSelectFile = String.Empty; + JustLoadFileList(_filePathList, _path); + } + + private void JustLoadFileList(List exportList, string folderPath, bool deep = false) + { + if (!LoadFoldChildFileList(exportList, folderPath, deep)) + { + EditorUtility.DisplayDialog("folder not exist", "folder not exist:"+_path, "ok"); + } + } + + private void LoadSelectFile() + { + _dicID2Select.Clear(); + _dicID2ID.Clear(); + _dicName2ID.Clear(); + + var xmlFilePath = _curSelectFile; + var fileName = Path.GetFileNameWithoutExtension(xmlFilePath); + var protocolNameList = new List(); + //读xml + if (fileName.StartsWith("proto_cs")) + { + Debug.Log("load xml.name:" + fileName); + XmlDocument xmlDoc = new XmlDocument(); + xmlDoc.Load(xmlFilePath); + GenProtocolNameList(xmlDoc.ChildNodes, protocolNameList); + _dicPath2Name[fileName] = protocolNameList; + Debug.Log(fileName + " success."); + } + } + + private bool LoadFoldChildFileList(List exportList, string folderPath, bool deep = false) + { + if (!Directory.Exists(folderPath)) + { + Log.Error("folder not exist: {0}", folderPath); + return false; + } + + string[] subFile = Directory.GetFiles(folderPath); + foreach (string fileName in subFile) + { + //有些筛选条件,直接写死这里了。方便 + var name = Path.GetFileNameWithoutExtension(fileName); + if (name.StartsWith("proto_cs")) + exportList.Add(fileName); + } + + if (deep) + { + string[] subFolders = Directory.GetDirectories(folderPath); + foreach (string folderName in subFolders) + { + LoadFoldChildFileList(exportList, folderName); + } + } + + return true; + } + + //把macro里的协议号和协议枚举名对应起来 + private void GenProtocolNameList(XmlNodeList nodeList, List nameList) + { + foreach (XmlNode node in nodeList) + { + if (node.Attributes == null) + continue; + if (node.Name == "macro") + { + var name = node.Attributes.GetNamedItem("name").Value; + if (name.StartsWith("CS_CMD") || name.StartsWith("CS_NOTIFY")) + { + var id = Convert.ToInt32(node.Attributes.GetNamedItem("value").Value); + _dicName2ID[name] = id; + if (nameList != null) + nameList.Add(name); + } + } + GenProtocolNameList(node.ChildNodes, nameList); + } + } + #endregion + + #region 点击处理 + private void OnClickGenBtn(bool genAll) + { + _strBindNotify = new StringBuilder(); + bool needRegCmdHandle = false; + StringBuilder sb = new StringBuilder(); + List listGenId = new List(); + var iter = _dicID2Select.GetEnumerator(); + while (iter.MoveNext()) + { + if (iter.Current.Value || genAll) + { + int resId = iter.Current.Key; + int resID; + if (_dicID2ID.TryGetValue(resId, out resID)) + { + if (resID != 0) + { + var oneStr = GenOneReq(resId, resID); + sb.Append(oneStr); + sb.Append("\n\n"); + listGenId.Add(resId); + listGenId.Add(resID); + } + else if (!listGenId.Contains(resId)) + { + needRegCmdHandle = true; + var oneStr = GenOneReq(0, resId); + sb.Append(oneStr); + sb.Append("\n\n"); + listGenId.Add(resId); + } + } + } + } + + if (needRegCmdHandle) + { + sb.Append("public void RegCmdHandle()\n"); + sb.Append("{\n"); + sb.Append(_strBindNotify); + sb.Append("}\n"); + } + + TextEditor te = new TextEditor(); + te.text = sb.ToString(); + te.SelectAll(); + te.Copy(); + } + + private static readonly Dictionary TempParamDic = new Dictionary(); + private static string _reqClassName = string.Empty; + private static string _resClassName = string.Empty; + private static string _reqEnumName = string.Empty; + private static string _resEnumName = string.Empty; + private static string _reqDesc = string.Empty; + private static bool _resResult; + + private string GenOneReq(int reqId, int resId) + { + TempParamDic.Clear(); + _reqClassName = string.Empty; + _resClassName = string.Empty; + _reqEnumName = string.Empty; + _resEnumName = string.Empty; + _resResult = false; + + var xmlFilePath = _curSelectFile; + var fileName = Path.GetFileNameWithoutExtension(xmlFilePath); + //读xml + if (fileName.StartsWith("proto_cs")) + { + Debug.Log("load xml.name:" + fileName); + XmlDocument xmlDoc = new XmlDocument(); + xmlDoc.Load(xmlFilePath); + _GenOneReq(xmlDoc.ChildNodes, reqId,resId); + Debug.Log(fileName + " success."); + + var sb = new StringBuilder(); + sb.Append("#region "); + sb.Append(_reqDesc); + sb.Append(string.Format("\n//{0}\n", _reqDesc)); + if (reqId != 0) + { + sb.Append("public void "); + sb.Append(_reqClassName.Substring(2)); + sb.Append("("); + foreach (var item in TempParamDic) + { + sb.Append(string.Format("{0} {1}, ", item.Value, item.Key)); + } + sb.Remove(sb.Length - 2, 2);//把多余的逗号和空格删了 + sb.Append(")\n{\n"); + sb.Append(string.Format("\tCSPkg reqPkg = ProtoUtil.BuildCSMsg(netMacros.{0});\n", _reqEnumName)); + sb.Append(string.Format("\t{0} reqData = reqPkg.Body.{1};\n", _reqClassName, _reqClassName.Substring(2))); + foreach (var item in TempParamDic) + { + sb.Append(string.Format("\treqData.{0} = {0};\n", item.Key)); + } + + sb.Append("\n"); + sb.Append(string.Format("\tGameClient.Instance.SendCSMsg(reqPkg, netMacros.{0}, {1});\n", _resEnumName, + _resClassName.Substring(2))); + sb.Append("}\n\n"); + } + else + { + _strBindNotify.Append(string.Format("\t\tGameClient.Instance.RegCmdHandle(netMacros.{0}, {1});\n", _resEnumName, _resClassName.Substring(2))); + } + + //回包 + sb.Append(string.Format("private void {0}(CSMsgResult result, CSPkg msg)\n", _resClassName.Substring(2))); + sb.Append("{\n"); + sb.Append(string.Format("\tif (DodUtil.CheckHaveError(result, msg, typeof({0})))\n", _resClassName)); + sb.Append("\t\treturn;\n\n"); + sb.Append(string.Format("\t{0} resData = msg.Body.{1};\n", _resClassName, _resClassName.Substring(2))); + if (_resResult) + { + sb.Append("\tif (resData.Result.Ret != 0)\n"); + sb.Append("\t{\n"); + sb.Append("\t\tUISys.Mgr.ShowTipMsg(resData.Result);\n"); + sb.Append("\t\treturn;\n"); + sb.Append("\t}\n"); + } + + sb.Append("\t//todo\n"); + sb.Append("}\n#endregion"); + return sb.ToString(); + } + + return null; + } + + private void _GenOneReq(XmlNodeList nodeList, int reqId,int resId) + { + foreach (XmlNode node in nodeList) + { + if (node.Attributes == null) + continue; + if (node.Name.Equals("macro")) + { + var name = node.Attributes.GetNamedItem("name").Value; + if (name.StartsWith("CS_CMD") || name.StartsWith("CS_NOTIFY")) + { + var id = Convert.ToInt32(node.Attributes.GetNamedItem("value").Value); + if (id == reqId) + _reqEnumName = name; + if (id == resId) + _resEnumName = name; + } + } + + if (node.Name.Equals("struct")) + { + if (node.Attributes.GetNamedItem("id") == null) + continue; + var enumName = node.Attributes.GetNamedItem("id").Value; + if (enumName.Equals(_reqEnumName)) + { + var name = node.Attributes.GetNamedItem("name").Value; + _reqClassName = name; + if (node.Attributes.GetNamedItem("name") != null) + { + _reqDesc = node.Attributes.GetNamedItem("desc").Value; + } + foreach (XmlNode childNode in node.ChildNodes) + { + if (childNode != null && childNode.Name.Equals("entry")) + { + var paramName = childNode.Attributes.GetNamedItem("name").Value; + var paramType = childNode.Attributes.GetNamedItem("type").Value; + TempParamDic.Add(paramName, paramType); + } + } + } + + if (enumName.Equals(_resEnumName)) + { + var className = node.Attributes.GetNamedItem("name").Value; + _resClassName = className; + } + } + _GenOneReq(node.ChildNodes, reqId, resId); + } + } + #endregion + + #region 导出协议ToCsharp + + private void ExportProto() + { + ProtoGenTools.Export(); + } + #endregion +} \ No newline at end of file diff --git a/Assets/TEngine/Editor/ProtoGenTools/ProtoScriptTools.cs.meta b/Assets/TEngine/Editor/ProtoGenTools/ProtoScriptTools.cs.meta new file mode 100644 index 00000000..a62c3ae5 --- /dev/null +++ b/Assets/TEngine/Editor/ProtoGenTools/ProtoScriptTools.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 989d4686a599e7047bba6f0cbb1bb5e7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TEngine/Editor/UI/ScriptGenerator.cs b/Assets/TEngine/Editor/UI/ScriptGenerator.cs index e385b213..aa0af83f 100644 --- a/Assets/TEngine/Editor/UI/ScriptGenerator.cs +++ b/Assets/TEngine/Editor/UI/ScriptGenerator.cs @@ -15,7 +15,7 @@ namespace TEngine.Editor.UI Generate(false); } - [MenuItem("GameObject/ScriptGenerator/UIProperty UniTask", priority = 43)] + [MenuItem("GameObject/ScriptGenerator/UIProperty - UniTask", priority = 43)] public static void MemberPropertyUniTask() { Generate(false, true); @@ -27,7 +27,7 @@ namespace TEngine.Editor.UI Generate(true); } - [MenuItem("GameObject/ScriptGenerator/UIPropertyAndListener UniTask", priority = 44)] + [MenuItem("GameObject/ScriptGenerator/UIPropertyAndListener - UniTask", priority = 44)] public static void MemberPropertyAndListenerUniTask() { Generate(true, true); diff --git a/Assets/TEngine/ResRaw/Resources/TEngineGlobalSettings.asset b/Assets/TEngine/ResRaw/Resources/TEngineGlobalSettings.asset index 89fdb377..6889677f 100644 --- a/Assets/TEngine/ResRaw/Resources/TEngineGlobalSettings.asset +++ b/Assets/TEngine/ResRaw/Resources/TEngineGlobalSettings.asset @@ -42,9 +42,9 @@ MonoBehaviour: m_Gitee: 1 HotUpdateAssemblies: - GameBase.dll - - GameLogic.dll - GameProto.dll - BattleCore.Runtime.dll + - GameLogic.dll AOTMetaAssemblies: - mscorlib.dll - System.dll diff --git a/Assets/TEngine/Runtime/GameSettings/HybridCLR/HybridCLRCustomGlobalSettings.cs b/Assets/TEngine/Runtime/GameSettings/HybridCLR/HybridCLRCustomGlobalSettings.cs index 8c077d17..76128b2c 100644 --- a/Assets/TEngine/Runtime/GameSettings/HybridCLR/HybridCLRCustomGlobalSettings.cs +++ b/Assets/TEngine/Runtime/GameSettings/HybridCLR/HybridCLRCustomGlobalSettings.cs @@ -30,7 +30,7 @@ public class HybridCLRCustomGlobalSettings [Header("Auto sync with [HybridCLRGlobalSettings]")] [Tooltip("You should modify the file form file path [Assets/CustomHybridCLR/Settings/HybridCLRGlobalSettings.asset]")] - public List HotUpdateAssemblies = new List() { "GameBase.dll","GameLogic.dll","GameProto.dll","BattleCore.Runtime.dll","Assembly-CSharp.dll"}; + public List HotUpdateAssemblies = new List() { "GameBase.dll","GameProto.dll","BattleCore.Runtime.dll","GameLogic.dll"}; [Header("Need manual setting!")] public List AOTMetaAssemblies= new List() {"mscorlib.dll","System.dll","System.Core.dll" }; diff --git a/Assets/TEngine/Runtime/Utility/ByteHelper.cs b/Assets/TEngine/Runtime/Utility/ByteHelper.cs new file mode 100644 index 00000000..35505c90 --- /dev/null +++ b/Assets/TEngine/Runtime/Utility/ByteHelper.cs @@ -0,0 +1,107 @@ +using System.Text; + +namespace TEngine +{ + public static class ByteHelper + { + public static string ToHex(this byte b) + { + return b.ToString("X2"); + } + + public static string ToHex(this byte[] bytes) + { + StringBuilder stringBuilder = new StringBuilder(); + foreach (byte b in bytes) + { + stringBuilder.Append(b.ToString("X2")); + } + + return stringBuilder.ToString(); + } + + public static string ToHex(this byte[] bytes, string format) + { + StringBuilder stringBuilder = new StringBuilder(); + foreach (byte b in bytes) + { + stringBuilder.Append(b.ToString(format)); + } + + return stringBuilder.ToString(); + } + + public static string ToHex(this byte[] bytes, int offset, int count) + { + StringBuilder stringBuilder = new StringBuilder(); + for (int i = offset; i < offset + count; ++i) + { + stringBuilder.Append(bytes[i].ToString("X2")); + } + + return stringBuilder.ToString(); + } + + public static string ToStr(this byte[] bytes) + { + return Encoding.Default.GetString(bytes); + } + + public static string ToStr(this byte[] bytes, int index, int count) + { + return Encoding.Default.GetString(bytes, index, count); + } + + public static string Utf8ToStr(this byte[] bytes) + { + return Encoding.UTF8.GetString(bytes); + } + + public static string Utf8ToStr(this byte[] bytes, int index, int count) + { + return Encoding.UTF8.GetString(bytes, index, count); + } + + public static void WriteTo(this byte[] bytes, int offset, uint num) + { + bytes[offset] = (byte)(num & 0xff); + bytes[offset + 1] = (byte)((num & 0xff00) >> 8); + bytes[offset + 2] = (byte)((num & 0xff0000) >> 16); + bytes[offset + 3] = (byte)((num & 0xff000000) >> 24); + } + + public static void WriteTo(this byte[] bytes, int offset, int num) + { + bytes[offset] = (byte)(num & 0xff); + bytes[offset + 1] = (byte)((num & 0xff00) >> 8); + bytes[offset + 2] = (byte)((num & 0xff0000) >> 16); + bytes[offset + 3] = (byte)((num & 0xff000000) >> 24); + } + + public static void WriteTo(this byte[] bytes, int offset, byte num) + { + bytes[offset] = num; + } + + public static void WriteTo(this byte[] bytes, int offset, short num) + { + bytes[offset] = (byte)(num & 0xff); + bytes[offset + 1] = (byte)((num & 0xff00) >> 8); + } + + public static void WriteTo(this byte[] bytes, int offset, ushort num) + { + bytes[offset] = (byte)(num & 0xff); + bytes[offset + 1] = (byte)((num & 0xff00) >> 8); + } + + public static unsafe void WriteTo(this byte[] bytes, int offset, long num) + { + byte* bPoint = (byte*)# + for (int i = 0; i < sizeof(long); ++i) + { + bytes[offset + i] = bPoint[i]; + } + } + } +} \ No newline at end of file diff --git a/Assets/TEngine/Runtime/Utility/ByteHelper.cs.meta b/Assets/TEngine/Runtime/Utility/ByteHelper.cs.meta new file mode 100644 index 00000000..6de651c7 --- /dev/null +++ b/Assets/TEngine/Runtime/Utility/ByteHelper.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c577d22a071e44c6bf0c2a0ed5964fbe +timeCreated: 1682418991 \ No newline at end of file diff --git a/Assets/TEngine/Thirdly/Animation.meta b/Assets/TEngine/Thirdly/Animation.meta new file mode 100644 index 00000000..a5cdf891 --- /dev/null +++ b/Assets/TEngine/Thirdly/Animation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0db55501a091a6e429dd80459f36b6af +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TEngine/Thirdly/Animation/Editor.meta b/Assets/TEngine/Thirdly/Animation/Editor.meta new file mode 100644 index 00000000..973f5217 --- /dev/null +++ b/Assets/TEngine/Thirdly/Animation/Editor.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: b94472036d46ad5498116fcc1cbf4dfe +folderAsset: yes +timeCreated: 1510262153 +licenseType: Store +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TEngine/Thirdly/Animation/Editor/AnimationClipUtil.cs b/Assets/TEngine/Thirdly/Animation/Editor/AnimationClipUtil.cs new file mode 100644 index 00000000..58c3f049 --- /dev/null +++ b/Assets/TEngine/Thirdly/Animation/Editor/AnimationClipUtil.cs @@ -0,0 +1,136 @@ +/*------------------------------------------------------------------------------ +Original Author: Pikachuxxxx +Adapted By: Brandon Lyman +This script is an adaptation of Pikachuxxxx's utiltiy to reverse an animation +clip in Unity. Please find the original Github Gist here: +https://gist.github.com/8101da6d14a5afde80c7c180e3a43644.git +ABSOLUTELY ALL CREDIT FOR THIS SCRIPT goes to Pikachuxxxx. Thank you so much for +your original script! +Unfortunately, their method that utilizes +"AnimationUtility.GetAllCurves()" is obsolete, according to the official +unity documentation: +https://docs.unity3d.com/ScriptReference/AnimationUtility.GetAllCurves.html +The editor suggests using "AnimationUtility.GetCurveBindings()" in its stead, +and this script reveals how that can be accomplished as it is slightly +different from the original methodology. I also added in some logic to +differentiate between the original clip and the new clip being created, as +I experienced null reference exceptions after the original "ClearAllCurves()" +call. Additionally, I placed the script's logic in a ScriptableWizard class to +fit the needs for my project. For more information on ScriptableWizards, please +refer to this Unity Learn Tutorial: +https://learn.unity.com/tutorial/creating-basic-editor-tools#5cf6c8f2edbc2a160a8a0951 +Hope this helps and please comment with any questions. Thanks! +------------------------------------------------------------------------------*/ + +using UnityEngine; +using UnityEditor; +using System.IO; +using System.Collections.Generic; +//using static DG.DemiEditor.DeGUIKey; + +public class SpiteAnimationClip : ScriptableWizard +{ + public string NewFileName = ""; + + public float BeginTime = 0; + + public float EndTime = 1; + + [MenuItem("Tools/SplitAnimationClip...")] + private static void SplitAnimationClipShow() + { + ScriptableWizard.DisplayWizard("SpiteAnimationClip...", "splite"); + } + + private void OnWizardCreate() + { + string directoryPath = + Path.GetDirectoryName(AssetDatabase.GetAssetPath(Selection.activeObject)); + string fileName = + Path.GetFileName(AssetDatabase.GetAssetPath(Selection.activeObject)); + string fileExtension = + Path.GetExtension(AssetDatabase.GetAssetPath(Selection.activeObject)); + fileName = fileName.Split('.')[0]; + + string copiedFilePath = ""; + if (NewFileName != null && NewFileName != "") + { + copiedFilePath = directoryPath + Path.DirectorySeparatorChar + NewFileName + fileExtension; + } + else + { + copiedFilePath = directoryPath + Path.DirectorySeparatorChar + fileName + $"_split_{BeginTime}_{EndTime}" + fileExtension; + } + + AnimationClip originalClip = GetSelectedClip(); + + AssetDatabase.CopyAsset(AssetDatabase.GetAssetPath(Selection.activeObject), copiedFilePath); + + AnimationClip reversedClip = (AnimationClip)AssetDatabase.LoadAssetAtPath(copiedFilePath, typeof(AnimationClip)); + + if (originalClip == null) + { + return; + } + + float clipLength = originalClip.length; + EditorCurveBinding[] curveBindings = AnimationUtility.GetCurveBindings(originalClip); + Debug.Log(curveBindings.Length); + reversedClip.ClearCurves(); + float timeOffset = -1; + foreach (EditorCurveBinding binding in curveBindings) + { + AnimationCurve curve = AnimationUtility.GetEditorCurve(originalClip, binding); + var keys = new List();// curve.keys; + int keyCount = curve.keys.Length; + for (int i = 0; i < keyCount; i++) + { + Keyframe K = curve.keys[i]; + + if (K.time >= BeginTime && K.time <= EndTime) + { + if (timeOffset < 0) + { + timeOffset = K.time; + } + K.time = K.time - timeOffset; + keys.Add(K); + Debug.LogError("time " + clipLength + " index " + i + " time " + K.time); + } + + } + curve.keys = keys.ToArray() ; + reversedClip.SetCurve(binding.path, binding.type, binding.propertyName, curve); + } + + AnimationEvent[] events = AnimationUtility.GetAnimationEvents(originalClip); + + var eventsList= new List(); + if (events.Length > 0) + { + for (int i = 0; i < events.Length; i++) + { + var eventTemp = events[i]; + if (eventTemp.time <= BeginTime && eventTemp.time >= EndTime) + { + eventTemp.time = eventTemp.time - timeOffset; + eventsList.Add(eventTemp); + } + } + AnimationUtility.SetAnimationEvents(reversedClip, eventsList.ToArray()); + } + + Debug.Log("[[ReverseAnimationClip.cs]] Successfully reversed " + + "animation clip " + fileName + "."); + } + + private AnimationClip GetSelectedClip() + { + Object[] clips = Selection.GetFiltered(typeof(AnimationClip), SelectionMode.Assets); + if (clips.Length > 0) + { + return clips[0] as AnimationClip; + } + return null; + } +} \ No newline at end of file diff --git a/Assets/TEngine/Thirdly/Animation/Editor/AnimationClipUtil.cs.meta b/Assets/TEngine/Thirdly/Animation/Editor/AnimationClipUtil.cs.meta new file mode 100644 index 00000000..b7df1b05 --- /dev/null +++ b/Assets/TEngine/Thirdly/Animation/Editor/AnimationClipUtil.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9368fbead1d3043419793a2c9c3ef030 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/TEngine/Thirdly/Animation/Editor/AnimationHierarchyEditorTool.cs b/Assets/TEngine/Thirdly/Animation/Editor/AnimationHierarchyEditorTool.cs new file mode 100644 index 00000000..72f764d4 --- /dev/null +++ b/Assets/TEngine/Thirdly/Animation/Editor/AnimationHierarchyEditorTool.cs @@ -0,0 +1,1075 @@ +/// INFORMATION +/// +/// Project: Chloroplast Games Framework +/// Game: Chloroplast Games Framework +/// Date: 02/05/2017 +/// Author: Chloroplast Games +/// Web: http://www.chloroplastgames.com +/// Programmers: David Cuenca Diez +/// Description: Tool that allows change the path of hierarchy from a animation from an animation clip. +/// + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using UnityEditor; +using UnityEngine; +using System.IO; +using System.Reflection; +using UnityEngine.Profiling; + +// Local Namespace +namespace CGF.Editor.Tools +{ + public class PathData + { + public string ClipName { get; } + public string CurrentPath { get; set; } + public string LastPath { get; set; } + public AnimationClip Clip { get; set; } + + public EditorCurveBinding EditorCurve; + + public PathData(string clipName, string currentPath, string lastPath, EditorCurveBinding editorCurve, AnimationClip clip) + { + ClipName = clipName; + CurrentPath = currentPath; + LastPath = lastPath; + EditorCurve = editorCurve; + Clip = clip; + } + } + + + /// \english + /// + /// Tool that allows change the path of hierarchy from a animation from an animation clip. + /// + /// \endenglish + /// \spanish + /// + /// Herramienta que permite canviar la ruta de la jerarqu韆 de las animaciones de un clip de animaci髇. + /// + /// \endspanish + public class CGFAnimationHierarchyEditorTool : EditorWindow + { + #region Public Variables + + #endregion + + + #region Private Variables + + private enum TypeGameObject + { + None, + + GameObject, + + /*AnimationClip, + + RuntimeAnimatorController*/ + }; + + private TypeGameObject _currentSelectionGameObject; + + private int index; + + private List _gameObjects; + + private Animator _animatorObject; + + private Animator _animatorObject2; + + private List _pathDataList; + + private RuntimeAnimatorController _myruntime; + + private List _currentAnimationClips; + + private List _myanimationClips; + + private List _clipNames = new List(); + + private string[] _modes = new string[] { "Path", "GameObject" }; + + private int _selectedMode = 0; + + private string _replacePath = ""; + + private GameObject _replaceGameObject; + + private string _replacementPath = ""; + + private GameObject _replacementGameObject; + + private Vector2 scrollPosContent; + + #endregion + + + #region Main Methods + + [MenuItem("Tools/Animation Hierarchy Editor Tool")] + private static void ShowWindow() + { + EditorWindow window = EditorWindow.GetWindow(typeof(CGFAnimationHierarchyEditorTool), false, "Animation Hierarchy Editor Tool", true); + + window.minSize = new Vector2(1024, 250); + } + + public CGFAnimationHierarchyEditorTool() + { + _currentSelectionGameObject = new TypeGameObject(); + + _currentSelectionGameObject = TypeGameObject.None; + + _myanimationClips = new List(); + + _gameObjects = new List(); + } + + private void OnEnable() + { + ResetSelection(); + } + + private void OnSelectionChange() + { + ResetSelection(); + + this.Repaint(); + } + + private void ResetSelection() + { + _myanimationClips.Clear(); + + _clipNames.Clear(); + + _animatorObject = null; + + _myruntime = null; + + _animatorObject2 = null; + + index = 0; + + if (Selection.activeGameObject is GameObject) + { + _currentSelectionGameObject = TypeGameObject.GameObject; + } + else + { + _currentSelectionGameObject = TypeGameObject.None; + } + + DrawSeletedAnimator(); + } + + private void DrawSeletedAnimator() + { + if (_currentSelectionGameObject != TypeGameObject.GameObject) + { + return; + } + + _animatorObject2 = Selection.activeGameObject.GetComponent(); + + if (_animatorObject2 == null) + { + _currentSelectionGameObject = TypeGameObject.None; + return; + } + + _animatorObject = _animatorObject2; + + if (_animatorObject2.runtimeAnimatorController == null) + { + _currentSelectionGameObject = TypeGameObject.None; + return; + } + + _myruntime = _animatorObject2.runtimeAnimatorController; + + if (_myruntime.animationClips.Length == 0) + { + _currentSelectionGameObject = TypeGameObject.None; + return; + } + + foreach (AnimationClip i in _myruntime.animationClips) + { + _myanimationClips.Add(i); + } + + _clipNames.Add("All Clips"); + + foreach (AnimationClip e in _myanimationClips) + { + _clipNames.Add(e.name); + } + + if (_myanimationClips.Count > 0) + { + _currentAnimationClips = _myanimationClips; + } + else + { + _currentAnimationClips = null; + } + + FillModel(); + } + + private void DrawGui() + { + bool animations = true; + + EditorGUILayout.Space(); + + EditorGUILayout.Space(); + + EditorGUILayout.BeginHorizontal(); + + GUILayout.Label("Selected Animator", GUILayout.Width(170)); + + GUI.enabled = false; + + _animatorObject = ((Animator)EditorGUILayout.ObjectField(_animatorObject, typeof(Animator), true, GUILayout.Width(300))); + + GUILayout.FlexibleSpace(); + + GUI.enabled = _currentSelectionGameObject == TypeGameObject.GameObject; + + GUILayout.Label("Bulk Replace Mode"); + + _selectedMode = EditorGUILayout.Popup(_selectedMode, _modes); + + EditorGUILayout.EndHorizontal(); + + EditorGUILayout.BeginHorizontal(); + + GUI.enabled = false; + + GUILayout.Label("Selected Animator Controller", GUILayout.Width(170)); + + _myruntime = ((RuntimeAnimatorController)EditorGUILayout.ObjectField(_myruntime, typeof(RuntimeAnimatorController), true, GUILayout.Width(300))); + + GUILayout.FlexibleSpace(); + + GUI.enabled = _currentSelectionGameObject == TypeGameObject.GameObject; + + switch (_selectedMode) + { + case 0: + + GUILayout.Label("Path"); + + _replacePath = EditorGUILayout.TextField(_replacePath); + + break; + + case 1: + + GUILayout.Label("GameObject"); + + _replaceGameObject = (GameObject)EditorGUILayout.ObjectField(_replaceGameObject, typeof(GameObject), true); + + break; + } + + EditorGUILayout.EndHorizontal(); + + EditorGUILayout.BeginHorizontal(); + + EditorGUI.BeginChangeCheck(); + + GUILayout.Label("Selected Animation Clip", GUILayout.Width(170)); + + switch (_currentSelectionGameObject) + { + case TypeGameObject.GameObject: + + GUI.enabled = true; + + index = EditorGUILayout.Popup(index, _clipNames.ToArray(), GUILayout.Width(300)); + + if (index == 0) + { + _currentAnimationClips = _myanimationClips; + } + else + { + _currentAnimationClips = new List() { _myanimationClips[index - 1] }; + } + + break; + case TypeGameObject.None: + + GUI.enabled = false; + + EditorGUILayout.Popup(index, new string[] { "" }, GUILayout.Width(300)); + + animations = false; + + break; + } + + if (EditorGUI.EndChangeCheck()) + { + FillModel(); + } + + GUI.enabled = _currentSelectionGameObject == TypeGameObject.GameObject; + + GUILayout.FlexibleSpace(); + + GUILayout.Label("Replacement"); + + switch (_selectedMode) + { + case 0: + + _replacementPath = EditorGUILayout.TextField(_replacementPath); + + break; + + case 1: + + _replacementGameObject = (GameObject)EditorGUILayout.ObjectField(_replacementGameObject, typeof(GameObject), true); + + break; + } + + EditorGUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + + GUILayout.FlexibleSpace(); + + if (GUILayout.Button("Replace", GUILayout.Width(205))) + { + Replace(); + } + + _gameObjects.Clear(); + + EditorGUILayout.EndHorizontal(); + + EditorGUILayout.Space(); + + EditorGUILayout.Space(); + + GUILayout.BeginHorizontal("Toolbar"); + + GUILayout.Label("Animation Clip", GUILayout.Width(188)); + + GUILayout.Label("Property"); + + GUILayout.Label("Path"); + + GUILayout.Label("Object", GUILayout.Width(150)); + + if (GUILayout.Button("Apply All", EditorStyles.toolbarButton, GUILayout.Width(70))) + { + foreach (var pathData in _pathDataList) + { + UpdatePath(pathData); + } + + EditorGUI.FocusTextInControl(null); + } + + if (GUILayout.Button("Revert All", EditorStyles.toolbarButton, GUILayout.Width(70))) + { + foreach (var pathData in _pathDataList) + { + Revert(pathData); + } + + EditorGUI.FocusTextInControl(null); + } + + GUI.enabled = true; + + GUILayout.EndHorizontal(); + + EditorGUILayout.Space(); + + if (_currentSelectionGameObject != TypeGameObject.None) + { + if (_pathDataList != null) + { + scrollPosContent = EditorGUILayout.BeginScrollView(scrollPosContent); + + foreach (var pathData in _pathDataList) + { + GUICreatePathItem(pathData); + } + + EditorGUILayout.EndScrollView(); + } + } + + if (!animations) + { + EditorGUILayout.BeginHorizontal(); + + GUI.enabled = false; + + EditorGUILayout.LabelField(new GUIContent(EditorGUIUtility.ObjectContent(null, typeof(Animator)).image), GUILayout.Width(16)); + + EditorGUILayout.LabelField("Property"); + + EditorGUILayout.TextField("SomeNewObject"); + + EditorGUILayout.ObjectField(null, typeof(GameObject), true); + + GUILayout.Button("Apply", GUILayout.Width(60)); + + GUILayout.Button("Revert", GUILayout.Width(60)); + + GUILayout.EndHorizontal(); + + EditorGUILayout.Space(); + + EditorGUILayout.BeginHorizontal(); + + GUI.enabled = true; + + GUILayout.FlexibleSpace(); + + EditorGUILayout.HelpBox("Please select a GameObject or Prefab with an Animator, Animation Clip or an Animator Controller.", MessageType.Info); + + GUILayout.FlexibleSpace(); + + GUILayout.EndHorizontal(); + } + } + + private void Revert(PathData pathData) + { + pathData.CurrentPath = pathData.LastPath; + + UpdatePath(pathData); + } + + private void Replace() + { + switch (_selectedMode) + { + case 0: + + if (string.IsNullOrEmpty(_replacePath)) + { + return; + } + + foreach (var pathData in _pathDataList) + { + pathData.CurrentPath = pathData.CurrentPath.Replace(_replacePath, _replacementPath); + } + + break; + + case 1: + + if (_replaceGameObject == null || _replacementGameObject == null) + { + return; + } + + foreach (var pathData in _pathDataList) + { + if (pathData.CurrentPath.Equals(ChildPath(_replaceGameObject))) + { + pathData.CurrentPath = ChildPath(_replacementGameObject); + } + } + + break; + } + } + + private void OnGUI() + { + DrawGui(); + } + + private void GUICreatePathItem(PathData pathData) + { + GameObject newObj; + + GameObject obj; + + obj = FindObjectInRoot(pathData.CurrentPath); + + EditorGUILayout.BeginHorizontal(); + + GUIStyle propertyNameStyle = new GUIStyle(EditorStyles.label); + propertyNameStyle.richText = true; + + GUIStyle pathNameStyle = new GUIStyle(EditorStyles.textField); + + if (obj == null || obj.GetComponent(pathData.EditorCurve.type) == null) + { + propertyNameStyle.normal.textColor = Color.yellow; + + pathNameStyle.normal.textColor = Color.yellow; + } + + EditorGUILayout.LabelField(pathData.ClipName, GUILayout.Width(280)); + + GUILayout.Space(-90); + + var lastPath = pathData.CurrentPath.Split('/').Last(); + var gameObjectName = string.IsNullOrEmpty(lastPath) ? obj?.name : lastPath; + EditorGUILayout.LabelField(new GUIContent(EditorGUIUtility.ObjectContent(null, pathData.EditorCurve.type).image), GUILayout.Width(16)); + EditorGUILayout.LabelField( + $"{gameObjectName} - " + + $"{string.Join(" ", Regex.Split(pathData.EditorCurve.type.Name, @"(?{ObjectNames.NicifyVariableName(pathData.EditorCurve.propertyName)}", + propertyNameStyle + ); + + GUIStyle buttonStyle = new GUIStyle(EditorStyles.miniButton); + + + if (!pathData.CurrentPath.Equals(pathData.EditorCurve.path)) + { + buttonStyle.fontStyle = FontStyle.Bold; + + pathNameStyle.fontStyle = FontStyle.Bold; + } + + pathData.CurrentPath = EditorGUILayout.TextField(pathData.CurrentPath, pathNameStyle); + + Color standardColor = GUI.color; + + if (obj != null) + { + GUI.color = Color.white; + } + + if (obj == null || obj.GetComponent(pathData.EditorCurve.type) == null) + { + GUI.color = Color.yellow; + } + + newObj = (GameObject)EditorGUILayout.ObjectField(obj, typeof(GameObject), true, GUILayout.Width(150)); + + if (obj != null) + { + _gameObjects.Add(obj); + } + + GUI.color = standardColor; + + GUI.enabled = true; + + buttonStyle.fontSize = 11; + + buttonStyle.fixedHeight = 18; + + buttonStyle.fixedWidth = 68; + + if (GUILayout.Button("Apply", buttonStyle) && !pathData.CurrentPath.Equals(pathData.EditorCurve.path)) + { + UpdatePath(pathData); + + EditorGUI.FocusTextInControl(null); + } + + buttonStyle.fontStyle = !pathData.LastPath.Equals(pathData.EditorCurve.path) ? FontStyle.Bold : FontStyle.Normal; + + if (GUILayout.Button("Revert", buttonStyle) && pathData.CurrentPath.Equals(pathData.EditorCurve.path)) + { + Revert(pathData); + } + + EditorGUILayout.EndHorizontal(); + + try + { + if (obj != newObj) + { + pathData.CurrentPath = ChildPath(newObj); + } + } + catch (UnityException ex) + { + Debug.LogError(ex.Message); + } + } + + private void OnInspectorUpdate() + { + this.Repaint(); + } + + private void FillModel() + { + try + { + _pathDataList = new List(); + + foreach (var currentAnimationClip in _currentAnimationClips) + { + var pathDataListByClip = FillModelWithCurves(currentAnimationClip.name, AnimationUtility.GetCurveBindings(currentAnimationClip), currentAnimationClip); + + var pathDataListByObjectReference = FillModelWithCurves(currentAnimationClip.name, AnimationUtility.GetObjectReferenceCurveBindings(currentAnimationClip), + currentAnimationClip); + + _pathDataList.AddRange(pathDataListByClip); + + _pathDataList.AddRange(pathDataListByObjectReference); + } + } + catch (Exception e) + { + Console.WriteLine(e); + } + } + + + private List FillModelWithCurves(string clipName, EditorCurveBinding[] curves, AnimationClip clip) + { + var pathDataList = new List(); + + foreach (var curve in curves) + { + var pathData = _pathDataList?.Find(pd => pd.EditorCurve.Equals(curve) && pd.ClipName == clipName); + + if (pathData != null) + { + pathData.EditorCurve = curve; + pathDataList.Add(pathData); + } + else + { + pathDataList.Add(new PathData(clipName, curve.path, curve.path, curve, clip)); + } + } + + return pathDataList; + } + + private void UpdatePath(PathData pathData) + { + if (pathData.CurrentPath.Equals(pathData.EditorCurve.path)) + { + return; + } + + pathData.LastPath = pathData.EditorCurve.path; + + AssetDatabase.StartAssetEditing(); + + AnimationClip animationClip = pathData.Clip; + + Undo.RecordObject(animationClip, "Animation Hierarchy Change"); + + AnimationCurve curve = AnimationUtility.GetEditorCurve(animationClip, pathData.EditorCurve); + + ObjectReferenceKeyframe[] objectReferenceCurve = AnimationUtility.GetObjectReferenceCurve(animationClip, pathData.EditorCurve); + + if (curve != null) + { + AnimationUtility.SetEditorCurve(animationClip, pathData.EditorCurve, null); + } + else + { + AnimationUtility.SetObjectReferenceCurve(animationClip, pathData.EditorCurve, null); + } + + pathData.EditorCurve.path = pathData.CurrentPath; + + if (curve != null) + { + AnimationUtility.SetEditorCurve(animationClip, pathData.EditorCurve, curve); + } + else + { + AnimationUtility.SetObjectReferenceCurve(animationClip, pathData.EditorCurve, objectReferenceCurve); + } + + AssetDatabase.StopAssetEditing(); + + EditorUtility.ClearProgressBar(); + + FillModel(); + + this.Repaint(); + } + + private GameObject FindObjectInRoot(string path) + { + if (_animatorObject == null) + { + return null; + } + + Transform child = _animatorObject.transform.Find(path); + + if (child != null) + { + return child.gameObject; + } + + else + { + return null; + } + } + + private string ChildPath(GameObject obj, bool sep = false) + { + if (_animatorObject == null) + { + throw new UnityException("Please assign Referenced Animator (Root) first!"); + } + + if (obj == _animatorObject.gameObject) + { + return ""; + } + + else + { + if (obj.transform.parent == null) + { + throw new UnityException("Object must belong to " + _animatorObject.ToString() + "!"); + } + else + { + return ChildPath(obj.transform.parent.gameObject, true) + obj.name + (sep ? "/" : ""); + } + } + } + + #endregion + + + #region Utility Methods + + #endregion + + + #region Utility Events + + #endregion + } +} + + +namespace TEngine.Editor +{ + class AnimationOpt + { + static Dictionary _FLOAT_FORMAT; + static MethodInfo getAnimationClipStats; + static FieldInfo sizeInfo; + static object[] _param = new object[1]; + + static AnimationOpt() + { + _FLOAT_FORMAT = new Dictionary(); + for (uint i = 1; i < 6; i++) + { + _FLOAT_FORMAT.Add(i, "f" + i.ToString()); + } + + Assembly asm = Assembly.GetAssembly(typeof(UnityEditor.Editor)); + getAnimationClipStats = typeof(AnimationUtility).GetMethod( + "GetAnimationClipStats", + BindingFlags.Static | BindingFlags.NonPublic + ); + Type aniclipstats = asm.GetType("UnityEditor.AnimationClipStats"); + sizeInfo = aniclipstats.GetField("size", BindingFlags.Public | BindingFlags.Instance); + } + + AnimationClip _clip; + string _path; + + public string path + { + get { return _path; } + } + + public long originFileSize { get; private set; } + + public int originMemorySize { get; private set; } + + public int originInspectorSize { get; private set; } + + public long optFileSize { get; private set; } + + public int optMemorySize { get; private set; } + + public int optInspectorSize { get; private set; } + + public AnimationOpt(string path, AnimationClip clip) + { + _path = path; + _clip = clip; + _GetOriginSize(); + } + + void _GetOriginSize() + { + originFileSize = _GetFileZie(); + originMemorySize = _GetMemSize(); + originInspectorSize = _GetInspectorSize(); + } + + void _GetOptSize() + { + optFileSize = _GetFileZie(); + optMemorySize = _GetMemSize(); + optInspectorSize = _GetInspectorSize(); + } + + long _GetFileZie() + { + FileInfo fi = new FileInfo(_path); + return fi.Length; + } + + int _GetMemSize() + { + return (int)Profiler.GetRuntimeMemorySizeLong(_clip); + } + + int _GetInspectorSize() + { + _param[0] = _clip; + var stats = getAnimationClipStats.Invoke(null, _param); + return (int)sizeInfo.GetValue(stats); + } + + void _OptmizeAnimationScaleCurve() + { + if (_clip != null) + { + //去除scale曲线 + foreach (EditorCurveBinding theCurveBinding in AnimationUtility.GetCurveBindings(_clip)) + { + string name = theCurveBinding.propertyName.ToLower(); + if (name.Contains("scale")) + { + AnimationUtility.SetEditorCurve(_clip, theCurveBinding, null); + Debug.LogFormat("关闭{0}的scale curve", _clip.name); + } + } + } + } + + void _OptmizeAnimationFloat_X(uint x) + { + if (_clip != null && x > 0) + { + //浮点数精度压缩到f3 + AnimationClipCurveData[] curves = null; +#pragma warning disable CS0618 + curves = AnimationUtility.GetAllCurves(_clip); +#pragma warning restore CS0618 + Keyframe key; + Keyframe[] keyFrames; + string floatFormat; + if (_FLOAT_FORMAT.TryGetValue(x, out floatFormat)) + { + if (curves != null && curves.Length > 0) + { + for (int ii = 0; ii < curves.Length; ++ii) + { + AnimationClipCurveData curveDate = curves[ii]; + if (curveDate.curve == null || curveDate.curve.keys == null) + { + //Debug.LogWarning(string.Format("AnimationClipCurveData {0} don't have curve; Animation name {1} ", curveDate, animationPath)); + continue; + } + + keyFrames = curveDate.curve.keys; + for (int i = 0; i < keyFrames.Length; i++) + { + key = keyFrames[i]; + key.value = float.Parse(key.value.ToString(floatFormat)); + key.inTangent = float.Parse(key.inTangent.ToString(floatFormat)); + key.outTangent = float.Parse(key.outTangent.ToString(floatFormat)); + key.inWeight = float.Parse(key.inWeight.ToString(floatFormat)); + key.outWeight = float.Parse(key.outWeight.ToString(floatFormat)); + keyFrames[i] = key; + } + + curveDate.curve.keys = keyFrames; + _clip.SetCurve( + curveDate.path, + curveDate.type, + curveDate.propertyName, + curveDate.curve + ); + } + } + } + else + { + Debug.LogErrorFormat("目前不支持{0}位浮点", x); + } + } + } + + public void Optimize(bool scaleOpt, uint floatSize) + { + if (scaleOpt) + { + _OptmizeAnimationScaleCurve(); + } + + _OptmizeAnimationFloat_X(floatSize); + _GetOptSize(); + } + + public void Optimize_Scale_Float3() + { + Optimize(false, 3); + } + + public void LogOrigin() + { + _logSize(originFileSize, originMemorySize, originInspectorSize); + } + + public void LogOpt() + { + _logSize(optFileSize, optMemorySize, optInspectorSize); + } + + public void LogDelta() + { + } + + void _logSize(long fileSize, int memSize, int inspectorSize) + { + Debug.LogFormat( + "{0} \nSize=[ {1} ]", + _path, + string.Format( + "FSize={0} ; Mem->{1} ; inspector->{2}", + EditorUtility.FormatBytes(fileSize), + EditorUtility.FormatBytes(memSize), + EditorUtility.FormatBytes(inspectorSize) + ) + ); + } + } + + public class OptimizeAnimationClipTool + { + static List _AnimOptList = new List(); + static List _Errors = new List(); + static int _Index = 0; + + [MenuItem("Assets/Animation/裁剪浮点数去除Scale")] + public static void Optimize() + { + _AnimOptList = FindAnims(); + if (_AnimOptList.Count > 0) + { + _Index = 0; + _Errors.Clear(); + EditorApplication.update = ScanAnimationClip; + } + } + + private static void ScanAnimationClip() + { + AnimationOpt _AnimOpt = _AnimOptList[_Index]; + bool isCancel = EditorUtility.DisplayCancelableProgressBar( + "优化AnimationClip", + _AnimOpt.path, + (float)_Index / (float)_AnimOptList.Count + ); + _AnimOpt.Optimize_Scale_Float3(); + _Index++; + if (isCancel || _Index >= _AnimOptList.Count) + { + EditorUtility.ClearProgressBar(); + Debug.Log( + string.Format( + "--优化完成-- 错误数量: {0} 总数量: {1}/{2} 错误信息↓:\n{3}\n----------输出完毕----------", + _Errors.Count, + _Index, + _AnimOptList.Count, + string.Join(string.Empty, _Errors.ToArray()) + ) + ); + Resources.UnloadUnusedAssets(); + GC.Collect(); + AssetDatabase.SaveAssets(); + EditorApplication.update = null; + _AnimOptList.Clear(); + _cachedOpts.Clear(); + _Index = 0; + } + } + + static Dictionary _cachedOpts = new Dictionary(); + + static AnimationOpt _GetNewAOpt(string path) + { + AnimationOpt opt = null; + if (!_cachedOpts.ContainsKey(path)) + { + AnimationClip clip = AssetDatabase.LoadAssetAtPath(path); + if (clip != null) + { + opt = new AnimationOpt(path, clip); + _cachedOpts[path] = opt; + } + } + + return opt; + } + + static List FindAnims() + { + string[] guids = null; + List path = new List(); + List assets = new List(); + UnityEngine.Object[] objs = Selection.GetFiltered(typeof(object), SelectionMode.Assets); + if (objs.Length > 0) + { + for (int i = 0; i < objs.Length; i++) + { + if (objs[i].GetType() == typeof(AnimationClip)) + { + string p = AssetDatabase.GetAssetPath(objs[i]); + AnimationOpt animopt = _GetNewAOpt(p); + if (animopt != null) assets.Add(animopt); + } + else + path.Add(AssetDatabase.GetAssetPath(objs[i])); + } + + if (path.Count > 0) + guids = AssetDatabase.FindAssets( + string.Format("t:{0}", typeof(AnimationClip).ToString().Replace("UnityEngine.", "")), + path.ToArray() + ); + else + guids = new string[] { }; + } + + for (int i = 0; i < guids.Length; i++) + { + string assetPath = AssetDatabase.GUIDToAssetPath(guids[i]); + AnimationOpt animopt = _GetNewAOpt(assetPath); + if (animopt != null) assets.Add(animopt); + } + + return assets; + } + } +} \ No newline at end of file diff --git a/Assets/TEngine/Thirdly/Animation/Editor/AnimationHierarchyEditorTool.cs.meta b/Assets/TEngine/Thirdly/Animation/Editor/AnimationHierarchyEditorTool.cs.meta new file mode 100644 index 00000000..aeeb3c49 --- /dev/null +++ b/Assets/TEngine/Thirdly/Animation/Editor/AnimationHierarchyEditorTool.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8be52d198504f814db7f9d88b54c5a44 +timeCreated: 1510337152 +licenseType: Store +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Luban/Proto/pb_schemas/proto_cs_base.proto b/Luban/Proto/pb_schemas/proto_cs_base.proto new file mode 100644 index 00000000..55a40694 --- /dev/null +++ b/Luban/Proto/pb_schemas/proto_cs_base.proto @@ -0,0 +1,36 @@ +syntax = "proto3"; + +package GameProto; +// 这个文件只放协议,和协议头 + +// 消息协议 +message CSPkg +{ + CSPkgHead Head = 1; //消息协议头 + CSPkgBody Body = 2; //消息协议体 +} + +// 消息协议头 +message CSPkgHead +{ + uint32 MsgId = 1; //协议号 + uint32 MsgLength = 2; //协议长度 + uint32 MsgVersion = 3; //协议版本 + uint32 Echo = 4; //回带字段 + uint32 SvrTime = 5; //服务器时间 +} + +// 消息协议体 +message CSPkgBody +{ + +} + + +// 协议ID +enum CSMsgID +{ + CS_START = 0; + CS_HeartBeat = 10001; + CS_END = 10000; +} diff --git a/Packages/manifest.json b/Packages/manifest.json index de2eeeaf..c48b1196 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,20 +1,20 @@ { "dependencies": { "com.focus-creative-games.hybridclr_unity": "2.1.0", - "com.unity.2d.animation": "5.2.0", - "com.unity.2d.pixel-perfect": "4.0.1", - "com.unity.2d.psdimporter": "4.3.0", + "com.unity.2d.animation": "7.0.9", + "com.unity.2d.pixel-perfect": "5.0.3", + "com.unity.2d.psdimporter": "6.0.7", "com.unity.2d.sprite": "1.0.0", - "com.unity.2d.spriteshape": "5.3.0", + "com.unity.2d.spriteshape": "7.0.6", "com.unity.2d.tilemap": "1.0.0", - "com.unity.collab-proxy": "1.15.15", - "com.unity.ide.rider": "2.0.7", - "com.unity.ide.visualstudio": "2.0.14", + "com.unity.collab-proxy": "2.0.1", + "com.unity.ide.rider": "3.0.18", + "com.unity.ide.visualstudio": "2.0.17", "com.unity.ide.vscode": "1.2.5", - "com.unity.scriptablebuildpipeline": "1.19.6", + "com.unity.scriptablebuildpipeline": "1.20.1", "com.unity.test-framework": "1.1.31", "com.unity.textmeshpro": "3.0.6", - "com.unity.timeline": "1.4.8", + "com.unity.timeline": "1.6.4", "com.unity.ugui": "1.0.0", "com.unity.modules.ai": "1.0.0", "com.unity.modules.androidjni": "1.0.0", @@ -58,4 +58,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index db99c571..774cbf32 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -8,12 +8,11 @@ "url": "https://package.openupm.cn" }, "com.unity.2d.animation": { - "version": "5.2.0", + "version": "7.0.9", "depth": 0, "source": "registry", "dependencies": { - "com.unity.2d.common": "4.2.0", - "com.unity.mathematics": "1.1.0", + "com.unity.2d.common": "6.0.6", "com.unity.2d.sprite": "1.0.0", "com.unity.modules.animation": "1.0.0", "com.unity.modules.uielements": "1.0.0" @@ -21,36 +20,38 @@ "url": "https://packages.unity.cn" }, "com.unity.2d.common": { - "version": "4.2.0", + "version": "6.0.6", "depth": 1, "source": "registry", "dependencies": { "com.unity.2d.sprite": "1.0.0", - "com.unity.modules.uielements": "1.0.0" + "com.unity.mathematics": "1.1.0", + "com.unity.modules.uielements": "1.0.0", + "com.unity.burst": "1.5.1" }, "url": "https://packages.unity.cn" }, "com.unity.2d.path": { - "version": "4.0.2", + "version": "5.0.2", "depth": 1, "source": "registry", "dependencies": {}, "url": "https://packages.unity.cn" }, "com.unity.2d.pixel-perfect": { - "version": "4.0.1", + "version": "5.0.3", "depth": 0, "source": "registry", "dependencies": {}, "url": "https://packages.unity.cn" }, "com.unity.2d.psdimporter": { - "version": "4.3.0", + "version": "6.0.7", "depth": 0, "source": "registry", "dependencies": { - "com.unity.2d.common": "4.2.0", - "com.unity.2d.animation": "5.2.0", + "com.unity.2d.animation": "7.0.9", + "com.unity.2d.common": "6.0.6", "com.unity.2d.sprite": "1.0.0" }, "url": "https://packages.unity.cn" @@ -62,13 +63,13 @@ "dependencies": {} }, "com.unity.2d.spriteshape": { - "version": "5.3.0", + "version": "7.0.6", "depth": 0, "source": "registry", "dependencies": { "com.unity.mathematics": "1.1.0", - "com.unity.2d.common": "4.2.0", - "com.unity.2d.path": "4.0.2", + "com.unity.2d.common": "6.0.4", + "com.unity.2d.path": "5.0.2", "com.unity.modules.physics2d": "1.0.0" }, "url": "https://packages.unity.cn" @@ -79,15 +80,22 @@ "source": "builtin", "dependencies": {} }, - "com.unity.collab-proxy": { - "version": "1.15.15", - "depth": 0, + "com.unity.burst": { + "version": "1.6.6", + "depth": 2, "source": "registry", "dependencies": { - "com.unity.services.core": "1.0.1" + "com.unity.mathematics": "1.2.1" }, "url": "https://packages.unity.cn" }, + "com.unity.collab-proxy": { + "version": "2.0.1", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.cn" + }, "com.unity.ext.nunit": { "version": "1.0.6", "depth": 1, @@ -96,16 +104,16 @@ "url": "https://packages.unity.cn" }, "com.unity.ide.rider": { - "version": "2.0.7", + "version": "3.0.18", "depth": 0, "source": "registry", "dependencies": { - "com.unity.test-framework": "1.1.1" + "com.unity.ext.nunit": "1.0.6" }, "url": "https://packages.unity.cn" }, "com.unity.ide.visualstudio": { - "version": "2.0.14", + "version": "2.0.17", "depth": 0, "source": "registry", "dependencies": { @@ -121,28 +129,19 @@ "url": "https://packages.unity.cn" }, "com.unity.mathematics": { - "version": "1.1.0", + "version": "1.2.6", "depth": 1, "source": "registry", "dependencies": {}, "url": "https://packages.unity.cn" }, "com.unity.scriptablebuildpipeline": { - "version": "1.19.6", + "version": "1.20.1", "depth": 0, "source": "registry", "dependencies": {}, "url": "https://packages.unity.cn" }, - "com.unity.services.core": { - "version": "1.0.1", - "depth": 1, - "source": "registry", - "dependencies": { - "com.unity.modules.unitywebrequest": "1.0.0" - }, - "url": "https://packages.unity.cn" - }, "com.unity.test-framework": { "version": "1.1.31", "depth": 0, @@ -164,7 +163,7 @@ "url": "https://packages.unity.cn" }, "com.unity.timeline": { - "version": "1.4.8", + "version": "1.6.4", "depth": 0, "source": "registry", "dependencies": { diff --git a/ProjectSettings/BurstAotSettings_StandaloneWindows.json b/ProjectSettings/BurstAotSettings_StandaloneWindows.json new file mode 100644 index 00000000..e02ae332 --- /dev/null +++ b/ProjectSettings/BurstAotSettings_StandaloneWindows.json @@ -0,0 +1,17 @@ +{ + "MonoBehaviour": { + "Version": 4, + "EnableBurstCompilation": true, + "EnableOptimisations": true, + "EnableSafetyChecks": false, + "EnableDebugInAllBuilds": false, + "UsePlatformSDKLinker": false, + "CpuMinTargetX32": 0, + "CpuMaxTargetX32": 0, + "CpuMinTargetX64": 0, + "CpuMaxTargetX64": 0, + "CpuTargetsX32": 6, + "CpuTargetsX64": 72, + "OptimizeFor": 0 + } +} diff --git a/ProjectSettings/CommonBurstAotSettings.json b/ProjectSettings/CommonBurstAotSettings.json new file mode 100644 index 00000000..0293dafc --- /dev/null +++ b/ProjectSettings/CommonBurstAotSettings.json @@ -0,0 +1,6 @@ +{ + "MonoBehaviour": { + "Version": 4, + "DisabledWarnings": "" + } +} diff --git a/ProjectSettings/HybridCLRSettings.asset b/ProjectSettings/HybridCLRSettings.asset index 88bcd3f3..e2c2fe44 100644 --- a/ProjectSettings/HybridCLRSettings.asset +++ b/ProjectSettings/HybridCLRSettings.asset @@ -18,9 +18,9 @@ MonoBehaviour: il2cppPlusRepoURL: https://gitee.com/focus-creative-games/il2cpp_plus hotUpdateAssemblyDefinitions: - {fileID: 5897886265953266890, guid: 08c3762f54316454ca6b6fbcb22b40e5, type: 3} - - {fileID: 5897886265953266890, guid: acd6baa97ba40d3478c29cd9c76ff9e3, type: 3} - {fileID: 5897886265953266890, guid: a90b2d3377c5e4a4db95cc44fb82045e, type: 3} - {fileID: 5897886265953266890, guid: 641632c4f8079b94f963b5284d859a12, type: 3} + - {fileID: 5897886265953266890, guid: acd6baa97ba40d3478c29cd9c76ff9e3, type: 3} hotUpdateAssemblies: [] preserveHotUpdateAssemblies: [] hotUpdateDllCompileOutputRootDir: HybridCLRData/HotUpdateDlls diff --git a/ProjectSettings/MemorySettings.asset b/ProjectSettings/MemorySettings.asset new file mode 100644 index 00000000..5b5facec --- /dev/null +++ b/ProjectSettings/MemorySettings.asset @@ -0,0 +1,35 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!387306366 &1 +MemorySettings: + m_ObjectHideFlags: 0 + m_EditorMemorySettings: + m_MainAllocatorBlockSize: -1 + m_ThreadAllocatorBlockSize: -1 + m_MainGfxBlockSize: -1 + m_ThreadGfxBlockSize: -1 + m_CacheBlockSize: -1 + m_TypetreeBlockSize: -1 + m_ProfilerBlockSize: -1 + m_ProfilerEditorBlockSize: -1 + m_BucketAllocatorGranularity: -1 + m_BucketAllocatorBucketsCount: -1 + m_BucketAllocatorBlockSize: -1 + m_BucketAllocatorBlockCount: -1 + m_ProfilerBucketAllocatorGranularity: -1 + m_ProfilerBucketAllocatorBucketsCount: -1 + m_ProfilerBucketAllocatorBlockSize: -1 + m_ProfilerBucketAllocatorBlockCount: -1 + m_TempAllocatorSizeMain: -1 + m_JobTempAllocatorBlockSize: -1 + m_BackgroundJobTempAllocatorBlockSize: -1 + m_JobTempAllocatorReducedBlockSize: -1 + m_TempAllocatorSizeGIBakingWorker: -1 + m_TempAllocatorSizeNavMeshWorker: -1 + m_TempAllocatorSizeAudioWorker: -1 + m_TempAllocatorSizeCloudWorker: -1 + m_TempAllocatorSizeGfx: -1 + m_TempAllocatorSizeJobWorker: -1 + m_TempAllocatorSizeBackgroundWorker: -1 + m_TempAllocatorSizePreloadManager: -1 + m_PlatformMemorySettings: {} diff --git a/ProjectSettings/PackageManagerSettings.asset b/ProjectSettings/PackageManagerSettings.asset index 8af7a773..9d005379 100644 --- a/ProjectSettings/PackageManagerSettings.asset +++ b/ProjectSettings/PackageManagerSettings.asset @@ -12,10 +12,11 @@ MonoBehaviour: m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} m_Name: m_EditorClassIdentifier: - m_EnablePreviewPackages: 1 + m_EnablePreReleasePackages: 0 m_EnablePackageDependencies: 1 m_AdvancedSettingsExpanded: 1 m_ScopedRegistriesSettingsExpanded: 1 + m_SeeAllPackageVersions: 0 oneTimeWarningShown: 1 m_Registries: - m_Id: main @@ -24,28 +25,20 @@ MonoBehaviour: m_Scopes: [] m_IsDefault: 1 m_Capabilities: 7 - - m_Id: scoped:hybridclr_unity + m_ConfigSource: 0 + - m_Id: scoped:project:hybridclr_unity m_Name: hybridclr_unity m_Url: https://package.openupm.cn m_Scopes: - com.focus-creative-games.hybridclr_unity m_IsDefault: 0 m_Capabilities: 0 - m_UserSelectedRegistryName: + m_ConfigSource: 4 + m_UserSelectedRegistryName: hybridclr_unity m_UserAddingNewScopedRegistry: 0 m_RegistryInfoDraft: - m_ErrorMessage: - m_Original: - m_Id: scoped:hybridclr_unity - m_Name: hybridclr_unity - m_Url: https://package.openupm.cn - m_Scopes: - - com.focus-creative-games.hybridclr_unity - m_IsDefault: 0 - m_Capabilities: 0 m_Modified: 0 - m_Name: hybridclr_unity - m_Url: https://package.openupm.cn - m_Scopes: - - com.focus-creative-games.hybridclr_unity - m_SelectedScopeIndex: 0 + m_ErrorMessage: + m_UserModificationsInstanceId: -832 + m_OriginalInstanceId: -836 + m_LoadAssets: 0 diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index f5c41dcd..7c9a6d41 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -3,7 +3,7 @@ --- !u!129 &1 PlayerSettings: m_ObjectHideFlags: 0 - serializedVersion: 22 + serializedVersion: 24 productGUID: 31414a79c236a5c45a5b9a6d85d8615c AndroidProfiler: 0 AndroidFilterTouchesWhenObscured: 0 @@ -156,11 +156,13 @@ PlayerSettings: enable360StereoCapture: 0 isWsaHolographicRemotingEnabled: 0 enableFrameTimingStats: 0 + enableOpenGLProfilerGPURecorders: 1 useHDRDisplay: 0 D3DHDRBitDepth: 0 m_ColorGamuts: 00000000 targetPixelDensity: 30 resolutionScalingMode: 0 + resetResolutionOnWindowResize: 0 androidSupportedAspectRatio: 1 androidMaxAspectRatio: 2.1 applicationIdentifier: @@ -173,7 +175,7 @@ PlayerSettings: tvOS: 0 overrideDefaultApplicationIdentifier: 1 AndroidBundleVersionCode: 1 - AndroidMinSdkVersion: 19 + AndroidMinSdkVersion: 22 AndroidTargetSdkVersion: 0 AndroidPreferredInstallLocation: 1 aotOptions: @@ -229,6 +231,7 @@ PlayerSettings: iOSLaunchScreeniPadCustomStoryboardPath: iOSDeviceRequirements: [] iOSURLSchemes: [] + macOSURLSchemes: [] iOSBackgroundModes: 0 iOSMetalForceHardShadows: 0 metalEditorSupport: 1 @@ -374,7 +377,7 @@ PlayerSettings: m_Kind: 1 m_SubKind: m_BuildTargetBatching: [] - m_BuildTargetSecurityBuild: [] + m_BuildTargetShaderSettings: [] m_BuildTargetGraphicsJobs: - m_BuildTarget: MacStandaloneSupport m_GraphicsJobs: 0 @@ -406,11 +409,13 @@ PlayerSettings: m_BuildTargetGraphicsAPIs: - m_BuildTarget: AndroidPlayer m_APIs: 150000000b000000 - m_Automatic: 0 + m_Automatic: 1 - m_BuildTarget: iOSSupport m_APIs: 10000000 m_Automatic: 1 m_BuildTargetVRSettings: [] + m_DefaultShaderChunkSizeInMB: 16 + m_DefaultShaderChunkCount: 0 openGLRequireES31: 0 openGLRequireES31AEP: 0 openGLRequireES32: 0 @@ -422,6 +427,7 @@ PlayerSettings: m_BuildTargetGroupLightmapEncodingQuality: [] m_BuildTargetGroupLightmapSettings: [] m_BuildTargetNormalMapEncoding: [] + m_BuildTargetDefaultTextureCompressionFormat: [] playModeTestRunnerEnabled: 0 runPlayModeTestAsEditModeTest: 0 actionOnDotNetUnhandledException: 1 @@ -431,7 +437,7 @@ PlayerSettings: cameraUsageDescription: "\u662F\u5426\u5141\u8BB8\u6253\u5F00\u6444\u50CF\u5934" locationUsageDescription: "\u662F\u5426\u5141\u8BB8\u8BBF\u95EE\u5B9A\u4F4D" microphoneUsageDescription: "\u662F\u5426\u5141\u8BB8\u8BBF\u95EE\u7535\u8BDD" - bluetoothUsageDescription: + bluetoothUsageDescription: "\u662F\u5426\u5141\u8BB8\u8BBF\u95EE\u84DD\u7259" switchNMETAOverride: switchNetLibKey: switchSocketMemoryPoolSize: 6144 @@ -440,6 +446,7 @@ PlayerSettings: switchScreenResolutionBehavior: 2 switchUseCPUProfiler: 0 switchUseGOLDLinker: 0 + switchLTOSetting: 0 switchApplicationID: 0x01004b9000490000 switchNSODependencies: switchTitleNames_0: @@ -515,7 +522,6 @@ PlayerSettings: switchReleaseVersion: 0 switchDisplayVersion: 1.0.0 switchStartupUserAccount: 0 - switchTouchScreenUsage: 0 switchSupportedLanguagesMask: 0 switchLogoType: 0 switchApplicationErrorCodeCategory: @@ -557,6 +563,7 @@ PlayerSettings: switchNativeFsCacheSize: 32 switchIsHoldTypeHorizontal: 0 switchSupportedNpadCount: 8 + switchEnableTouchScreen: 1 switchSocketConfigEnabled: 0 switchTcpInitialSendBufferSize: 32 switchTcpInitialReceiveBufferSize: 64 @@ -569,6 +576,7 @@ PlayerSettings: switchNetworkInterfaceManagerInitializeEnabled: 1 switchPlayerConnectionEnabled: 1 switchUseNewStyleFilepaths: 0 + switchUseLegacyFmodPriorities: 1 switchUseMicroSleepForYield: 1 switchEnableRamDiskSupport: 0 switchMicroSleepForYieldTime: 25 @@ -668,12 +676,13 @@ PlayerSettings: webGLLinkerTarget: 1 webGLThreadsSupport: 0 webGLDecompressionFallback: 0 + webGLPowerPreference: 2 scriptingDefineSymbols: - 1: ENABLE_LOG - 4: ENABLE_LOG - 7: ENABLE_LOG - 13: ENABLE_LOG - 14: ENABLE_LOG + Android: ENABLE_LOG + Standalone: ENABLE_LOG + WebGL: ENABLE_LOG + Windows Store Apps: ENABLE_LOG + iPhone: ENABLE_LOG additionalCompilerArguments: {} platformArchitecture: {} scriptingBackend: @@ -685,8 +694,8 @@ PlayerSettings: suppressCommonWarnings: 1 allowUnsafeCode: 1 useDeterministicCompilation: 1 - useReferenceAssemblies: 1 enableRoslynAnalyzers: 1 + selectedPlatform: 0 additionalIl2CppArgs: scriptingRuntimeVersion: 1 gcIncremental: 0 @@ -766,6 +775,7 @@ PlayerSettings: m_VersionName: apiCompatibilityLevel: 6 activeInputHandler: 0 + windowsGamepadBackendHint: 0 cloudProjectId: 323deeed-4aa5-498b-9105-0efdb8cce118 framebufferDepthMemorylessMode: 0 qualitySettingsNames: [] @@ -773,4 +783,6 @@ PlayerSettings: organizationId: cloudEnabled: 0 legacyClampBlendShapeWeights: 0 + playerDataPath: + forceSRGBBlit: 1 virtualTexturingSupportEnabled: 0 diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index 720f47ef..53df9d93 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2020.3.33f1c2 -m_EditorVersionWithRevision: 2020.3.33f1c2 (8e753a737e7b) +m_EditorVersion: 2021.3.20f1c1 +m_EditorVersionWithRevision: 2021.3.20f1c1 (7cf0fbd73406) diff --git a/ProjectSettings/SceneTemplateSettings.json b/ProjectSettings/SceneTemplateSettings.json new file mode 100644 index 00000000..6f3e60fd --- /dev/null +++ b/ProjectSettings/SceneTemplateSettings.json @@ -0,0 +1,167 @@ +{ + "templatePinStates": [], + "dependencyTypeInfos": [ + { + "userAdded": false, + "type": "UnityEngine.AnimationClip", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEditor.Animations.AnimatorController", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.AnimatorOverrideController", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEditor.Audio.AudioMixerController", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.ComputeShader", + "ignore": true, + "defaultInstantiationMode": 1, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Cubemap", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.GameObject", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEditor.LightingDataAsset", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": false + }, + { + "userAdded": false, + "type": "UnityEngine.LightingSettings", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Material", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEditor.MonoScript", + "ignore": true, + "defaultInstantiationMode": 1, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.PhysicMaterial", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.PhysicsMaterial2D", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Rendering.PostProcessing.PostProcessResources", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Rendering.VolumeProfile", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEditor.SceneAsset", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": false + }, + { + "userAdded": false, + "type": "UnityEngine.Shader", + "ignore": true, + "defaultInstantiationMode": 1, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.ShaderVariantCollection", + "ignore": true, + "defaultInstantiationMode": 1, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Texture", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Texture2D", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + }, + { + "userAdded": false, + "type": "UnityEngine.Timeline.TimelineAsset", + "ignore": false, + "defaultInstantiationMode": 0, + "supportsModification": true + } + ], + "defaultDependencyTypeInfo": { + "userAdded": false, + "type": "", + "ignore": false, + "defaultInstantiationMode": 1, + "supportsModification": true + }, + "newSceneOverride": 0 +} \ No newline at end of file diff --git a/ProjectSettings/TimelineSettings.asset b/ProjectSettings/TimelineSettings.asset index b4fbdb09..cfaebd7a 100644 --- a/ProjectSettings/TimelineSettings.asset +++ b/ProjectSettings/TimelineSettings.asset @@ -13,3 +13,4 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: assetDefaultFramerate: 60 + m_DefaultFrameRate: 60 diff --git a/ProjectSettings/boot.config b/ProjectSettings/boot.config new file mode 100644 index 00000000..e69de29b diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index fd41ce76..d8da778f 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -5,33 +5,36 @@ EditorUserSettings: m_ObjectHideFlags: 0 serializedVersion: 4 m_ConfigSettings: - RecentlyUsedScenePath-0: - value: 2242470311464677080f021607265a1e5932002b21382a353e662e30e7ee312badc033e7e2283e300a0be22c083b3436bc1f0702e212 + RecentlyUsedSceneGuid-0: + value: 0557570353005959590f5f7b48700744174f417c7e717165797b1835b2b96d6a flags: 0 - RecentlyUsedScenePath-1: + RecentlyUsedScenePath-0: value: 2242470311464677080f021607265a1e5932002b21382a353e662e30e7ee312badd333faf333313b032eea3b053d181aea1e471ef8021e12 flags: 0 - RecentlyUsedScenePath-2: + RecentlyUsedScenePath-1: value: 2242470311464677080f021607265a1e5932002b21382a353e662e30e7ee312badc033e7e2283e301c03fc350a393526e20f1a45e305031f08 flags: 0 - RecentlyUsedScenePath-3: + RecentlyUsedScenePath-2: value: 2242470311464677080f021607265a1e5932002b21382a353e663c21e1e83d2ee7e379dde2292b353705dd350337053dfd0e1028c5451f05181ae4 flags: 0 - RecentlyUsedScenePath-4: + RecentlyUsedScenePath-3: value: 2242470311464677080f021607265a1e5932002b21382a353e663c21e1e83d2ee7e379c6eb3e18091027f73d092e0d3ae1293a45e305031f08 flags: 0 - RecentlyUsedScenePath-5: + RecentlyUsedScenePath-4: value: 2242470311464677080f021607265a1e5932002b21382a353e662e30e7ee312badd737fdef092f30300cea190a3a0d3ae119471ef8021e12 flags: 0 - RecentlyUsedScenePath-6: + RecentlyUsedScenePath-5: value: 2242470311464677080f021607265a1e5932002b21382a353e662e30e7ee312badcb39eee81936323c0fee280d3d4f2afc031d12 flags: 0 - RecentlyUsedScenePath-7: + RecentlyUsedScenePath-6: value: 22424703114646680e0b0227036c5e020204553f256522353e201a3dacf53a31f6fe flags: 0 - RecentlyUsedScenePath-8: + RecentlyUsedScenePath-7: value: 224247031146467a2c3a092f006c4b151b07563f22213229 flags: 0 + RecentlyUsedScenePath-8: + value: 224247031146467a2c3a092f006c6b15050357012f3812353e3d5218e1f0003df1f378fce9332b25 + flags: 0 RecentlyUsedScenePath-9: value: 22424703114646680e0b0227036c52111f19563f22213229 flags: 0 @@ -43,9 +46,13 @@ EditorUserSettings: m_VCDebugCmd: 0 m_VCDebugOut: 0 m_SemanticMergeMode: 2 + m_DesiredImportWorkerCount: 1 + m_StandbyImportWorkerCount: 1 + m_IdleImportWorkerShutdownDelay: 60000 m_VCShowFailedCheckout: 1 m_VCOverwriteFailedCheckoutAssets: 1 m_VCProjectOverlayIcons: 1 m_VCHierarchyOverlayIcons: 1 m_VCOtherOverlayIcons: 1 m_VCAllowAsyncUpdate: 1 + m_ArtifactGarbageCollection: 1