diff --git a/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/IUIResourceLoader.cs b/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/IUIResourceLoader.cs index 7b32bf95..7b54f200 100644 --- a/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/IUIResourceLoader.cs +++ b/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/IUIResourceLoader.cs @@ -37,7 +37,7 @@ namespace GameLogic /// public class UIResourceLoader : IUIResourceLoader { - private readonly IResourceModule m_ResourceLoaderImp = ModuleSystem.GetModule(); + private readonly IResourceModule _resourceLoaderImp = ModuleSystem.GetModule(); /// /// 同步加载游戏物体并实例化。 @@ -49,7 +49,7 @@ namespace GameLogic /// 会实例化资源到场景,无需主动UnloadAsset,Destroy时自动UnloadAsset。 public GameObject LoadGameObject(string location, Transform parent = null, string packageName = "") { - return m_ResourceLoaderImp.LoadGameObject(location, parent, packageName); + return _resourceLoaderImp.LoadGameObject(location, parent, packageName); } /// @@ -63,7 +63,7 @@ namespace GameLogic /// 会实例化资源到场景,无需主动UnloadAsset,Destroy时自动UnloadAsset。 public async UniTask LoadGameObjectAsync(string location, Transform parent = null, CancellationToken cancellationToken = default, string packageName = "") { - return await m_ResourceLoaderImp.LoadGameObjectAsync(location, parent, cancellationToken, packageName); + return await _resourceLoaderImp.LoadGameObjectAsync(location, parent, cancellationToken, packageName); } } } \ No newline at end of file diff --git a/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/UIBase.cs b/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/UIBase.cs index 738c3c84..9f152176 100644 --- a/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/UIBase.cs +++ b/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/UIBase.cs @@ -103,12 +103,12 @@ namespace GameLogic /// /// 存在Update更新的UI子组件列表。 /// - protected List m_listUpdateChild = null; + protected List ListUpdateChild = null; /// /// 是否持有Update行为。 /// - protected bool m_updateListValid = false; + protected bool UpdateListValid = false; /// /// 代码自动生成绑定。 @@ -186,7 +186,7 @@ namespace GameLogic internal void SetUpdateDirty() { - m_updateListValid = false; + UpdateListValid = false; if (Parent != null) { Parent.SetUpdateDirty(); diff --git a/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/UIModule.cs b/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/UIModule.cs index 1d9cfc38..f73867dc 100644 --- a/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/UIModule.cs +++ b/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/UIModule.cs @@ -10,30 +10,30 @@ namespace GameLogic { public sealed partial class UIModule : Singleton, IUpdate { - private static Transform m_InstanceRoot = null; + private static Transform _instanceRoot = null; - private bool m_enableErrorLog = true; + private bool _enableErrorLog = true; - private Camera m_UICamera = null; + private readonly Camera _uiCamera = null; - private readonly List _stack = new List(100); + private readonly List _uiStack = new List(100); - public const int LAYER_DEEP = 2000; - public const int WINDOW_DEEP = 100; - public const int WINDOW_HIDE_LAYER = 2; // Ignore Raycast - public const int WINDOW_SHOW_LAYER = 5; // UI + public const int LayerDeep = 2000; + public const int WindowDeep = 100; + public const int WindowHideLayer = 2; // Ignore Raycast + public const int WindowShowLayer = 5; // UI public static IUIResourceLoader Resource; /// /// UI根节点。 /// - public static Transform UIRoot => m_InstanceRoot; + public static Transform UIRoot => _instanceRoot; /// /// UI根节点。 /// - public Camera UICamera => m_UICamera; + public Camera UICamera => _uiCamera; private ErrorLogger _errorLogger; @@ -42,7 +42,7 @@ namespace GameLogic var uiRoot = GameObject.Find("UIRoot"); if (uiRoot != null) { - m_InstanceRoot = uiRoot.GetComponentInChildren()?.transform; + _instanceRoot = uiRoot.GetComponentInChildren()?.transform; } else { @@ -52,31 +52,31 @@ namespace GameLogic Resource = new UIResourceLoader(); - UnityEngine.Object.DontDestroyOnLoad(m_InstanceRoot.parent != null ? m_InstanceRoot.parent : m_InstanceRoot); + UnityEngine.Object.DontDestroyOnLoad(_instanceRoot.parent != null ? _instanceRoot.parent : _instanceRoot); - m_InstanceRoot.gameObject.layer = LayerMask.NameToLayer("UI"); + _instanceRoot.gameObject.layer = LayerMask.NameToLayer("UI"); if (Debugger.Instance != null) { switch (Debugger.Instance.ActiveWindowType) { case DebuggerActiveWindowType.AlwaysOpen: - m_enableErrorLog = true; + _enableErrorLog = true; break; case DebuggerActiveWindowType.OnlyOpenWhenDevelopment: - m_enableErrorLog = Debug.isDebugBuild; + _enableErrorLog = Debug.isDebugBuild; break; case DebuggerActiveWindowType.OnlyOpenInEditor: - m_enableErrorLog = Application.isEditor; + _enableErrorLog = Application.isEditor; break; default: - m_enableErrorLog = false; + _enableErrorLog = false; break; } - if (m_enableErrorLog) + if (_enableErrorLog) { _errorLogger = new ErrorLogger(this); } @@ -91,9 +91,9 @@ namespace GameLogic _errorLogger = null; } CloseAll(isShutDown:true); - if (m_InstanceRoot != null && m_InstanceRoot.parent != null) + if (_instanceRoot != null && _instanceRoot.parent != null) { - UnityEngine.Object.Destroy(m_InstanceRoot.parent.gameObject); + UnityEngine.Object.Destroy(_instanceRoot.parent.gameObject); } } @@ -164,12 +164,12 @@ namespace GameLogic /// public string GetTopWindow() { - if (_stack.Count == 0) + if (_uiStack.Count == 0) { return string.Empty; } - UIWindow topWindow = _stack[^1]; + UIWindow topWindow = _uiStack[^1]; return topWindow.WindowName; } @@ -179,10 +179,10 @@ namespace GameLogic public string GetTopWindow(int layer) { UIWindow lastOne = null; - for (int i = 0; i < _stack.Count; i++) + for (int i = 0; i < _uiStack.Count; i++) { - if (_stack[i].WindowLayer == layer) - lastOne = _stack[i]; + if (_uiStack[i].WindowLayer == layer) + lastOne = _uiStack[i]; } if (lastOne == null) @@ -196,9 +196,9 @@ namespace GameLogic /// public bool IsAnyLoading() { - for (int i = 0; i < _stack.Count; i++) + for (int i = 0; i < _uiStack.Count; i++) { - var window = _stack[i]; + var window = _uiStack[i]; if (window.IsLoadDone == false) return true; } @@ -390,13 +390,13 @@ namespace GameLogic /// public void CloseAll(bool isShutDown = false) { - for (int i = 0; i < _stack.Count; i++) + for (int i = 0; i < _uiStack.Count; i++) { - UIWindow window = _stack[i]; + UIWindow window = _uiStack[i]; window.InternalDestroy(isShutDown); } - _stack.Clear(); + _uiStack.Clear(); } /// @@ -404,16 +404,16 @@ namespace GameLogic /// public void CloseAllWithOut(UIWindow withOut) { - for (int i = _stack.Count - 1; i >= 0; i--) + for (int i = _uiStack.Count - 1; i >= 0; i--) { - UIWindow window = _stack[i]; + UIWindow window = _uiStack[i]; if (window == withOut) { continue; } window.InternalDestroy(); - _stack.RemoveAt(i); + _uiStack.RemoveAt(i); } } @@ -422,16 +422,16 @@ namespace GameLogic /// public void CloseAllWithOut() where T : UIWindow { - for (int i = _stack.Count - 1; i >= 0; i--) + for (int i = _uiStack.Count - 1; i >= 0; i--) { - UIWindow window = _stack[i]; + UIWindow window = _uiStack[i]; if (window.GetType() == typeof(T)) { continue; } window.InternalDestroy(); - _stack.RemoveAt(i); + _uiStack.RemoveAt(i); } } @@ -445,13 +445,13 @@ namespace GameLogic private void OnSortWindowDepth(int layer) { - int depth = layer * LAYER_DEEP; - for (int i = 0; i < _stack.Count; i++) + int depth = layer * LayerDeep; + for (int i = 0; i < _uiStack.Count; i++) { - if (_stack[i].WindowLayer == layer) + if (_uiStack[i].WindowLayer == layer) { - _stack[i].Depth = depth; - depth += WINDOW_DEEP; + _uiStack[i].Depth = depth; + depth += WindowDeep; } } } @@ -459,9 +459,9 @@ namespace GameLogic private void OnSetWindowVisible() { bool isHideNext = false; - for (int i = _stack.Count - 1; i >= 0; i--) + for (int i = _uiStack.Count - 1; i >= 0; i--) { - UIWindow window = _stack[i]; + UIWindow window = _uiStack[i]; if (isHideNext == false) { if (window.IsHide) @@ -581,9 +581,9 @@ namespace GameLogic private UIWindow GetWindow(string windowName) { - for (int i = 0; i < _stack.Count; i++) + for (int i = 0; i < _uiStack.Count; i++) { - UIWindow window = _stack[i]; + UIWindow window = _uiStack[i]; if (window.WindowName == windowName) { return window; @@ -595,9 +595,9 @@ namespace GameLogic private bool IsContains(string windowName) { - for (int i = 0; i < _stack.Count; i++) + for (int i = 0; i < _uiStack.Count; i++) { - UIWindow window = _stack[i]; + UIWindow window = _uiStack[i]; if (window.WindowName == windowName) { return true; @@ -615,9 +615,9 @@ namespace GameLogic // 获取插入到所属层级的位置 int insertIndex = -1; - for (int i = 0; i < _stack.Count; i++) + for (int i = 0; i < _uiStack.Count; i++) { - if (window.WindowLayer == _stack[i].WindowLayer) + if (window.WindowLayer == _uiStack[i].WindowLayer) { insertIndex = i + 1; } @@ -626,9 +626,9 @@ namespace GameLogic // 如果没有所属层级,找到相邻层级 if (insertIndex == -1) { - for (int i = 0; i < _stack.Count; i++) + for (int i = 0; i < _uiStack.Count; i++) { - if (window.WindowLayer > _stack[i].WindowLayer) + if (window.WindowLayer > _uiStack[i].WindowLayer) { insertIndex = i + 1; } @@ -642,31 +642,31 @@ namespace GameLogic } // 最后插入到堆栈 - _stack.Insert(insertIndex, window); + _uiStack.Insert(insertIndex, window); } private void Pop(UIWindow window) { // 从堆栈里移除 - _stack.Remove(window); + _uiStack.Remove(window); } public void OnUpdate() { - if (_stack == null) + if (_uiStack == null) { return; } - int count = _stack.Count; - for (int i = 0; i < _stack.Count; i++) + int count = _uiStack.Count; + for (int i = 0; i < _uiStack.Count; i++) { - if (_stack.Count != count) + if (_uiStack.Count != count) { break; } - var window = _stack[i]; + var window = _uiStack[i]; window.InternalUpdate(); } } diff --git a/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/UIWidget.cs b/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/UIWidget.cs index 8313cdaa..0af68539 100644 --- a/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/UIWidget.cs +++ b/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/UIWidget.cs @@ -78,15 +78,15 @@ namespace GameLogic List listNextUpdateChild = null; if (ListChild != null && ListChild.Count > 0) { - listNextUpdateChild = m_listUpdateChild; - var updateListValid = m_updateListValid; + listNextUpdateChild = ListUpdateChild; + var updateListValid = UpdateListValid; List listChild = null; if (!updateListValid) { if (listNextUpdateChild == null) { listNextUpdateChild = new List(); - m_listUpdateChild = listNextUpdateChild; + ListUpdateChild = listNextUpdateChild; } else { @@ -119,7 +119,7 @@ namespace GameLogic if (!updateListValid) { - m_updateListValid = true; + UpdateListValid = true; } } @@ -265,7 +265,7 @@ namespace GameLogic for (var index = 0; index < listCanvas.Length; index++) { var childCanvas = listCanvas[index]; - childCanvas.sortingOrder = parentCanvas.sortingOrder + childCanvas.sortingOrder % UIModule.WINDOW_DEEP; + childCanvas.sortingOrder = parentCanvas.sortingOrder + childCanvas.sortingOrder % UIModule.WindowDeep; } } } diff --git a/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/UIWindow.cs b/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/UIWindow.cs index d67fc54b..578f25b8 100644 --- a/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/UIWindow.cs +++ b/UnityProject/Assets/GameScripts/HotFix/GameLogic/Module/UIModule/UIWindow.cs @@ -138,7 +138,7 @@ namespace GameLogic { if (_canvas != null) { - return _canvas.gameObject.layer == UIModule.WINDOW_SHOW_LAYER; + return _canvas.gameObject.layer == UIModule.WindowShowLayer; } else { @@ -150,7 +150,7 @@ namespace GameLogic { if (_canvas != null) { - int setLayer = value ? UIModule.WINDOW_SHOW_LAYER : UIModule.WINDOW_HIDE_LAYER; + int setLayer = value ? UIModule.WindowShowLayer : UIModule.WindowHideLayer; if (_canvas.gameObject.layer == setLayer) return; @@ -295,15 +295,15 @@ namespace GameLogic List listNextUpdateChild = null; if (ListChild != null && ListChild.Count > 0) { - listNextUpdateChild = m_listUpdateChild; - var updateListValid = m_updateListValid; + listNextUpdateChild = ListUpdateChild; + var updateListValid = UpdateListValid; List listChild = null; if (!updateListValid) { if (listNextUpdateChild == null) { listNextUpdateChild = new List(); - m_listUpdateChild = listNextUpdateChild; + ListUpdateChild = listNextUpdateChild; } else { @@ -336,7 +336,7 @@ namespace GameLogic if (!updateListValid) { - m_updateListValid = true; + UpdateListValid = true; } } diff --git a/UnityProject/Assets/GameScripts/HotFix/GameLogic/SingletonSystem/SingletonSystem.cs b/UnityProject/Assets/GameScripts/HotFix/GameLogic/SingletonSystem/SingletonSystem.cs index a790773a..3fb8a1e5 100644 --- a/UnityProject/Assets/GameScripts/HotFix/GameLogic/SingletonSystem/SingletonSystem.cs +++ b/UnityProject/Assets/GameScripts/HotFix/GameLogic/SingletonSystem/SingletonSystem.cs @@ -281,16 +281,16 @@ namespace GameLogic #region 生命周期 - private static bool m_isInit = false; + private static bool _isInit = false; private static void CheckInit() { - if (m_isInit == true) + if (_isInit == true) { return; } - m_isInit = true; + _isInit = true; _updateDriver ??= ModuleSystem.GetModule(); _updateDriver.AddUpdateListener(OnUpdate); @@ -304,12 +304,12 @@ namespace GameLogic private static void DeInit() { - if (m_isInit == false) + if (_isInit == false) { return; } - m_isInit = false; + _isInit = false; _updateDriver ??= ModuleSystem.GetModule(); _updateDriver.RemoveUpdateListener(OnUpdate); diff --git a/UnityProject/Assets/GameScripts/Procedure/ProcedureBase.cs b/UnityProject/Assets/GameScripts/Procedure/ProcedureBase.cs index 7f571155..d1518355 100644 --- a/UnityProject/Assets/GameScripts/Procedure/ProcedureBase.cs +++ b/UnityProject/Assets/GameScripts/Procedure/ProcedureBase.cs @@ -10,11 +10,6 @@ namespace Procedure /// public abstract bool UseNativeDialog { get; } - protected IResourceModule _resourceModule; - - protected ProcedureBase() - { - _resourceModule = ModuleSystem.GetModule(); - } + protected readonly IResourceModule _resourceModule = ModuleSystem.GetModule(); } } \ No newline at end of file diff --git a/UnityProject/Assets/GameScripts/Procedure/ProcedureInitResources.cs b/UnityProject/Assets/GameScripts/Procedure/ProcedureInitResources.cs index 5dffab37..fd3c614b 100644 --- a/UnityProject/Assets/GameScripts/Procedure/ProcedureInitResources.cs +++ b/UnityProject/Assets/GameScripts/Procedure/ProcedureInitResources.cs @@ -10,7 +10,7 @@ namespace Procedure { public class ProcedureInitResources : ProcedureBase { - private bool m_InitResourcesComplete = false; + private bool _initResourcesComplete = false; public override bool UseNativeDialog => true; @@ -18,7 +18,7 @@ namespace Procedure { base.OnEnter(procedureOwner); - m_InitResourcesComplete = false; + _initResourcesComplete = false; LauncherMgr.Show(UIDefine.UILoadUpdate, "初始化资源中..."); @@ -30,7 +30,7 @@ namespace Procedure { base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds); - if (!m_InitResourcesComplete) + if (!_initResourcesComplete) { // 初始化资源未完成则继续等待 return; @@ -74,7 +74,7 @@ namespace Procedure yield break; } - m_InitResourcesComplete = true; + _initResourcesComplete = true; } private void OnInitResourcesError(ProcedureOwner procedureOwner) diff --git a/UnityProject/Assets/GameScripts/Procedure/ProcedureLoadAssembly.cs b/UnityProject/Assets/GameScripts/Procedure/ProcedureLoadAssembly.cs index 8705263f..a8a26290 100644 --- a/UnityProject/Assets/GameScripts/Procedure/ProcedureLoadAssembly.cs +++ b/UnityProject/Assets/GameScripts/Procedure/ProcedureLoadAssembly.cs @@ -18,106 +18,103 @@ namespace Procedure /// public class ProcedureLoadAssembly : ProcedureBase { - private bool m_enableAddressable = true; + private bool _enableAddressable = true; public override bool UseNativeDialog => true; - private int m_LoadAssetCount; - private int m_LoadMetadataAssetCount; - private int m_FailureAssetCount; - private int m_FailureMetadataAssetCount; - private bool m_LoadAssemblyComplete; - private bool m_LoadMetadataAssemblyComplete; - private bool m_LoadAssemblyWait; -#pragma warning disable CS0414 - private bool m_LoadMetadataAssemblyWait; -#pragma warning restore CS0414 - private Assembly m_MainLogicAssembly; - private List m_HotfixAssemblys; - private IFsm m_procedureOwner; - private UpdateSetting m_Setting; + private int _loadAssetCount; + private int _loadMetadataAssetCount; + private int _failureAssetCount; + private int _failureMetadataAssetCount; + private bool _loadAssemblyComplete; + private bool _loadMetadataAssemblyComplete; + private bool _loadAssemblyWait; + private bool _loadMetadataAssemblyWait; + private Assembly _mainLogicAssembly; + private List _hotfixAssemblyList; + private IFsm _procedureOwner; + private UpdateSetting _setting; protected override void OnInit(IFsm procedureOwner) { base.OnInit(procedureOwner); - m_Setting = Settings.UpdateSetting; + _setting = Settings.UpdateSetting; } protected override void OnEnter(IFsm procedureOwner) { base.OnEnter(procedureOwner); - Log.Debug("HyBridCLR ProcedureLoadAssembly OnEnter"); - m_procedureOwner = procedureOwner; - + Log.Debug("HybridCLR ProcedureLoadAssembly OnEnter"); + _procedureOwner = procedureOwner; LoadAssembly().Forget(); } private async UniTaskVoid LoadAssembly() { - m_LoadAssemblyComplete = false; - m_HotfixAssemblys = new List(); + _loadAssemblyComplete = false; + _hotfixAssemblyList = new List(); //AOT Assembly加载原始metadata - if (m_Setting.Enable) + if (_setting.Enable) { #if !UNITY_EDITOR - m_LoadMetadataAssemblyComplete = false; + _loadMetadataAssemblyComplete = false; LoadMetadataForAOTAssembly(); #else - m_LoadMetadataAssemblyComplete = true; + _loadMetadataAssemblyComplete = true; #endif } else { - m_LoadMetadataAssemblyComplete = true; + _loadMetadataAssemblyComplete = true; } - if (!m_Setting.Enable || _resourceModule.PlayMode == EPlayMode.EditorSimulateMode) + if (!_setting.Enable || _resourceModule.PlayMode == EPlayMode.EditorSimulateMode) { - m_MainLogicAssembly = GetMainLogicAssembly(); + _mainLogicAssembly = GetMainLogicAssembly(); } else { - if (m_Setting.Enable) + if (_setting.Enable) { - foreach (string hotUpdateDllName in m_Setting.HotUpdateAssemblies) + foreach (string hotUpdateDllName in _setting.HotUpdateAssemblies) { var assetLocation = hotUpdateDllName; - if (!m_enableAddressable) + if (!_enableAddressable) { assetLocation = Utility.Path.GetRegularPath( Path.Combine( "Assets", - m_Setting.AssemblyTextAssetPath, - $"{hotUpdateDllName}{m_Setting.AssemblyTextAssetExtension}")); + _setting.AssemblyTextAssetPath, + $"{hotUpdateDllName}{_setting.AssemblyTextAssetExtension}")); } Log.Debug($"LoadAsset: [ {assetLocation} ]"); - m_LoadAssetCount++; + _loadAssetCount++; var result = await _resourceModule.LoadAssetAsync(assetLocation); LoadAssetSuccess(result); } - m_LoadAssemblyWait = true; + _loadAssemblyWait = true; } else { - m_MainLogicAssembly = GetMainLogicAssembly(); + _mainLogicAssembly = GetMainLogicAssembly(); } } - if (m_LoadAssetCount == 0) + if (_loadAssetCount == 0) { - m_LoadAssemblyComplete = true; + _loadAssemblyComplete = true; } } protected override void OnUpdate(IFsm procedureOwner, float elapseSeconds, float realElapseSeconds) { base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds); - if (!m_LoadAssemblyComplete) + if (!_loadAssemblyComplete) { return; } - if (!m_LoadMetadataAssemblyComplete) + if (!_loadMetadataAssemblyComplete) { return; } @@ -126,17 +123,17 @@ namespace Procedure private void AllAssemblyLoadComplete() { - ChangeState(m_procedureOwner); + ChangeState(_procedureOwner); #if UNITY_EDITOR - m_MainLogicAssembly = GetMainLogicAssembly(); + _mainLogicAssembly = GetMainLogicAssembly(); #endif - if (m_MainLogicAssembly == null) + if (_mainLogicAssembly == null) { Log.Fatal($"Main logic assembly missing."); return; } - var appType = m_MainLogicAssembly.GetType("GameApp"); + var appType = _mainLogicAssembly.GetType("GameApp"); if (appType == null) { Log.Fatal($"Main logic type 'GameMain' missing."); @@ -148,31 +145,31 @@ namespace Procedure Log.Fatal($"Main logic entry method 'Entrance' missing."); return; } - object[] objects = new object[] { new object[] { m_HotfixAssemblys } }; + object[] objects = new object[] { new object[] { _hotfixAssemblyList } }; entryMethod.Invoke(appType, objects); } private Assembly GetMainLogicAssembly() { - m_HotfixAssemblys.Clear(); + _hotfixAssemblyList.Clear(); Assembly mainLogicAssembly = null; foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) { - if (string.Compare(m_Setting.LogicMainDllName, $"{assembly.GetName().Name}.dll", + if (string.Compare(_setting.LogicMainDllName, $"{assembly.GetName().Name}.dll", StringComparison.Ordinal) == 0) { mainLogicAssembly = assembly; } - foreach (var hotUpdateDllName in m_Setting.HotUpdateAssemblies) + foreach (var hotUpdateDllName in _setting.HotUpdateAssemblies) { if (hotUpdateDllName == $"{assembly.GetName().Name}.dll") { - m_HotfixAssemblys.Add(assembly); + _hotfixAssemblyList.Add(assembly); } } - if (mainLogicAssembly != null && m_HotfixAssemblys.Count == m_Setting.HotUpdateAssemblies.Count) + if (mainLogicAssembly != null && _hotfixAssemblyList.Count == _setting.HotUpdateAssemblies.Count) { break; } @@ -187,7 +184,7 @@ namespace Procedure /// 代码资产。 private void LoadAssetSuccess(TextAsset textAsset) { - m_LoadAssetCount--; + _loadAssetCount--; if (textAsset == null) { Log.Warning($"Load Assembly failed."); @@ -200,22 +197,22 @@ namespace Procedure try { var assembly = Assembly.Load(textAsset.bytes); - if (string.Compare(m_Setting.LogicMainDllName, assetName, StringComparison.Ordinal) == 0) + if (string.Compare(_setting.LogicMainDllName, assetName, StringComparison.Ordinal) == 0) { - m_MainLogicAssembly = assembly; + _mainLogicAssembly = assembly; } - m_HotfixAssemblys.Add(assembly); + _hotfixAssemblyList.Add(assembly); Log.Debug($"Assembly [ {assembly.GetName().Name} ] loaded"); } catch (Exception e) { - m_FailureAssetCount++; + _failureAssetCount++; Log.Fatal(e); throw; } finally { - m_LoadAssemblyComplete = m_LoadAssemblyWait && 0 == m_LoadAssetCount; + _loadAssemblyComplete = _loadAssemblyWait && 0 == _loadAssetCount; } _resourceModule.UnloadAsset(textAsset); } @@ -231,29 +228,29 @@ namespace Procedure // 注意,补充元数据是给AOT dll补充元数据,而不是给热更新dll补充元数据。 // 热更新dll不缺元数据,不需要补充,如果调用LoadMetadataForAOTAssembly会返回错误 - if (m_Setting.AOTMetaAssemblies.Count == 0) + if (_setting.AOTMetaAssemblies.Count == 0) { - m_LoadMetadataAssemblyComplete = true; + _loadMetadataAssemblyComplete = true; return; } - foreach (string aotDllName in m_Setting.AOTMetaAssemblies) + foreach (string aotDllName in _setting.AOTMetaAssemblies) { var assetLocation = aotDllName; - if (!m_enableAddressable) + if (!_enableAddressable) { assetLocation = Utility.Path.GetRegularPath( Path.Combine( "Assets", - m_Setting.AssemblyTextAssetPath, - $"{aotDllName}{m_Setting.AssemblyTextAssetExtension}")); + _setting.AssemblyTextAssetPath, + $"{aotDllName}{_setting.AssemblyTextAssetExtension}")); } Log.Debug($"LoadMetadataAsset: [ {assetLocation} ]"); - m_LoadMetadataAssetCount++; + _loadMetadataAssetCount++; _resourceModule.LoadAsset(assetLocation, LoadMetadataAssetSuccess); } - m_LoadMetadataAssemblyWait = true; + _loadMetadataAssemblyWait = true; } /// @@ -262,7 +259,7 @@ namespace Procedure /// 代码资产。 private void LoadMetadataAssetSuccess(TextAsset textAsset) { - m_LoadMetadataAssetCount--; + _loadMetadataAssetCount--; if (null == textAsset) { Log.Debug($"LoadMetadataAssetSuccess:Load Metadata failed."); @@ -283,13 +280,13 @@ namespace Procedure } catch (Exception e) { - m_FailureMetadataAssetCount++; + _failureMetadataAssetCount++; Log.Fatal(e.Message); throw; } finally { - m_LoadMetadataAssemblyComplete = m_LoadMetadataAssemblyWait && 0 == m_LoadMetadataAssetCount; + _loadMetadataAssemblyComplete = _loadMetadataAssemblyWait && 0 == _loadMetadataAssetCount; } _resourceModule.UnloadAsset(textAsset); } diff --git a/UnityProject/Assets/Plugins.meta b/UnityProject/Assets/Resources.meta similarity index 77% rename from UnityProject/Assets/Plugins.meta rename to UnityProject/Assets/Resources.meta index ba02676f..140d938c 100644 --- a/UnityProject/Assets/Plugins.meta +++ b/UnityProject/Assets/Resources.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2d267ef672bd9e54e81b5cae5eac09a3 +guid: 56995850190b0cb43aaa2dde5e71890e folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/UnityProject/Assets/Resources/package.meta b/UnityProject/Assets/Resources/package.meta new file mode 100644 index 00000000..d864c584 --- /dev/null +++ b/UnityProject/Assets/Resources/package.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ebf7360e04898ef44aa6de753faf3bfb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Scenes/main.unity b/UnityProject/Assets/Scenes/main.unity index f3e49e48..09158da3 100644 --- a/UnityProject/Assets/Scenes/main.unity +++ b/UnityProject/Assets/Scenes/main.unity @@ -207,6 +207,54 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1168036240 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1168036242} + - component: {fileID: 1168036241} + m_Layer: 0 + m_Name: GameObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1168036241 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1168036240} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ed5bd2409ef34ad99ff913c2ee6ddf90, type: 3} + m_Name: + m_EditorClassIdentifier: + ShowAdvanced: 0 + AdvancedSetting1: 0 + HiddenWhenShown: + InversedLogicField: 0 +--- !u!4 &1168036242 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1168036240} + 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: 0} + m_RootOrder: 3 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &2425705316520036048 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/UnityProject/Assets/TEngine/Editor/Inspector/ProcedureSettingInspector.cs b/UnityProject/Assets/TEngine/Editor/Inspector/ProcedureSettingInspector.cs index 2e61b7c4..bf735624 100644 --- a/UnityProject/Assets/TEngine/Editor/Inspector/ProcedureSettingInspector.cs +++ b/UnityProject/Assets/TEngine/Editor/Inspector/ProcedureSettingInspector.cs @@ -8,12 +8,12 @@ namespace TEngine.Editor.Inspector [CustomEditor(typeof(ProcedureSetting))] internal sealed class ProcedureSettingInspector : GameFrameworkInspector { - private SerializedProperty m_AvailableProcedureTypeNames = null; - private SerializedProperty m_EntranceProcedureTypeName = null; + private SerializedProperty _availableProcedureTypeNames = null; + private SerializedProperty _entranceProcedureTypeName = null; - private string[] m_ProcedureTypeNames = null; - private List m_CurrentAvailableProcedureTypeNames = null; - private int m_EntranceProcedureIndex = -1; + private string[] _procedureTypeNames = null; + private List _currentAvailableProcedureTypeNames = null; + private int _entranceProcedureIndex = -1; public override void OnInspectorGUI() { @@ -23,7 +23,7 @@ namespace TEngine.Editor.Inspector ProcedureSetting t = (ProcedureSetting)target; - if (string.IsNullOrEmpty(m_EntranceProcedureTypeName.stringValue)) + if (string.IsNullOrEmpty(_entranceProcedureTypeName.stringValue)) { EditorGUILayout.HelpBox("Entrance procedure is invalid.", MessageType.Error); } @@ -31,23 +31,23 @@ namespace TEngine.Editor.Inspector EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode); { GUILayout.Label("Available Procedures", EditorStyles.boldLabel); - if (m_ProcedureTypeNames.Length > 0) + if (_procedureTypeNames.Length > 0) { EditorGUILayout.BeginVertical("box"); { - foreach (string procedureTypeName in m_ProcedureTypeNames) + foreach (string procedureTypeName in _procedureTypeNames) { - bool selected = m_CurrentAvailableProcedureTypeNames.Contains(procedureTypeName); + bool selected = _currentAvailableProcedureTypeNames.Contains(procedureTypeName); if (selected != EditorGUILayout.ToggleLeft(procedureTypeName, selected)) { if (!selected) { - m_CurrentAvailableProcedureTypeNames.Add(procedureTypeName); + _currentAvailableProcedureTypeNames.Add(procedureTypeName); WriteAvailableProcedureTypeNames(); } - else if (procedureTypeName != m_EntranceProcedureTypeName.stringValue) + else if (procedureTypeName != _entranceProcedureTypeName.stringValue) { - m_CurrentAvailableProcedureTypeNames.Remove(procedureTypeName); + _currentAvailableProcedureTypeNames.Remove(procedureTypeName); WriteAvailableProcedureTypeNames(); } } @@ -60,15 +60,15 @@ namespace TEngine.Editor.Inspector EditorGUILayout.HelpBox("There is no available procedure.", MessageType.Warning); } - if (m_CurrentAvailableProcedureTypeNames.Count > 0) + if (_currentAvailableProcedureTypeNames.Count > 0) { EditorGUILayout.Separator(); - int selectedIndex = EditorGUILayout.Popup("Entrance Procedure", m_EntranceProcedureIndex, m_CurrentAvailableProcedureTypeNames.ToArray()); - if (selectedIndex != m_EntranceProcedureIndex) + int selectedIndex = EditorGUILayout.Popup("Entrance Procedure", _entranceProcedureIndex, _currentAvailableProcedureTypeNames.ToArray()); + if (selectedIndex != _entranceProcedureIndex) { - m_EntranceProcedureIndex = selectedIndex; - m_EntranceProcedureTypeName.stringValue = m_CurrentAvailableProcedureTypeNames[selectedIndex]; + _entranceProcedureIndex = selectedIndex; + _entranceProcedureTypeName.stringValue = _currentAvailableProcedureTypeNames[selectedIndex]; } } else @@ -92,28 +92,28 @@ namespace TEngine.Editor.Inspector private void OnEnable() { - m_AvailableProcedureTypeNames = serializedObject.FindProperty("availableProcedureTypeNames"); - m_EntranceProcedureTypeName = serializedObject.FindProperty("entranceProcedureTypeName"); + _availableProcedureTypeNames = serializedObject.FindProperty("availableProcedureTypeNames"); + _entranceProcedureTypeName = serializedObject.FindProperty("entranceProcedureTypeName"); RefreshTypeNames(); } private void RefreshTypeNames() { - m_ProcedureTypeNames = Type.GetRuntimeTypeNames(typeof(ProcedureBase)); + _procedureTypeNames = Type.GetRuntimeTypeNames(typeof(ProcedureBase)); ReadAvailableProcedureTypeNames(); - int oldCount = m_CurrentAvailableProcedureTypeNames.Count; - m_CurrentAvailableProcedureTypeNames = m_CurrentAvailableProcedureTypeNames.Where(x => m_ProcedureTypeNames.Contains(x)).ToList(); - if (m_CurrentAvailableProcedureTypeNames.Count != oldCount) + int oldCount = _currentAvailableProcedureTypeNames.Count; + _currentAvailableProcedureTypeNames = _currentAvailableProcedureTypeNames.Where(x => _procedureTypeNames.Contains(x)).ToList(); + if (_currentAvailableProcedureTypeNames.Count != oldCount) { WriteAvailableProcedureTypeNames(); } - else if (!string.IsNullOrEmpty(m_EntranceProcedureTypeName.stringValue)) + else if (!string.IsNullOrEmpty(_entranceProcedureTypeName.stringValue)) { - m_EntranceProcedureIndex = m_CurrentAvailableProcedureTypeNames.IndexOf(m_EntranceProcedureTypeName.stringValue); - if (m_EntranceProcedureIndex < 0) + _entranceProcedureIndex = _currentAvailableProcedureTypeNames.IndexOf(_entranceProcedureTypeName.stringValue); + if (_entranceProcedureIndex < 0) { - m_EntranceProcedureTypeName.stringValue = null; + _entranceProcedureTypeName.stringValue = null; } } @@ -122,36 +122,36 @@ namespace TEngine.Editor.Inspector private void ReadAvailableProcedureTypeNames() { - m_CurrentAvailableProcedureTypeNames = new List(); - int count = m_AvailableProcedureTypeNames.arraySize; + _currentAvailableProcedureTypeNames = new List(); + int count = _availableProcedureTypeNames.arraySize; for (int i = 0; i < count; i++) { - m_CurrentAvailableProcedureTypeNames.Add(m_AvailableProcedureTypeNames.GetArrayElementAtIndex(i).stringValue); + _currentAvailableProcedureTypeNames.Add(_availableProcedureTypeNames.GetArrayElementAtIndex(i).stringValue); } } private void WriteAvailableProcedureTypeNames() { - m_AvailableProcedureTypeNames.ClearArray(); - if (m_CurrentAvailableProcedureTypeNames == null) + _availableProcedureTypeNames.ClearArray(); + if (_currentAvailableProcedureTypeNames == null) { return; } - m_CurrentAvailableProcedureTypeNames.Sort(); - int count = m_CurrentAvailableProcedureTypeNames.Count; + _currentAvailableProcedureTypeNames.Sort(); + int count = _currentAvailableProcedureTypeNames.Count; for (int i = 0; i < count; i++) { - m_AvailableProcedureTypeNames.InsertArrayElementAtIndex(i); - m_AvailableProcedureTypeNames.GetArrayElementAtIndex(i).stringValue = m_CurrentAvailableProcedureTypeNames[i]; + _availableProcedureTypeNames.InsertArrayElementAtIndex(i); + _availableProcedureTypeNames.GetArrayElementAtIndex(i).stringValue = _currentAvailableProcedureTypeNames[i]; } - if (!string.IsNullOrEmpty(m_EntranceProcedureTypeName.stringValue)) + if (!string.IsNullOrEmpty(_entranceProcedureTypeName.stringValue)) { - m_EntranceProcedureIndex = m_CurrentAvailableProcedureTypeNames.IndexOf(m_EntranceProcedureTypeName.stringValue); - if (m_EntranceProcedureIndex < 0) + _entranceProcedureIndex = _currentAvailableProcedureTypeNames.IndexOf(_entranceProcedureTypeName.stringValue); + if (_entranceProcedureIndex < 0) { - m_EntranceProcedureTypeName.stringValue = null; + _entranceProcedureTypeName.stringValue = null; } } } diff --git a/UnityProject/Assets/TEngine/Editor/Inspector/ResourceModuleDriverInspector.cs b/UnityProject/Assets/TEngine/Editor/Inspector/ResourceModuleDriverInspector.cs index 936a74da..9f5b93e9 100644 --- a/UnityProject/Assets/TEngine/Editor/Inspector/ResourceModuleDriverInspector.cs +++ b/UnityProject/Assets/TEngine/Editor/Inspector/ResourceModuleDriverInspector.cs @@ -16,23 +16,23 @@ namespace TEngine.Editor.Inspector "WebPlayMode (WebGL运行模式)" }; - private SerializedProperty m_PlayMode = null; - private SerializedProperty m_UpdatableWhilePlaying = null; - private SerializedProperty m_Milliseconds = null; - private SerializedProperty m_MinUnloadUnusedAssetsInterval = null; - private SerializedProperty m_MaxUnloadUnusedAssetsInterval = null; - private SerializedProperty m_UseSystemUnloadUnusedAssets = null; - private SerializedProperty m_AssetAutoReleaseInterval = null; - private SerializedProperty m_AssetCapacity = null; - private SerializedProperty m_AssetExpireTime = null; - private SerializedProperty m_AssetPriority = null; - private SerializedProperty m_DownloadingMaxNum = null; - private SerializedProperty m_FailedTryAgain = null; - private SerializedProperty m_PackageName = null; - private int m_playModeIndex = 0; + private SerializedProperty _playMode = null; + private SerializedProperty _updatableWhilePlaying = null; + private SerializedProperty _milliseconds = null; + private SerializedProperty _minUnloadUnusedAssetsInterval = null; + private SerializedProperty _maxUnloadUnusedAssetsInterval = null; + private SerializedProperty _useSystemUnloadUnusedAssets = null; + private SerializedProperty _assetAutoReleaseInterval = null; + private SerializedProperty _assetCapacity = null; + private SerializedProperty _assetExpireTime = null; + private SerializedProperty _assetPriority = null; + private SerializedProperty _downloadingMaxNum = null; + private SerializedProperty _failedTryAgain = null; + private SerializedProperty _packageName = null; + private int _playModeIndex = 0; - private int m_PackageNameIndex = 0; - private string[] m_PackageNames; + private int _packageNameIndex = 0; + private string[] _packageNames; public override void OnInspectorGUI() { base.OnInspectorGUI(); @@ -49,48 +49,48 @@ namespace TEngine.Editor.Inspector } else { - int selectedIndex = EditorGUILayout.Popup("Play Mode", m_playModeIndex, _playModeNames); - if (selectedIndex != m_playModeIndex) + int selectedIndex = EditorGUILayout.Popup("Play Mode", _playModeIndex, _playModeNames); + if (selectedIndex != _playModeIndex) { - m_playModeIndex = selectedIndex; - m_PlayMode.enumValueIndex = selectedIndex; + _playModeIndex = selectedIndex; + _playMode.enumValueIndex = selectedIndex; } } } - EditorGUILayout.PropertyField(m_UpdatableWhilePlaying); + EditorGUILayout.PropertyField(_updatableWhilePlaying); EditorGUI.EndDisabledGroup(); - m_PackageNames = GetBuildPackageNames().ToArray(); - m_PackageNameIndex = Array.IndexOf(m_PackageNames, m_PackageName.stringValue); - if (m_PackageNameIndex < 0) + _packageNames = GetBuildPackageNames().ToArray(); + _packageNameIndex = Array.IndexOf(_packageNames, _packageName.stringValue); + if (_packageNameIndex < 0) { - m_PackageNameIndex = 0; + _packageNameIndex = 0; } - m_PackageNameIndex = EditorGUILayout.Popup("Package Name", m_PackageNameIndex, m_PackageNames); - if (m_PackageName.stringValue != m_PackageNames[m_PackageNameIndex]) + _packageNameIndex = EditorGUILayout.Popup("Package Name", _packageNameIndex, _packageNames); + if (_packageName.stringValue != _packageNames[_packageNameIndex]) { - m_PackageName.stringValue = m_PackageNames[m_PackageNameIndex]; + _packageName.stringValue = _packageNames[_packageNameIndex]; } - int milliseconds = EditorGUILayout.DelayedIntField("Milliseconds", m_Milliseconds.intValue); - if (milliseconds != m_Milliseconds.intValue) + int milliseconds = EditorGUILayout.DelayedIntField("Milliseconds", _milliseconds.intValue); + if (milliseconds != _milliseconds.intValue) { if (EditorApplication.isPlaying) { - t.Milliseconds = milliseconds; + t.milliseconds = milliseconds; } else { - m_Milliseconds.longValue = milliseconds; + _milliseconds.longValue = milliseconds; } } - EditorGUILayout.PropertyField(m_UseSystemUnloadUnusedAssets); + EditorGUILayout.PropertyField(_useSystemUnloadUnusedAssets); float minUnloadUnusedAssetsInterval = - EditorGUILayout.Slider("Min Unload Unused Assets Interval", m_MinUnloadUnusedAssetsInterval.floatValue, 0f, 3600f); - if (Math.Abs(minUnloadUnusedAssetsInterval - m_MinUnloadUnusedAssetsInterval.floatValue) > 0.01f) + EditorGUILayout.Slider("Min Unload Unused Assets Interval", _minUnloadUnusedAssetsInterval.floatValue, 0f, 3600f); + if (Math.Abs(minUnloadUnusedAssetsInterval - _minUnloadUnusedAssetsInterval.floatValue) > 0.01f) { if (EditorApplication.isPlaying) { @@ -98,13 +98,13 @@ namespace TEngine.Editor.Inspector } else { - m_MinUnloadUnusedAssetsInterval.floatValue = minUnloadUnusedAssetsInterval; + _minUnloadUnusedAssetsInterval.floatValue = minUnloadUnusedAssetsInterval; } } float maxUnloadUnusedAssetsInterval = - EditorGUILayout.Slider("Max Unload Unused Assets Interval", m_MaxUnloadUnusedAssetsInterval.floatValue, 0f, 3600f); - if (Math.Abs(maxUnloadUnusedAssetsInterval - m_MaxUnloadUnusedAssetsInterval.floatValue) > 0.01f) + EditorGUILayout.Slider("Max Unload Unused Assets Interval", _maxUnloadUnusedAssetsInterval.floatValue, 0f, 3600f); + if (Math.Abs(maxUnloadUnusedAssetsInterval - _maxUnloadUnusedAssetsInterval.floatValue) > 0.01f) { if (EditorApplication.isPlaying) { @@ -112,12 +112,12 @@ namespace TEngine.Editor.Inspector } else { - m_MaxUnloadUnusedAssetsInterval.floatValue = maxUnloadUnusedAssetsInterval; + _maxUnloadUnusedAssetsInterval.floatValue = maxUnloadUnusedAssetsInterval; } } - float downloadingMaxNum = EditorGUILayout.Slider("Max Downloading Num", m_DownloadingMaxNum.intValue, 1f, 48f); - if (Math.Abs(downloadingMaxNum - m_DownloadingMaxNum.intValue) > 0.001f) + float downloadingMaxNum = EditorGUILayout.Slider("Max Downloading Num", _downloadingMaxNum.intValue, 1f, 48f); + if (Math.Abs(downloadingMaxNum - _downloadingMaxNum.intValue) > 0.001f) { if (EditorApplication.isPlaying) { @@ -125,12 +125,12 @@ namespace TEngine.Editor.Inspector } else { - m_DownloadingMaxNum.intValue = (int)downloadingMaxNum; + _downloadingMaxNum.intValue = (int)downloadingMaxNum; } } - float failedTryAgain = EditorGUILayout.Slider("Max FailedTryAgain Count", m_FailedTryAgain.intValue, 1f, 48f); - if (Math.Abs(failedTryAgain - m_FailedTryAgain.intValue) > 0.001f) + float failedTryAgain = EditorGUILayout.Slider("Max FailedTryAgain Count", _failedTryAgain.intValue, 1f, 48f); + if (Math.Abs(failedTryAgain - _failedTryAgain.intValue) > 0.001f) { if (EditorApplication.isPlaying) { @@ -138,14 +138,14 @@ namespace TEngine.Editor.Inspector } else { - m_FailedTryAgain.intValue = (int)failedTryAgain; + _failedTryAgain.intValue = (int)failedTryAgain; } } EditorGUI.BeginDisabledGroup(EditorApplication.isPlaying); { - float assetAutoReleaseInterval = EditorGUILayout.DelayedFloatField("Asset Auto Release Interval", m_AssetAutoReleaseInterval.floatValue); - if (Math.Abs(assetAutoReleaseInterval - m_AssetAutoReleaseInterval.floatValue) > 0.01f) + float assetAutoReleaseInterval = EditorGUILayout.DelayedFloatField("Asset Auto Release Interval", _assetAutoReleaseInterval.floatValue); + if (Math.Abs(assetAutoReleaseInterval - _assetAutoReleaseInterval.floatValue) > 0.01f) { if (EditorApplication.isPlaying) { @@ -153,12 +153,12 @@ namespace TEngine.Editor.Inspector } else { - m_AssetAutoReleaseInterval.floatValue = assetAutoReleaseInterval; + _assetAutoReleaseInterval.floatValue = assetAutoReleaseInterval; } } - int assetCapacity = EditorGUILayout.DelayedIntField("Asset Capacity", m_AssetCapacity.intValue); - if (assetCapacity != m_AssetCapacity.intValue) + int assetCapacity = EditorGUILayout.DelayedIntField("Asset Capacity", _assetCapacity.intValue); + if (assetCapacity != _assetCapacity.intValue) { if (EditorApplication.isPlaying) { @@ -166,12 +166,12 @@ namespace TEngine.Editor.Inspector } else { - m_AssetCapacity.intValue = assetCapacity; + _assetCapacity.intValue = assetCapacity; } } - float assetExpireTime = EditorGUILayout.DelayedFloatField("Asset Expire Time", m_AssetExpireTime.floatValue); - if (Math.Abs(assetExpireTime - m_AssetExpireTime.floatValue) > 0.01f) + float assetExpireTime = EditorGUILayout.DelayedFloatField("Asset Expire Time", _assetExpireTime.floatValue); + if (Math.Abs(assetExpireTime - _assetExpireTime.floatValue) > 0.01f) { if (EditorApplication.isPlaying) { @@ -179,12 +179,12 @@ namespace TEngine.Editor.Inspector } else { - m_AssetExpireTime.floatValue = assetExpireTime; + _assetExpireTime.floatValue = assetExpireTime; } } - int assetPriority = EditorGUILayout.DelayedIntField("Asset Priority", m_AssetPriority.intValue); - if (assetPriority != m_AssetPriority.intValue) + int assetPriority = EditorGUILayout.DelayedIntField("Asset Priority", _assetPriority.intValue); + if (assetPriority != _assetPriority.intValue) { if (EditorApplication.isPlaying) { @@ -192,7 +192,7 @@ namespace TEngine.Editor.Inspector } else { - m_AssetPriority.intValue = assetPriority; + _assetPriority.intValue = assetPriority; } } } @@ -219,19 +219,19 @@ namespace TEngine.Editor.Inspector private void OnEnable() { - m_PlayMode = serializedObject.FindProperty("playMode"); - m_UpdatableWhilePlaying = serializedObject.FindProperty("m_UpdatableWhilePlaying"); - m_Milliseconds = serializedObject.FindProperty("Milliseconds"); - m_MinUnloadUnusedAssetsInterval = serializedObject.FindProperty("m_MinUnloadUnusedAssetsInterval"); - m_MaxUnloadUnusedAssetsInterval = serializedObject.FindProperty("m_MaxUnloadUnusedAssetsInterval"); - m_UseSystemUnloadUnusedAssets = serializedObject.FindProperty("m_UseSystemUnloadUnusedAssets"); - m_AssetAutoReleaseInterval = serializedObject.FindProperty("m_AssetAutoReleaseInterval"); - m_AssetCapacity = serializedObject.FindProperty("m_AssetCapacity"); - m_AssetExpireTime = serializedObject.FindProperty("m_AssetExpireTime"); - m_AssetPriority = serializedObject.FindProperty("m_AssetPriority"); - m_DownloadingMaxNum = serializedObject.FindProperty("m_DownloadingMaxNum"); - m_FailedTryAgain = serializedObject.FindProperty("m_FailedTryAgain"); - m_PackageName = serializedObject.FindProperty("packageName"); + _playMode = serializedObject.FindProperty("playMode"); + _updatableWhilePlaying = serializedObject.FindProperty("updatableWhilePlaying"); + _milliseconds = serializedObject.FindProperty("milliseconds"); + _minUnloadUnusedAssetsInterval = serializedObject.FindProperty("minUnloadUnusedAssetsInterval"); + _maxUnloadUnusedAssetsInterval = serializedObject.FindProperty("maxUnloadUnusedAssetsInterval"); + _useSystemUnloadUnusedAssets = serializedObject.FindProperty("useSystemUnloadUnusedAssets"); + _assetAutoReleaseInterval = serializedObject.FindProperty("assetAutoReleaseInterval"); + _assetCapacity = serializedObject.FindProperty("assetCapacity"); + _assetExpireTime = serializedObject.FindProperty("assetExpireTime"); + _assetPriority = serializedObject.FindProperty("assetPriority"); + _downloadingMaxNum = serializedObject.FindProperty("downloadingMaxNum"); + _failedTryAgain = serializedObject.FindProperty("failedTryAgain"); + _packageName = serializedObject.FindProperty("packageName"); RefreshModes(); RefreshTypeNames(); @@ -239,7 +239,7 @@ namespace TEngine.Editor.Inspector private void RefreshModes() { - m_playModeIndex = m_PlayMode.enumValueIndex > 0 ? m_PlayMode.enumValueIndex : 0; + _playModeIndex = _playMode.enumValueIndex > 0 ? _playMode.enumValueIndex : 0; } private void RefreshTypeNames() diff --git a/UnityProject/Assets/TEngine/Editor/Inspector/RootModuleInspector.cs b/UnityProject/Assets/TEngine/Editor/Inspector/RootModuleInspector.cs index 2bc833b1..4c445af1 100644 --- a/UnityProject/Assets/TEngine/Editor/Inspector/RootModuleInspector.cs +++ b/UnityProject/Assets/TEngine/Editor/Inspector/RootModuleInspector.cs @@ -14,21 +14,21 @@ namespace TEngine.Editor private static readonly float[] GameSpeed = new float[] { 0f, 0.01f, 0.1f, 0.25f, 0.5f, 1f, 1.5f, 2f, 4f, 8f }; private static readonly string[] GameSpeedForDisplay = new string[] { "0x", "0.01x", "0.1x", "0.25x", "0.5x", "1x", "1.5x", "2x", "4x", "8x" }; - private SerializedProperty m_EditorLanguage = null; - private SerializedProperty m_TextHelperTypeName = null; - private SerializedProperty m_LogHelperTypeName = null; - private SerializedProperty m_JsonHelperTypeName = null; - private SerializedProperty m_FrameRate = null; - private SerializedProperty m_GameSpeed = null; - private SerializedProperty m_RunInBackground = null; - private SerializedProperty m_NeverSleep = null; + private SerializedProperty _editorLanguage = null; + private SerializedProperty _textHelperTypeName = null; + private SerializedProperty _logHelperTypeName = null; + private SerializedProperty _jsonHelperTypeName = null; + private SerializedProperty _frameRate = null; + private SerializedProperty _gameSpeed = null; + private SerializedProperty _runInBackground = null; + private SerializedProperty _neverSleep = null; - private string[] m_TextHelperTypeNames = null; - private int m_TextHelperTypeNameIndex = 0; - private string[] m_LogHelperTypeNames = null; - private int m_LogHelperTypeNameIndex = 0; - private string[] m_JsonHelperTypeNames = null; - private int m_JsonHelperTypeNameIndex = 0; + private string[] _textHelperTypeNames = null; + private int _textHelperTypeNameIndex = 0; + private string[] _logHelperTypeNames = null; + private int _logHelperTypeNameIndex = 0; + private string[] _jsonHelperTypeNames = null; + private int _jsonHelperTypeNameIndex = 0; public override void OnInspectorGUI() { @@ -40,39 +40,39 @@ namespace TEngine.Editor EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode); { - EditorGUILayout.PropertyField(m_EditorLanguage); + EditorGUILayout.PropertyField(_editorLanguage); EditorGUILayout.BeginVertical("box"); { EditorGUILayout.LabelField("Global Helpers", EditorStyles.boldLabel); - int textHelperSelectedIndex = EditorGUILayout.Popup("Text Helper", m_TextHelperTypeNameIndex, m_TextHelperTypeNames); - if (textHelperSelectedIndex != m_TextHelperTypeNameIndex) + int textHelperSelectedIndex = EditorGUILayout.Popup("Text Helper", _textHelperTypeNameIndex, _textHelperTypeNames); + if (textHelperSelectedIndex != _textHelperTypeNameIndex) { - m_TextHelperTypeNameIndex = textHelperSelectedIndex; - m_TextHelperTypeName.stringValue = textHelperSelectedIndex <= 0 ? null : m_TextHelperTypeNames[textHelperSelectedIndex]; + _textHelperTypeNameIndex = textHelperSelectedIndex; + _textHelperTypeName.stringValue = textHelperSelectedIndex <= 0 ? null : _textHelperTypeNames[textHelperSelectedIndex]; } - int logHelperSelectedIndex = EditorGUILayout.Popup("Log Helper", m_LogHelperTypeNameIndex, m_LogHelperTypeNames); - if (logHelperSelectedIndex != m_LogHelperTypeNameIndex) + int logHelperSelectedIndex = EditorGUILayout.Popup("Log Helper", _logHelperTypeNameIndex, _logHelperTypeNames); + if (logHelperSelectedIndex != _logHelperTypeNameIndex) { - m_LogHelperTypeNameIndex = logHelperSelectedIndex; - m_LogHelperTypeName.stringValue = logHelperSelectedIndex <= 0 ? null : m_LogHelperTypeNames[logHelperSelectedIndex]; + _logHelperTypeNameIndex = logHelperSelectedIndex; + _logHelperTypeName.stringValue = logHelperSelectedIndex <= 0 ? null : _logHelperTypeNames[logHelperSelectedIndex]; } - int jsonHelperSelectedIndex = EditorGUILayout.Popup("JSON Helper", m_JsonHelperTypeNameIndex, m_JsonHelperTypeNames); - if (jsonHelperSelectedIndex != m_JsonHelperTypeNameIndex) + int jsonHelperSelectedIndex = EditorGUILayout.Popup("JSON Helper", _jsonHelperTypeNameIndex, _jsonHelperTypeNames); + if (jsonHelperSelectedIndex != _jsonHelperTypeNameIndex) { - m_JsonHelperTypeNameIndex = jsonHelperSelectedIndex; - m_JsonHelperTypeName.stringValue = jsonHelperSelectedIndex <= 0 ? null : m_JsonHelperTypeNames[jsonHelperSelectedIndex]; + _jsonHelperTypeNameIndex = jsonHelperSelectedIndex; + _jsonHelperTypeName.stringValue = jsonHelperSelectedIndex <= 0 ? null : _jsonHelperTypeNames[jsonHelperSelectedIndex]; } } EditorGUILayout.EndVertical(); } EditorGUI.EndDisabledGroup(); - int frameRate = EditorGUILayout.IntSlider("Frame Rate", m_FrameRate.intValue, 1, 120); - if (frameRate != m_FrameRate.intValue) + int frameRate = EditorGUILayout.IntSlider("Frame Rate", _frameRate.intValue, 1, 120); + if (frameRate != _frameRate.intValue) { if (EditorApplication.isPlaying) { @@ -80,20 +80,20 @@ namespace TEngine.Editor } else { - m_FrameRate.intValue = frameRate; + _frameRate.intValue = frameRate; } } EditorGUILayout.BeginVertical("box"); { - float gameSpeed = EditorGUILayout.Slider("Game Speed", m_GameSpeed.floatValue, 0f, 8f); + float gameSpeed = EditorGUILayout.Slider("Game Speed", _gameSpeed.floatValue, 0f, 8f); int selectedGameSpeed = GUILayout.SelectionGrid(GetSelectedGameSpeed(gameSpeed), GameSpeedForDisplay, 5); if (selectedGameSpeed >= 0) { gameSpeed = GetGameSpeed(selectedGameSpeed); } - if (Math.Abs(gameSpeed - m_GameSpeed.floatValue) > 0.01f) + if (Math.Abs(gameSpeed - _gameSpeed.floatValue) > 0.01f) { if (EditorApplication.isPlaying) { @@ -101,14 +101,14 @@ namespace TEngine.Editor } else { - m_GameSpeed.floatValue = gameSpeed; + _gameSpeed.floatValue = gameSpeed; } } } EditorGUILayout.EndVertical(); - bool runInBackground = EditorGUILayout.Toggle("Run in Background", m_RunInBackground.boolValue); - if (runInBackground != m_RunInBackground.boolValue) + bool runInBackground = EditorGUILayout.Toggle("Run in Background", _runInBackground.boolValue); + if (runInBackground != _runInBackground.boolValue) { if (EditorApplication.isPlaying) { @@ -116,12 +116,12 @@ namespace TEngine.Editor } else { - m_RunInBackground.boolValue = runInBackground; + _runInBackground.boolValue = runInBackground; } } - bool neverSleep = EditorGUILayout.Toggle("Never Sleep", m_NeverSleep.boolValue); - if (neverSleep != m_NeverSleep.boolValue) + bool neverSleep = EditorGUILayout.Toggle("Never Sleep", _neverSleep.boolValue); + if (neverSleep != _neverSleep.boolValue) { if (EditorApplication.isPlaying) { @@ -129,7 +129,7 @@ namespace TEngine.Editor } else { - m_NeverSleep.boolValue = neverSleep; + _neverSleep.boolValue = neverSleep; } } @@ -145,14 +145,14 @@ namespace TEngine.Editor private void OnEnable() { - m_EditorLanguage = serializedObject.FindProperty("m_EditorLanguage"); - m_TextHelperTypeName = serializedObject.FindProperty("m_TextHelperTypeName"); - m_LogHelperTypeName = serializedObject.FindProperty("m_LogHelperTypeName"); - m_JsonHelperTypeName = serializedObject.FindProperty("m_JsonHelperTypeName"); - m_FrameRate = serializedObject.FindProperty("m_FrameRate"); - m_GameSpeed = serializedObject.FindProperty("m_GameSpeed"); - m_RunInBackground = serializedObject.FindProperty("m_RunInBackground"); - m_NeverSleep = serializedObject.FindProperty("m_NeverSleep"); + _editorLanguage = serializedObject.FindProperty("editorLanguage"); + _textHelperTypeName = serializedObject.FindProperty("textHelperTypeName"); + _logHelperTypeName = serializedObject.FindProperty("logHelperTypeName"); + _jsonHelperTypeName = serializedObject.FindProperty("jsonHelperTypeName"); + _frameRate = serializedObject.FindProperty("frameRate"); + _gameSpeed = serializedObject.FindProperty("gameSpeed"); + _runInBackground = serializedObject.FindProperty("runInBackground"); + _neverSleep = serializedObject.FindProperty("neverSleep"); RefreshTypeNames(); } @@ -165,15 +165,15 @@ namespace TEngine.Editor }; textHelperTypeNames.AddRange(Type.GetRuntimeTypeNames(typeof(Utility.Text.ITextHelper))); - m_TextHelperTypeNames = textHelperTypeNames.ToArray(); - m_TextHelperTypeNameIndex = 0; - if (!string.IsNullOrEmpty(m_TextHelperTypeName.stringValue)) + _textHelperTypeNames = textHelperTypeNames.ToArray(); + _textHelperTypeNameIndex = 0; + if (!string.IsNullOrEmpty(_textHelperTypeName.stringValue)) { - m_TextHelperTypeNameIndex = textHelperTypeNames.IndexOf(m_TextHelperTypeName.stringValue); - if (m_TextHelperTypeNameIndex <= 0) + _textHelperTypeNameIndex = textHelperTypeNames.IndexOf(_textHelperTypeName.stringValue); + if (_textHelperTypeNameIndex <= 0) { - m_TextHelperTypeNameIndex = 0; - m_TextHelperTypeName.stringValue = null; + _textHelperTypeNameIndex = 0; + _textHelperTypeName.stringValue = null; } } @@ -183,15 +183,15 @@ namespace TEngine.Editor }; logHelperTypeNames.AddRange(Type.GetRuntimeTypeNames(typeof(GameFrameworkLog.ILogHelper))); - m_LogHelperTypeNames = logHelperTypeNames.ToArray(); - m_LogHelperTypeNameIndex = 0; - if (!string.IsNullOrEmpty(m_LogHelperTypeName.stringValue)) + _logHelperTypeNames = logHelperTypeNames.ToArray(); + _logHelperTypeNameIndex = 0; + if (!string.IsNullOrEmpty(_logHelperTypeName.stringValue)) { - m_LogHelperTypeNameIndex = logHelperTypeNames.IndexOf(m_LogHelperTypeName.stringValue); - if (m_LogHelperTypeNameIndex <= 0) + _logHelperTypeNameIndex = logHelperTypeNames.IndexOf(_logHelperTypeName.stringValue); + if (_logHelperTypeNameIndex <= 0) { - m_LogHelperTypeNameIndex = 0; - m_LogHelperTypeName.stringValue = null; + _logHelperTypeNameIndex = 0; + _logHelperTypeName.stringValue = null; } } @@ -201,15 +201,15 @@ namespace TEngine.Editor }; jsonHelperTypeNames.AddRange(Type.GetRuntimeTypeNames(typeof(Utility.Json.IJsonHelper))); - m_JsonHelperTypeNames = jsonHelperTypeNames.ToArray(); - m_JsonHelperTypeNameIndex = 0; - if (!string.IsNullOrEmpty(m_JsonHelperTypeName.stringValue)) + _jsonHelperTypeNames = jsonHelperTypeNames.ToArray(); + _jsonHelperTypeNameIndex = 0; + if (!string.IsNullOrEmpty(_jsonHelperTypeName.stringValue)) { - m_JsonHelperTypeNameIndex = jsonHelperTypeNames.IndexOf(m_JsonHelperTypeName.stringValue); - if (m_JsonHelperTypeNameIndex <= 0) + _jsonHelperTypeNameIndex = jsonHelperTypeNames.IndexOf(_jsonHelperTypeName.stringValue); + if (_jsonHelperTypeNameIndex <= 0) { - m_JsonHelperTypeNameIndex = 0; - m_JsonHelperTypeName.stringValue = null; + _jsonHelperTypeNameIndex = 0; + _jsonHelperTypeName.stringValue = null; } } diff --git a/UnityProject/Assets/TEngine/Libraries.meta b/UnityProject/Assets/TEngine/Libraries.meta new file mode 100644 index 00000000..a8eda6d2 --- /dev/null +++ b/UnityProject/Assets/TEngine/Libraries.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 07e683cdfed9cae409efdc29179643ed +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/UnityProject/Assets/Plugins/System.Buffers.dll b/UnityProject/Assets/TEngine/Libraries/System.Buffers.dll similarity index 100% rename from UnityProject/Assets/Plugins/System.Buffers.dll rename to UnityProject/Assets/TEngine/Libraries/System.Buffers.dll diff --git a/UnityProject/Assets/Plugins/System.Buffers.dll.meta b/UnityProject/Assets/TEngine/Libraries/System.Buffers.dll.meta similarity index 100% rename from UnityProject/Assets/Plugins/System.Buffers.dll.meta rename to UnityProject/Assets/TEngine/Libraries/System.Buffers.dll.meta diff --git a/UnityProject/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll b/UnityProject/Assets/TEngine/Libraries/System.Runtime.CompilerServices.Unsafe.dll similarity index 100% rename from UnityProject/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll rename to UnityProject/Assets/TEngine/Libraries/System.Runtime.CompilerServices.Unsafe.dll diff --git a/UnityProject/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll.meta b/UnityProject/Assets/TEngine/Libraries/System.Runtime.CompilerServices.Unsafe.dll.meta similarity index 100% rename from UnityProject/Assets/Plugins/System.Runtime.CompilerServices.Unsafe.dll.meta rename to UnityProject/Assets/TEngine/Libraries/System.Runtime.CompilerServices.Unsafe.dll.meta diff --git a/UnityProject/Assets/TEngine/Runtime/Core/DataStruct/GameFrameworkLinkedList.cs b/UnityProject/Assets/TEngine/Runtime/Core/DataStruct/GameFrameworkLinkedList.cs index 75459255..0b3ced8e 100644 --- a/UnityProject/Assets/TEngine/Runtime/Core/DataStruct/GameFrameworkLinkedList.cs +++ b/UnityProject/Assets/TEngine/Runtime/Core/DataStruct/GameFrameworkLinkedList.cs @@ -341,7 +341,7 @@ namespace TEngine [StructLayout(LayoutKind.Auto)] public struct Enumerator : IEnumerator, IEnumerator { - private LinkedList.Enumerator m_Enumerator; + private LinkedList.Enumerator _enumerator; internal Enumerator(LinkedList linkedList) { @@ -350,25 +350,25 @@ namespace TEngine throw new GameFrameworkException("Linked list is invalid."); } - m_Enumerator = linkedList.GetEnumerator(); + _enumerator = linkedList.GetEnumerator(); } /// /// 获取当前结点。 /// - public T Current => m_Enumerator.Current; + public T Current => _enumerator.Current; /// /// 获取当前的枚举数。 /// - object IEnumerator.Current => m_Enumerator.Current; + object IEnumerator.Current => _enumerator.Current; /// /// 清理枚举数。 /// public void Dispose() { - m_Enumerator.Dispose(); + _enumerator.Dispose(); } /// @@ -377,7 +377,7 @@ namespace TEngine /// 返回下一个结点。 public bool MoveNext() { - return m_Enumerator.MoveNext(); + return _enumerator.MoveNext(); } /// @@ -385,7 +385,7 @@ namespace TEngine /// void IEnumerator.Reset() { - ((IEnumerator)m_Enumerator).Reset(); + ((IEnumerator)_enumerator).Reset(); } } } diff --git a/UnityProject/Assets/TEngine/Runtime/Core/DataStruct/GameFrameworkLinkedListRange.cs b/UnityProject/Assets/TEngine/Runtime/Core/DataStruct/GameFrameworkLinkedListRange.cs index 53295d96..3cdf468d 100644 --- a/UnityProject/Assets/TEngine/Runtime/Core/DataStruct/GameFrameworkLinkedListRange.cs +++ b/UnityProject/Assets/TEngine/Runtime/Core/DataStruct/GameFrameworkLinkedListRange.cs @@ -118,9 +118,9 @@ namespace TEngine [StructLayout(LayoutKind.Auto)] public struct Enumerator : IEnumerator, IEnumerator { - private readonly GameFrameworkLinkedListRange m_GameFrameworkLinkedListRange; - private LinkedListNode m_Current; - private T m_CurrentValue; + private readonly GameFrameworkLinkedListRange _gameFrameworkLinkedListRange; + private LinkedListNode _current; + private T _currentValue; internal Enumerator(GameFrameworkLinkedListRange range) { @@ -129,20 +129,20 @@ namespace TEngine throw new GameFrameworkException("Range is invalid."); } - m_GameFrameworkLinkedListRange = range; - m_Current = m_GameFrameworkLinkedListRange._first; - m_CurrentValue = default(T); + _gameFrameworkLinkedListRange = range; + _current = _gameFrameworkLinkedListRange._first; + _currentValue = default(T); } /// /// 获取当前结点。 /// - public T Current => m_CurrentValue; + public T Current => _currentValue; /// /// 获取当前的枚举数。 /// - object IEnumerator.Current => m_CurrentValue; + object IEnumerator.Current => _currentValue; /// /// 清理枚举数。 @@ -157,13 +157,13 @@ namespace TEngine /// 返回下一个结点。 public bool MoveNext() { - if (m_Current == null || m_Current == m_GameFrameworkLinkedListRange._terminal) + if (_current == null || _current == _gameFrameworkLinkedListRange._terminal) { return false; } - m_CurrentValue = m_Current.Value; - m_Current = m_Current.Next; + _currentValue = _current.Value; + _current = _current.Next; return true; } @@ -172,8 +172,8 @@ namespace TEngine /// void IEnumerator.Reset() { - m_Current = m_GameFrameworkLinkedListRange._first; - m_CurrentValue = default(T); + _current = _gameFrameworkLinkedListRange._first; + _currentValue = default(T); } } } diff --git a/UnityProject/Assets/TEngine/Runtime/Core/DataStruct/GameFrameworkMultiDictionary.cs b/UnityProject/Assets/TEngine/Runtime/Core/DataStruct/GameFrameworkMultiDictionary.cs index a7c5fba1..73880051 100644 --- a/UnityProject/Assets/TEngine/Runtime/Core/DataStruct/GameFrameworkMultiDictionary.cs +++ b/UnityProject/Assets/TEngine/Runtime/Core/DataStruct/GameFrameworkMultiDictionary.cs @@ -207,7 +207,7 @@ namespace TEngine [StructLayout(LayoutKind.Auto)] public struct Enumerator : IEnumerator>>, IEnumerator { - private Dictionary>.Enumerator m_Enumerator; + private Dictionary>.Enumerator _enumerator; internal Enumerator(Dictionary> dictionary) { @@ -216,25 +216,25 @@ namespace TEngine throw new GameFrameworkException("Dictionary is invalid."); } - m_Enumerator = dictionary.GetEnumerator(); + _enumerator = dictionary.GetEnumerator(); } /// /// 获取当前结点。 /// - public KeyValuePair> Current => m_Enumerator.Current; + public KeyValuePair> Current => _enumerator.Current; /// /// 获取当前的枚举数。 /// - object IEnumerator.Current => m_Enumerator.Current; + object IEnumerator.Current => _enumerator.Current; /// /// 清理枚举数。 /// public void Dispose() { - m_Enumerator.Dispose(); + _enumerator.Dispose(); } /// @@ -243,7 +243,7 @@ namespace TEngine /// 返回下一个结点。 public bool MoveNext() { - return m_Enumerator.MoveNext(); + return _enumerator.MoveNext(); } /// @@ -251,7 +251,7 @@ namespace TEngine /// void IEnumerator.Reset() { - ((IEnumerator>>)m_Enumerator).Reset(); + ((IEnumerator>>)_enumerator).Reset(); } } } diff --git a/UnityProject/Assets/TEngine/Runtime/Core/GameEvent/ActorEventDispatcher.cs b/UnityProject/Assets/TEngine/Runtime/Core/GameEvent/ActorEventDispatcher.cs index 1fe66615..0e929535 100644 --- a/UnityProject/Assets/TEngine/Runtime/Core/GameEvent/ActorEventDispatcher.cs +++ b/UnityProject/Assets/TEngine/Runtime/Core/GameEvent/ActorEventDispatcher.cs @@ -34,24 +34,17 @@ namespace TEngine /// /// 所有事件。 /// - private readonly Dictionary> _allEventListenerMap; + private readonly Dictionary> _allEventListenerMap = new(); /// /// 用于标记一个事件是不是正在处理。 /// - private readonly List _processEventList; + private readonly List _processEventList = new(); /// /// 用于标记一个事件是不是被移除。 /// - private readonly List _delayDeleteEventList; - - public ActorEventDispatcher() - { - _processEventList = new List(); - _delayDeleteEventList = new List(); - _allEventListenerMap = new Dictionary>(); - } + private readonly List _delayDeleteEventList = new(); /// /// 移除所有事件监听。 diff --git a/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioCategory.cs b/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioCategory.cs index ace64120..9d058b02 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioCategory.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioCategory.cs @@ -76,7 +76,7 @@ namespace TEngine this.audioMixer = audioMixer; _maxChannel = maxChannel; _audioGroupConfig = audioGroupConfig; - AudioMixerGroup[] audioMixerGroups = audioMixer.FindMatchingGroups(Utility.Text.Format("Master/{0}", audioGroupConfig.AudioType.ToString())); + AudioMixerGroup[] audioMixerGroups = audioMixer.FindMatchingGroups(Utility.Text.Format("Master/{0}", audioGroupConfig.audioType.ToString())); if (audioMixerGroups.Length > 0) { _audioMixerGroup = audioMixerGroups[0]; diff --git a/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioGroupConfig.cs b/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioGroupConfig.cs index 7a154265..19ab12de 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioGroupConfig.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioGroupConfig.cs @@ -1,5 +1,6 @@ using System; using UnityEngine; +using UnityEngine.Serialization; namespace TEngine { @@ -9,19 +10,19 @@ namespace TEngine [Serializable] public sealed class AudioGroupConfig { - [SerializeField] private string m_Name = null; + [SerializeField] private string name = null; - [SerializeField] private bool m_Mute = false; + [SerializeField] private bool mute = false; - [SerializeField, Range(0f, 1f)] private float m_Volume = 1f; + [SerializeField, Range(0f, 1f)] private float volume = 1f; - [SerializeField] private int m_AgentHelperCount = 1; + [SerializeField] private int agentHelperCount = 1; /// /// 音效分类,可分别关闭/开启对应分类音效。 /// /// 命名与AudioMixer中分类名保持一致。 - public AudioType AudioType; + public AudioType audioType; /// /// 音频源中3D声音的衰减模式。 @@ -44,22 +45,22 @@ namespace TEngine /// /// 音频轨道组配置的名称。 /// - public string Name => m_Name; + public string Name => name; /// /// 是否禁用。 /// - public bool Mute => m_Mute; + public bool Mute => mute; /// /// 音量大小。 /// - public float Volume => m_Volume; + public float Volume => volume; /// /// 音频代理个数。 /// 命名与AudioMixer中个数保持一致。 /// - public int AgentHelperCount => m_AgentHelperCount; + public int AgentHelperCount => agentHelperCount; } } \ No newline at end of file diff --git a/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioModule.cs b/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioModule.cs index 76993e8d..536dcd6a 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioModule.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/AudioModule/AudioModule.cs @@ -389,7 +389,7 @@ namespace TEngine for (int index = 0; index < (int)AudioType.Max; ++index) { AudioType audioType = (AudioType)index; - AudioGroupConfig audioGroupConfig = _audioGroupConfigs.First(t => t.AudioType == audioType); + AudioGroupConfig audioGroupConfig = _audioGroupConfigs.First(t => t.audioType == audioType); _audioCategories[index] = new AudioCategory(audioGroupConfig.AgentHelperCount, _audioMixer, audioGroupConfig); _categoriesVolume[index] = audioGroupConfig.Volume; } diff --git a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.LogNode.cs b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.LogNode.cs index c09ce6a0..84710126 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.LogNode.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.LogNode.cs @@ -10,22 +10,22 @@ namespace TEngine /// public sealed class LogNode : IMemory { - private DateTime m_LogTime; - private int m_LogFrameCount; - private LogType m_LogType; - private string m_LogMessage; - private string m_StackTrack; + private DateTime _logTime; + private int _logFrameCount; + private LogType _logType; + private string _logMessage; + private string _stackTrack; /// /// 初始化日志记录结点的新实例。 /// public LogNode() { - m_LogTime = default(DateTime); - m_LogFrameCount = 0; - m_LogType = LogType.Error; - m_LogMessage = null; - m_StackTrack = null; + _logTime = default(DateTime); + _logFrameCount = 0; + _logType = LogType.Error; + _logMessage = null; + _stackTrack = null; } /// @@ -35,7 +35,7 @@ namespace TEngine { get { - return m_LogTime; + return _logTime; } } @@ -46,7 +46,7 @@ namespace TEngine { get { - return m_LogFrameCount; + return _logFrameCount; } } @@ -57,7 +57,7 @@ namespace TEngine { get { - return m_LogType; + return _logType; } } @@ -68,7 +68,7 @@ namespace TEngine { get { - return m_LogMessage; + return _logMessage; } } @@ -79,7 +79,7 @@ namespace TEngine { get { - return m_StackTrack; + return _stackTrack; } } @@ -93,11 +93,11 @@ namespace TEngine public static LogNode Create(LogType logType, string logMessage, string stackTrack) { LogNode logNode = MemoryPool.Acquire(); - logNode.m_LogTime = DateTime.UtcNow; - logNode.m_LogFrameCount = Time.frameCount; - logNode.m_LogType = logType; - logNode.m_LogMessage = logMessage; - logNode.m_StackTrack = stackTrack; + logNode._logTime = DateTime.UtcNow; + logNode._logFrameCount = Time.frameCount; + logNode._logType = logType; + logNode._logMessage = logMessage; + logNode._stackTrack = stackTrack; return logNode; } @@ -106,11 +106,11 @@ namespace TEngine /// public void Clear() { - m_LogTime = default(DateTime); - m_LogFrameCount = 0; - m_LogType = LogType.Error; - m_LogMessage = null; - m_StackTrack = null; + _logTime = default(DateTime); + _logFrameCount = 0; + _logType = LogType.Error; + _logMessage = null; + _stackTrack = null; } } } diff --git a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.MemoryPoolInformationWindow.cs b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.MemoryPoolInformationWindow.cs index 437c042c..576ae5c9 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.MemoryPoolInformationWindow.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.MemoryPoolInformationWindow.cs @@ -8,10 +8,10 @@ namespace TEngine { private sealed class MemoryPoolPoolInformationWindow : ScrollableDebuggerWindowBase { - private readonly Dictionary> m_MemoryPoolInfos = new Dictionary>(StringComparer.Ordinal); - private readonly Comparison m_NormalClassNameComparer = NormalClassNameComparer; - private readonly Comparison m_FullClassNameComparer = FullClassNameComparer; - private bool m_ShowFullClassName = false; + private readonly Dictionary> _memoryPoolInfos = new Dictionary>(StringComparer.Ordinal); + private readonly Comparison _normalClassNameComparer = NormalClassNameComparer; + private readonly Comparison _fullClassNameComparer = FullClassNameComparer; + private bool _showFullClassName = false; public override void Initialize(params object[] args) { @@ -27,30 +27,30 @@ namespace TEngine } GUILayout.EndVertical(); - m_ShowFullClassName = GUILayout.Toggle(m_ShowFullClassName, "Show Full Class Name"); - m_MemoryPoolInfos.Clear(); + _showFullClassName = GUILayout.Toggle(_showFullClassName, "Show Full Class Name"); + _memoryPoolInfos.Clear(); MemoryPoolInfo[] memoryPoolInfos = MemoryPool.GetAllMemoryPoolInfos(); foreach (MemoryPoolInfo memoryPoolInfo in memoryPoolInfos) { string assemblyName = memoryPoolInfo.Type.Assembly.GetName().Name; List results = null; - if (!m_MemoryPoolInfos.TryGetValue(assemblyName, out results)) + if (!_memoryPoolInfos.TryGetValue(assemblyName, out results)) { results = new List(); - m_MemoryPoolInfos.Add(assemblyName, results); + _memoryPoolInfos.Add(assemblyName, results); } results.Add(memoryPoolInfo); } - foreach (KeyValuePair> assemblyMemoryPoolInfo in m_MemoryPoolInfos) + foreach (KeyValuePair> assemblyMemoryPoolInfo in _memoryPoolInfos) { GUILayout.Label(Utility.Text.Format("Assembly: {0}", assemblyMemoryPoolInfo.Key)); GUILayout.BeginVertical("box"); { GUILayout.BeginHorizontal(); { - GUILayout.Label(m_ShowFullClassName ? "Full Class Name" : "Class Name"); + GUILayout.Label(_showFullClassName ? "Full Class Name" : "Class Name"); GUILayout.Label("Unused", GUILayout.Width(60f)); GUILayout.Label("Using", GUILayout.Width(60f)); GUILayout.Label("Acquire", GUILayout.Width(60f)); @@ -62,7 +62,7 @@ namespace TEngine if (assemblyMemoryPoolInfo.Value.Count > 0) { - assemblyMemoryPoolInfo.Value.Sort(m_ShowFullClassName ? m_FullClassNameComparer : m_NormalClassNameComparer); + assemblyMemoryPoolInfo.Value.Sort(_showFullClassName ? _fullClassNameComparer : _normalClassNameComparer); foreach (MemoryPoolInfo memoryPoolInfo in assemblyMemoryPoolInfo.Value) { DrawMemoryPoolInfo(memoryPoolInfo); @@ -81,7 +81,7 @@ namespace TEngine { GUILayout.BeginHorizontal(); { - GUILayout.Label(m_ShowFullClassName ? memoryPoolInfo.Type.FullName : memoryPoolInfo.Type.Name); + GUILayout.Label(_showFullClassName ? memoryPoolInfo.Type.FullName : memoryPoolInfo.Type.Name); GUILayout.Label(memoryPoolInfo.UnusedMemoryCount.ToString(), GUILayout.Width(60f)); GUILayout.Label(memoryPoolInfo.UsingMemoryCount.ToString(), GUILayout.Width(60f)); GUILayout.Label(memoryPoolInfo.AcquireMemoryCount.ToString(), GUILayout.Width(60f)); diff --git a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.NetworkInformationWindow.cs b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.NetworkInformationWindow.cs deleted file mode 100644 index c7288370..00000000 --- a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.NetworkInformationWindow.cs +++ /dev/null @@ -1,61 +0,0 @@ -// using UnityEngine; -// -// namespace TEngine -// { -// public sealed partial class DebuggerModule -// { -// private sealed class NetworkInformationWindow : ScrollableDebuggerWindowBase -// { -// private NetworkComponent m_NetworkComponent = null; -// -// public override void Initialize(params object[] args) -// { -// m_NetworkComponent = GameEntry.GetComponent(); -// if (m_NetworkComponent == null) -// { -// Log.Fatal("Network component is invalid."); -// return; -// } -// } -// -// protected override void OnDrawScrollableWindow() -// { -// GUILayout.Label("Network Information"); -// GUILayout.BeginVertical("box"); -// { -// DrawItem("Network Channel Count", m_NetworkComponent.NetworkChannelCount.ToString()); -// } -// GUILayout.EndVertical(); -// INetworkChannel[] networkChannels = m_NetworkComponent.GetAllNetworkChannels(); -// for (int i = 0; i < networkChannels.Length; i++) -// { -// DrawNetworkChannel(networkChannels[i]); -// } -// } -// -// private void DrawNetworkChannel(INetworkChannel networkChannel) -// { -// GUILayout.Label(Utility.Text.Format("Network Channel: {0} ({1})", networkChannel.Name, networkChannel.Connected ? "Connected" : "Disconnected")); -// GUILayout.BeginVertical("box"); -// { -// DrawItem("Service Type", networkChannel.ServiceType.ToString()); -// DrawItem("Address Family", networkChannel.AddressFamily.ToString()); -// DrawItem("Local Address", networkChannel.Connected ? networkChannel.Socket.LocalEndPoint.ToString() : "Unavailable"); -// DrawItem("Remote Address", networkChannel.Connected ? networkChannel.Socket.RemoteEndPoint.ToString() : "Unavailable"); -// DrawItem("Send Packet", Utility.Text.Format("{0} / {1}", networkChannel.SendPacketCount, networkChannel.SentPacketCount)); -// DrawItem("Receive Packet", Utility.Text.Format("{0} / {1}", networkChannel.ReceivePacketCount, networkChannel.ReceivedPacketCount)); -// DrawItem("Miss Heart Beat Count", networkChannel.MissHeartBeatCount.ToString()); -// DrawItem("Heart Beat", Utility.Text.Format("{0:F2} / {1:F2}", networkChannel.HeartBeatElapseSeconds, networkChannel.HeartBeatInterval)); -// if (networkChannel.Connected) -// { -// if (GUILayout.Button("Disconnect", GUILayout.Height(30f))) -// { -// networkChannel.Close(); -// } -// } -// } -// GUILayout.EndVertical(); -// } -// } -// } -// } diff --git a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.NetworkInformationWindow.cs.meta b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.NetworkInformationWindow.cs.meta deleted file mode 100644 index 7d7440b2..00000000 --- a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.NetworkInformationWindow.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 91eb2683b03a4eb0afdd2edd034df2cc -timeCreated: 1680489774 \ No newline at end of file diff --git a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.QualityInformationWindow.cs b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.QualityInformationWindow.cs index ffab1633..6bf07d1b 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.QualityInformationWindow.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.QualityInformationWindow.cs @@ -6,7 +6,7 @@ namespace TEngine { private sealed class QualityInformationWindow : ScrollableDebuggerWindowBase { - private bool m_ApplyExpensiveChanges = false; + private bool _applyExpensiveChanges = false; protected override void OnDrawScrollableWindow() { @@ -16,12 +16,12 @@ namespace TEngine int currentQualityLevel = QualitySettings.GetQualityLevel(); DrawItem("Current Quality Level", QualitySettings.names[currentQualityLevel]); - m_ApplyExpensiveChanges = GUILayout.Toggle(m_ApplyExpensiveChanges, "Apply expensive changes on quality level change."); + _applyExpensiveChanges = GUILayout.Toggle(_applyExpensiveChanges, "Apply expensive changes on quality level change."); int newQualityLevel = GUILayout.SelectionGrid(currentQualityLevel, QualitySettings.names, 3, "toggle"); if (newQualityLevel != currentQualityLevel) { - QualitySettings.SetQualityLevel(newQualityLevel, m_ApplyExpensiveChanges); + QualitySettings.SetQualityLevel(newQualityLevel, _applyExpensiveChanges); } } GUILayout.EndVertical(); diff --git a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.RuntimeMemoryInformationWindow.Sample.cs b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.RuntimeMemoryInformationWindow.Sample.cs index 26eefdc4..c9cfa9f6 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.RuntimeMemoryInformationWindow.Sample.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.RuntimeMemoryInformationWindow.Sample.cs @@ -6,24 +6,24 @@ { private sealed class Sample { - private readonly string m_Name; - private readonly string m_Type; - private readonly long m_Size; - private bool m_Highlight; + private readonly string _name; + private readonly string _type; + private readonly long _size; + private bool _highlight; public Sample(string name, string type, long size) { - m_Name = name; - m_Type = type; - m_Size = size; - m_Highlight = false; + _name = name; + _type = type; + _size = size; + _highlight = false; } public string Name { get { - return m_Name; + return _name; } } @@ -31,7 +31,7 @@ { get { - return m_Type; + return _type; } } @@ -39,7 +39,7 @@ { get { - return m_Size; + return _size; } } @@ -47,11 +47,11 @@ { get { - return m_Highlight; + return _highlight; } set { - m_Highlight = value; + _highlight = value; } } } diff --git a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.RuntimeMemoryInformationWindow.cs b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.RuntimeMemoryInformationWindow.cs index 55cdc1d3..a428ca46 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.RuntimeMemoryInformationWindow.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.RuntimeMemoryInformationWindow.cs @@ -13,12 +13,12 @@ namespace TEngine { private const int ShowSampleCount = 300; - private readonly List m_Samples = new List(); - private readonly Comparison m_SampleComparer = SampleComparer; - private DateTime m_SampleTime = DateTime.MinValue; - private long m_SampleSize = 0L; - private long m_DuplicateSampleSize = 0L; - private int m_DuplicateSimpleCount = 0; + private readonly List _samples = new List(); + private readonly Comparison _sampleComparer = SampleComparer; + private DateTime _sampleTime = DateTime.MinValue; + private long _sampleSize = 0L; + private long _duplicateSampleSize = 0L; + private int _duplicateSimpleCount = 0; protected override void OnDrawScrollableWindow() { @@ -31,22 +31,22 @@ namespace TEngine TakeSample(); } - if (m_SampleTime <= DateTime.MinValue) + if (_sampleTime <= DateTime.MinValue) { GUILayout.Label(Utility.Text.Format("Please take sample for {0} first.", typeName)); } else { - if (m_DuplicateSimpleCount > 0) + if (_duplicateSimpleCount > 0) { - GUILayout.Label(Utility.Text.Format("{0} {1}s ({2}) obtained at {3:yyyy-MM-dd HH:mm:ss}, while {4} {1}s ({5}) might be duplicated.", m_Samples.Count, typeName, GetByteLengthString(m_SampleSize), m_SampleTime.ToLocalTime(), m_DuplicateSimpleCount, GetByteLengthString(m_DuplicateSampleSize))); + GUILayout.Label(Utility.Text.Format("{0} {1}s ({2}) obtained at {3:yyyy-MM-dd HH:mm:ss}, while {4} {1}s ({5}) might be duplicated.", _samples.Count, typeName, GetByteLengthString(_sampleSize), _sampleTime.ToLocalTime(), _duplicateSimpleCount, GetByteLengthString(_duplicateSampleSize))); } else { - GUILayout.Label(Utility.Text.Format("{0} {1}s ({2}) obtained at {3:yyyy-MM-dd HH:mm:ss}.", m_Samples.Count, typeName, GetByteLengthString(m_SampleSize), m_SampleTime.ToLocalTime())); + GUILayout.Label(Utility.Text.Format("{0} {1}s ({2}) obtained at {3:yyyy-MM-dd HH:mm:ss}.", _samples.Count, typeName, GetByteLengthString(_sampleSize), _sampleTime.ToLocalTime())); } - if (m_Samples.Count > 0) + if (_samples.Count > 0) { GUILayout.BeginHorizontal(); { @@ -58,13 +58,13 @@ namespace TEngine } int count = 0; - for (int i = 0; i < m_Samples.Count; i++) + for (int i = 0; i < _samples.Count; i++) { GUILayout.BeginHorizontal(); { - GUILayout.Label(m_Samples[i].Highlight ? Utility.Text.Format("{0}", m_Samples[i].Name) : m_Samples[i].Name); - GUILayout.Label(m_Samples[i].Highlight ? Utility.Text.Format("{0}", m_Samples[i].Type) : m_Samples[i].Type, GUILayout.Width(240f)); - GUILayout.Label(m_Samples[i].Highlight ? Utility.Text.Format("{0}", GetByteLengthString(m_Samples[i].Size)) : GetByteLengthString(m_Samples[i].Size), GUILayout.Width(80f)); + GUILayout.Label(_samples[i].Highlight ? Utility.Text.Format("{0}", _samples[i].Name) : _samples[i].Name); + GUILayout.Label(_samples[i].Highlight ? Utility.Text.Format("{0}", _samples[i].Type) : _samples[i].Type, GUILayout.Width(240f)); + GUILayout.Label(_samples[i].Highlight ? Utility.Text.Format("{0}", GetByteLengthString(_samples[i].Size)) : GetByteLengthString(_samples[i].Size), GUILayout.Width(80f)); } GUILayout.EndHorizontal(); @@ -81,11 +81,11 @@ namespace TEngine private void TakeSample() { - m_SampleTime = DateTime.UtcNow; - m_SampleSize = 0L; - m_DuplicateSampleSize = 0L; - m_DuplicateSimpleCount = 0; - m_Samples.Clear(); + _sampleTime = DateTime.UtcNow; + _sampleSize = 0L; + _duplicateSampleSize = 0L; + _duplicateSimpleCount = 0; + _samples.Clear(); T[] samples = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < samples.Length; i++) @@ -96,19 +96,19 @@ namespace TEngine #else sampleSize = Profiler.GetRuntimeMemorySize(samples[i]); #endif - m_SampleSize += sampleSize; - m_Samples.Add(new Sample(samples[i].name, samples[i].GetType().Name, sampleSize)); + _sampleSize += sampleSize; + _samples.Add(new Sample(samples[i].name, samples[i].GetType().Name, sampleSize)); } - m_Samples.Sort(m_SampleComparer); + _samples.Sort(_sampleComparer); - for (int i = 1; i < m_Samples.Count; i++) + for (int i = 1; i < _samples.Count; i++) { - if (m_Samples[i].Name == m_Samples[i - 1].Name && m_Samples[i].Type == m_Samples[i - 1].Type && m_Samples[i].Size == m_Samples[i - 1].Size) + if (_samples[i].Name == _samples[i - 1].Name && _samples[i].Type == _samples[i - 1].Type && _samples[i].Size == _samples[i - 1].Size) { - m_Samples[i].Highlight = true; - m_DuplicateSampleSize += m_Samples[i].Size; - m_DuplicateSimpleCount++; + _samples[i].Highlight = true; + _duplicateSampleSize += _samples[i].Size; + _duplicateSimpleCount++; } } } diff --git a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.RuntimeMemorySummaryWindow.Record.cs b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.RuntimeMemorySummaryWindow.Record.cs index 1fe763ac..7170864e 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.RuntimeMemorySummaryWindow.Record.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.RuntimeMemorySummaryWindow.Record.cs @@ -6,22 +6,22 @@ { private sealed class Record { - private readonly string m_Name; - private int m_Count; - private long m_Size; + private readonly string _name; + private int _count; + private long _size; public Record(string name) { - m_Name = name; - m_Count = 0; - m_Size = 0L; + _name = name; + _count = 0; + _size = 0L; } public string Name { get { - return m_Name; + return _name; } } @@ -29,11 +29,11 @@ { get { - return m_Count; + return _count; } set { - m_Count = value; + _count = value; } } @@ -41,11 +41,11 @@ { get { - return m_Size; + return _size; } set { - m_Size = value; + _size = value; } } } diff --git a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.RuntimeMemorySummaryWindow.cs b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.RuntimeMemorySummaryWindow.cs index 058cc310..6c9d9aeb 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.RuntimeMemorySummaryWindow.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.RuntimeMemorySummaryWindow.cs @@ -11,11 +11,11 @@ namespace TEngine { private sealed partial class RuntimeMemorySummaryWindow : ScrollableDebuggerWindowBase { - private readonly List m_Records = new List(); - private readonly Comparison m_RecordComparer = RecordComparer; - private DateTime m_SampleTime = DateTime.MinValue; - private int m_SampleCount = 0; - private long m_SampleSize = 0L; + private readonly List _records = new List(); + private readonly Comparison _recordComparer = RecordComparer; + private DateTime _sampleTime = DateTime.MinValue; + private int _sampleCount = 0; + private long _sampleSize = 0L; protected override void OnDrawScrollableWindow() { @@ -27,13 +27,13 @@ namespace TEngine TakeSample(); } - if (m_SampleTime <= DateTime.MinValue) + if (_sampleTime <= DateTime.MinValue) { GUILayout.Label("Please take sample first."); } else { - GUILayout.Label(Utility.Text.Format("{0} Objects ({1}) obtained at {2:yyyy-MM-dd HH:mm:ss}.", m_SampleCount, GetByteLengthString(m_SampleSize), m_SampleTime.ToLocalTime())); + GUILayout.Label(Utility.Text.Format("{0} Objects ({1}) obtained at {2:yyyy-MM-dd HH:mm:ss}.", _sampleCount, GetByteLengthString(_sampleSize), _sampleTime.ToLocalTime())); GUILayout.BeginHorizontal(); { @@ -43,13 +43,13 @@ namespace TEngine } GUILayout.EndHorizontal(); - for (int i = 0; i < m_Records.Count; i++) + for (int i = 0; i < _records.Count; i++) { GUILayout.BeginHorizontal(); { - GUILayout.Label(m_Records[i].Name); - GUILayout.Label(m_Records[i].Count.ToString(), GUILayout.Width(120f)); - GUILayout.Label(GetByteLengthString(m_Records[i].Size), GUILayout.Width(120f)); + GUILayout.Label(_records[i].Name); + GUILayout.Label(_records[i].Count.ToString(), GUILayout.Width(120f)); + GUILayout.Label(GetByteLengthString(_records[i].Size), GUILayout.Width(120f)); } GUILayout.EndHorizontal(); } @@ -60,10 +60,10 @@ namespace TEngine private void TakeSample() { - m_Records.Clear(); - m_SampleTime = DateTime.UtcNow; - m_SampleCount = 0; - m_SampleSize = 0L; + _records.Clear(); + _sampleTime = DateTime.UtcNow; + _sampleCount = 0; + _sampleSize = 0L; UnityEngine.Object[] samples = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < samples.Length; i++) @@ -75,11 +75,11 @@ namespace TEngine sampleSize = Profiler.GetRuntimeMemorySize(samples[i]); #endif string name = samples[i].GetType().Name; - m_SampleCount++; - m_SampleSize += sampleSize; + _sampleCount++; + _sampleSize += sampleSize; Record record = null; - foreach (Record r in m_Records) + foreach (Record r in _records) { if (r.Name == name) { @@ -91,14 +91,14 @@ namespace TEngine if (record == null) { record = new Record(name); - m_Records.Add(record); + _records.Add(record); } record.Count++; record.Size += sampleSize; } - m_Records.Sort(m_RecordComparer); + _records.Sort(_recordComparer); } private static int RecordComparer(Record a, Record b) diff --git a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.ScrollableDebuggerWindowBase.cs b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.ScrollableDebuggerWindowBase.cs index 9f628858..42b5f6bc 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.ScrollableDebuggerWindowBase.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.ScrollableDebuggerWindowBase.cs @@ -7,7 +7,7 @@ namespace TEngine private abstract class ScrollableDebuggerWindowBase : IDebuggerWindow { private const float TitleWidth = 240f; - private Vector2 m_ScrollPosition = Vector2.zero; + private Vector2 _scrollPosition = Vector2.zero; public virtual void Initialize(params object[] args) { @@ -31,7 +31,7 @@ namespace TEngine public void OnDraw() { - m_ScrollPosition = GUILayout.BeginScrollView(m_ScrollPosition); + _scrollPosition = GUILayout.BeginScrollView(_scrollPosition); { OnDrawScrollableWindow(); } diff --git a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.SettingsWindow.cs b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.SettingsWindow.cs index d63dc88b..c3b53429 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.SettingsWindow.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.SettingsWindow.cs @@ -8,13 +8,13 @@ namespace TEngine private sealed class SettingsWindow : ScrollableDebuggerWindowBase { private Debugger _debugger = null; - private float m_LastIconX = 0f; - private float m_LastIconY = 0f; - private float m_LastWindowX = 0f; - private float m_LastWindowY = 0f; - private float m_LastWindowWidth = 0f; - private float m_LastWindowHeight = 0f; - private float m_LastWindowScale = 0f; + private float _lastIconX = 0f; + private float _lastIconY = 0f; + private float _lastWindowX = 0f; + private float _lastWindowY = 0f; + private float _lastWindowWidth = 0f; + private float _lastWindowHeight = 0f; + private float _lastWindowScale = 0f; public override void Initialize(params object[] args) { @@ -25,59 +25,59 @@ namespace TEngine return; } - m_LastIconX = PlayerPrefs.GetFloat("Debugger.Icon.X", DefaultIconRect.x); - m_LastIconY = PlayerPrefs.GetFloat("Debugger.Icon.Y", DefaultIconRect.y); - m_LastWindowX = PlayerPrefs.GetFloat("Debugger.Window.X", DefaultWindowRect.x); - m_LastWindowY = PlayerPrefs.GetFloat("Debugger.Window.Y", DefaultWindowRect.y); - m_LastWindowWidth = PlayerPrefs.GetFloat("Debugger.Window.Width", DefaultWindowRect.width); - m_LastWindowHeight = PlayerPrefs.GetFloat("Debugger.Window.Height", DefaultWindowRect.height); + _lastIconX = PlayerPrefs.GetFloat("Debugger.Icon.X", DefaultIconRect.x); + _lastIconY = PlayerPrefs.GetFloat("Debugger.Icon.Y", DefaultIconRect.y); + _lastWindowX = PlayerPrefs.GetFloat("Debugger.Window.X", DefaultWindowRect.x); + _lastWindowY = PlayerPrefs.GetFloat("Debugger.Window.Y", DefaultWindowRect.y); + _lastWindowWidth = PlayerPrefs.GetFloat("Debugger.Window.Width", DefaultWindowRect.width); + _lastWindowHeight = PlayerPrefs.GetFloat("Debugger.Window.Height", DefaultWindowRect.height); - _debugger.WindowScale = m_LastWindowScale = PlayerPrefs.GetFloat("Debugger.Window.Scale", DefaultWindowScale); - _debugger.IconRect = new Rect(m_LastIconX, m_LastIconY, DefaultIconRect.width, DefaultIconRect.height); - _debugger.WindowRect = new Rect(m_LastWindowX, m_LastWindowY, m_LastWindowWidth, m_LastWindowHeight); + _debugger.WindowScale = _lastWindowScale = PlayerPrefs.GetFloat("Debugger.Window.Scale", DefaultWindowScale); + _debugger.IconRect = new Rect(_lastIconX, _lastIconY, DefaultIconRect.width, DefaultIconRect.height); + _debugger.WindowRect = new Rect(_lastWindowX, _lastWindowY, _lastWindowWidth, _lastWindowHeight); } public override void OnUpdate(float elapseSeconds, float realElapseSeconds) { - if (Math.Abs(m_LastIconX - _debugger.IconRect.x) > 0.01f) + if (Math.Abs(_lastIconX - _debugger.IconRect.x) > 0.01f) { - m_LastIconX = _debugger.IconRect.x; + _lastIconX = _debugger.IconRect.x; PlayerPrefs.SetFloat("Debugger.Icon.X", _debugger.IconRect.x); } - if (Math.Abs(m_LastIconY - _debugger.IconRect.y) > 0.01f) + if (Math.Abs(_lastIconY - _debugger.IconRect.y) > 0.01f) { - m_LastIconY = _debugger.IconRect.y; + _lastIconY = _debugger.IconRect.y; PlayerPrefs.SetFloat("Debugger.Icon.Y", _debugger.IconRect.y); } - if (Math.Abs(m_LastWindowX - _debugger.WindowRect.x) > 0.01f) + if (Math.Abs(_lastWindowX - _debugger.WindowRect.x) > 0.01f) { - m_LastWindowX = _debugger.WindowRect.x; + _lastWindowX = _debugger.WindowRect.x; PlayerPrefs.SetFloat("Debugger.Window.X", _debugger.WindowRect.x); } - if (Math.Abs(m_LastWindowY - _debugger.WindowRect.y) > 0.01f) + if (Math.Abs(_lastWindowY - _debugger.WindowRect.y) > 0.01f) { - m_LastWindowY = _debugger.WindowRect.y; + _lastWindowY = _debugger.WindowRect.y; PlayerPrefs.SetFloat("Debugger.Window.Y", _debugger.WindowRect.y); } - if (Math.Abs(m_LastWindowWidth - _debugger.WindowRect.width) > 0.01f) + if (Math.Abs(_lastWindowWidth - _debugger.WindowRect.width) > 0.01f) { - m_LastWindowWidth = _debugger.WindowRect.width; + _lastWindowWidth = _debugger.WindowRect.width; PlayerPrefs.SetFloat("Debugger.Window.Width", _debugger.WindowRect.width); } - if (Math.Abs(m_LastWindowHeight - _debugger.WindowRect.height) > 0.01f) + if (Math.Abs(_lastWindowHeight - _debugger.WindowRect.height) > 0.01f) { - m_LastWindowHeight = _debugger.WindowRect.height; + _lastWindowHeight = _debugger.WindowRect.height; PlayerPrefs.SetFloat("Debugger.Window.Height", _debugger.WindowRect.height); } - if (Math.Abs(m_LastWindowScale - _debugger.WindowScale) > 0.01f) + if (Math.Abs(_lastWindowScale - _debugger.WindowScale) > 0.01f) { - m_LastWindowScale = _debugger.WindowScale; + _lastWindowScale = _debugger.WindowScale; PlayerPrefs.SetFloat("Debugger.Window.Scale", _debugger.WindowScale); } } diff --git a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.TimeInformationWindow.cs b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.TimeInformationWindow.cs index bc7d0577..4dd9b3e5 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.TimeInformationWindow.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Component/DebuggerModule.TimeInformationWindow.cs @@ -1,4 +1,5 @@ -using UnityEngine; +using System.Globalization; +using UnityEngine; namespace TEngine { @@ -12,30 +13,30 @@ namespace TEngine GUILayout.BeginVertical("box"); { DrawItem("Time Scale", Utility.Text.Format("{0} [{1}]", Time.timeScale, GetTimeScaleDescription(Time.timeScale))); - DrawItem("Realtime Since Startup", Time.realtimeSinceStartup.ToString()); - DrawItem("Time Since Level Load", Time.timeSinceLevelLoad.ToString()); - DrawItem("Time", Time.time.ToString()); - DrawItem("Fixed Time", Time.fixedTime.ToString()); - DrawItem("Unscaled Time", Time.unscaledTime.ToString()); + DrawItem("Realtime Since Startup", Time.realtimeSinceStartup.ToString(CultureInfo.InvariantCulture)); + DrawItem("Time Since Level Load", Time.timeSinceLevelLoad.ToString(CultureInfo.InvariantCulture)); + DrawItem("Time", Time.time.ToString(CultureInfo.InvariantCulture)); + DrawItem("Fixed Time", Time.fixedTime.ToString(CultureInfo.InvariantCulture)); + DrawItem("Unscaled Time", Time.unscaledTime.ToString(CultureInfo.InvariantCulture)); #if UNITY_5_6_OR_NEWER - DrawItem("Fixed Unscaled Time", Time.fixedUnscaledTime.ToString()); + DrawItem("Fixed Unscaled Time", Time.fixedUnscaledTime.ToString(CultureInfo.InvariantCulture)); #endif - DrawItem("Delta Time", Time.deltaTime.ToString()); - DrawItem("Fixed Delta Time", Time.fixedDeltaTime.ToString()); - DrawItem("Unscaled Delta Time", Time.unscaledDeltaTime.ToString()); + DrawItem("Delta Time", Time.deltaTime.ToString(CultureInfo.InvariantCulture)); + DrawItem("Fixed Delta Time", Time.fixedDeltaTime.ToString(CultureInfo.InvariantCulture)); + DrawItem("Unscaled Delta Time", Time.unscaledDeltaTime.ToString(CultureInfo.InvariantCulture)); #if UNITY_5_6_OR_NEWER - DrawItem("Fixed Unscaled Delta Time", Time.fixedUnscaledDeltaTime.ToString()); + DrawItem("Fixed Unscaled Delta Time", Time.fixedUnscaledDeltaTime.ToString(CultureInfo.InvariantCulture)); #endif - DrawItem("Smooth Delta Time", Time.smoothDeltaTime.ToString()); - DrawItem("Maximum Delta Time", Time.maximumDeltaTime.ToString()); + DrawItem("Smooth Delta Time", Time.smoothDeltaTime.ToString(CultureInfo.InvariantCulture)); + DrawItem("Maximum Delta Time", Time.maximumDeltaTime.ToString(CultureInfo.InvariantCulture)); #if UNITY_5_5_OR_NEWER - DrawItem("Maximum Particle Delta Time", Time.maximumParticleDeltaTime.ToString()); + DrawItem("Maximum Particle Delta Time", Time.maximumParticleDeltaTime.ToString(CultureInfo.InvariantCulture)); #endif DrawItem("Frame Count", Time.frameCount.ToString()); DrawItem("Rendered Frame Count", Time.renderedFrameCount.ToString()); DrawItem("Capture Framerate", Time.captureFramerate.ToString()); #if UNITY_2019_2_OR_NEWER - DrawItem("Capture Delta Time", Time.captureDeltaTime.ToString()); + DrawItem("Capture Delta Time", Time.captureDeltaTime.ToString(CultureInfo.InvariantCulture)); #endif #if UNITY_5_6_OR_NEWER DrawItem("In Fixed Time Step", Time.inFixedTimeStep.ToString()); diff --git a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Debugger.cs b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Debugger.cs index 3f985fec..8587da58 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Debugger.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/Debugger.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using UnityEngine; +using UnityEngine.Serialization; using Object = UnityEngine.Object; namespace TEngine @@ -31,56 +32,55 @@ namespace TEngine private static TextEditor s_TextEditor = null; private IDebuggerModule _debuggerModule = null; - private Rect m_DragRect = new Rect(0f, 0f, float.MaxValue, 25f); - private Rect m_IconRect = DefaultIconRect; - private Rect m_WindowRect = DefaultWindowRect; - private float m_WindowScale = DefaultWindowScale; + private readonly Rect _dragRect = new Rect(0f, 0f, float.MaxValue, 25f); + private Rect _iconRect = DefaultIconRect; + private Rect _windowRect = DefaultWindowRect; + private float _windowScale = DefaultWindowScale; [SerializeField] - private GUISkin m_Skin = null; + private GUISkin skin = null; [SerializeField] - private DebuggerActiveWindowType m_ActiveWindow = DebuggerActiveWindowType.AlwaysOpen; + private DebuggerActiveWindowType activeWindow = DebuggerActiveWindowType.AlwaysOpen; - public DebuggerActiveWindowType ActiveWindowType => m_ActiveWindow; + public DebuggerActiveWindowType ActiveWindowType => activeWindow; [SerializeField] - private bool m_ShowFullWindow = false; + private bool _showFullWindow = false; [SerializeField] - private ConsoleWindow m_ConsoleWindow = new ConsoleWindow(); + private ConsoleWindow _consoleWindow = new ConsoleWindow(); - private SystemInformationWindow m_SystemInformationWindow = new SystemInformationWindow(); - private EnvironmentInformationWindow m_EnvironmentInformationWindow = new EnvironmentInformationWindow(); - private ScreenInformationWindow m_ScreenInformationWindow = new ScreenInformationWindow(); - private GraphicsInformationWindow m_GraphicsInformationWindow = new GraphicsInformationWindow(); - private InputSummaryInformationWindow m_InputSummaryInformationWindow = new InputSummaryInformationWindow(); - private InputTouchInformationWindow m_InputTouchInformationWindow = new InputTouchInformationWindow(); - private InputLocationInformationWindow m_InputLocationInformationWindow = new InputLocationInformationWindow(); - private InputAccelerationInformationWindow m_InputAccelerationInformationWindow = new InputAccelerationInformationWindow(); - private InputGyroscopeInformationWindow m_InputGyroscopeInformationWindow = new InputGyroscopeInformationWindow(); - private InputCompassInformationWindow m_InputCompassInformationWindow = new InputCompassInformationWindow(); - private PathInformationWindow m_PathInformationWindow = new PathInformationWindow(); - private SceneInformationWindow m_SceneInformationWindow = new SceneInformationWindow(); - private TimeInformationWindow m_TimeInformationWindow = new TimeInformationWindow(); - private QualityInformationWindow m_QualityInformationWindow = new QualityInformationWindow(); - private ProfilerInformationWindow m_ProfilerInformationWindow = new ProfilerInformationWindow(); - private RuntimeMemorySummaryWindow m_RuntimeMemorySummaryWindow = new RuntimeMemorySummaryWindow(); - private RuntimeMemoryInformationWindow m_RuntimeMemoryAllInformationWindow = new RuntimeMemoryInformationWindow(); - private RuntimeMemoryInformationWindow m_RuntimeMemoryTextureInformationWindow = new RuntimeMemoryInformationWindow(); - private RuntimeMemoryInformationWindow m_RuntimeMemoryMeshInformationWindow = new RuntimeMemoryInformationWindow(); - private RuntimeMemoryInformationWindow m_RuntimeMemoryMaterialInformationWindow = new RuntimeMemoryInformationWindow(); - private RuntimeMemoryInformationWindow m_RuntimeMemoryShaderInformationWindow = new RuntimeMemoryInformationWindow(); - private RuntimeMemoryInformationWindow m_RuntimeMemoryAnimationClipInformationWindow = new RuntimeMemoryInformationWindow(); - private RuntimeMemoryInformationWindow m_RuntimeMemoryAudioClipInformationWindow = new RuntimeMemoryInformationWindow(); - private RuntimeMemoryInformationWindow m_RuntimeMemoryFontInformationWindow = new RuntimeMemoryInformationWindow(); - private RuntimeMemoryInformationWindow m_RuntimeMemoryTextAssetInformationWindow = new RuntimeMemoryInformationWindow(); - private RuntimeMemoryInformationWindow m_RuntimeMemoryScriptableObjectInformationWindow = new RuntimeMemoryInformationWindow(); - private MemoryPoolPoolInformationWindow _mMemoryPoolPoolInformationWindow = new MemoryPoolPoolInformationWindow(); - // private NetworkInformationWindow m_NetworkInformationWindow = new NetworkInformationWindow(); - private SettingsWindow m_SettingsWindow = new SettingsWindow(); + private SystemInformationWindow _systemInformationWindow = new SystemInformationWindow(); + private EnvironmentInformationWindow _environmentInformationWindow = new EnvironmentInformationWindow(); + private ScreenInformationWindow _screenInformationWindow = new ScreenInformationWindow(); + private GraphicsInformationWindow _graphicsInformationWindow = new GraphicsInformationWindow(); + private InputSummaryInformationWindow _inputSummaryInformationWindow = new InputSummaryInformationWindow(); + private InputTouchInformationWindow _inputTouchInformationWindow = new InputTouchInformationWindow(); + private InputLocationInformationWindow _inputLocationInformationWindow = new InputLocationInformationWindow(); + private InputAccelerationInformationWindow _inputAccelerationInformationWindow = new InputAccelerationInformationWindow(); + private InputGyroscopeInformationWindow _inputGyroscopeInformationWindow = new InputGyroscopeInformationWindow(); + private InputCompassInformationWindow _inputCompassInformationWindow = new InputCompassInformationWindow(); + private PathInformationWindow _pathInformationWindow = new PathInformationWindow(); + private SceneInformationWindow _sceneInformationWindow = new SceneInformationWindow(); + private TimeInformationWindow _timeInformationWindow = new TimeInformationWindow(); + private QualityInformationWindow _qualityInformationWindow = new QualityInformationWindow(); + private ProfilerInformationWindow _profilerInformationWindow = new ProfilerInformationWindow(); + private RuntimeMemorySummaryWindow _runtimeMemorySummaryWindow = new RuntimeMemorySummaryWindow(); + private RuntimeMemoryInformationWindow _runtimeMemoryAllInformationWindow = new RuntimeMemoryInformationWindow(); + private RuntimeMemoryInformationWindow _runtimeMemoryTextureInformationWindow = new RuntimeMemoryInformationWindow(); + private RuntimeMemoryInformationWindow _runtimeMemoryMeshInformationWindow = new RuntimeMemoryInformationWindow(); + private RuntimeMemoryInformationWindow _runtimeMemoryMaterialInformationWindow = new RuntimeMemoryInformationWindow(); + private RuntimeMemoryInformationWindow _runtimeMemoryShaderInformationWindow = new RuntimeMemoryInformationWindow(); + private RuntimeMemoryInformationWindow _runtimeMemoryAnimationClipInformationWindow = new RuntimeMemoryInformationWindow(); + private RuntimeMemoryInformationWindow _runtimeMemoryAudioClipInformationWindow = new RuntimeMemoryInformationWindow(); + private RuntimeMemoryInformationWindow _runtimeMemoryFontInformationWindow = new RuntimeMemoryInformationWindow(); + private RuntimeMemoryInformationWindow _runtimeMemoryTextAssetInformationWindow = new RuntimeMemoryInformationWindow(); + private RuntimeMemoryInformationWindow _runtimeMemoryScriptableObjectInformationWindow = new RuntimeMemoryInformationWindow(); + private MemoryPoolPoolInformationWindow _memoryPoolPoolInformationWindow = new MemoryPoolPoolInformationWindow(); + private SettingsWindow _settingsWindow = new SettingsWindow(); - private FpsCounter m_FpsCounter = null; + private FpsCounter _fpsCounter = null; /// /// 获取或设置调试器窗口是否激活。 @@ -100,14 +100,14 @@ namespace TEngine /// public bool ShowFullWindow { - get => m_ShowFullWindow; + get => _showFullWindow; set { if (_eventSystem != null) { _eventSystem.SetActive(!value); } - m_ShowFullWindow = value; + _showFullWindow = value; } } @@ -116,8 +116,8 @@ namespace TEngine /// public Rect IconRect { - get => m_IconRect; - set => m_IconRect = value; + get => _iconRect; + set => _iconRect = value; } /// @@ -125,8 +125,8 @@ namespace TEngine /// public Rect WindowRect { - get => m_WindowRect; - set => m_WindowRect = value; + get => _windowRect; + set => _windowRect = value; } /// @@ -134,8 +134,8 @@ namespace TEngine /// public float WindowScale { - get => m_WindowScale; - set => m_WindowScale = value; + get => _windowScale; + set => _windowScale = value; } private GameObject _eventSystem; @@ -164,7 +164,7 @@ namespace TEngine return; } - m_FpsCounter = new FpsCounter(0.5f); + _fpsCounter = new FpsCounter(0.5f); var lastIconX = PlayerPrefs.GetFloat("Debugger.Icon.X", DefaultIconRect.x); var lastIconY = PlayerPrefs.GetFloat("Debugger.Icon.Y", DefaultIconRect.y); @@ -172,46 +172,45 @@ namespace TEngine var lastWindowY = PlayerPrefs.GetFloat("Debugger.Window.Y", DefaultWindowRect.y); var lastWindowWidth = PlayerPrefs.GetFloat("Debugger.Window.Width", DefaultWindowRect.width); var lastWindowHeight = PlayerPrefs.GetFloat("Debugger.Window.Height", DefaultWindowRect.height); - m_WindowScale = PlayerPrefs.GetFloat("Debugger.Window.Scale", DefaultWindowScale); - m_WindowRect = new Rect(lastIconX, lastIconY, DefaultIconRect.width, DefaultIconRect.height); - m_WindowRect = new Rect(lastWindowX, lastWindowY, lastWindowWidth, lastWindowHeight); + _windowScale = PlayerPrefs.GetFloat("Debugger.Window.Scale", DefaultWindowScale); + _windowRect = new Rect(lastIconX, lastIconY, DefaultIconRect.width, DefaultIconRect.height); + _windowRect = new Rect(lastWindowX, lastWindowY, lastWindowWidth, lastWindowHeight); } private void Start() { Initialize(); - RegisterDebuggerWindow("Console", m_ConsoleWindow); - RegisterDebuggerWindow("Information/System", m_SystemInformationWindow); - RegisterDebuggerWindow("Information/Environment", m_EnvironmentInformationWindow); - RegisterDebuggerWindow("Information/Screen", m_ScreenInformationWindow); - RegisterDebuggerWindow("Information/Graphics", m_GraphicsInformationWindow); - RegisterDebuggerWindow("Information/Input/Summary", m_InputSummaryInformationWindow); - RegisterDebuggerWindow("Information/Input/Touch", m_InputTouchInformationWindow); - RegisterDebuggerWindow("Information/Input/Location", m_InputLocationInformationWindow); - RegisterDebuggerWindow("Information/Input/Acceleration", m_InputAccelerationInformationWindow); - RegisterDebuggerWindow("Information/Input/Gyroscope", m_InputGyroscopeInformationWindow); - RegisterDebuggerWindow("Information/Input/Compass", m_InputCompassInformationWindow); - RegisterDebuggerWindow("Information/Other/Scene", m_SceneInformationWindow); - RegisterDebuggerWindow("Information/Other/Path", m_PathInformationWindow); - RegisterDebuggerWindow("Information/Other/Time", m_TimeInformationWindow); - RegisterDebuggerWindow("Information/Other/Quality", m_QualityInformationWindow); - RegisterDebuggerWindow("Profiler/Summary", m_ProfilerInformationWindow); - RegisterDebuggerWindow("Profiler/Memory/Summary", m_RuntimeMemorySummaryWindow); - RegisterDebuggerWindow("Profiler/Memory/All", m_RuntimeMemoryAllInformationWindow); - RegisterDebuggerWindow("Profiler/Memory/Texture", m_RuntimeMemoryTextureInformationWindow); - RegisterDebuggerWindow("Profiler/Memory/Mesh", m_RuntimeMemoryMeshInformationWindow); - RegisterDebuggerWindow("Profiler/Memory/Material", m_RuntimeMemoryMaterialInformationWindow); - RegisterDebuggerWindow("Profiler/Memory/Shader", m_RuntimeMemoryShaderInformationWindow); - RegisterDebuggerWindow("Profiler/Memory/AnimationClip", m_RuntimeMemoryAnimationClipInformationWindow); - RegisterDebuggerWindow("Profiler/Memory/AudioClip", m_RuntimeMemoryAudioClipInformationWindow); - RegisterDebuggerWindow("Profiler/Memory/Font", m_RuntimeMemoryFontInformationWindow); - RegisterDebuggerWindow("Profiler/Memory/TextAsset", m_RuntimeMemoryTextAssetInformationWindow); - RegisterDebuggerWindow("Profiler/Memory/ScriptableObject", m_RuntimeMemoryScriptableObjectInformationWindow); - RegisterDebuggerWindow("Profiler/Reference Pool", _mMemoryPoolPoolInformationWindow); - // RegisterDebuggerWindow("Profiler/Network", m_NetworkInformationWindow); - RegisterDebuggerWindow("Other/Settings", m_SettingsWindow); + RegisterDebuggerWindow("Console", _consoleWindow); + RegisterDebuggerWindow("Information/System", _systemInformationWindow); + RegisterDebuggerWindow("Information/Environment", _environmentInformationWindow); + RegisterDebuggerWindow("Information/Screen", _screenInformationWindow); + RegisterDebuggerWindow("Information/Graphics", _graphicsInformationWindow); + RegisterDebuggerWindow("Information/Input/Summary", _inputSummaryInformationWindow); + RegisterDebuggerWindow("Information/Input/Touch", _inputTouchInformationWindow); + RegisterDebuggerWindow("Information/Input/Location", _inputLocationInformationWindow); + RegisterDebuggerWindow("Information/Input/Acceleration", _inputAccelerationInformationWindow); + RegisterDebuggerWindow("Information/Input/Gyroscope", _inputGyroscopeInformationWindow); + RegisterDebuggerWindow("Information/Input/Compass", _inputCompassInformationWindow); + RegisterDebuggerWindow("Information/Other/Scene", _sceneInformationWindow); + RegisterDebuggerWindow("Information/Other/Path", _pathInformationWindow); + RegisterDebuggerWindow("Information/Other/Time", _timeInformationWindow); + RegisterDebuggerWindow("Information/Other/Quality", _qualityInformationWindow); + RegisterDebuggerWindow("Profiler/Summary", _profilerInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/Summary", _runtimeMemorySummaryWindow); + RegisterDebuggerWindow("Profiler/Memory/All", _runtimeMemoryAllInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/Texture", _runtimeMemoryTextureInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/Mesh", _runtimeMemoryMeshInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/Material", _runtimeMemoryMaterialInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/Shader", _runtimeMemoryShaderInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/AnimationClip", _runtimeMemoryAnimationClipInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/AudioClip", _runtimeMemoryAudioClipInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/Font", _runtimeMemoryFontInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/TextAsset", _runtimeMemoryTextAssetInformationWindow); + RegisterDebuggerWindow("Profiler/Memory/ScriptableObject", _runtimeMemoryScriptableObjectInformationWindow); + RegisterDebuggerWindow("Profiler/Reference Pool", _memoryPoolPoolInformationWindow); + RegisterDebuggerWindow("Other/Settings", _settingsWindow); - switch (m_ActiveWindow) + switch (activeWindow) { case DebuggerActiveWindowType.AlwaysOpen: ActiveWindow = true; @@ -233,7 +232,7 @@ namespace TEngine private void Update() { - m_FpsCounter.Update(Time.deltaTime, Time.unscaledDeltaTime); + _fpsCounter.Update(Time.deltaTime, Time.unscaledDeltaTime); } private void OnGUI() @@ -246,16 +245,16 @@ namespace TEngine GUISkin cachedGuiSkin = GUI.skin; Matrix4x4 cachedMatrix = GUI.matrix; - GUI.skin = m_Skin; - GUI.matrix = Matrix4x4.Scale(new Vector3(m_WindowScale, m_WindowScale, 1f)); + GUI.skin = skin; + GUI.matrix = Matrix4x4.Scale(new Vector3(_windowScale, _windowScale, 1f)); - if (m_ShowFullWindow) + if (_showFullWindow) { - m_WindowRect = GUILayout.Window(0, m_WindowRect, DrawWindow, "DEBUGGER"); + _windowRect = GUILayout.Window(0, _windowRect, DrawWindow, "DEBUGGER"); } else { - m_IconRect = GUILayout.Window(0, m_IconRect, DrawDebuggerWindowIcon, "DEBUGGER"); + _iconRect = GUILayout.Window(0, _iconRect, DrawDebuggerWindowIcon, "DEBUGGER"); } GUI.matrix = cachedMatrix; @@ -319,7 +318,7 @@ namespace TEngine /// 要获取的日志。 public void GetRecentLogs(List results) { - m_ConsoleWindow.GetRecentLogs(results); + _consoleWindow.GetRecentLogs(results); } /// @@ -329,12 +328,12 @@ namespace TEngine /// 要获取最近日志的数量。 public void GetRecentLogs(List results, int count) { - m_ConsoleWindow.GetRecentLogs(results, count); + _consoleWindow.GetRecentLogs(results, count); } private void DrawWindow(int windowId) { - GUI.DragWindow(m_DragRect); + GUI.DragWindow(_dragRect); DrawDebuggerWindowGroup(_debuggerModule.DebuggerWindowRoot); } @@ -387,28 +386,28 @@ namespace TEngine private void DrawDebuggerWindowIcon(int windowId) { - GUI.DragWindow(m_DragRect); + GUI.DragWindow(_dragRect); GUILayout.Space(5); Color32 color = Color.white; - m_ConsoleWindow.RefreshCount(); - if (m_ConsoleWindow.FatalCount > 0) + _consoleWindow.RefreshCount(); + if (_consoleWindow.FatalCount > 0) { - color = m_ConsoleWindow.GetLogStringColor(LogType.Exception); + color = _consoleWindow.GetLogStringColor(LogType.Exception); } - else if (m_ConsoleWindow.ErrorCount > 0) + else if (_consoleWindow.ErrorCount > 0) { - color = m_ConsoleWindow.GetLogStringColor(LogType.Error); + color = _consoleWindow.GetLogStringColor(LogType.Error); } - else if (m_ConsoleWindow.WarningCount > 0) + else if (_consoleWindow.WarningCount > 0) { - color = m_ConsoleWindow.GetLogStringColor(LogType.Warning); + color = _consoleWindow.GetLogStringColor(LogType.Warning); } else { - color = m_ConsoleWindow.GetLogStringColor(LogType.Log); + color = _consoleWindow.GetLogStringColor(LogType.Log); } - string title = Utility.Text.Format("FPS: {4:F2}", color.r, color.g, color.b, color.a, m_FpsCounter.CurrentFps); + string title = Utility.Text.Format("FPS: {4:F2}", color.r, color.g, color.b, color.a, _fpsCounter.CurrentFps); if (GUILayout.Button(title, GUILayout.Width(100f), GUILayout.Height(40f))) { ShowFullWindow = true; diff --git a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/DebuggerComponent.ConsoleWindow.cs b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/DebuggerComponent.ConsoleWindow.cs index 702f5759..73f791f3 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/DebuggerComponent.ConsoleWindow.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/DebuggerComponent.ConsoleWindow.cs @@ -25,69 +25,69 @@ namespace TEngine private bool _lastFatalFilter = true; [SerializeField] - private bool m_LockScroll = true; + private bool lockScroll = true; [SerializeField] - private int m_MaxLine = 100; + private int maxLine = 100; [SerializeField] - private bool m_InfoFilter = true; + private bool infoFilter = true; [SerializeField] - private bool m_WarningFilter = true; + private bool warningFilter = true; [SerializeField] - private bool m_ErrorFilter = true; + private bool errorFilter = true; [SerializeField] - private bool m_FatalFilter = true; + private bool fatalFilter = true; [SerializeField] - private Color32 m_InfoColor = Color.white; + private Color32 infoColor = Color.white; [SerializeField] - private Color32 m_WarningColor = Color.yellow; + private Color32 warningColor = Color.yellow; [SerializeField] - private Color32 m_ErrorColor = Color.red; + private Color32 errorColor = Color.red; [SerializeField] - private Color32 m_FatalColor = new Color(0.7f, 0.2f, 0.2f); + private Color32 fatalColor = new Color(0.7f, 0.2f, 0.2f); public bool LockScroll { - get => m_LockScroll; - set => m_LockScroll = value; + get => lockScroll; + set => lockScroll = value; } public int MaxLine { - get => m_MaxLine; - set => m_MaxLine = value; + get => maxLine; + set => maxLine = value; } public bool InfoFilter { - get => m_InfoFilter; - set => m_InfoFilter = value; + get => infoFilter; + set => infoFilter = value; } public bool WarningFilter { - get => m_WarningFilter; - set => m_WarningFilter = value; + get => warningFilter; + set => warningFilter = value; } public bool ErrorFilter { - get => m_ErrorFilter; - set => m_ErrorFilter = value; + get => errorFilter; + set => errorFilter = value; } public bool FatalFilter { - get => m_FatalFilter; - set => m_FatalFilter = value; + get => fatalFilter; + set => fatalFilter = value; } public int InfoCount => _infoCount; @@ -100,36 +100,36 @@ namespace TEngine public Color32 InfoColor { - get => m_InfoColor; - set => m_InfoColor = value; + get => infoColor; + set => infoColor = value; } public Color32 WarningColor { - get => m_WarningColor; - set => m_WarningColor = value; + get => warningColor; + set => warningColor = value; } public Color32 ErrorColor { - get => m_ErrorColor; - set => m_ErrorColor = value; + get => errorColor; + set => errorColor = value; } public Color32 FatalColor { - get => m_FatalColor; - set => m_FatalColor = value; + get => fatalColor; + set => fatalColor = value; } public void Initialize(params object[] args) { Application.logMessageReceived += OnLogMessageReceived; - m_LockScroll = _lastLockScroll = PlayerPrefs.GetInt("Debugger.Console.LockScroll", 1) == 1; - m_InfoFilter = _lastInfoFilter = PlayerPrefs.GetInt("Debugger.Console.InfoFilter", 1) == 1; - m_WarningFilter = _lastWarningFilter = PlayerPrefs.GetInt("Debugger.Console.WarningFilter", 1) == 1; - m_ErrorFilter = _lastErrorFilter = PlayerPrefs.GetInt("Debugger.Console.ErrorFilter", 1) == 1; - m_FatalFilter = _lastFatalFilter = PlayerPrefs.GetInt("Debugger.Console.FatalFilter", 1) == 1; + lockScroll = _lastLockScroll = PlayerPrefs.GetInt("Debugger.Console.LockScroll", 1) == 1; + infoFilter = _lastInfoFilter = PlayerPrefs.GetInt("Debugger.Console.InfoFilter", 1) == 1; + warningFilter = _lastWarningFilter = PlayerPrefs.GetInt("Debugger.Console.WarningFilter", 1) == 1; + errorFilter = _lastErrorFilter = PlayerPrefs.GetInt("Debugger.Console.ErrorFilter", 1) == 1; + fatalFilter = _lastFatalFilter = PlayerPrefs.GetInt("Debugger.Console.FatalFilter", 1) == 1; } public void Shutdown() @@ -148,34 +148,34 @@ namespace TEngine public void OnUpdate(float elapseSeconds, float realElapseSeconds) { - if (_lastLockScroll != m_LockScroll) + if (_lastLockScroll != lockScroll) { - _lastLockScroll = m_LockScroll; - PlayerPrefs.SetInt("Debugger.Console.LockScroll", m_LockScroll ? 1 : 0); + _lastLockScroll = lockScroll; + PlayerPrefs.SetInt("Debugger.Console.LockScroll", lockScroll ? 1 : 0); } - if (_lastInfoFilter != m_InfoFilter) + if (_lastInfoFilter != infoFilter) { - _lastInfoFilter = m_InfoFilter; - PlayerPrefs.SetInt("Debugger.Console.InfoFilter", m_InfoFilter ? 1 : 0); + _lastInfoFilter = infoFilter; + PlayerPrefs.SetInt("Debugger.Console.InfoFilter", infoFilter ? 1 : 0); } - if (_lastWarningFilter != m_WarningFilter) + if (_lastWarningFilter != warningFilter) { - _lastWarningFilter = m_WarningFilter; - PlayerPrefs.SetInt("Debugger.Console.WarningFilter", m_WarningFilter ? 1 : 0); + _lastWarningFilter = warningFilter; + PlayerPrefs.SetInt("Debugger.Console.WarningFilter", warningFilter ? 1 : 0); } - if (_lastErrorFilter != m_ErrorFilter) + if (_lastErrorFilter != errorFilter) { - _lastErrorFilter = m_ErrorFilter; - PlayerPrefs.SetInt("Debugger.Console.ErrorFilter", m_ErrorFilter ? 1 : 0); + _lastErrorFilter = errorFilter; + PlayerPrefs.SetInt("Debugger.Console.ErrorFilter", errorFilter ? 1 : 0); } - if (_lastFatalFilter != m_FatalFilter) + if (_lastFatalFilter != fatalFilter) { - _lastFatalFilter = m_FatalFilter; - PlayerPrefs.SetInt("Debugger.Console.FatalFilter", m_FatalFilter ? 1 : 0); + _lastFatalFilter = fatalFilter; + PlayerPrefs.SetInt("Debugger.Console.FatalFilter", fatalFilter ? 1 : 0); } } @@ -189,18 +189,18 @@ namespace TEngine { Clear(); } - m_LockScroll = GUILayout.Toggle(m_LockScroll, "Lock Scroll", GUILayout.Width(90f)); + lockScroll = GUILayout.Toggle(lockScroll, "Lock Scroll", GUILayout.Width(90f)); GUILayout.FlexibleSpace(); - m_InfoFilter = GUILayout.Toggle(m_InfoFilter, Utility.Text.Format("Info ({0})", _infoCount), GUILayout.Width(90f)); - m_WarningFilter = GUILayout.Toggle(m_WarningFilter, Utility.Text.Format("Warning ({0})", _warningCount), GUILayout.Width(90f)); - m_ErrorFilter = GUILayout.Toggle(m_ErrorFilter, Utility.Text.Format("Error ({0})", _errorCount), GUILayout.Width(90f)); - m_FatalFilter = GUILayout.Toggle(m_FatalFilter, Utility.Text.Format("Fatal ({0})", _fatalCount), GUILayout.Width(90f)); + infoFilter = GUILayout.Toggle(infoFilter, Utility.Text.Format("Info ({0})", _infoCount), GUILayout.Width(90f)); + warningFilter = GUILayout.Toggle(warningFilter, Utility.Text.Format("Warning ({0})", _warningCount), GUILayout.Width(90f)); + errorFilter = GUILayout.Toggle(errorFilter, Utility.Text.Format("Error ({0})", _errorCount), GUILayout.Width(90f)); + fatalFilter = GUILayout.Toggle(fatalFilter, Utility.Text.Format("Fatal ({0})", _fatalCount), GUILayout.Width(90f)); } GUILayout.EndHorizontal(); GUILayout.BeginVertical("box"); { - if (m_LockScroll) + if (lockScroll) { _logScrollPosition.y = float.MaxValue; } @@ -213,28 +213,28 @@ namespace TEngine switch (logNode.LogType) { case LogType.Log: - if (!m_InfoFilter) + if (!infoFilter) { continue; } break; case LogType.Warning: - if (!m_WarningFilter) + if (!warningFilter) { continue; } break; case LogType.Error: - if (!m_ErrorFilter) + if (!errorFilter) { continue; } break; case LogType.Exception: - if (!m_FatalFilter) + if (!fatalFilter) { continue; } @@ -367,7 +367,7 @@ namespace TEngine } _logNodes.Enqueue(LogNode.Create(logType, logMessage, stackTrace)); - while (_logNodes.Count > m_MaxLine) + while (_logNodes.Count > maxLine) { MemoryPool.Release(_logNodes.Dequeue()); } @@ -385,19 +385,19 @@ namespace TEngine switch (logType) { case LogType.Log: - color = m_InfoColor; + color = infoColor; break; case LogType.Warning: - color = m_WarningColor; + color = warningColor; break; case LogType.Error: - color = m_ErrorColor; + color = errorColor; break; case LogType.Exception: - color = m_FatalColor; + color = fatalColor; break; } diff --git a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/DebuggerManager.DebuggerWindowGroup.cs b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/DebuggerManager.DebuggerWindowGroup.cs index bb7fa0db..6aa2441d 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/DebuggerManager.DebuggerWindowGroup.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/DebugerModule/DebuggerManager.DebuggerWindowGroup.cs @@ -9,16 +9,9 @@ namespace TEngine /// private sealed class DebuggerWindowGroup : IDebuggerWindowGroup { - private readonly List> _debuggerWindows; - private int _selectedIndex; - private string[] _debuggerWindowNames; - - public DebuggerWindowGroup() - { - _debuggerWindows = new List>(); - _selectedIndex = 0; - _debuggerWindowNames = null; - } + private readonly List> _debuggerWindows = new(); + private int _selectedIndex = 0; + private string[] _debuggerWindowNames = null; /// /// 获取调试器窗口数量。 diff --git a/UnityProject/Assets/TEngine/Runtime/Module/ObjectPoolModule/ObjectInfo.cs b/UnityProject/Assets/TEngine/Runtime/Module/ObjectPoolModule/ObjectInfo.cs index 1414eea6..a0beeb8c 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/ObjectPoolModule/ObjectInfo.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/ObjectPoolModule/ObjectInfo.cs @@ -9,12 +9,12 @@ namespace TEngine [StructLayout(LayoutKind.Auto)] public struct ObjectInfo { - private readonly string m_Name; - private readonly bool m_Locked; - private readonly bool m_CustomCanReleaseFlag; - private readonly int m_Priority; - private readonly DateTime m_LastUseTime; - private readonly int m_SpawnCount; + private readonly string _name; + private readonly bool _locked; + private readonly bool _customCanReleaseFlag; + private readonly int _priority; + private readonly DateTime _lastUseTime; + private readonly int _spawnCount; /// /// 初始化对象信息的新实例。 @@ -27,47 +27,47 @@ namespace TEngine /// 对象的获取计数。 public ObjectInfo(string name, bool locked, bool customCanReleaseFlag, int priority, DateTime lastUseTime, int spawnCount) { - m_Name = name; - m_Locked = locked; - m_CustomCanReleaseFlag = customCanReleaseFlag; - m_Priority = priority; - m_LastUseTime = lastUseTime; - m_SpawnCount = spawnCount; + _name = name; + _locked = locked; + _customCanReleaseFlag = customCanReleaseFlag; + _priority = priority; + _lastUseTime = lastUseTime; + _spawnCount = spawnCount; } /// /// 获取对象名称。 /// - public string Name => m_Name; + public string Name => _name; /// /// 获取对象是否被加锁。 /// - public bool Locked => m_Locked; + public bool Locked => _locked; /// /// 获取对象自定义释放检查标记。 /// - public bool CustomCanReleaseFlag => m_CustomCanReleaseFlag; + public bool CustomCanReleaseFlag => _customCanReleaseFlag; /// /// 获取对象的优先级。 /// - public int Priority => m_Priority; + public int Priority => _priority; /// /// 获取对象上次使用时间。 /// - public DateTime LastUseTime => m_LastUseTime; + public DateTime LastUseTime => _lastUseTime; /// /// 获取对象是否正在使用。 /// - public bool IsInUse => m_SpawnCount > 0; + public bool IsInUse => _spawnCount > 0; /// /// 获取对象的获取计数。 /// - public int SpawnCount => m_SpawnCount; + public int SpawnCount => _spawnCount; } } \ No newline at end of file diff --git a/UnityProject/Assets/TEngine/Runtime/Module/ObjectPoolModule/ObjectPoolBase.cs b/UnityProject/Assets/TEngine/Runtime/Module/ObjectPoolModule/ObjectPoolBase.cs index 73a7b965..84a90207 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/ObjectPoolModule/ObjectPoolBase.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/ObjectPoolModule/ObjectPoolBase.cs @@ -7,7 +7,7 @@ namespace TEngine /// public abstract class ObjectPoolBase { - private readonly string m_Name; + private readonly string _name; /// /// 初始化对象池基类的新实例。 @@ -23,18 +23,18 @@ namespace TEngine /// 对象池名称。 public ObjectPoolBase(string name) { - m_Name = name ?? string.Empty; + _name = name ?? string.Empty; } /// /// 获取对象池名称。 /// - public string Name => m_Name; + public string Name => _name; /// /// 获取对象池完整名称。 /// - public string FullName => new TypeNamePair(ObjectType, m_Name).ToString(); + public string FullName => new TypeNamePair(ObjectType, _name).ToString(); /// /// 获取对象池对象类型。 diff --git a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/BuildinFileManifest.cs b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/BuildinFileManifest.cs deleted file mode 100644 index 5f66197f..00000000 --- a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/BuildinFileManifest.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -/// -/// 内置资源清单 -/// -public class BuildinFileManifest : ScriptableObject -{ - [Serializable] - public class Element - { - public string PackageName; - public string FileName; - public string FileCRC32; - } - - public List BuildinFiles = new List(); -} \ No newline at end of file diff --git a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/BuildinFileManifest.cs.meta b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/BuildinFileManifest.cs.meta deleted file mode 100644 index 5553246a..00000000 --- a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/BuildinFileManifest.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: cc7dcf335fa34c189b66b9b8446f12e9 -timeCreated: 1705979503 \ No newline at end of file diff --git a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Callback/LoadAssetCallbacks.cs b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Callback/LoadAssetCallbacks.cs index 5f017978..42787b23 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Callback/LoadAssetCallbacks.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Callback/LoadAssetCallbacks.cs @@ -5,9 +5,9 @@ namespace TEngine /// public sealed class LoadAssetCallbacks { - private readonly LoadAssetSuccessCallback m_LoadAssetSuccessCallback; - private readonly LoadAssetFailureCallback m_LoadAssetFailureCallback; - private readonly LoadAssetUpdateCallback m_LoadAssetUpdateCallback; + private readonly LoadAssetSuccessCallback _loadAssetSuccessCallback; + private readonly LoadAssetFailureCallback _loadAssetFailureCallback; + private readonly LoadAssetUpdateCallback _loadAssetUpdateCallback; /// /// 初始化加载资源回调函数集的新实例。 @@ -51,9 +51,9 @@ namespace TEngine throw new GameFrameworkException("Load asset success callback is invalid."); } - m_LoadAssetSuccessCallback = loadAssetSuccessCallback; - m_LoadAssetFailureCallback = loadAssetFailureCallback; - m_LoadAssetUpdateCallback = loadAssetUpdateCallback; + _loadAssetSuccessCallback = loadAssetSuccessCallback; + _loadAssetFailureCallback = loadAssetFailureCallback; + _loadAssetUpdateCallback = loadAssetUpdateCallback; } /// @@ -63,7 +63,7 @@ namespace TEngine { get { - return m_LoadAssetSuccessCallback; + return _loadAssetSuccessCallback; } } @@ -74,7 +74,7 @@ namespace TEngine { get { - return m_LoadAssetFailureCallback; + return _loadAssetFailureCallback; } } @@ -85,7 +85,7 @@ namespace TEngine { get { - return m_LoadAssetUpdateCallback; + return _loadAssetUpdateCallback; } } } diff --git a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Callback/LoadSceneCallbacks.cs b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Callback/LoadSceneCallbacks.cs index a0168bdb..a9f705aa 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Callback/LoadSceneCallbacks.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Callback/LoadSceneCallbacks.cs @@ -5,9 +5,9 @@ /// public sealed class LoadSceneCallbacks { - private readonly LoadSceneSuccessCallback m_LoadSceneSuccessCallback; - private readonly LoadSceneFailureCallback m_LoadSceneFailureCallback; - private readonly LoadSceneUpdateCallback m_LoadSceneUpdateCallback; + private readonly LoadSceneSuccessCallback _loadSceneSuccessCallback; + private readonly LoadSceneFailureCallback _loadSceneFailureCallback; + private readonly LoadSceneUpdateCallback _loadSceneUpdateCallback; /// /// 初始化加载场景回调函数集的新实例。 @@ -51,9 +51,9 @@ throw new GameFrameworkException("Load scene success callback is invalid."); } - m_LoadSceneSuccessCallback = loadSceneSuccessCallback; - m_LoadSceneFailureCallback = loadSceneFailureCallback; - m_LoadSceneUpdateCallback = loadSceneUpdateCallback; + _loadSceneSuccessCallback = loadSceneSuccessCallback; + _loadSceneFailureCallback = loadSceneFailureCallback; + _loadSceneUpdateCallback = loadSceneUpdateCallback; } /// @@ -63,7 +63,7 @@ { get { - return m_LoadSceneSuccessCallback; + return _loadSceneSuccessCallback; } } @@ -74,7 +74,7 @@ { get { - return m_LoadSceneFailureCallback; + return _loadSceneFailureCallback; } } @@ -85,7 +85,7 @@ { get { - return m_LoadSceneUpdateCallback; + return _loadSceneUpdateCallback; } } } diff --git a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Callback/UnloadSceneCallbacks.cs b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Callback/UnloadSceneCallbacks.cs index 1f581e29..c8c3df08 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Callback/UnloadSceneCallbacks.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Callback/UnloadSceneCallbacks.cs @@ -5,8 +5,8 @@ /// public sealed class UnloadSceneCallbacks { - private readonly UnloadSceneSuccessCallback m_UnloadSceneSuccessCallback; - private readonly UnloadSceneFailureCallback m_UnloadSceneFailureCallback; + private readonly UnloadSceneSuccessCallback _unloadSceneSuccessCallback; + private readonly UnloadSceneFailureCallback _unloadSceneFailureCallback; /// /// 初始化卸载场景回调函数集的新实例。 @@ -29,8 +29,8 @@ throw new GameFrameworkException("Unload scene success callback is invalid."); } - m_UnloadSceneSuccessCallback = unloadSceneSuccessCallback; - m_UnloadSceneFailureCallback = unloadSceneFailureCallback; + _unloadSceneSuccessCallback = unloadSceneSuccessCallback; + _unloadSceneFailureCallback = unloadSceneFailureCallback; } /// @@ -40,7 +40,7 @@ { get { - return m_UnloadSceneSuccessCallback; + return _unloadSceneSuccessCallback; } } @@ -51,7 +51,7 @@ { get { - return m_UnloadSceneFailureCallback; + return _unloadSceneFailureCallback; } } } diff --git a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Extension/Implement/SetSpriteObject.cs b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Extension/Implement/SetSpriteObject.cs index fa672916..bafa388f 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Extension/Implement/SetSpriteObject.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Extension/Implement/SetSpriteObject.cs @@ -20,86 +20,86 @@ namespace TEngine #if ODIN_INSPECTOR [ShowInInspector] #endif - private SetType setType; + private SetType _setType; #if ODIN_INSPECTOR [ShowInInspector] #endif - private Image m_Image; + private Image _image; #if ODIN_INSPECTOR [ShowInInspector] #endif - private SpriteRenderer m_SpriteRenderer; + private SpriteRenderer _spriteRenderer; #if ODIN_INSPECTOR [ShowInInspector] #endif - private Sprite Sprite; + private Sprite _sprite; public string Location { get; private set; } - private bool m_SetNativeSize = false; + private bool _setNativeSize = false; public void SetAsset(Object asset) { - Sprite = (Sprite)asset; + _sprite = (Sprite)asset; - if (m_Image != null) + if (_image != null) { - m_Image.sprite = Sprite; - if (m_SetNativeSize) + _image.sprite = _sprite; + if (_setNativeSize) { - m_Image.SetNativeSize(); + _image.SetNativeSize(); } } - else if (m_SpriteRenderer != null) + else if (_spriteRenderer != null) { - m_SpriteRenderer.sprite = Sprite; + _spriteRenderer.sprite = _sprite; } } public bool IsCanRelease() { - if (setType == SetType.Image) + if (_setType == SetType.Image) { - return m_Image == null || m_Image.sprite == null || - (Sprite != null && m_Image.sprite != Sprite); + return _image == null || _image.sprite == null || + (_sprite != null && _image.sprite != _sprite); } - else if (setType == SetType.SpriteRender) + else if (_setType == SetType.SpriteRender) { - return m_SpriteRenderer == null || m_SpriteRenderer.sprite == null || - (Sprite != null && m_SpriteRenderer.sprite != Sprite); + return _spriteRenderer == null || _spriteRenderer.sprite == null || + (_sprite != null && _spriteRenderer.sprite != _sprite); } return true; } public void Clear() { - m_SpriteRenderer = null; - m_Image = null; + _spriteRenderer = null; + _image = null; Location = null; - Sprite = null; - setType = SetType.None; - m_SetNativeSize = false; + _sprite = null; + _setType = SetType.None; + _setNativeSize = false; } public static SetSpriteObject Create(Image image, string location, bool setNativeSize = false) { SetSpriteObject item = MemoryPool.Acquire(); - item.m_Image = image; - item.m_SetNativeSize = setNativeSize; + item._image = image; + item._setNativeSize = setNativeSize; item.Location = location; - item.setType = SetType.Image; + item._setType = SetType.Image; return item; } public static SetSpriteObject Create(SpriteRenderer spriteRenderer, string location) { SetSpriteObject item = MemoryPool.Acquire(); - item.m_SpriteRenderer = spriteRenderer; + item._spriteRenderer = spriteRenderer; item.Location = location; - item.setType = SetType.SpriteRender; + item._setType = SetType.SpriteRender; return item; } } diff --git a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Extension/ResourceExtComponent.Resource.cs b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Extension/ResourceExtComponent.Resource.cs index 1f8d701a..bee7a380 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Extension/ResourceExtComponent.Resource.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Extension/ResourceExtComponent.Resource.cs @@ -7,32 +7,32 @@ namespace TEngine /// /// 资源组件。 /// - private static IResourceModule m_ResourceModule; + private static IResourceModule _resourceModule; - private LoadAssetCallbacks m_LoadAssetCallbacks; + private LoadAssetCallbacks _loadAssetCallbacks; - public static IResourceModule ResourceModule => m_ResourceModule; + public static IResourceModule ResourceModule => _resourceModule; private void InitializedResources() { - m_ResourceModule = ModuleSystem.GetModule(); - m_LoadAssetCallbacks = new LoadAssetCallbacks(OnLoadAssetSuccess, OnLoadAssetFailure); + _resourceModule = ModuleSystem.GetModule(); + _loadAssetCallbacks = new LoadAssetCallbacks(OnLoadAssetSuccess, OnLoadAssetFailure); } private void OnLoadAssetFailure(string assetName, LoadResourceStatus status, string errormessage, object userdata) { - m_AssetLoadingList.Remove(assetName); + _assetLoadingList.Remove(assetName); Log.Error("Can not load asset from '{1}' with error message '{2}'.", assetName, errormessage); } private void OnLoadAssetSuccess(string assetName, object asset, float duration, object userdata) { - m_AssetLoadingList.Remove(assetName); + _assetLoadingList.Remove(assetName); ISetAssetObject setAssetObject = (ISetAssetObject)userdata; UnityEngine.Object assetObject = asset as UnityEngine.Object; if (assetObject != null) { - m_AssetItemPool.Register(AssetItemObject.Create(setAssetObject.Location, assetObject), true); + _assetItemPool.Register(AssetItemObject.Create(setAssetObject.Location, assetObject), true); SetAsset(setAssetObject, assetObject); } else @@ -49,15 +49,15 @@ namespace TEngine { await TryWaitingLoading(setAssetObject.Location); - if (m_AssetItemPool.CanSpawn(setAssetObject.Location)) + if (_assetItemPool.CanSpawn(setAssetObject.Location)) { - var assetObject = (T)m_AssetItemPool.Spawn(setAssetObject.Location).Target; + var assetObject = (T)_assetItemPool.Spawn(setAssetObject.Location).Target; SetAsset(setAssetObject, assetObject); } else { - m_AssetLoadingList.Add(setAssetObject.Location); - m_ResourceModule.LoadAssetAsync(setAssetObject.Location, 0, m_LoadAssetCallbacks, setAssetObject); + _assetLoadingList.Add(setAssetObject.Location); + _resourceModule.LoadAssetAsync(setAssetObject.Location, 0, _loadAssetCallbacks, setAssetObject); } } } diff --git a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Extension/ResourceExtComponent.cs b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Extension/ResourceExtComponent.cs index 474a8f25..3383795c 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Extension/ResourceExtComponent.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Extension/ResourceExtComponent.cs @@ -3,6 +3,7 @@ using System.Collections; using System.Collections.Generic; using Cysharp.Threading.Tasks; using UnityEngine; +using UnityEngine.Serialization; using Object = UnityEngine.Object; #if ODIN_INSPECTOR using Sirenix.OdinInspector; @@ -18,24 +19,24 @@ namespace TEngine { public static ResourceExtComponent Instance { private set; get; } - private readonly TimeoutController m_TimeoutController = new TimeoutController(); + private readonly TimeoutController _timeoutController = new TimeoutController(); /// /// 正在加载的资源列表。 /// - private readonly HashSet m_AssetLoadingList = new HashSet(); + private readonly HashSet _assetLoadingList = new HashSet(); /// /// 检查是否可以释放间隔 /// - [SerializeField] private float m_CheckCanReleaseInterval = 30f; + [SerializeField] private float checkCanReleaseInterval = 30f; - private float m_CheckCanReleaseTime = 0.0f; + private float _checkCanReleaseTime = 0.0f; /// /// 对象池自动释放时间间隔 /// - [SerializeField] private float m_AutoReleaseInterval = 60f; + [SerializeField] private float autoReleaseInterval = 60f; /// /// 保存加载的图片对象 @@ -43,19 +44,19 @@ namespace TEngine #if ODIN_INSPECTOR [ShowInInspector] #endif - private LinkedList m_LoadAssetObjectsLinkedList; + private LinkedList _loadAssetObjectsLinkedList; /// /// 散图集合对象池 /// - private IObjectPool m_AssetItemPool; + private IObjectPool _assetItemPool; #if UNITY_EDITOR public LinkedList LoadAssetObjectsLinkedList { - get => m_LoadAssetObjectsLinkedList; - set => m_LoadAssetObjectsLinkedList = value; + get => _loadAssetObjectsLinkedList; + set => _loadAssetObjectsLinkedList = value; } #endif private IEnumerator Start() @@ -63,18 +64,18 @@ namespace TEngine Instance = this; yield return new WaitForEndOfFrame(); IObjectPoolModule objectPoolComponent = ModuleSystem.GetModule(); - m_AssetItemPool = objectPoolComponent.CreateMultiSpawnObjectPool( + _assetItemPool = objectPoolComponent.CreateMultiSpawnObjectPool( "SetAssetPool", - m_AutoReleaseInterval, 16, 60, 0); - m_LoadAssetObjectsLinkedList = new LinkedList(); + autoReleaseInterval, 16, 60, 0); + _loadAssetObjectsLinkedList = new LinkedList(); InitializedResources(); } private void Update() { - m_CheckCanReleaseTime += Time.unscaledDeltaTime; - if (m_CheckCanReleaseTime < (double)m_CheckCanReleaseInterval) + _checkCanReleaseTime += Time.unscaledDeltaTime; + if (_checkCanReleaseTime < (double)checkCanReleaseInterval) { return; } @@ -90,45 +91,45 @@ namespace TEngine #endif public void ReleaseUnused() { - if (m_LoadAssetObjectsLinkedList == null) + if (_loadAssetObjectsLinkedList == null) { return; } - LinkedListNode current = m_LoadAssetObjectsLinkedList.First; + LinkedListNode current = _loadAssetObjectsLinkedList.First; while (current != null) { var next = current.Next; if (current.Value.AssetObject.IsCanRelease()) { - m_AssetItemPool.Unspawn(current.Value.AssetTarget); + _assetItemPool.Unspawn(current.Value.AssetTarget); MemoryPool.Release(current.Value.AssetObject); - m_LoadAssetObjectsLinkedList.Remove(current); + _loadAssetObjectsLinkedList.Remove(current); } current = next; } - m_CheckCanReleaseTime = 0f; + _checkCanReleaseTime = 0f; } private void SetAsset(ISetAssetObject setAssetObject, Object assetObject) { - m_LoadAssetObjectsLinkedList.AddLast(new LoadAssetObject(setAssetObject, assetObject)); + _loadAssetObjectsLinkedList.AddLast(new LoadAssetObject(setAssetObject, assetObject)); setAssetObject.SetAsset(assetObject); } private async UniTask TryWaitingLoading(string assetObjectKey) { - if (m_AssetLoadingList.Contains(assetObjectKey)) + if (_assetLoadingList.Contains(assetObjectKey)) { try { await UniTask.WaitUntil( - () => !m_AssetLoadingList.Contains(assetObjectKey)) + () => !_assetLoadingList.Contains(assetObjectKey)) #if UNITY_EDITOR - .AttachExternalCancellation(m_TimeoutController.Timeout(TimeSpan.FromSeconds(60))); - m_TimeoutController.Reset(); + .AttachExternalCancellation(_timeoutController.Timeout(TimeSpan.FromSeconds(60))); + _timeoutController.Reset(); #else ; #endif @@ -136,7 +137,7 @@ namespace TEngine } catch (OperationCanceledException ex) { - if (m_TimeoutController.IsTimeout()) + if (_timeoutController.IsTimeout()) { Log.Error($"LoadAssetAsync Waiting {assetObjectKey} timeout. reason:{ex.Message}"); } diff --git a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Reference/AssetsReference.cs b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Reference/AssetsReference.cs index 8c0a5641..67725baa 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Reference/AssetsReference.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/Reference/AssetsReference.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using UnityEngine; +using UnityEngine.Serialization; using Object = UnityEngine.Object; namespace TEngine @@ -21,9 +22,9 @@ namespace TEngine public sealed class AssetsReference : MonoBehaviour { - [SerializeField] private GameObject _sourceGameObject; + [SerializeField] private GameObject sourceGameObject; - [SerializeField] private List _refAssetInfoList; + [SerializeField] private List refAssetInfoList; private IResourceModule _resourceModule; @@ -39,9 +40,9 @@ namespace TEngine throw new GameFrameworkException($"resourceModule is null."); } - if (_sourceGameObject != null) + if (sourceGameObject != null) { - _resourceModule.UnloadAsset(_sourceGameObject); + _resourceModule.UnloadAsset(sourceGameObject); } ReleaseRefAssetInfoList(); @@ -49,14 +50,14 @@ namespace TEngine private void ReleaseRefAssetInfoList() { - if (_refAssetInfoList != null) + if (refAssetInfoList != null) { - foreach (var refInfo in _refAssetInfoList) + foreach (var refInfo in refAssetInfoList) { _resourceModule.UnloadAsset(refInfo.refAsset); } - _refAssetInfoList.Clear(); + refAssetInfoList.Clear(); } } @@ -73,7 +74,7 @@ namespace TEngine } _resourceModule = resourceModule; - _sourceGameObject = source; + sourceGameObject = source; return this; } @@ -85,11 +86,11 @@ namespace TEngine } _resourceModule = resourceModule; - if (_refAssetInfoList == null) + if (refAssetInfoList == null) { - _refAssetInfoList = new List(); + refAssetInfoList = new List(); } - _refAssetInfoList.Add(new AssetsRefInfo(source)); + refAssetInfoList.Add(new AssetsRefInfo(source)); return this; } diff --git a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModule.AssetObject.cs b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModule.AssetObject.cs index 85b8c30b..ba2e9e2d 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModule.AssetObject.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModule.AssetObject.cs @@ -10,14 +10,8 @@ namespace TEngine /// private sealed class AssetObject : ObjectBase { - private AssetHandle m_AssetHandle; - private ResourceModule m_ResourceManager; - - - public AssetObject() - { - m_AssetHandle = null; - } + private AssetHandle _assetHandle = null; + private ResourceModule _resourceModule; public static AssetObject Create(string name, object target, object assetHandle, ResourceModule resourceModule) { @@ -33,15 +27,15 @@ namespace TEngine AssetObject assetObject = MemoryPool.Acquire(); assetObject.Initialize(name, target); - assetObject.m_AssetHandle = (AssetHandle)assetHandle; - assetObject.m_ResourceManager = resourceModule; + assetObject._assetHandle = (AssetHandle)assetHandle; + assetObject._resourceModule = resourceModule; return assetObject; } public override void Clear() { base.Clear(); - m_AssetHandle = null; + _assetHandle = null; } protected internal override void OnUnspawn() @@ -53,7 +47,7 @@ namespace TEngine { if (!isShutdown) { - AssetHandle handle = m_AssetHandle; + AssetHandle handle = _assetHandle; if (handle is { IsValid: true }) { handle.Dispose(); diff --git a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModule.Pool.cs b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModule.Pool.cs index aa639828..dc3fbecd 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModule.Pool.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModule.Pool.cs @@ -2,15 +2,15 @@ { internal partial class ResourceModule { - private IObjectPool m_AssetPool; + private IObjectPool _assetPool; /// /// 获取或设置资源对象池自动释放可释放对象的间隔秒数。 /// public float AssetAutoReleaseInterval { - get => m_AssetPool.AutoReleaseInterval; - set => m_AssetPool.AutoReleaseInterval = value; + get => _assetPool.AutoReleaseInterval; + set => _assetPool.AutoReleaseInterval = value; } /// @@ -18,8 +18,8 @@ /// public int AssetCapacity { - get => m_AssetPool.Capacity; - set => m_AssetPool.Capacity = value; + get => _assetPool.Capacity; + set => _assetPool.Capacity = value; } /// @@ -27,8 +27,8 @@ /// public float AssetExpireTime { - get => m_AssetPool.ExpireTime; - set => m_AssetPool.ExpireTime = value; + get => _assetPool.ExpireTime; + set => _assetPool.ExpireTime = value; } /// @@ -36,8 +36,8 @@ /// public int AssetPriority { - get => m_AssetPool.Priority; - set => m_AssetPool.Priority = value; + get => _assetPool.Priority; + set => _assetPool.Priority = value; } /// @@ -46,9 +46,9 @@ /// 要卸载的资源。 public void UnloadAsset(object asset) { - if (m_AssetPool != null) + if (_assetPool != null) { - m_AssetPool.Unspawn(asset); + _assetPool.Unspawn(asset); } } @@ -62,7 +62,7 @@ { throw new GameFrameworkException("Object pool manager is invalid."); } - m_AssetPool = objectPoolModule.CreateMultiSpawnObjectPool("Asset Pool"); + _assetPool = objectPoolModule.CreateMultiSpawnObjectPool("Asset Pool"); } } } \ No newline at end of file diff --git a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModule.cs b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModule.cs index 33bd3951..7e2df253 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModule.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModule.cs @@ -49,19 +49,19 @@ namespace TEngine public string FallbackHostServerURL { get; set; } - private string m_ApplicableGameVersion; + private string _applicableGameVersion; - private int m_InternalResourceVersion; + private int _internalResourceVersion; /// /// 获取当前资源适用的游戏版本号。 /// - public string ApplicableGameVersion => m_ApplicableGameVersion; + public string ApplicableGameVersion => _applicableGameVersion; /// /// 获取当前内部资源版本号。 /// - public int InternalResourceVersion => m_InternalResourceVersion; + public int InternalResourceVersion => _internalResourceVersion; /// /// 当前最新的包裹版本。 @@ -318,10 +318,10 @@ namespace TEngine public void OnLowMemory() { Log.Warning("Low memory reported..."); - m_ForceUnloadUnusedAssetsAction?.Invoke(true); + _forceUnloadUnusedAssetsAction?.Invoke(true); } - private Action m_ForceUnloadUnusedAssetsAction; + private Action _forceUnloadUnusedAssetsAction; /// /// 低内存回调保护。 @@ -329,7 +329,7 @@ namespace TEngine /// 低内存行为。 public void SetForceUnloadUnusedAssetsAction(Action action) { - m_ForceUnloadUnusedAssetsAction = action; + _forceUnloadUnusedAssetsAction = action; } /// @@ -337,7 +337,7 @@ namespace TEngine /// public void UnloadUnusedAssets() { - m_AssetPool.ReleaseAllUnused(); + _assetPool.ReleaseAllUnused(); foreach (var package in PackageMap.Values) { if (package is { InitializeStatus: EOperationStatus.Succeed }) @@ -369,7 +369,7 @@ namespace TEngine public void ForceUnloadUnusedAssets(bool performGCCollect) { - m_ForceUnloadUnusedAssetsAction?.Invoke(performGCCollect); + _forceUnloadUnusedAssetsAction?.Invoke(performGCCollect); } #region Public Methods @@ -623,7 +623,7 @@ namespace TEngine } string assetObjectKey = GetCacheKey(location, packageName); - AssetObject assetObject = m_AssetPool.Spawn(assetObjectKey); + AssetObject assetObject = _assetPool.Spawn(assetObjectKey); if (assetObject != null) { return assetObject.Target as T; @@ -634,7 +634,7 @@ namespace TEngine T ret = handle.AssetObject as T; assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this); - m_AssetPool.Register(assetObject, true); + _assetPool.Register(assetObject, true); return ret; } @@ -647,7 +647,7 @@ namespace TEngine } string assetObjectKey = GetCacheKey(location, packageName); - AssetObject assetObject = m_AssetPool.Spawn(assetObjectKey); + AssetObject assetObject = _assetPool.Spawn(assetObjectKey); if (assetObject != null) { return AssetsReference.Instantiate(assetObject.Target as GameObject, parent, this).gameObject; @@ -658,7 +658,7 @@ namespace TEngine GameObject gameObject = AssetsReference.Instantiate(handle.AssetObject as GameObject, parent, this).gameObject; assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this); - m_AssetPool.Register(assetObject, true); + _assetPool.Register(assetObject, true); return gameObject; } @@ -687,7 +687,7 @@ namespace TEngine await TryWaitingLoading(assetObjectKey); - AssetObject assetObject = m_AssetPool.Spawn(assetObjectKey); + AssetObject assetObject = _assetPool.Spawn(assetObjectKey); if (assetObject != null) { await UniTask.Yield(); @@ -706,7 +706,7 @@ namespace TEngine if (assetHandle.AssetObject != null) { assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this); - m_AssetPool.Register(assetObject, true); + _assetPool.Register(assetObject, true); callback?.Invoke(assetObject.Target as T); } @@ -748,7 +748,7 @@ namespace TEngine await TryWaitingLoading(assetObjectKey); - AssetObject assetObject = m_AssetPool.Spawn(assetObjectKey); + AssetObject assetObject = _assetPool.Spawn(assetObjectKey); if (assetObject != null) { await UniTask.Yield(); @@ -768,7 +768,7 @@ namespace TEngine } assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this); - m_AssetPool.Register(assetObject, true); + _assetPool.Register(assetObject, true); _assetLoadingList.Remove(assetObjectKey); @@ -786,7 +786,7 @@ namespace TEngine await TryWaitingLoading(assetObjectKey); - AssetObject assetObject = m_AssetPool.Spawn(assetObjectKey); + AssetObject assetObject = _assetPool.Spawn(assetObjectKey); if (assetObject != null) { await UniTask.Yield(); @@ -808,7 +808,7 @@ namespace TEngine GameObject gameObject = AssetsReference.Instantiate(handle.AssetObject as GameObject, parent, this).gameObject; assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this); - m_AssetPool.Register(assetObject, true); + _assetPool.Register(assetObject, true); _assetLoadingList.Remove(assetObjectKey); @@ -844,7 +844,7 @@ namespace TEngine float duration = Time.time; - AssetObject assetObject = m_AssetPool.Spawn(assetObjectKey); + AssetObject assetObject = _assetPool.Spawn(assetObjectKey); if (assetObject != null) { await UniTask.Yield(); @@ -895,7 +895,7 @@ namespace TEngine else { assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this); - m_AssetPool.Register(assetObject, true); + _assetPool.Register(assetObject, true); _assetLoadingList.Remove(assetObjectKey); @@ -934,7 +934,7 @@ namespace TEngine float duration = Time.time; - AssetObject assetObject = m_AssetPool.Spawn(assetObjectKey); + AssetObject assetObject = _assetPool.Spawn(assetObjectKey); if (assetObject != null) { await UniTask.Yield(); @@ -985,7 +985,7 @@ namespace TEngine else { assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this); - m_AssetPool.Register(assetObject, true); + _assetPool.Register(assetObject, true); _assetLoadingList.Remove(assetObjectKey); diff --git a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModuleDriver.cs b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModuleDriver.cs index a18de63e..d2f84491 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModuleDriver.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/ResourceModule/ResourceModuleDriver.cs @@ -1,5 +1,6 @@ using System; using UnityEngine; +using UnityEngine.Serialization; using YooAsset; namespace TEngine @@ -14,23 +15,23 @@ namespace TEngine private const int DefaultPriority = 0; - private IResourceModule m_ResourceModule; + private IResourceModule _resourceModule; - private bool m_ForceUnloadUnusedAssets = false; + private bool _forceUnloadUnusedAssets = false; - private bool m_PreorderUnloadUnusedAssets = false; + private bool _preorderUnloadUnusedAssets = false; - private bool m_PerformGCCollect = false; + private bool _performGCCollect = false; - private AsyncOperation m_AsyncOperation = null; + private AsyncOperation _asyncOperation = null; - private float m_LastUnloadUnusedAssetsOperationElapseSeconds = 0f; + private float _lastUnloadUnusedAssetsOperationElapseSeconds = 0f; - [SerializeField] private float m_MinUnloadUnusedAssetsInterval = 60f; + [SerializeField] private float minUnloadUnusedAssetsInterval = 60f; - [SerializeField] private float m_MaxUnloadUnusedAssetsInterval = 300f; + [SerializeField] private float maxUnloadUnusedAssetsInterval = 300f; - [SerializeField] private bool m_UseSystemUnloadUnusedAssets = true; + [SerializeField] private bool useSystemUnloadUnusedAssets = true; /// /// 当前最新的包裹版本。 @@ -87,54 +88,54 @@ namespace TEngine /// /// 是否支持边玩边下载。 /// - [SerializeField] private bool m_UpdatableWhilePlaying = false; + [SerializeField] private bool updatableWhilePlaying = false; /// /// 是否支持边玩边下载。 /// - public bool UpdatableWhilePlaying => m_UpdatableWhilePlaying; + public bool UpdatableWhilePlaying => updatableWhilePlaying; /// /// 设置异步系统参数,每帧执行消耗的最大时间切片(单位:毫秒) /// - [SerializeField] public long Milliseconds = 30; + [SerializeField] public long milliseconds = 30; - public int m_DownloadingMaxNum = 10; + public int downloadingMaxNum = 10; /// /// 获取或设置同时最大下载数目。 /// public int DownloadingMaxNum { - get => m_DownloadingMaxNum; - set => m_DownloadingMaxNum = value; + get => downloadingMaxNum; + set => downloadingMaxNum = value; } - public int m_FailedTryAgain = 3; + [SerializeField] public int failedTryAgain = 3; public int FailedTryAgain { - get => m_FailedTryAgain; - set => m_FailedTryAgain = value; + get => failedTryAgain; + set => failedTryAgain = value; } /// /// 获取当前资源适用的游戏版本号。 /// - public string ApplicableGameVersion => m_ResourceModule.ApplicableGameVersion; + public string ApplicableGameVersion => _resourceModule.ApplicableGameVersion; /// /// 获取当前内部资源版本号。 /// - public int InternalResourceVersion => m_ResourceModule.InternalResourceVersion; + public int InternalResourceVersion => _resourceModule.InternalResourceVersion; /// /// 获取或设置无用资源释放的最小间隔时间,以秒为单位。 /// public float MinUnloadUnusedAssetsInterval { - get => m_MinUnloadUnusedAssetsInterval; - set => m_MinUnloadUnusedAssetsInterval = value; + get => minUnloadUnusedAssetsInterval; + set => minUnloadUnusedAssetsInterval = value; } /// @@ -142,8 +143,8 @@ namespace TEngine /// public float MaxUnloadUnusedAssetsInterval { - get => m_MaxUnloadUnusedAssetsInterval; - set => m_MaxUnloadUnusedAssetsInterval = value; + get => maxUnloadUnusedAssetsInterval; + set => maxUnloadUnusedAssetsInterval = value; } /// @@ -151,30 +152,30 @@ namespace TEngine /// public bool UseSystemUnloadUnusedAssets { - get => m_UseSystemUnloadUnusedAssets; - set => m_UseSystemUnloadUnusedAssets = value; + get => useSystemUnloadUnusedAssets; + set => useSystemUnloadUnusedAssets = value; } /// /// 获取无用资源释放的等待时长,以秒为单位。 /// - public float LastUnloadUnusedAssetsOperationElapseSeconds => m_LastUnloadUnusedAssetsOperationElapseSeconds; + public float LastUnloadUnusedAssetsOperationElapseSeconds => _lastUnloadUnusedAssetsOperationElapseSeconds; - [SerializeField] private float m_AssetAutoReleaseInterval = 60f; + [SerializeField] private float assetAutoReleaseInterval = 60f; - [SerializeField] private int m_AssetCapacity = 64; + [SerializeField] private int assetCapacity = 64; - [SerializeField] private float m_AssetExpireTime = 60f; + [SerializeField] private float assetExpireTime = 60f; - [SerializeField] private int m_AssetPriority = 0; + [SerializeField] private int assetPriority = 0; /// /// 获取或设置资源对象池自动释放可释放对象的间隔秒数。 /// public float AssetAutoReleaseInterval { - get => m_ResourceModule.AssetAutoReleaseInterval; - set => m_ResourceModule.AssetAutoReleaseInterval = m_AssetAutoReleaseInterval = value; + get => _resourceModule.AssetAutoReleaseInterval; + set => _resourceModule.AssetAutoReleaseInterval = assetAutoReleaseInterval = value; } /// @@ -182,8 +183,8 @@ namespace TEngine /// public int AssetCapacity { - get => m_ResourceModule.AssetCapacity; - set => m_ResourceModule.AssetCapacity = m_AssetCapacity = value; + get => _resourceModule.AssetCapacity; + set => _resourceModule.AssetCapacity = assetCapacity = value; } /// @@ -191,8 +192,8 @@ namespace TEngine /// public float AssetExpireTime { - get => m_ResourceModule.AssetExpireTime; - set => m_ResourceModule.AssetExpireTime = m_AssetExpireTime = value; + get => _resourceModule.AssetExpireTime; + set => _resourceModule.AssetExpireTime = assetExpireTime = value; } /// @@ -200,16 +201,16 @@ namespace TEngine /// public int AssetPriority { - get => m_ResourceModule.AssetPriority; - set => m_ResourceModule.AssetPriority = m_AssetPriority = value; + get => _resourceModule.AssetPriority; + set => _resourceModule.AssetPriority = assetPriority = value; } #endregion private void Start() { - m_ResourceModule = ModuleSystem.GetModule(); - if (m_ResourceModule == null) + _resourceModule = ModuleSystem.GetModule(); + if (_resourceModule == null) { Log.Fatal("Resource module is invalid."); return; @@ -223,20 +224,20 @@ namespace TEngine #endif } - m_ResourceModule.DefaultPackageName = PackageName; - m_ResourceModule.PlayMode = PlayMode; - m_ResourceModule.Milliseconds = Milliseconds; - m_ResourceModule.HostServerURL = Settings.UpdateSetting.GetResDownLoadPath(); - m_ResourceModule.FallbackHostServerURL = Settings.UpdateSetting.GetFallbackResDownLoadPath(); - m_ResourceModule.DownloadingMaxNum = DownloadingMaxNum; - m_ResourceModule.FailedTryAgain = FailedTryAgain; - m_ResourceModule.UpdatableWhilePlaying = UpdatableWhilePlaying; - m_ResourceModule.Initialize(); - m_ResourceModule.AssetAutoReleaseInterval = m_AssetAutoReleaseInterval; - m_ResourceModule.AssetCapacity = m_AssetCapacity; - m_ResourceModule.AssetExpireTime = m_AssetExpireTime; - m_ResourceModule.AssetPriority = m_AssetPriority; - m_ResourceModule.SetForceUnloadUnusedAssetsAction(ForceUnloadUnusedAssets); + _resourceModule.DefaultPackageName = PackageName; + _resourceModule.PlayMode = PlayMode; + _resourceModule.Milliseconds = milliseconds; + _resourceModule.HostServerURL = Settings.UpdateSetting.GetResDownLoadPath(); + _resourceModule.FallbackHostServerURL = Settings.UpdateSetting.GetFallbackResDownLoadPath(); + _resourceModule.DownloadingMaxNum = DownloadingMaxNum; + _resourceModule.FailedTryAgain = FailedTryAgain; + _resourceModule.UpdatableWhilePlaying = UpdatableWhilePlaying; + _resourceModule.Initialize(); + _resourceModule.AssetAutoReleaseInterval = assetAutoReleaseInterval; + _resourceModule.AssetCapacity = assetCapacity; + _resourceModule.AssetExpireTime = assetExpireTime; + _resourceModule.AssetPriority = assetPriority; + _resourceModule.SetForceUnloadUnusedAssetsAction(ForceUnloadUnusedAssets); Log.Info($"ResourceModule Run Mode:{PlayMode}"); } @@ -248,38 +249,38 @@ namespace TEngine /// 是否使用垃圾回收。 public void ForceUnloadUnusedAssets(bool performGCCollect) { - m_ForceUnloadUnusedAssets = true; + _forceUnloadUnusedAssets = true; if (performGCCollect) { - m_PerformGCCollect = true; + _performGCCollect = true; } } private void Update() { - m_LastUnloadUnusedAssetsOperationElapseSeconds += Time.unscaledDeltaTime; - if (m_AsyncOperation == null && (m_ForceUnloadUnusedAssets || m_LastUnloadUnusedAssetsOperationElapseSeconds >= m_MaxUnloadUnusedAssetsInterval || - m_PreorderUnloadUnusedAssets && m_LastUnloadUnusedAssetsOperationElapseSeconds >= m_MinUnloadUnusedAssetsInterval)) + _lastUnloadUnusedAssetsOperationElapseSeconds += Time.unscaledDeltaTime; + if (_asyncOperation == null && (_forceUnloadUnusedAssets || _lastUnloadUnusedAssetsOperationElapseSeconds >= maxUnloadUnusedAssetsInterval || + _preorderUnloadUnusedAssets && _lastUnloadUnusedAssetsOperationElapseSeconds >= minUnloadUnusedAssetsInterval)) { Log.Info("Unload unused assets..."); - m_ForceUnloadUnusedAssets = false; - m_PreorderUnloadUnusedAssets = false; - m_LastUnloadUnusedAssetsOperationElapseSeconds = 0f; - m_AsyncOperation = Resources.UnloadUnusedAssets(); - if (m_UseSystemUnloadUnusedAssets) + _forceUnloadUnusedAssets = false; + _preorderUnloadUnusedAssets = false; + _lastUnloadUnusedAssetsOperationElapseSeconds = 0f; + _asyncOperation = Resources.UnloadUnusedAssets(); + if (useSystemUnloadUnusedAssets) { - m_ResourceModule.UnloadUnusedAssets(); + _resourceModule.UnloadUnusedAssets(); } } - if (m_AsyncOperation is { isDone: true }) + if (_asyncOperation is { isDone: true }) { - m_AsyncOperation = null; - if (m_PerformGCCollect) + _asyncOperation = null; + if (_performGCCollect) { Log.Info("GC.Collect..."); - m_PerformGCCollect = false; + _performGCCollect = false; GC.Collect(); } } diff --git a/UnityProject/Assets/TEngine/Runtime/Module/RootModule.cs b/UnityProject/Assets/TEngine/Runtime/Module/RootModule.cs index c800ac92..6c6f2176 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/RootModule.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/RootModule.cs @@ -9,41 +9,33 @@ namespace TEngine [DisallowMultipleComponent] public sealed class RootModule : MonoBehaviour { - private const int DefaultDpi = 96; // default windows dpi + private const int DefaultDpi = 96; // default windows dpi - private float m_GameSpeedBeforePause = 1f; + private float _gameSpeedBeforePause = 1f; - [SerializeField] - private Language m_EditorLanguage = Language.Unspecified; + [SerializeField] private Language editorLanguage = Language.Unspecified; - [SerializeField] - private string m_TextHelperTypeName = "TEngine.DefaultTextHelper"; - - [SerializeField] - private string m_LogHelperTypeName = "TEngine.DefaultLogHelper"; + [SerializeField] private string textHelperTypeName = "TEngine.DefaultTextHelper"; - [SerializeField] - private string m_JsonHelperTypeName = "TEngine.DefaultJsonHelper"; + [SerializeField] private string logHelperTypeName = "TEngine.DefaultLogHelper"; - [SerializeField] - private int m_FrameRate = 120; + [SerializeField] private string jsonHelperTypeName = "TEngine.DefaultJsonHelper"; - [SerializeField] - private float m_GameSpeed = 1f; + [SerializeField] private int frameRate = 120; - [SerializeField] - private bool m_RunInBackground = true; + [SerializeField] private float gameSpeed = 1f; - [SerializeField] - private bool m_NeverSleep = true; + [SerializeField] private bool runInBackground = true; + + [SerializeField] private bool neverSleep = true; /// /// 获取或设置编辑器语言(仅编辑器内有效)。 /// public Language EditorLanguage { - get => m_EditorLanguage; - set => m_EditorLanguage = value; + get => editorLanguage; + set => editorLanguage = value; } /// @@ -51,8 +43,8 @@ namespace TEngine /// public int FrameRate { - get => m_FrameRate; - set => Application.targetFrameRate = m_FrameRate = value; + get => frameRate; + set => Application.targetFrameRate = frameRate = value; } /// @@ -60,27 +52,27 @@ namespace TEngine /// public float GameSpeed { - get => m_GameSpeed; - set => Time.timeScale = m_GameSpeed = value >= 0f ? value : 0f; + get => gameSpeed; + set => Time.timeScale = gameSpeed = value >= 0f ? value : 0f; } /// /// 获取游戏是否暂停。 /// - public bool IsGamePaused => m_GameSpeed <= 0f; + public bool IsGamePaused => gameSpeed <= 0f; /// /// 获取是否正常游戏速度。 /// - public bool IsNormalGameSpeed => Math.Abs(m_GameSpeed - 1f) < 0.01f; + public bool IsNormalGameSpeed => Math.Abs(gameSpeed - 1f) < 0.01f; /// /// 获取或设置是否允许后台运行。 /// public bool RunInBackground { - get => m_RunInBackground; - set => Application.runInBackground = m_RunInBackground = value; + get => runInBackground; + set => Application.runInBackground = runInBackground = value; } /// @@ -88,10 +80,10 @@ namespace TEngine /// public bool NeverSleep { - get => m_NeverSleep; + get => neverSleep; set { - m_NeverSleep = value; + neverSleep = value; Screen.sleepTimeout = value ? SleepTimeout.NeverSleep : SleepTimeout.SystemSetting; } } @@ -112,11 +104,11 @@ namespace TEngine { Utility.Converter.ScreenDpi = DefaultDpi; } - - Application.targetFrameRate = m_FrameRate; - Time.timeScale = m_GameSpeed; - Application.runInBackground = m_RunInBackground; - Screen.sleepTimeout = m_NeverSleep ? SleepTimeout.NeverSleep : SleepTimeout.SystemSetting; + + Application.targetFrameRate = frameRate; + Time.timeScale = gameSpeed; + Application.runInBackground = runInBackground; + Screen.sleepTimeout = neverSleep ? SleepTimeout.NeverSleep : SleepTimeout.SystemSetting; Application.lowMemory += OnLowMemory; GameTime.StartFrame(); @@ -161,7 +153,7 @@ namespace TEngine return; } - m_GameSpeedBeforePause = GameSpeed; + _gameSpeedBeforePause = GameSpeed; GameSpeed = 0f; } @@ -175,7 +167,7 @@ namespace TEngine return; } - GameSpeed = m_GameSpeedBeforePause; + GameSpeed = _gameSpeedBeforePause; } /// @@ -198,22 +190,22 @@ namespace TEngine private void InitTextHelper() { - if (string.IsNullOrEmpty(m_TextHelperTypeName)) + if (string.IsNullOrEmpty(textHelperTypeName)) { return; } - Type textHelperType = Utility.Assembly.GetType(m_TextHelperTypeName); + Type textHelperType = Utility.Assembly.GetType(textHelperTypeName); if (textHelperType == null) { - Log.Error("Can not find text helper type '{0}'.", m_TextHelperTypeName); + Log.Error("Can not find text helper type '{0}'.", textHelperTypeName); return; } Utility.Text.ITextHelper textHelper = (Utility.Text.ITextHelper)Activator.CreateInstance(textHelperType); if (textHelper == null) { - Log.Error("Can not create text helper instance '{0}'.", m_TextHelperTypeName); + Log.Error("Can not create text helper instance '{0}'.", textHelperTypeName); return; } @@ -222,21 +214,24 @@ namespace TEngine private void InitLogHelper() { - if (string.IsNullOrEmpty(m_LogHelperTypeName)) + if (string.IsNullOrEmpty(logHelperTypeName)) { return; } - Type logHelperType = Utility.Assembly.GetType(m_LogHelperTypeName); + Type logHelperType = Utility.Assembly.GetType(logHelperTypeName); if (logHelperType == null) { - throw new GameFrameworkException(Utility.Text.Format("Can not find log helper type '{0}'.", m_LogHelperTypeName)); + throw new GameFrameworkException(Utility.Text.Format("Can not find log helper type '{0}'.", + logHelperTypeName)); } - GameFrameworkLog.ILogHelper logHelper = (GameFrameworkLog.ILogHelper)Activator.CreateInstance(logHelperType); + GameFrameworkLog.ILogHelper + logHelper = (GameFrameworkLog.ILogHelper)Activator.CreateInstance(logHelperType); if (logHelper == null) { - throw new GameFrameworkException(Utility.Text.Format("Can not create log helper instance '{0}'.", m_LogHelperTypeName)); + throw new GameFrameworkException(Utility.Text.Format("Can not create log helper instance '{0}'.", + logHelperTypeName)); } GameFrameworkLog.SetLogHelper(logHelper); @@ -244,22 +239,22 @@ namespace TEngine private void InitJsonHelper() { - if (string.IsNullOrEmpty(m_JsonHelperTypeName)) + if (string.IsNullOrEmpty(jsonHelperTypeName)) { return; } - Type jsonHelperType = Utility.Assembly.GetType(m_JsonHelperTypeName); + Type jsonHelperType = Utility.Assembly.GetType(jsonHelperTypeName); if (jsonHelperType == null) { - Log.Error("Can not find JSON helper type '{0}'.", m_JsonHelperTypeName); + Log.Error("Can not find JSON helper type '{0}'.", jsonHelperTypeName); return; } Utility.Json.IJsonHelper jsonHelper = (Utility.Json.IJsonHelper)Activator.CreateInstance(jsonHelperType); if (jsonHelper == null) { - Log.Error("Can not create JSON helper instance '{0}'.", m_JsonHelperTypeName); + Log.Error("Can not create JSON helper instance '{0}'.", jsonHelperTypeName); return; } @@ -269,7 +264,7 @@ namespace TEngine private void OnLowMemory() { Log.Warning("Low memory reported..."); - + IObjectPoolModule objectPoolModule = ModuleSystem.GetModule(); if (objectPoolModule != null) { @@ -283,4 +278,4 @@ namespace TEngine } } } -} +} \ No newline at end of file diff --git a/UnityProject/Assets/TEngine/Runtime/Module/Settings/Settings.cs b/UnityProject/Assets/TEngine/Runtime/Module/Settings/Settings.cs index b3ad441f..03d7bd15 100644 --- a/UnityProject/Assets/TEngine/Runtime/Module/Settings/Settings.cs +++ b/UnityProject/Assets/TEngine/Runtime/Module/Settings/Settings.cs @@ -1,6 +1,4 @@ -using System; -using UnityEngine; -using UnityEngine.Serialization; +using UnityEngine; namespace TEngine { @@ -27,13 +25,13 @@ namespace TEngine } [SerializeField] private AudioSetting audioSetting; - + [SerializeField] private ProcedureSetting procedureSetting; [SerializeField] private UpdateSetting updateSetting; public static AudioSetting AudioSetting => Instance.audioSetting; - + public static ProcedureSetting ProcedureSetting => Instance.procedureSetting; public static UpdateSetting UpdateSetting => Instance.updateSetting; diff --git a/UnityProject/Assets/TEngine/Runtime/Module/UIModule.meta b/UnityProject/Assets/TEngine/Runtime/Module/UIModule.meta deleted file mode 100644 index ef4ca1b7..00000000 --- a/UnityProject/Assets/TEngine/Runtime/Module/UIModule.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 2e3cd0841baf4f42a5ac166b4a9fce2b -timeCreated: 1705927238 \ No newline at end of file diff --git a/UnityProject/Assets/TEngine/Runtime/Module/UIModule/IUIModule.cs b/UnityProject/Assets/TEngine/Runtime/Module/UIModule/IUIModule.cs deleted file mode 100644 index fc57eb80..00000000 --- a/UnityProject/Assets/TEngine/Runtime/Module/UIModule/IUIModule.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace TEngine -{ - public interface IUIModule - { - - } -} \ No newline at end of file diff --git a/UnityProject/Assets/TEngine/Runtime/Module/UIModule/IUIModule.cs.meta b/UnityProject/Assets/TEngine/Runtime/Module/UIModule/IUIModule.cs.meta deleted file mode 100644 index fd993c3f..00000000 --- a/UnityProject/Assets/TEngine/Runtime/Module/UIModule/IUIModule.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 20e1c311409e4636a6f6b07c843e6aa7 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/UnityProject/Assets/TEngine/Runtime/Module/UIModule/UIModule.cs b/UnityProject/Assets/TEngine/Runtime/Module/UIModule/UIModule.cs deleted file mode 100644 index 1970674c..00000000 --- a/UnityProject/Assets/TEngine/Runtime/Module/UIModule/UIModule.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Collections.Generic; - -namespace TEngine -{ - internal class UIModule : Module, IUIModule - { - private IResourceModule _resourceModule; - - public override void OnInit() - { - } - - public override void Shutdown() - { - - } - - public void Init() - { - _resourceModule = ModuleSystem.GetModule(); - } - } -} \ No newline at end of file diff --git a/UnityProject/Assets/TEngine/Runtime/Module/UIModule/UIModule.cs.meta b/UnityProject/Assets/TEngine/Runtime/Module/UIModule/UIModule.cs.meta deleted file mode 100644 index 613ef347..00000000 --- a/UnityProject/Assets/TEngine/Runtime/Module/UIModule/UIModule.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: f42e54968df4423eac3a935f0f06b904 -timeCreated: 1705927246 \ No newline at end of file diff --git a/UnityProject/Assets/TEngine/Settings/AudioSetting.asset b/UnityProject/Assets/TEngine/Settings/AudioSetting.asset index f4c7ca21..b31aecf5 100644 --- a/UnityProject/Assets/TEngine/Settings/AudioSetting.asset +++ b/UnityProject/Assets/TEngine/Settings/AudioSetting.asset @@ -13,35 +13,35 @@ MonoBehaviour: m_Name: AudioSetting m_EditorClassIdentifier: audioGroupConfigs: - - m_Name: Music - m_Mute: 0 - m_Volume: 0.5 - m_AgentHelperCount: 1 - AudioType: 2 + - name: Music + mute: 0 + volume: 0.5 + agentHelperCount: 1 + audioType: 2 audioRolloffMode: 1 minDistance: 15 maxDistance: 50 - - m_Name: Sound - m_Mute: 0 - m_Volume: 0.5 - m_AgentHelperCount: 4 - AudioType: 0 + - name: Sound + mute: 0 + volume: 0.5 + agentHelperCount: 4 + audioType: 0 audioRolloffMode: 0 minDistance: 1 maxDistance: 500 - - m_Name: UISound - m_Mute: 0 - m_Volume: 0.5 - m_AgentHelperCount: 4 - AudioType: 1 + - name: UISound + mute: 0 + volume: 0.5 + agentHelperCount: 4 + audioType: 1 audioRolloffMode: 0 minDistance: 1 maxDistance: 500 - - m_Name: Voice - m_Mute: 0 - m_Volume: 0.5 - m_AgentHelperCount: 1 - AudioType: 3 + - name: Voice + mute: 0 + volume: 0.5 + agentHelperCount: 1 + audioType: 3 audioRolloffMode: 0 minDistance: 1 maxDistance: 500 diff --git a/UnityProject/Assets/TEngine/Settings/Game App Config Data.asset b/UnityProject/Assets/TEngine/Settings/Game App Config Data.asset new file mode 100644 index 00000000..3bfd3a18 --- /dev/null +++ b/UnityProject/Assets/TEngine/Settings/Game App Config Data.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: 0} + m_Name: Game App Config Data + m_EditorClassIdentifier: TEngine.Runtime:TEngine:GameAppConfigData + gameAppConfigInfoList: [] diff --git a/UnityProject/Assets/TEngine/Settings/Game App Config Data.asset.meta b/UnityProject/Assets/TEngine/Settings/Game App Config Data.asset.meta new file mode 100644 index 00000000..d2e112f9 --- /dev/null +++ b/UnityProject/Assets/TEngine/Settings/Game App Config Data.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0135d4f2f69a1d04aa9d82d50d3763db +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: