统一命名规范private变量_filedInfo

This commit is contained in:
Alex-Rachel
2025-03-08 19:44:06 +08:00
parent 9b72cbcb7c
commit 6cf5aa46c1
67 changed files with 1093 additions and 1170 deletions

View File

@@ -37,7 +37,7 @@ namespace GameLogic
/// </summary> /// </summary>
public class UIResourceLoader : IUIResourceLoader public class UIResourceLoader : IUIResourceLoader
{ {
private readonly IResourceModule m_ResourceLoaderImp = ModuleSystem.GetModule<IResourceModule>(); private readonly IResourceModule _resourceLoaderImp = ModuleSystem.GetModule<IResourceModule>();
/// <summary> /// <summary>
/// 同步加载游戏物体并实例化。 /// 同步加载游戏物体并实例化。
@@ -49,7 +49,7 @@ namespace GameLogic
/// <remarks>会实例化资源到场景无需主动UnloadAssetDestroy时自动UnloadAsset。</remarks> /// <remarks>会实例化资源到场景无需主动UnloadAssetDestroy时自动UnloadAsset。</remarks>
public GameObject LoadGameObject(string location, Transform parent = null, string packageName = "") public GameObject LoadGameObject(string location, Transform parent = null, string packageName = "")
{ {
return m_ResourceLoaderImp.LoadGameObject(location, parent, packageName); return _resourceLoaderImp.LoadGameObject(location, parent, packageName);
} }
/// <summary> /// <summary>
@@ -63,7 +63,7 @@ namespace GameLogic
/// <remarks>会实例化资源到场景无需主动UnloadAssetDestroy时自动UnloadAsset。</remarks> /// <remarks>会实例化资源到场景无需主动UnloadAssetDestroy时自动UnloadAsset。</remarks>
public async UniTask<GameObject> LoadGameObjectAsync(string location, Transform parent = null, CancellationToken cancellationToken = default, string packageName = "") public async UniTask<GameObject> 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);
} }
} }
} }

View File

@@ -103,12 +103,12 @@ namespace GameLogic
/// <summary> /// <summary>
/// 存在Update更新的UI子组件列表。 /// 存在Update更新的UI子组件列表。
/// </summary> /// </summary>
protected List<UIWidget> m_listUpdateChild = null; protected List<UIWidget> ListUpdateChild = null;
/// <summary> /// <summary>
/// 是否持有Update行为。 /// 是否持有Update行为。
/// </summary> /// </summary>
protected bool m_updateListValid = false; protected bool UpdateListValid = false;
/// <summary> /// <summary>
/// 代码自动生成绑定。 /// 代码自动生成绑定。
@@ -186,7 +186,7 @@ namespace GameLogic
internal void SetUpdateDirty() internal void SetUpdateDirty()
{ {
m_updateListValid = false; UpdateListValid = false;
if (Parent != null) if (Parent != null)
{ {
Parent.SetUpdateDirty(); Parent.SetUpdateDirty();

View File

@@ -10,30 +10,30 @@ namespace GameLogic
{ {
public sealed partial class UIModule : Singleton<UIModule>, IUpdate public sealed partial class UIModule : Singleton<UIModule>, 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<UIWindow> _stack = new List<UIWindow>(100); private readonly List<UIWindow> _uiStack = new List<UIWindow>(100);
public const int LAYER_DEEP = 2000; public const int LayerDeep = 2000;
public const int WINDOW_DEEP = 100; public const int WindowDeep = 100;
public const int WINDOW_HIDE_LAYER = 2; // Ignore Raycast public const int WindowHideLayer = 2; // Ignore Raycast
public const int WINDOW_SHOW_LAYER = 5; // UI public const int WindowShowLayer = 5; // UI
public static IUIResourceLoader Resource; public static IUIResourceLoader Resource;
/// <summary> /// <summary>
/// UI根节点。 /// UI根节点。
/// </summary> /// </summary>
public static Transform UIRoot => m_InstanceRoot; public static Transform UIRoot => _instanceRoot;
/// <summary> /// <summary>
/// UI根节点。 /// UI根节点。
/// </summary> /// </summary>
public Camera UICamera => m_UICamera; public Camera UICamera => _uiCamera;
private ErrorLogger _errorLogger; private ErrorLogger _errorLogger;
@@ -42,7 +42,7 @@ namespace GameLogic
var uiRoot = GameObject.Find("UIRoot"); var uiRoot = GameObject.Find("UIRoot");
if (uiRoot != null) if (uiRoot != null)
{ {
m_InstanceRoot = uiRoot.GetComponentInChildren<Canvas>()?.transform; _instanceRoot = uiRoot.GetComponentInChildren<Canvas>()?.transform;
} }
else else
{ {
@@ -52,31 +52,31 @@ namespace GameLogic
Resource = new UIResourceLoader(); 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) if (Debugger.Instance != null)
{ {
switch (Debugger.Instance.ActiveWindowType) switch (Debugger.Instance.ActiveWindowType)
{ {
case DebuggerActiveWindowType.AlwaysOpen: case DebuggerActiveWindowType.AlwaysOpen:
m_enableErrorLog = true; _enableErrorLog = true;
break; break;
case DebuggerActiveWindowType.OnlyOpenWhenDevelopment: case DebuggerActiveWindowType.OnlyOpenWhenDevelopment:
m_enableErrorLog = Debug.isDebugBuild; _enableErrorLog = Debug.isDebugBuild;
break; break;
case DebuggerActiveWindowType.OnlyOpenInEditor: case DebuggerActiveWindowType.OnlyOpenInEditor:
m_enableErrorLog = Application.isEditor; _enableErrorLog = Application.isEditor;
break; break;
default: default:
m_enableErrorLog = false; _enableErrorLog = false;
break; break;
} }
if (m_enableErrorLog) if (_enableErrorLog)
{ {
_errorLogger = new ErrorLogger(this); _errorLogger = new ErrorLogger(this);
} }
@@ -91,9 +91,9 @@ namespace GameLogic
_errorLogger = null; _errorLogger = null;
} }
CloseAll(isShutDown:true); 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
/// </summary> /// </summary>
public string GetTopWindow() public string GetTopWindow()
{ {
if (_stack.Count == 0) if (_uiStack.Count == 0)
{ {
return string.Empty; return string.Empty;
} }
UIWindow topWindow = _stack[^1]; UIWindow topWindow = _uiStack[^1];
return topWindow.WindowName; return topWindow.WindowName;
} }
@@ -179,10 +179,10 @@ namespace GameLogic
public string GetTopWindow(int layer) public string GetTopWindow(int layer)
{ {
UIWindow lastOne = null; UIWindow lastOne = null;
for (int i = 0; i < _stack.Count; i++) for (int i = 0; i < _uiStack.Count; i++)
{ {
if (_stack[i].WindowLayer == layer) if (_uiStack[i].WindowLayer == layer)
lastOne = _stack[i]; lastOne = _uiStack[i];
} }
if (lastOne == null) if (lastOne == null)
@@ -196,9 +196,9 @@ namespace GameLogic
/// </summary> /// </summary>
public bool IsAnyLoading() 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) if (window.IsLoadDone == false)
return true; return true;
} }
@@ -390,13 +390,13 @@ namespace GameLogic
/// </summary> /// </summary>
public void CloseAll(bool isShutDown = false) 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); window.InternalDestroy(isShutDown);
} }
_stack.Clear(); _uiStack.Clear();
} }
/// <summary> /// <summary>
@@ -404,16 +404,16 @@ namespace GameLogic
/// </summary> /// </summary>
public void CloseAllWithOut(UIWindow withOut) 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) if (window == withOut)
{ {
continue; continue;
} }
window.InternalDestroy(); window.InternalDestroy();
_stack.RemoveAt(i); _uiStack.RemoveAt(i);
} }
} }
@@ -422,16 +422,16 @@ namespace GameLogic
/// </summary> /// </summary>
public void CloseAllWithOut<T>() where T : UIWindow public void CloseAllWithOut<T>() 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)) if (window.GetType() == typeof(T))
{ {
continue; continue;
} }
window.InternalDestroy(); window.InternalDestroy();
_stack.RemoveAt(i); _uiStack.RemoveAt(i);
} }
} }
@@ -445,13 +445,13 @@ namespace GameLogic
private void OnSortWindowDepth(int layer) private void OnSortWindowDepth(int layer)
{ {
int depth = layer * LAYER_DEEP; int depth = layer * LayerDeep;
for (int i = 0; i < _stack.Count; i++) for (int i = 0; i < _uiStack.Count; i++)
{ {
if (_stack[i].WindowLayer == layer) if (_uiStack[i].WindowLayer == layer)
{ {
_stack[i].Depth = depth; _uiStack[i].Depth = depth;
depth += WINDOW_DEEP; depth += WindowDeep;
} }
} }
} }
@@ -459,9 +459,9 @@ namespace GameLogic
private void OnSetWindowVisible() private void OnSetWindowVisible()
{ {
bool isHideNext = false; 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 (isHideNext == false)
{ {
if (window.IsHide) if (window.IsHide)
@@ -581,9 +581,9 @@ namespace GameLogic
private UIWindow GetWindow(string windowName) 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) if (window.WindowName == windowName)
{ {
return window; return window;
@@ -595,9 +595,9 @@ namespace GameLogic
private bool IsContains(string windowName) 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) if (window.WindowName == windowName)
{ {
return true; return true;
@@ -615,9 +615,9 @@ namespace GameLogic
// 获取插入到所属层级的位置 // 获取插入到所属层级的位置
int insertIndex = -1; 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; insertIndex = i + 1;
} }
@@ -626,9 +626,9 @@ namespace GameLogic
// 如果没有所属层级,找到相邻层级 // 如果没有所属层级,找到相邻层级
if (insertIndex == -1) 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; insertIndex = i + 1;
} }
@@ -642,31 +642,31 @@ namespace GameLogic
} }
// 最后插入到堆栈 // 最后插入到堆栈
_stack.Insert(insertIndex, window); _uiStack.Insert(insertIndex, window);
} }
private void Pop(UIWindow window) private void Pop(UIWindow window)
{ {
// 从堆栈里移除 // 从堆栈里移除
_stack.Remove(window); _uiStack.Remove(window);
} }
public void OnUpdate() public void OnUpdate()
{ {
if (_stack == null) if (_uiStack == null)
{ {
return; return;
} }
int count = _stack.Count; int count = _uiStack.Count;
for (int i = 0; i < _stack.Count; i++) for (int i = 0; i < _uiStack.Count; i++)
{ {
if (_stack.Count != count) if (_uiStack.Count != count)
{ {
break; break;
} }
var window = _stack[i]; var window = _uiStack[i];
window.InternalUpdate(); window.InternalUpdate();
} }
} }

View File

@@ -78,15 +78,15 @@ namespace GameLogic
List<UIWidget> listNextUpdateChild = null; List<UIWidget> listNextUpdateChild = null;
if (ListChild != null && ListChild.Count > 0) if (ListChild != null && ListChild.Count > 0)
{ {
listNextUpdateChild = m_listUpdateChild; listNextUpdateChild = ListUpdateChild;
var updateListValid = m_updateListValid; var updateListValid = UpdateListValid;
List<UIWidget> listChild = null; List<UIWidget> listChild = null;
if (!updateListValid) if (!updateListValid)
{ {
if (listNextUpdateChild == null) if (listNextUpdateChild == null)
{ {
listNextUpdateChild = new List<UIWidget>(); listNextUpdateChild = new List<UIWidget>();
m_listUpdateChild = listNextUpdateChild; ListUpdateChild = listNextUpdateChild;
} }
else else
{ {
@@ -119,7 +119,7 @@ namespace GameLogic
if (!updateListValid) if (!updateListValid)
{ {
m_updateListValid = true; UpdateListValid = true;
} }
} }
@@ -265,7 +265,7 @@ namespace GameLogic
for (var index = 0; index < listCanvas.Length; index++) for (var index = 0; index < listCanvas.Length; index++)
{ {
var childCanvas = listCanvas[index]; var childCanvas = listCanvas[index];
childCanvas.sortingOrder = parentCanvas.sortingOrder + childCanvas.sortingOrder % UIModule.WINDOW_DEEP; childCanvas.sortingOrder = parentCanvas.sortingOrder + childCanvas.sortingOrder % UIModule.WindowDeep;
} }
} }
} }

View File

@@ -138,7 +138,7 @@ namespace GameLogic
{ {
if (_canvas != null) if (_canvas != null)
{ {
return _canvas.gameObject.layer == UIModule.WINDOW_SHOW_LAYER; return _canvas.gameObject.layer == UIModule.WindowShowLayer;
} }
else else
{ {
@@ -150,7 +150,7 @@ namespace GameLogic
{ {
if (_canvas != null) 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) if (_canvas.gameObject.layer == setLayer)
return; return;
@@ -295,15 +295,15 @@ namespace GameLogic
List<UIWidget> listNextUpdateChild = null; List<UIWidget> listNextUpdateChild = null;
if (ListChild != null && ListChild.Count > 0) if (ListChild != null && ListChild.Count > 0)
{ {
listNextUpdateChild = m_listUpdateChild; listNextUpdateChild = ListUpdateChild;
var updateListValid = m_updateListValid; var updateListValid = UpdateListValid;
List<UIWidget> listChild = null; List<UIWidget> listChild = null;
if (!updateListValid) if (!updateListValid)
{ {
if (listNextUpdateChild == null) if (listNextUpdateChild == null)
{ {
listNextUpdateChild = new List<UIWidget>(); listNextUpdateChild = new List<UIWidget>();
m_listUpdateChild = listNextUpdateChild; ListUpdateChild = listNextUpdateChild;
} }
else else
{ {
@@ -336,7 +336,7 @@ namespace GameLogic
if (!updateListValid) if (!updateListValid)
{ {
m_updateListValid = true; UpdateListValid = true;
} }
} }

View File

@@ -281,16 +281,16 @@ namespace GameLogic
#region #region
private static bool m_isInit = false; private static bool _isInit = false;
private static void CheckInit() private static void CheckInit()
{ {
if (m_isInit == true) if (_isInit == true)
{ {
return; return;
} }
m_isInit = true; _isInit = true;
_updateDriver ??= ModuleSystem.GetModule<IUpdateDriver>(); _updateDriver ??= ModuleSystem.GetModule<IUpdateDriver>();
_updateDriver.AddUpdateListener(OnUpdate); _updateDriver.AddUpdateListener(OnUpdate);
@@ -304,12 +304,12 @@ namespace GameLogic
private static void DeInit() private static void DeInit()
{ {
if (m_isInit == false) if (_isInit == false)
{ {
return; return;
} }
m_isInit = false; _isInit = false;
_updateDriver ??= ModuleSystem.GetModule<IUpdateDriver>(); _updateDriver ??= ModuleSystem.GetModule<IUpdateDriver>();
_updateDriver.RemoveUpdateListener(OnUpdate); _updateDriver.RemoveUpdateListener(OnUpdate);

View File

@@ -10,11 +10,6 @@ namespace Procedure
/// </summary> /// </summary>
public abstract bool UseNativeDialog { get; } public abstract bool UseNativeDialog { get; }
protected IResourceModule _resourceModule; protected readonly IResourceModule _resourceModule = ModuleSystem.GetModule<IResourceModule>();
protected ProcedureBase()
{
_resourceModule = ModuleSystem.GetModule<IResourceModule>();
}
} }
} }

View File

@@ -10,7 +10,7 @@ namespace Procedure
{ {
public class ProcedureInitResources : ProcedureBase public class ProcedureInitResources : ProcedureBase
{ {
private bool m_InitResourcesComplete = false; private bool _initResourcesComplete = false;
public override bool UseNativeDialog => true; public override bool UseNativeDialog => true;
@@ -18,7 +18,7 @@ namespace Procedure
{ {
base.OnEnter(procedureOwner); base.OnEnter(procedureOwner);
m_InitResourcesComplete = false; _initResourcesComplete = false;
LauncherMgr.Show(UIDefine.UILoadUpdate, "初始化资源中..."); LauncherMgr.Show(UIDefine.UILoadUpdate, "初始化资源中...");
@@ -30,7 +30,7 @@ namespace Procedure
{ {
base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds); base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);
if (!m_InitResourcesComplete) if (!_initResourcesComplete)
{ {
// 初始化资源未完成则继续等待 // 初始化资源未完成则继续等待
return; return;
@@ -74,7 +74,7 @@ namespace Procedure
yield break; yield break;
} }
m_InitResourcesComplete = true; _initResourcesComplete = true;
} }
private void OnInitResourcesError(ProcedureOwner procedureOwner) private void OnInitResourcesError(ProcedureOwner procedureOwner)

View File

@@ -18,106 +18,103 @@ namespace Procedure
/// </summary> /// </summary>
public class ProcedureLoadAssembly : ProcedureBase public class ProcedureLoadAssembly : ProcedureBase
{ {
private bool m_enableAddressable = true; private bool _enableAddressable = true;
public override bool UseNativeDialog => true; public override bool UseNativeDialog => true;
private int m_LoadAssetCount; private int _loadAssetCount;
private int m_LoadMetadataAssetCount; private int _loadMetadataAssetCount;
private int m_FailureAssetCount; private int _failureAssetCount;
private int m_FailureMetadataAssetCount; private int _failureMetadataAssetCount;
private bool m_LoadAssemblyComplete; private bool _loadAssemblyComplete;
private bool m_LoadMetadataAssemblyComplete; private bool _loadMetadataAssemblyComplete;
private bool m_LoadAssemblyWait; private bool _loadAssemblyWait;
#pragma warning disable CS0414 private bool _loadMetadataAssemblyWait;
private bool m_LoadMetadataAssemblyWait; private Assembly _mainLogicAssembly;
#pragma warning restore CS0414 private List<Assembly> _hotfixAssemblyList;
private Assembly m_MainLogicAssembly; private IFsm<IProcedureModule> _procedureOwner;
private List<Assembly> m_HotfixAssemblys; private UpdateSetting _setting;
private IFsm<IProcedureModule> m_procedureOwner;
private UpdateSetting m_Setting;
protected override void OnInit(IFsm<IProcedureModule> procedureOwner) protected override void OnInit(IFsm<IProcedureModule> procedureOwner)
{ {
base.OnInit(procedureOwner); base.OnInit(procedureOwner);
m_Setting = Settings.UpdateSetting; _setting = Settings.UpdateSetting;
} }
protected override void OnEnter(IFsm<IProcedureModule> procedureOwner) protected override void OnEnter(IFsm<IProcedureModule> procedureOwner)
{ {
base.OnEnter(procedureOwner); base.OnEnter(procedureOwner);
Log.Debug("HyBridCLR ProcedureLoadAssembly OnEnter"); Log.Debug("HybridCLR ProcedureLoadAssembly OnEnter");
m_procedureOwner = procedureOwner; _procedureOwner = procedureOwner;
LoadAssembly().Forget(); LoadAssembly().Forget();
} }
private async UniTaskVoid LoadAssembly() private async UniTaskVoid LoadAssembly()
{ {
m_LoadAssemblyComplete = false; _loadAssemblyComplete = false;
m_HotfixAssemblys = new List<Assembly>(); _hotfixAssemblyList = new List<Assembly>();
//AOT Assembly加载原始metadata //AOT Assembly加载原始metadata
if (m_Setting.Enable) if (_setting.Enable)
{ {
#if !UNITY_EDITOR #if !UNITY_EDITOR
m_LoadMetadataAssemblyComplete = false; _loadMetadataAssemblyComplete = false;
LoadMetadataForAOTAssembly(); LoadMetadataForAOTAssembly();
#else #else
m_LoadMetadataAssemblyComplete = true; _loadMetadataAssemblyComplete = true;
#endif #endif
} }
else 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 else
{ {
if (m_Setting.Enable) if (_setting.Enable)
{ {
foreach (string hotUpdateDllName in m_Setting.HotUpdateAssemblies) foreach (string hotUpdateDllName in _setting.HotUpdateAssemblies)
{ {
var assetLocation = hotUpdateDllName; var assetLocation = hotUpdateDllName;
if (!m_enableAddressable) if (!_enableAddressable)
{ {
assetLocation = Utility.Path.GetRegularPath( assetLocation = Utility.Path.GetRegularPath(
Path.Combine( Path.Combine(
"Assets", "Assets",
m_Setting.AssemblyTextAssetPath, _setting.AssemblyTextAssetPath,
$"{hotUpdateDllName}{m_Setting.AssemblyTextAssetExtension}")); $"{hotUpdateDllName}{_setting.AssemblyTextAssetExtension}"));
} }
Log.Debug($"LoadAsset: [ {assetLocation} ]"); Log.Debug($"LoadAsset: [ {assetLocation} ]");
m_LoadAssetCount++; _loadAssetCount++;
var result = await _resourceModule.LoadAssetAsync<TextAsset>(assetLocation); var result = await _resourceModule.LoadAssetAsync<TextAsset>(assetLocation);
LoadAssetSuccess(result); LoadAssetSuccess(result);
} }
m_LoadAssemblyWait = true; _loadAssemblyWait = true;
} }
else else
{ {
m_MainLogicAssembly = GetMainLogicAssembly(); _mainLogicAssembly = GetMainLogicAssembly();
} }
} }
if (m_LoadAssetCount == 0) if (_loadAssetCount == 0)
{ {
m_LoadAssemblyComplete = true; _loadAssemblyComplete = true;
} }
} }
protected override void OnUpdate(IFsm<IProcedureModule> procedureOwner, float elapseSeconds, float realElapseSeconds) protected override void OnUpdate(IFsm<IProcedureModule> procedureOwner, float elapseSeconds, float realElapseSeconds)
{ {
base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds); base.OnUpdate(procedureOwner, elapseSeconds, realElapseSeconds);
if (!m_LoadAssemblyComplete) if (!_loadAssemblyComplete)
{ {
return; return;
} }
if (!m_LoadMetadataAssemblyComplete) if (!_loadMetadataAssemblyComplete)
{ {
return; return;
} }
@@ -126,17 +123,17 @@ namespace Procedure
private void AllAssemblyLoadComplete() private void AllAssemblyLoadComplete()
{ {
ChangeState<ProcedureStartGame>(m_procedureOwner); ChangeState<ProcedureStartGame>(_procedureOwner);
#if UNITY_EDITOR #if UNITY_EDITOR
m_MainLogicAssembly = GetMainLogicAssembly(); _mainLogicAssembly = GetMainLogicAssembly();
#endif #endif
if (m_MainLogicAssembly == null) if (_mainLogicAssembly == null)
{ {
Log.Fatal($"Main logic assembly missing."); Log.Fatal($"Main logic assembly missing.");
return; return;
} }
var appType = m_MainLogicAssembly.GetType("GameApp"); var appType = _mainLogicAssembly.GetType("GameApp");
if (appType == null) if (appType == null)
{ {
Log.Fatal($"Main logic type 'GameMain' missing."); Log.Fatal($"Main logic type 'GameMain' missing.");
@@ -148,31 +145,31 @@ namespace Procedure
Log.Fatal($"Main logic entry method 'Entrance' missing."); Log.Fatal($"Main logic entry method 'Entrance' missing.");
return; return;
} }
object[] objects = new object[] { new object[] { m_HotfixAssemblys } }; object[] objects = new object[] { new object[] { _hotfixAssemblyList } };
entryMethod.Invoke(appType, objects); entryMethod.Invoke(appType, objects);
} }
private Assembly GetMainLogicAssembly() private Assembly GetMainLogicAssembly()
{ {
m_HotfixAssemblys.Clear(); _hotfixAssemblyList.Clear();
Assembly mainLogicAssembly = null; Assembly mainLogicAssembly = null;
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies()) 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) StringComparison.Ordinal) == 0)
{ {
mainLogicAssembly = assembly; mainLogicAssembly = assembly;
} }
foreach (var hotUpdateDllName in m_Setting.HotUpdateAssemblies) foreach (var hotUpdateDllName in _setting.HotUpdateAssemblies)
{ {
if (hotUpdateDllName == $"{assembly.GetName().Name}.dll") 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; break;
} }
@@ -187,7 +184,7 @@ namespace Procedure
/// <param name="textAsset">代码资产。</param> /// <param name="textAsset">代码资产。</param>
private void LoadAssetSuccess(TextAsset textAsset) private void LoadAssetSuccess(TextAsset textAsset)
{ {
m_LoadAssetCount--; _loadAssetCount--;
if (textAsset == null) if (textAsset == null)
{ {
Log.Warning($"Load Assembly failed."); Log.Warning($"Load Assembly failed.");
@@ -200,22 +197,22 @@ namespace Procedure
try try
{ {
var assembly = Assembly.Load(textAsset.bytes); 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"); Log.Debug($"Assembly [ {assembly.GetName().Name} ] loaded");
} }
catch (Exception e) catch (Exception e)
{ {
m_FailureAssetCount++; _failureAssetCount++;
Log.Fatal(e); Log.Fatal(e);
throw; throw;
} }
finally finally
{ {
m_LoadAssemblyComplete = m_LoadAssemblyWait && 0 == m_LoadAssetCount; _loadAssemblyComplete = _loadAssemblyWait && 0 == _loadAssetCount;
} }
_resourceModule.UnloadAsset(textAsset); _resourceModule.UnloadAsset(textAsset);
} }
@@ -231,29 +228,29 @@ namespace Procedure
// 注意补充元数据是给AOT dll补充元数据而不是给热更新dll补充元数据。 // 注意补充元数据是给AOT dll补充元数据而不是给热更新dll补充元数据。
// 热更新dll不缺元数据不需要补充如果调用LoadMetadataForAOTAssembly会返回错误 // 热更新dll不缺元数据不需要补充如果调用LoadMetadataForAOTAssembly会返回错误
if (m_Setting.AOTMetaAssemblies.Count == 0) if (_setting.AOTMetaAssemblies.Count == 0)
{ {
m_LoadMetadataAssemblyComplete = true; _loadMetadataAssemblyComplete = true;
return; return;
} }
foreach (string aotDllName in m_Setting.AOTMetaAssemblies) foreach (string aotDllName in _setting.AOTMetaAssemblies)
{ {
var assetLocation = aotDllName; var assetLocation = aotDllName;
if (!m_enableAddressable) if (!_enableAddressable)
{ {
assetLocation = Utility.Path.GetRegularPath( assetLocation = Utility.Path.GetRegularPath(
Path.Combine( Path.Combine(
"Assets", "Assets",
m_Setting.AssemblyTextAssetPath, _setting.AssemblyTextAssetPath,
$"{aotDllName}{m_Setting.AssemblyTextAssetExtension}")); $"{aotDllName}{_setting.AssemblyTextAssetExtension}"));
} }
Log.Debug($"LoadMetadataAsset: [ {assetLocation} ]"); Log.Debug($"LoadMetadataAsset: [ {assetLocation} ]");
m_LoadMetadataAssetCount++; _loadMetadataAssetCount++;
_resourceModule.LoadAsset<TextAsset>(assetLocation, LoadMetadataAssetSuccess); _resourceModule.LoadAsset<TextAsset>(assetLocation, LoadMetadataAssetSuccess);
} }
m_LoadMetadataAssemblyWait = true; _loadMetadataAssemblyWait = true;
} }
/// <summary> /// <summary>
@@ -262,7 +259,7 @@ namespace Procedure
/// <param name="textAsset">代码资产。</param> /// <param name="textAsset">代码资产。</param>
private void LoadMetadataAssetSuccess(TextAsset textAsset) private void LoadMetadataAssetSuccess(TextAsset textAsset)
{ {
m_LoadMetadataAssetCount--; _loadMetadataAssetCount--;
if (null == textAsset) if (null == textAsset)
{ {
Log.Debug($"LoadMetadataAssetSuccess:Load Metadata failed."); Log.Debug($"LoadMetadataAssetSuccess:Load Metadata failed.");
@@ -283,13 +280,13 @@ namespace Procedure
} }
catch (Exception e) catch (Exception e)
{ {
m_FailureMetadataAssetCount++; _failureMetadataAssetCount++;
Log.Fatal(e.Message); Log.Fatal(e.Message);
throw; throw;
} }
finally finally
{ {
m_LoadMetadataAssemblyComplete = m_LoadMetadataAssemblyWait && 0 == m_LoadMetadataAssetCount; _loadMetadataAssemblyComplete = _loadMetadataAssemblyWait && 0 == _loadMetadataAssetCount;
} }
_resourceModule.UnloadAsset(textAsset); _resourceModule.UnloadAsset(textAsset);
} }

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2d267ef672bd9e54e81b5cae5eac09a3 guid: 56995850190b0cb43aaa2dde5e71890e
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ebf7360e04898ef44aa6de753faf3bfb
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -207,6 +207,54 @@ Transform:
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 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 --- !u!1001 &2425705316520036048
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@@ -8,12 +8,12 @@ namespace TEngine.Editor.Inspector
[CustomEditor(typeof(ProcedureSetting))] [CustomEditor(typeof(ProcedureSetting))]
internal sealed class ProcedureSettingInspector : GameFrameworkInspector internal sealed class ProcedureSettingInspector : GameFrameworkInspector
{ {
private SerializedProperty m_AvailableProcedureTypeNames = null; private SerializedProperty _availableProcedureTypeNames = null;
private SerializedProperty m_EntranceProcedureTypeName = null; private SerializedProperty _entranceProcedureTypeName = null;
private string[] m_ProcedureTypeNames = null; private string[] _procedureTypeNames = null;
private List<string> m_CurrentAvailableProcedureTypeNames = null; private List<string> _currentAvailableProcedureTypeNames = null;
private int m_EntranceProcedureIndex = -1; private int _entranceProcedureIndex = -1;
public override void OnInspectorGUI() public override void OnInspectorGUI()
{ {
@@ -23,7 +23,7 @@ namespace TEngine.Editor.Inspector
ProcedureSetting t = (ProcedureSetting)target; ProcedureSetting t = (ProcedureSetting)target;
if (string.IsNullOrEmpty(m_EntranceProcedureTypeName.stringValue)) if (string.IsNullOrEmpty(_entranceProcedureTypeName.stringValue))
{ {
EditorGUILayout.HelpBox("Entrance procedure is invalid.", MessageType.Error); EditorGUILayout.HelpBox("Entrance procedure is invalid.", MessageType.Error);
} }
@@ -31,23 +31,23 @@ namespace TEngine.Editor.Inspector
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode); EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
{ {
GUILayout.Label("Available Procedures", EditorStyles.boldLabel); GUILayout.Label("Available Procedures", EditorStyles.boldLabel);
if (m_ProcedureTypeNames.Length > 0) if (_procedureTypeNames.Length > 0)
{ {
EditorGUILayout.BeginVertical("box"); 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 != EditorGUILayout.ToggleLeft(procedureTypeName, selected))
{ {
if (!selected) if (!selected)
{ {
m_CurrentAvailableProcedureTypeNames.Add(procedureTypeName); _currentAvailableProcedureTypeNames.Add(procedureTypeName);
WriteAvailableProcedureTypeNames(); WriteAvailableProcedureTypeNames();
} }
else if (procedureTypeName != m_EntranceProcedureTypeName.stringValue) else if (procedureTypeName != _entranceProcedureTypeName.stringValue)
{ {
m_CurrentAvailableProcedureTypeNames.Remove(procedureTypeName); _currentAvailableProcedureTypeNames.Remove(procedureTypeName);
WriteAvailableProcedureTypeNames(); WriteAvailableProcedureTypeNames();
} }
} }
@@ -60,15 +60,15 @@ namespace TEngine.Editor.Inspector
EditorGUILayout.HelpBox("There is no available procedure.", MessageType.Warning); EditorGUILayout.HelpBox("There is no available procedure.", MessageType.Warning);
} }
if (m_CurrentAvailableProcedureTypeNames.Count > 0) if (_currentAvailableProcedureTypeNames.Count > 0)
{ {
EditorGUILayout.Separator(); EditorGUILayout.Separator();
int selectedIndex = EditorGUILayout.Popup("Entrance Procedure", m_EntranceProcedureIndex, m_CurrentAvailableProcedureTypeNames.ToArray()); int selectedIndex = EditorGUILayout.Popup("Entrance Procedure", _entranceProcedureIndex, _currentAvailableProcedureTypeNames.ToArray());
if (selectedIndex != m_EntranceProcedureIndex) if (selectedIndex != _entranceProcedureIndex)
{ {
m_EntranceProcedureIndex = selectedIndex; _entranceProcedureIndex = selectedIndex;
m_EntranceProcedureTypeName.stringValue = m_CurrentAvailableProcedureTypeNames[selectedIndex]; _entranceProcedureTypeName.stringValue = _currentAvailableProcedureTypeNames[selectedIndex];
} }
} }
else else
@@ -92,28 +92,28 @@ namespace TEngine.Editor.Inspector
private void OnEnable() private void OnEnable()
{ {
m_AvailableProcedureTypeNames = serializedObject.FindProperty("availableProcedureTypeNames"); _availableProcedureTypeNames = serializedObject.FindProperty("availableProcedureTypeNames");
m_EntranceProcedureTypeName = serializedObject.FindProperty("entranceProcedureTypeName"); _entranceProcedureTypeName = serializedObject.FindProperty("entranceProcedureTypeName");
RefreshTypeNames(); RefreshTypeNames();
} }
private void RefreshTypeNames() private void RefreshTypeNames()
{ {
m_ProcedureTypeNames = Type.GetRuntimeTypeNames(typeof(ProcedureBase)); _procedureTypeNames = Type.GetRuntimeTypeNames(typeof(ProcedureBase));
ReadAvailableProcedureTypeNames(); ReadAvailableProcedureTypeNames();
int oldCount = m_CurrentAvailableProcedureTypeNames.Count; int oldCount = _currentAvailableProcedureTypeNames.Count;
m_CurrentAvailableProcedureTypeNames = m_CurrentAvailableProcedureTypeNames.Where(x => m_ProcedureTypeNames.Contains(x)).ToList(); _currentAvailableProcedureTypeNames = _currentAvailableProcedureTypeNames.Where(x => _procedureTypeNames.Contains(x)).ToList();
if (m_CurrentAvailableProcedureTypeNames.Count != oldCount) if (_currentAvailableProcedureTypeNames.Count != oldCount)
{ {
WriteAvailableProcedureTypeNames(); WriteAvailableProcedureTypeNames();
} }
else if (!string.IsNullOrEmpty(m_EntranceProcedureTypeName.stringValue)) else if (!string.IsNullOrEmpty(_entranceProcedureTypeName.stringValue))
{ {
m_EntranceProcedureIndex = m_CurrentAvailableProcedureTypeNames.IndexOf(m_EntranceProcedureTypeName.stringValue); _entranceProcedureIndex = _currentAvailableProcedureTypeNames.IndexOf(_entranceProcedureTypeName.stringValue);
if (m_EntranceProcedureIndex < 0) if (_entranceProcedureIndex < 0)
{ {
m_EntranceProcedureTypeName.stringValue = null; _entranceProcedureTypeName.stringValue = null;
} }
} }
@@ -122,36 +122,36 @@ namespace TEngine.Editor.Inspector
private void ReadAvailableProcedureTypeNames() private void ReadAvailableProcedureTypeNames()
{ {
m_CurrentAvailableProcedureTypeNames = new List<string>(); _currentAvailableProcedureTypeNames = new List<string>();
int count = m_AvailableProcedureTypeNames.arraySize; int count = _availableProcedureTypeNames.arraySize;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
m_CurrentAvailableProcedureTypeNames.Add(m_AvailableProcedureTypeNames.GetArrayElementAtIndex(i).stringValue); _currentAvailableProcedureTypeNames.Add(_availableProcedureTypeNames.GetArrayElementAtIndex(i).stringValue);
} }
} }
private void WriteAvailableProcedureTypeNames() private void WriteAvailableProcedureTypeNames()
{ {
m_AvailableProcedureTypeNames.ClearArray(); _availableProcedureTypeNames.ClearArray();
if (m_CurrentAvailableProcedureTypeNames == null) if (_currentAvailableProcedureTypeNames == null)
{ {
return; return;
} }
m_CurrentAvailableProcedureTypeNames.Sort(); _currentAvailableProcedureTypeNames.Sort();
int count = m_CurrentAvailableProcedureTypeNames.Count; int count = _currentAvailableProcedureTypeNames.Count;
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
m_AvailableProcedureTypeNames.InsertArrayElementAtIndex(i); _availableProcedureTypeNames.InsertArrayElementAtIndex(i);
m_AvailableProcedureTypeNames.GetArrayElementAtIndex(i).stringValue = m_CurrentAvailableProcedureTypeNames[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); _entranceProcedureIndex = _currentAvailableProcedureTypeNames.IndexOf(_entranceProcedureTypeName.stringValue);
if (m_EntranceProcedureIndex < 0) if (_entranceProcedureIndex < 0)
{ {
m_EntranceProcedureTypeName.stringValue = null; _entranceProcedureTypeName.stringValue = null;
} }
} }
} }

View File

@@ -16,23 +16,23 @@ namespace TEngine.Editor.Inspector
"WebPlayMode (WebGL运行模式)" "WebPlayMode (WebGL运行模式)"
}; };
private SerializedProperty m_PlayMode = null; private SerializedProperty _playMode = null;
private SerializedProperty m_UpdatableWhilePlaying = null; private SerializedProperty _updatableWhilePlaying = null;
private SerializedProperty m_Milliseconds = null; private SerializedProperty _milliseconds = null;
private SerializedProperty m_MinUnloadUnusedAssetsInterval = null; private SerializedProperty _minUnloadUnusedAssetsInterval = null;
private SerializedProperty m_MaxUnloadUnusedAssetsInterval = null; private SerializedProperty _maxUnloadUnusedAssetsInterval = null;
private SerializedProperty m_UseSystemUnloadUnusedAssets = null; private SerializedProperty _useSystemUnloadUnusedAssets = null;
private SerializedProperty m_AssetAutoReleaseInterval = null; private SerializedProperty _assetAutoReleaseInterval = null;
private SerializedProperty m_AssetCapacity = null; private SerializedProperty _assetCapacity = null;
private SerializedProperty m_AssetExpireTime = null; private SerializedProperty _assetExpireTime = null;
private SerializedProperty m_AssetPriority = null; private SerializedProperty _assetPriority = null;
private SerializedProperty m_DownloadingMaxNum = null; private SerializedProperty _downloadingMaxNum = null;
private SerializedProperty m_FailedTryAgain = null; private SerializedProperty _failedTryAgain = null;
private SerializedProperty m_PackageName = null; private SerializedProperty _packageName = null;
private int m_playModeIndex = 0; private int _playModeIndex = 0;
private int m_PackageNameIndex = 0; private int _packageNameIndex = 0;
private string[] m_PackageNames; private string[] _packageNames;
public override void OnInspectorGUI() public override void OnInspectorGUI()
{ {
base.OnInspectorGUI(); base.OnInspectorGUI();
@@ -49,48 +49,48 @@ namespace TEngine.Editor.Inspector
} }
else else
{ {
int selectedIndex = EditorGUILayout.Popup("Play Mode", m_playModeIndex, _playModeNames); int selectedIndex = EditorGUILayout.Popup("Play Mode", _playModeIndex, _playModeNames);
if (selectedIndex != m_playModeIndex) if (selectedIndex != _playModeIndex)
{ {
m_playModeIndex = selectedIndex; _playModeIndex = selectedIndex;
m_PlayMode.enumValueIndex = selectedIndex; _playMode.enumValueIndex = selectedIndex;
} }
} }
} }
EditorGUILayout.PropertyField(m_UpdatableWhilePlaying); EditorGUILayout.PropertyField(_updatableWhilePlaying);
EditorGUI.EndDisabledGroup(); EditorGUI.EndDisabledGroup();
m_PackageNames = GetBuildPackageNames().ToArray(); _packageNames = GetBuildPackageNames().ToArray();
m_PackageNameIndex = Array.IndexOf(m_PackageNames, m_PackageName.stringValue); _packageNameIndex = Array.IndexOf(_packageNames, _packageName.stringValue);
if (m_PackageNameIndex < 0) if (_packageNameIndex < 0)
{ {
m_PackageNameIndex = 0; _packageNameIndex = 0;
} }
m_PackageNameIndex = EditorGUILayout.Popup("Package Name", m_PackageNameIndex, m_PackageNames); _packageNameIndex = EditorGUILayout.Popup("Package Name", _packageNameIndex, _packageNames);
if (m_PackageName.stringValue != m_PackageNames[m_PackageNameIndex]) if (_packageName.stringValue != _packageNames[_packageNameIndex])
{ {
m_PackageName.stringValue = m_PackageNames[m_PackageNameIndex]; _packageName.stringValue = _packageNames[_packageNameIndex];
} }
int milliseconds = EditorGUILayout.DelayedIntField("Milliseconds", m_Milliseconds.intValue); int milliseconds = EditorGUILayout.DelayedIntField("Milliseconds", _milliseconds.intValue);
if (milliseconds != m_Milliseconds.intValue) if (milliseconds != _milliseconds.intValue)
{ {
if (EditorApplication.isPlaying) if (EditorApplication.isPlaying)
{ {
t.Milliseconds = milliseconds; t.milliseconds = milliseconds;
} }
else else
{ {
m_Milliseconds.longValue = milliseconds; _milliseconds.longValue = milliseconds;
} }
} }
EditorGUILayout.PropertyField(m_UseSystemUnloadUnusedAssets); EditorGUILayout.PropertyField(_useSystemUnloadUnusedAssets);
float minUnloadUnusedAssetsInterval = float minUnloadUnusedAssetsInterval =
EditorGUILayout.Slider("Min Unload Unused Assets Interval", m_MinUnloadUnusedAssetsInterval.floatValue, 0f, 3600f); EditorGUILayout.Slider("Min Unload Unused Assets Interval", _minUnloadUnusedAssetsInterval.floatValue, 0f, 3600f);
if (Math.Abs(minUnloadUnusedAssetsInterval - m_MinUnloadUnusedAssetsInterval.floatValue) > 0.01f) if (Math.Abs(minUnloadUnusedAssetsInterval - _minUnloadUnusedAssetsInterval.floatValue) > 0.01f)
{ {
if (EditorApplication.isPlaying) if (EditorApplication.isPlaying)
{ {
@@ -98,13 +98,13 @@ namespace TEngine.Editor.Inspector
} }
else else
{ {
m_MinUnloadUnusedAssetsInterval.floatValue = minUnloadUnusedAssetsInterval; _minUnloadUnusedAssetsInterval.floatValue = minUnloadUnusedAssetsInterval;
} }
} }
float maxUnloadUnusedAssetsInterval = float maxUnloadUnusedAssetsInterval =
EditorGUILayout.Slider("Max Unload Unused Assets Interval", m_MaxUnloadUnusedAssetsInterval.floatValue, 0f, 3600f); EditorGUILayout.Slider("Max Unload Unused Assets Interval", _maxUnloadUnusedAssetsInterval.floatValue, 0f, 3600f);
if (Math.Abs(maxUnloadUnusedAssetsInterval - m_MaxUnloadUnusedAssetsInterval.floatValue) > 0.01f) if (Math.Abs(maxUnloadUnusedAssetsInterval - _maxUnloadUnusedAssetsInterval.floatValue) > 0.01f)
{ {
if (EditorApplication.isPlaying) if (EditorApplication.isPlaying)
{ {
@@ -112,12 +112,12 @@ namespace TEngine.Editor.Inspector
} }
else else
{ {
m_MaxUnloadUnusedAssetsInterval.floatValue = maxUnloadUnusedAssetsInterval; _maxUnloadUnusedAssetsInterval.floatValue = maxUnloadUnusedAssetsInterval;
} }
} }
float downloadingMaxNum = EditorGUILayout.Slider("Max Downloading Num", m_DownloadingMaxNum.intValue, 1f, 48f); float downloadingMaxNum = EditorGUILayout.Slider("Max Downloading Num", _downloadingMaxNum.intValue, 1f, 48f);
if (Math.Abs(downloadingMaxNum - m_DownloadingMaxNum.intValue) > 0.001f) if (Math.Abs(downloadingMaxNum - _downloadingMaxNum.intValue) > 0.001f)
{ {
if (EditorApplication.isPlaying) if (EditorApplication.isPlaying)
{ {
@@ -125,12 +125,12 @@ namespace TEngine.Editor.Inspector
} }
else else
{ {
m_DownloadingMaxNum.intValue = (int)downloadingMaxNum; _downloadingMaxNum.intValue = (int)downloadingMaxNum;
} }
} }
float failedTryAgain = EditorGUILayout.Slider("Max FailedTryAgain Count", m_FailedTryAgain.intValue, 1f, 48f); float failedTryAgain = EditorGUILayout.Slider("Max FailedTryAgain Count", _failedTryAgain.intValue, 1f, 48f);
if (Math.Abs(failedTryAgain - m_FailedTryAgain.intValue) > 0.001f) if (Math.Abs(failedTryAgain - _failedTryAgain.intValue) > 0.001f)
{ {
if (EditorApplication.isPlaying) if (EditorApplication.isPlaying)
{ {
@@ -138,14 +138,14 @@ namespace TEngine.Editor.Inspector
} }
else else
{ {
m_FailedTryAgain.intValue = (int)failedTryAgain; _failedTryAgain.intValue = (int)failedTryAgain;
} }
} }
EditorGUI.BeginDisabledGroup(EditorApplication.isPlaying); EditorGUI.BeginDisabledGroup(EditorApplication.isPlaying);
{ {
float assetAutoReleaseInterval = EditorGUILayout.DelayedFloatField("Asset Auto Release Interval", m_AssetAutoReleaseInterval.floatValue); float assetAutoReleaseInterval = EditorGUILayout.DelayedFloatField("Asset Auto Release Interval", _assetAutoReleaseInterval.floatValue);
if (Math.Abs(assetAutoReleaseInterval - m_AssetAutoReleaseInterval.floatValue) > 0.01f) if (Math.Abs(assetAutoReleaseInterval - _assetAutoReleaseInterval.floatValue) > 0.01f)
{ {
if (EditorApplication.isPlaying) if (EditorApplication.isPlaying)
{ {
@@ -153,12 +153,12 @@ namespace TEngine.Editor.Inspector
} }
else else
{ {
m_AssetAutoReleaseInterval.floatValue = assetAutoReleaseInterval; _assetAutoReleaseInterval.floatValue = assetAutoReleaseInterval;
} }
} }
int assetCapacity = EditorGUILayout.DelayedIntField("Asset Capacity", m_AssetCapacity.intValue); int assetCapacity = EditorGUILayout.DelayedIntField("Asset Capacity", _assetCapacity.intValue);
if (assetCapacity != m_AssetCapacity.intValue) if (assetCapacity != _assetCapacity.intValue)
{ {
if (EditorApplication.isPlaying) if (EditorApplication.isPlaying)
{ {
@@ -166,12 +166,12 @@ namespace TEngine.Editor.Inspector
} }
else else
{ {
m_AssetCapacity.intValue = assetCapacity; _assetCapacity.intValue = assetCapacity;
} }
} }
float assetExpireTime = EditorGUILayout.DelayedFloatField("Asset Expire Time", m_AssetExpireTime.floatValue); float assetExpireTime = EditorGUILayout.DelayedFloatField("Asset Expire Time", _assetExpireTime.floatValue);
if (Math.Abs(assetExpireTime - m_AssetExpireTime.floatValue) > 0.01f) if (Math.Abs(assetExpireTime - _assetExpireTime.floatValue) > 0.01f)
{ {
if (EditorApplication.isPlaying) if (EditorApplication.isPlaying)
{ {
@@ -179,12 +179,12 @@ namespace TEngine.Editor.Inspector
} }
else else
{ {
m_AssetExpireTime.floatValue = assetExpireTime; _assetExpireTime.floatValue = assetExpireTime;
} }
} }
int assetPriority = EditorGUILayout.DelayedIntField("Asset Priority", m_AssetPriority.intValue); int assetPriority = EditorGUILayout.DelayedIntField("Asset Priority", _assetPriority.intValue);
if (assetPriority != m_AssetPriority.intValue) if (assetPriority != _assetPriority.intValue)
{ {
if (EditorApplication.isPlaying) if (EditorApplication.isPlaying)
{ {
@@ -192,7 +192,7 @@ namespace TEngine.Editor.Inspector
} }
else else
{ {
m_AssetPriority.intValue = assetPriority; _assetPriority.intValue = assetPriority;
} }
} }
} }
@@ -219,19 +219,19 @@ namespace TEngine.Editor.Inspector
private void OnEnable() private void OnEnable()
{ {
m_PlayMode = serializedObject.FindProperty("playMode"); _playMode = serializedObject.FindProperty("playMode");
m_UpdatableWhilePlaying = serializedObject.FindProperty("m_UpdatableWhilePlaying"); _updatableWhilePlaying = serializedObject.FindProperty("updatableWhilePlaying");
m_Milliseconds = serializedObject.FindProperty("Milliseconds"); _milliseconds = serializedObject.FindProperty("milliseconds");
m_MinUnloadUnusedAssetsInterval = serializedObject.FindProperty("m_MinUnloadUnusedAssetsInterval"); _minUnloadUnusedAssetsInterval = serializedObject.FindProperty("minUnloadUnusedAssetsInterval");
m_MaxUnloadUnusedAssetsInterval = serializedObject.FindProperty("m_MaxUnloadUnusedAssetsInterval"); _maxUnloadUnusedAssetsInterval = serializedObject.FindProperty("maxUnloadUnusedAssetsInterval");
m_UseSystemUnloadUnusedAssets = serializedObject.FindProperty("m_UseSystemUnloadUnusedAssets"); _useSystemUnloadUnusedAssets = serializedObject.FindProperty("useSystemUnloadUnusedAssets");
m_AssetAutoReleaseInterval = serializedObject.FindProperty("m_AssetAutoReleaseInterval"); _assetAutoReleaseInterval = serializedObject.FindProperty("assetAutoReleaseInterval");
m_AssetCapacity = serializedObject.FindProperty("m_AssetCapacity"); _assetCapacity = serializedObject.FindProperty("assetCapacity");
m_AssetExpireTime = serializedObject.FindProperty("m_AssetExpireTime"); _assetExpireTime = serializedObject.FindProperty("assetExpireTime");
m_AssetPriority = serializedObject.FindProperty("m_AssetPriority"); _assetPriority = serializedObject.FindProperty("assetPriority");
m_DownloadingMaxNum = serializedObject.FindProperty("m_DownloadingMaxNum"); _downloadingMaxNum = serializedObject.FindProperty("downloadingMaxNum");
m_FailedTryAgain = serializedObject.FindProperty("m_FailedTryAgain"); _failedTryAgain = serializedObject.FindProperty("failedTryAgain");
m_PackageName = serializedObject.FindProperty("packageName"); _packageName = serializedObject.FindProperty("packageName");
RefreshModes(); RefreshModes();
RefreshTypeNames(); RefreshTypeNames();
@@ -239,7 +239,7 @@ namespace TEngine.Editor.Inspector
private void RefreshModes() private void RefreshModes()
{ {
m_playModeIndex = m_PlayMode.enumValueIndex > 0 ? m_PlayMode.enumValueIndex : 0; _playModeIndex = _playMode.enumValueIndex > 0 ? _playMode.enumValueIndex : 0;
} }
private void RefreshTypeNames() private void RefreshTypeNames()

View File

@@ -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 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 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 _editorLanguage = null;
private SerializedProperty m_TextHelperTypeName = null; private SerializedProperty _textHelperTypeName = null;
private SerializedProperty m_LogHelperTypeName = null; private SerializedProperty _logHelperTypeName = null;
private SerializedProperty m_JsonHelperTypeName = null; private SerializedProperty _jsonHelperTypeName = null;
private SerializedProperty m_FrameRate = null; private SerializedProperty _frameRate = null;
private SerializedProperty m_GameSpeed = null; private SerializedProperty _gameSpeed = null;
private SerializedProperty m_RunInBackground = null; private SerializedProperty _runInBackground = null;
private SerializedProperty m_NeverSleep = null; private SerializedProperty _neverSleep = null;
private string[] m_TextHelperTypeNames = null; private string[] _textHelperTypeNames = null;
private int m_TextHelperTypeNameIndex = 0; private int _textHelperTypeNameIndex = 0;
private string[] m_LogHelperTypeNames = null; private string[] _logHelperTypeNames = null;
private int m_LogHelperTypeNameIndex = 0; private int _logHelperTypeNameIndex = 0;
private string[] m_JsonHelperTypeNames = null; private string[] _jsonHelperTypeNames = null;
private int m_JsonHelperTypeNameIndex = 0; private int _jsonHelperTypeNameIndex = 0;
public override void OnInspectorGUI() public override void OnInspectorGUI()
{ {
@@ -40,39 +40,39 @@ namespace TEngine.Editor
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode); EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
{ {
EditorGUILayout.PropertyField(m_EditorLanguage); EditorGUILayout.PropertyField(_editorLanguage);
EditorGUILayout.BeginVertical("box"); EditorGUILayout.BeginVertical("box");
{ {
EditorGUILayout.LabelField("Global Helpers", EditorStyles.boldLabel); EditorGUILayout.LabelField("Global Helpers", EditorStyles.boldLabel);
int textHelperSelectedIndex = EditorGUILayout.Popup("Text Helper", m_TextHelperTypeNameIndex, m_TextHelperTypeNames); int textHelperSelectedIndex = EditorGUILayout.Popup("Text Helper", _textHelperTypeNameIndex, _textHelperTypeNames);
if (textHelperSelectedIndex != m_TextHelperTypeNameIndex) if (textHelperSelectedIndex != _textHelperTypeNameIndex)
{ {
m_TextHelperTypeNameIndex = textHelperSelectedIndex; _textHelperTypeNameIndex = textHelperSelectedIndex;
m_TextHelperTypeName.stringValue = textHelperSelectedIndex <= 0 ? null : m_TextHelperTypeNames[textHelperSelectedIndex]; _textHelperTypeName.stringValue = textHelperSelectedIndex <= 0 ? null : _textHelperTypeNames[textHelperSelectedIndex];
} }
int logHelperSelectedIndex = EditorGUILayout.Popup("Log Helper", m_LogHelperTypeNameIndex, m_LogHelperTypeNames); int logHelperSelectedIndex = EditorGUILayout.Popup("Log Helper", _logHelperTypeNameIndex, _logHelperTypeNames);
if (logHelperSelectedIndex != m_LogHelperTypeNameIndex) if (logHelperSelectedIndex != _logHelperTypeNameIndex)
{ {
m_LogHelperTypeNameIndex = logHelperSelectedIndex; _logHelperTypeNameIndex = logHelperSelectedIndex;
m_LogHelperTypeName.stringValue = logHelperSelectedIndex <= 0 ? null : m_LogHelperTypeNames[logHelperSelectedIndex]; _logHelperTypeName.stringValue = logHelperSelectedIndex <= 0 ? null : _logHelperTypeNames[logHelperSelectedIndex];
} }
int jsonHelperSelectedIndex = EditorGUILayout.Popup("JSON Helper", m_JsonHelperTypeNameIndex, m_JsonHelperTypeNames); int jsonHelperSelectedIndex = EditorGUILayout.Popup("JSON Helper", _jsonHelperTypeNameIndex, _jsonHelperTypeNames);
if (jsonHelperSelectedIndex != m_JsonHelperTypeNameIndex) if (jsonHelperSelectedIndex != _jsonHelperTypeNameIndex)
{ {
m_JsonHelperTypeNameIndex = jsonHelperSelectedIndex; _jsonHelperTypeNameIndex = jsonHelperSelectedIndex;
m_JsonHelperTypeName.stringValue = jsonHelperSelectedIndex <= 0 ? null : m_JsonHelperTypeNames[jsonHelperSelectedIndex]; _jsonHelperTypeName.stringValue = jsonHelperSelectedIndex <= 0 ? null : _jsonHelperTypeNames[jsonHelperSelectedIndex];
} }
} }
EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical();
} }
EditorGUI.EndDisabledGroup(); EditorGUI.EndDisabledGroup();
int frameRate = EditorGUILayout.IntSlider("Frame Rate", m_FrameRate.intValue, 1, 120); int frameRate = EditorGUILayout.IntSlider("Frame Rate", _frameRate.intValue, 1, 120);
if (frameRate != m_FrameRate.intValue) if (frameRate != _frameRate.intValue)
{ {
if (EditorApplication.isPlaying) if (EditorApplication.isPlaying)
{ {
@@ -80,20 +80,20 @@ namespace TEngine.Editor
} }
else else
{ {
m_FrameRate.intValue = frameRate; _frameRate.intValue = frameRate;
} }
} }
EditorGUILayout.BeginVertical("box"); 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); int selectedGameSpeed = GUILayout.SelectionGrid(GetSelectedGameSpeed(gameSpeed), GameSpeedForDisplay, 5);
if (selectedGameSpeed >= 0) if (selectedGameSpeed >= 0)
{ {
gameSpeed = GetGameSpeed(selectedGameSpeed); gameSpeed = GetGameSpeed(selectedGameSpeed);
} }
if (Math.Abs(gameSpeed - m_GameSpeed.floatValue) > 0.01f) if (Math.Abs(gameSpeed - _gameSpeed.floatValue) > 0.01f)
{ {
if (EditorApplication.isPlaying) if (EditorApplication.isPlaying)
{ {
@@ -101,14 +101,14 @@ namespace TEngine.Editor
} }
else else
{ {
m_GameSpeed.floatValue = gameSpeed; _gameSpeed.floatValue = gameSpeed;
} }
} }
} }
EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical();
bool runInBackground = EditorGUILayout.Toggle("Run in Background", m_RunInBackground.boolValue); bool runInBackground = EditorGUILayout.Toggle("Run in Background", _runInBackground.boolValue);
if (runInBackground != m_RunInBackground.boolValue) if (runInBackground != _runInBackground.boolValue)
{ {
if (EditorApplication.isPlaying) if (EditorApplication.isPlaying)
{ {
@@ -116,12 +116,12 @@ namespace TEngine.Editor
} }
else else
{ {
m_RunInBackground.boolValue = runInBackground; _runInBackground.boolValue = runInBackground;
} }
} }
bool neverSleep = EditorGUILayout.Toggle("Never Sleep", m_NeverSleep.boolValue); bool neverSleep = EditorGUILayout.Toggle("Never Sleep", _neverSleep.boolValue);
if (neverSleep != m_NeverSleep.boolValue) if (neverSleep != _neverSleep.boolValue)
{ {
if (EditorApplication.isPlaying) if (EditorApplication.isPlaying)
{ {
@@ -129,7 +129,7 @@ namespace TEngine.Editor
} }
else else
{ {
m_NeverSleep.boolValue = neverSleep; _neverSleep.boolValue = neverSleep;
} }
} }
@@ -145,14 +145,14 @@ namespace TEngine.Editor
private void OnEnable() private void OnEnable()
{ {
m_EditorLanguage = serializedObject.FindProperty("m_EditorLanguage"); _editorLanguage = serializedObject.FindProperty("editorLanguage");
m_TextHelperTypeName = serializedObject.FindProperty("m_TextHelperTypeName"); _textHelperTypeName = serializedObject.FindProperty("textHelperTypeName");
m_LogHelperTypeName = serializedObject.FindProperty("m_LogHelperTypeName"); _logHelperTypeName = serializedObject.FindProperty("logHelperTypeName");
m_JsonHelperTypeName = serializedObject.FindProperty("m_JsonHelperTypeName"); _jsonHelperTypeName = serializedObject.FindProperty("jsonHelperTypeName");
m_FrameRate = serializedObject.FindProperty("m_FrameRate"); _frameRate = serializedObject.FindProperty("frameRate");
m_GameSpeed = serializedObject.FindProperty("m_GameSpeed"); _gameSpeed = serializedObject.FindProperty("gameSpeed");
m_RunInBackground = serializedObject.FindProperty("m_RunInBackground"); _runInBackground = serializedObject.FindProperty("runInBackground");
m_NeverSleep = serializedObject.FindProperty("m_NeverSleep"); _neverSleep = serializedObject.FindProperty("neverSleep");
RefreshTypeNames(); RefreshTypeNames();
} }
@@ -165,15 +165,15 @@ namespace TEngine.Editor
}; };
textHelperTypeNames.AddRange(Type.GetRuntimeTypeNames(typeof(Utility.Text.ITextHelper))); textHelperTypeNames.AddRange(Type.GetRuntimeTypeNames(typeof(Utility.Text.ITextHelper)));
m_TextHelperTypeNames = textHelperTypeNames.ToArray(); _textHelperTypeNames = textHelperTypeNames.ToArray();
m_TextHelperTypeNameIndex = 0; _textHelperTypeNameIndex = 0;
if (!string.IsNullOrEmpty(m_TextHelperTypeName.stringValue)) if (!string.IsNullOrEmpty(_textHelperTypeName.stringValue))
{ {
m_TextHelperTypeNameIndex = textHelperTypeNames.IndexOf(m_TextHelperTypeName.stringValue); _textHelperTypeNameIndex = textHelperTypeNames.IndexOf(_textHelperTypeName.stringValue);
if (m_TextHelperTypeNameIndex <= 0) if (_textHelperTypeNameIndex <= 0)
{ {
m_TextHelperTypeNameIndex = 0; _textHelperTypeNameIndex = 0;
m_TextHelperTypeName.stringValue = null; _textHelperTypeName.stringValue = null;
} }
} }
@@ -183,15 +183,15 @@ namespace TEngine.Editor
}; };
logHelperTypeNames.AddRange(Type.GetRuntimeTypeNames(typeof(GameFrameworkLog.ILogHelper))); logHelperTypeNames.AddRange(Type.GetRuntimeTypeNames(typeof(GameFrameworkLog.ILogHelper)));
m_LogHelperTypeNames = logHelperTypeNames.ToArray(); _logHelperTypeNames = logHelperTypeNames.ToArray();
m_LogHelperTypeNameIndex = 0; _logHelperTypeNameIndex = 0;
if (!string.IsNullOrEmpty(m_LogHelperTypeName.stringValue)) if (!string.IsNullOrEmpty(_logHelperTypeName.stringValue))
{ {
m_LogHelperTypeNameIndex = logHelperTypeNames.IndexOf(m_LogHelperTypeName.stringValue); _logHelperTypeNameIndex = logHelperTypeNames.IndexOf(_logHelperTypeName.stringValue);
if (m_LogHelperTypeNameIndex <= 0) if (_logHelperTypeNameIndex <= 0)
{ {
m_LogHelperTypeNameIndex = 0; _logHelperTypeNameIndex = 0;
m_LogHelperTypeName.stringValue = null; _logHelperTypeName.stringValue = null;
} }
} }
@@ -201,15 +201,15 @@ namespace TEngine.Editor
}; };
jsonHelperTypeNames.AddRange(Type.GetRuntimeTypeNames(typeof(Utility.Json.IJsonHelper))); jsonHelperTypeNames.AddRange(Type.GetRuntimeTypeNames(typeof(Utility.Json.IJsonHelper)));
m_JsonHelperTypeNames = jsonHelperTypeNames.ToArray(); _jsonHelperTypeNames = jsonHelperTypeNames.ToArray();
m_JsonHelperTypeNameIndex = 0; _jsonHelperTypeNameIndex = 0;
if (!string.IsNullOrEmpty(m_JsonHelperTypeName.stringValue)) if (!string.IsNullOrEmpty(_jsonHelperTypeName.stringValue))
{ {
m_JsonHelperTypeNameIndex = jsonHelperTypeNames.IndexOf(m_JsonHelperTypeName.stringValue); _jsonHelperTypeNameIndex = jsonHelperTypeNames.IndexOf(_jsonHelperTypeName.stringValue);
if (m_JsonHelperTypeNameIndex <= 0) if (_jsonHelperTypeNameIndex <= 0)
{ {
m_JsonHelperTypeNameIndex = 0; _jsonHelperTypeNameIndex = 0;
m_JsonHelperTypeName.stringValue = null; _jsonHelperTypeName.stringValue = null;
} }
} }

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 07e683cdfed9cae409efdc29179643ed
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -341,7 +341,7 @@ namespace TEngine
[StructLayout(LayoutKind.Auto)] [StructLayout(LayoutKind.Auto)]
public struct Enumerator : IEnumerator<T>, IEnumerator public struct Enumerator : IEnumerator<T>, IEnumerator
{ {
private LinkedList<T>.Enumerator m_Enumerator; private LinkedList<T>.Enumerator _enumerator;
internal Enumerator(LinkedList<T> linkedList) internal Enumerator(LinkedList<T> linkedList)
{ {
@@ -350,25 +350,25 @@ namespace TEngine
throw new GameFrameworkException("Linked list is invalid."); throw new GameFrameworkException("Linked list is invalid.");
} }
m_Enumerator = linkedList.GetEnumerator(); _enumerator = linkedList.GetEnumerator();
} }
/// <summary> /// <summary>
/// 获取当前结点。 /// 获取当前结点。
/// </summary> /// </summary>
public T Current => m_Enumerator.Current; public T Current => _enumerator.Current;
/// <summary> /// <summary>
/// 获取当前的枚举数。 /// 获取当前的枚举数。
/// </summary> /// </summary>
object IEnumerator.Current => m_Enumerator.Current; object IEnumerator.Current => _enumerator.Current;
/// <summary> /// <summary>
/// 清理枚举数。 /// 清理枚举数。
/// </summary> /// </summary>
public void Dispose() public void Dispose()
{ {
m_Enumerator.Dispose(); _enumerator.Dispose();
} }
/// <summary> /// <summary>
@@ -377,7 +377,7 @@ namespace TEngine
/// <returns>返回下一个结点。</returns> /// <returns>返回下一个结点。</returns>
public bool MoveNext() public bool MoveNext()
{ {
return m_Enumerator.MoveNext(); return _enumerator.MoveNext();
} }
/// <summary> /// <summary>
@@ -385,7 +385,7 @@ namespace TEngine
/// </summary> /// </summary>
void IEnumerator.Reset() void IEnumerator.Reset()
{ {
((IEnumerator<T>)m_Enumerator).Reset(); ((IEnumerator<T>)_enumerator).Reset();
} }
} }
} }

View File

@@ -118,9 +118,9 @@ namespace TEngine
[StructLayout(LayoutKind.Auto)] [StructLayout(LayoutKind.Auto)]
public struct Enumerator : IEnumerator<T>, IEnumerator public struct Enumerator : IEnumerator<T>, IEnumerator
{ {
private readonly GameFrameworkLinkedListRange<T> m_GameFrameworkLinkedListRange; private readonly GameFrameworkLinkedListRange<T> _gameFrameworkLinkedListRange;
private LinkedListNode<T> m_Current; private LinkedListNode<T> _current;
private T m_CurrentValue; private T _currentValue;
internal Enumerator(GameFrameworkLinkedListRange<T> range) internal Enumerator(GameFrameworkLinkedListRange<T> range)
{ {
@@ -129,20 +129,20 @@ namespace TEngine
throw new GameFrameworkException("Range is invalid."); throw new GameFrameworkException("Range is invalid.");
} }
m_GameFrameworkLinkedListRange = range; _gameFrameworkLinkedListRange = range;
m_Current = m_GameFrameworkLinkedListRange._first; _current = _gameFrameworkLinkedListRange._first;
m_CurrentValue = default(T); _currentValue = default(T);
} }
/// <summary> /// <summary>
/// 获取当前结点。 /// 获取当前结点。
/// </summary> /// </summary>
public T Current => m_CurrentValue; public T Current => _currentValue;
/// <summary> /// <summary>
/// 获取当前的枚举数。 /// 获取当前的枚举数。
/// </summary> /// </summary>
object IEnumerator.Current => m_CurrentValue; object IEnumerator.Current => _currentValue;
/// <summary> /// <summary>
/// 清理枚举数。 /// 清理枚举数。
@@ -157,13 +157,13 @@ namespace TEngine
/// <returns>返回下一个结点。</returns> /// <returns>返回下一个结点。</returns>
public bool MoveNext() public bool MoveNext()
{ {
if (m_Current == null || m_Current == m_GameFrameworkLinkedListRange._terminal) if (_current == null || _current == _gameFrameworkLinkedListRange._terminal)
{ {
return false; return false;
} }
m_CurrentValue = m_Current.Value; _currentValue = _current.Value;
m_Current = m_Current.Next; _current = _current.Next;
return true; return true;
} }
@@ -172,8 +172,8 @@ namespace TEngine
/// </summary> /// </summary>
void IEnumerator.Reset() void IEnumerator.Reset()
{ {
m_Current = m_GameFrameworkLinkedListRange._first; _current = _gameFrameworkLinkedListRange._first;
m_CurrentValue = default(T); _currentValue = default(T);
} }
} }
} }

View File

@@ -207,7 +207,7 @@ namespace TEngine
[StructLayout(LayoutKind.Auto)] [StructLayout(LayoutKind.Auto)]
public struct Enumerator : IEnumerator<KeyValuePair<TKey, GameFrameworkLinkedListRange<TValue>>>, IEnumerator public struct Enumerator : IEnumerator<KeyValuePair<TKey, GameFrameworkLinkedListRange<TValue>>>, IEnumerator
{ {
private Dictionary<TKey, GameFrameworkLinkedListRange<TValue>>.Enumerator m_Enumerator; private Dictionary<TKey, GameFrameworkLinkedListRange<TValue>>.Enumerator _enumerator;
internal Enumerator(Dictionary<TKey, GameFrameworkLinkedListRange<TValue>> dictionary) internal Enumerator(Dictionary<TKey, GameFrameworkLinkedListRange<TValue>> dictionary)
{ {
@@ -216,25 +216,25 @@ namespace TEngine
throw new GameFrameworkException("Dictionary is invalid."); throw new GameFrameworkException("Dictionary is invalid.");
} }
m_Enumerator = dictionary.GetEnumerator(); _enumerator = dictionary.GetEnumerator();
} }
/// <summary> /// <summary>
/// 获取当前结点。 /// 获取当前结点。
/// </summary> /// </summary>
public KeyValuePair<TKey, GameFrameworkLinkedListRange<TValue>> Current => m_Enumerator.Current; public KeyValuePair<TKey, GameFrameworkLinkedListRange<TValue>> Current => _enumerator.Current;
/// <summary> /// <summary>
/// 获取当前的枚举数。 /// 获取当前的枚举数。
/// </summary> /// </summary>
object IEnumerator.Current => m_Enumerator.Current; object IEnumerator.Current => _enumerator.Current;
/// <summary> /// <summary>
/// 清理枚举数。 /// 清理枚举数。
/// </summary> /// </summary>
public void Dispose() public void Dispose()
{ {
m_Enumerator.Dispose(); _enumerator.Dispose();
} }
/// <summary> /// <summary>
@@ -243,7 +243,7 @@ namespace TEngine
/// <returns>返回下一个结点。</returns> /// <returns>返回下一个结点。</returns>
public bool MoveNext() public bool MoveNext()
{ {
return m_Enumerator.MoveNext(); return _enumerator.MoveNext();
} }
/// <summary> /// <summary>
@@ -251,7 +251,7 @@ namespace TEngine
/// </summary> /// </summary>
void IEnumerator.Reset() void IEnumerator.Reset()
{ {
((IEnumerator<KeyValuePair<TKey, GameFrameworkLinkedListRange<TValue>>>)m_Enumerator).Reset(); ((IEnumerator<KeyValuePair<TKey, GameFrameworkLinkedListRange<TValue>>>)_enumerator).Reset();
} }
} }
} }

View File

@@ -34,24 +34,17 @@ namespace TEngine
/// <summary> /// <summary>
/// 所有事件。 /// 所有事件。
/// </summary> /// </summary>
private readonly Dictionary<int, List<EventRegInfo>> _allEventListenerMap; private readonly Dictionary<int, List<EventRegInfo>> _allEventListenerMap = new();
/// <summary> /// <summary>
/// 用于标记一个事件是不是正在处理。 /// 用于标记一个事件是不是正在处理。
/// </summary> /// </summary>
private readonly List<int> _processEventList; private readonly List<int> _processEventList = new();
/// <summary> /// <summary>
/// 用于标记一个事件是不是被移除。 /// 用于标记一个事件是不是被移除。
/// </summary> /// </summary>
private readonly List<int> _delayDeleteEventList; private readonly List<int> _delayDeleteEventList = new();
public ActorEventDispatcher()
{
_processEventList = new List<int>();
_delayDeleteEventList = new List<int>();
_allEventListenerMap = new Dictionary<int, List<EventRegInfo>>();
}
/// <summary> /// <summary>
/// 移除所有事件监听。 /// 移除所有事件监听。

View File

@@ -76,7 +76,7 @@ namespace TEngine
this.audioMixer = audioMixer; this.audioMixer = audioMixer;
_maxChannel = maxChannel; _maxChannel = maxChannel;
_audioGroupConfig = audioGroupConfig; _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) if (audioMixerGroups.Length > 0)
{ {
_audioMixerGroup = audioMixerGroups[0]; _audioMixerGroup = audioMixerGroups[0];

View File

@@ -1,5 +1,6 @@
using System; using System;
using UnityEngine; using UnityEngine;
using UnityEngine.Serialization;
namespace TEngine namespace TEngine
{ {
@@ -9,19 +10,19 @@ namespace TEngine
[Serializable] [Serializable]
public sealed class AudioGroupConfig 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;
/// <summary> /// <summary>
/// 音效分类,可分别关闭/开启对应分类音效。 /// 音效分类,可分别关闭/开启对应分类音效。
/// </summary> /// </summary>
/// <remarks>命名与AudioMixer中分类名保持一致。</remarks> /// <remarks>命名与AudioMixer中分类名保持一致。</remarks>
public AudioType AudioType; public AudioType audioType;
/// <summary> /// <summary>
/// 音频源中3D声音的衰减模式。 /// 音频源中3D声音的衰减模式。
@@ -44,22 +45,22 @@ namespace TEngine
/// <summary> /// <summary>
/// 音频轨道组配置的名称。 /// 音频轨道组配置的名称。
/// </summary> /// </summary>
public string Name => m_Name; public string Name => name;
/// <summary> /// <summary>
/// 是否禁用。 /// 是否禁用。
/// </summary> /// </summary>
public bool Mute => m_Mute; public bool Mute => mute;
/// <summary> /// <summary>
/// 音量大小。 /// 音量大小。
/// </summary> /// </summary>
public float Volume => m_Volume; public float Volume => volume;
/// <summary> /// <summary>
/// 音频代理个数。 /// 音频代理个数。
/// <remarks>命名与AudioMixer中个数保持一致。</remarks> /// <remarks>命名与AudioMixer中个数保持一致。</remarks>
/// </summary> /// </summary>
public int AgentHelperCount => m_AgentHelperCount; public int AgentHelperCount => agentHelperCount;
} }
} }

View File

@@ -389,7 +389,7 @@ namespace TEngine
for (int index = 0; index < (int)AudioType.Max; ++index) for (int index = 0; index < (int)AudioType.Max; ++index)
{ {
AudioType audioType = (AudioType)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); _audioCategories[index] = new AudioCategory(audioGroupConfig.AgentHelperCount, _audioMixer, audioGroupConfig);
_categoriesVolume[index] = audioGroupConfig.Volume; _categoriesVolume[index] = audioGroupConfig.Volume;
} }

View File

@@ -10,22 +10,22 @@ namespace TEngine
/// </summary> /// </summary>
public sealed class LogNode : IMemory public sealed class LogNode : IMemory
{ {
private DateTime m_LogTime; private DateTime _logTime;
private int m_LogFrameCount; private int _logFrameCount;
private LogType m_LogType; private LogType _logType;
private string m_LogMessage; private string _logMessage;
private string m_StackTrack; private string _stackTrack;
/// <summary> /// <summary>
/// 初始化日志记录结点的新实例。 /// 初始化日志记录结点的新实例。
/// </summary> /// </summary>
public LogNode() public LogNode()
{ {
m_LogTime = default(DateTime); _logTime = default(DateTime);
m_LogFrameCount = 0; _logFrameCount = 0;
m_LogType = LogType.Error; _logType = LogType.Error;
m_LogMessage = null; _logMessage = null;
m_StackTrack = null; _stackTrack = null;
} }
/// <summary> /// <summary>
@@ -35,7 +35,7 @@ namespace TEngine
{ {
get get
{ {
return m_LogTime; return _logTime;
} }
} }
@@ -46,7 +46,7 @@ namespace TEngine
{ {
get get
{ {
return m_LogFrameCount; return _logFrameCount;
} }
} }
@@ -57,7 +57,7 @@ namespace TEngine
{ {
get get
{ {
return m_LogType; return _logType;
} }
} }
@@ -68,7 +68,7 @@ namespace TEngine
{ {
get get
{ {
return m_LogMessage; return _logMessage;
} }
} }
@@ -79,7 +79,7 @@ namespace TEngine
{ {
get get
{ {
return m_StackTrack; return _stackTrack;
} }
} }
@@ -93,11 +93,11 @@ namespace TEngine
public static LogNode Create(LogType logType, string logMessage, string stackTrack) public static LogNode Create(LogType logType, string logMessage, string stackTrack)
{ {
LogNode logNode = MemoryPool.Acquire<LogNode>(); LogNode logNode = MemoryPool.Acquire<LogNode>();
logNode.m_LogTime = DateTime.UtcNow; logNode._logTime = DateTime.UtcNow;
logNode.m_LogFrameCount = Time.frameCount; logNode._logFrameCount = Time.frameCount;
logNode.m_LogType = logType; logNode._logType = logType;
logNode.m_LogMessage = logMessage; logNode._logMessage = logMessage;
logNode.m_StackTrack = stackTrack; logNode._stackTrack = stackTrack;
return logNode; return logNode;
} }
@@ -106,11 +106,11 @@ namespace TEngine
/// </summary> /// </summary>
public void Clear() public void Clear()
{ {
m_LogTime = default(DateTime); _logTime = default(DateTime);
m_LogFrameCount = 0; _logFrameCount = 0;
m_LogType = LogType.Error; _logType = LogType.Error;
m_LogMessage = null; _logMessage = null;
m_StackTrack = null; _stackTrack = null;
} }
} }
} }

View File

@@ -8,10 +8,10 @@ namespace TEngine
{ {
private sealed class MemoryPoolPoolInformationWindow : ScrollableDebuggerWindowBase private sealed class MemoryPoolPoolInformationWindow : ScrollableDebuggerWindowBase
{ {
private readonly Dictionary<string, List<MemoryPoolInfo>> m_MemoryPoolInfos = new Dictionary<string, List<MemoryPoolInfo>>(StringComparer.Ordinal); private readonly Dictionary<string, List<MemoryPoolInfo>> _memoryPoolInfos = new Dictionary<string, List<MemoryPoolInfo>>(StringComparer.Ordinal);
private readonly Comparison<MemoryPoolInfo> m_NormalClassNameComparer = NormalClassNameComparer; private readonly Comparison<MemoryPoolInfo> _normalClassNameComparer = NormalClassNameComparer;
private readonly Comparison<MemoryPoolInfo> m_FullClassNameComparer = FullClassNameComparer; private readonly Comparison<MemoryPoolInfo> _fullClassNameComparer = FullClassNameComparer;
private bool m_ShowFullClassName = false; private bool _showFullClassName = false;
public override void Initialize(params object[] args) public override void Initialize(params object[] args)
{ {
@@ -27,30 +27,30 @@ namespace TEngine
} }
GUILayout.EndVertical(); GUILayout.EndVertical();
m_ShowFullClassName = GUILayout.Toggle(m_ShowFullClassName, "Show Full Class Name"); _showFullClassName = GUILayout.Toggle(_showFullClassName, "Show Full Class Name");
m_MemoryPoolInfos.Clear(); _memoryPoolInfos.Clear();
MemoryPoolInfo[] memoryPoolInfos = MemoryPool.GetAllMemoryPoolInfos(); MemoryPoolInfo[] memoryPoolInfos = MemoryPool.GetAllMemoryPoolInfos();
foreach (MemoryPoolInfo memoryPoolInfo in memoryPoolInfos) foreach (MemoryPoolInfo memoryPoolInfo in memoryPoolInfos)
{ {
string assemblyName = memoryPoolInfo.Type.Assembly.GetName().Name; string assemblyName = memoryPoolInfo.Type.Assembly.GetName().Name;
List<MemoryPoolInfo> results = null; List<MemoryPoolInfo> results = null;
if (!m_MemoryPoolInfos.TryGetValue(assemblyName, out results)) if (!_memoryPoolInfos.TryGetValue(assemblyName, out results))
{ {
results = new List<MemoryPoolInfo>(); results = new List<MemoryPoolInfo>();
m_MemoryPoolInfos.Add(assemblyName, results); _memoryPoolInfos.Add(assemblyName, results);
} }
results.Add(memoryPoolInfo); results.Add(memoryPoolInfo);
} }
foreach (KeyValuePair<string, List<MemoryPoolInfo>> assemblyMemoryPoolInfo in m_MemoryPoolInfos) foreach (KeyValuePair<string, List<MemoryPoolInfo>> assemblyMemoryPoolInfo in _memoryPoolInfos)
{ {
GUILayout.Label(Utility.Text.Format("<b>Assembly: {0}</b>", assemblyMemoryPoolInfo.Key)); GUILayout.Label(Utility.Text.Format("<b>Assembly: {0}</b>", assemblyMemoryPoolInfo.Key));
GUILayout.BeginVertical("box"); GUILayout.BeginVertical("box");
{ {
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
{ {
GUILayout.Label(m_ShowFullClassName ? "<b>Full Class Name</b>" : "<b>Class Name</b>"); GUILayout.Label(_showFullClassName ? "<b>Full Class Name</b>" : "<b>Class Name</b>");
GUILayout.Label("<b>Unused</b>", GUILayout.Width(60f)); GUILayout.Label("<b>Unused</b>", GUILayout.Width(60f));
GUILayout.Label("<b>Using</b>", GUILayout.Width(60f)); GUILayout.Label("<b>Using</b>", GUILayout.Width(60f));
GUILayout.Label("<b>Acquire</b>", GUILayout.Width(60f)); GUILayout.Label("<b>Acquire</b>", GUILayout.Width(60f));
@@ -62,7 +62,7 @@ namespace TEngine
if (assemblyMemoryPoolInfo.Value.Count > 0) 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) foreach (MemoryPoolInfo memoryPoolInfo in assemblyMemoryPoolInfo.Value)
{ {
DrawMemoryPoolInfo(memoryPoolInfo); DrawMemoryPoolInfo(memoryPoolInfo);
@@ -81,7 +81,7 @@ namespace TEngine
{ {
GUILayout.BeginHorizontal(); 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.UnusedMemoryCount.ToString(), GUILayout.Width(60f));
GUILayout.Label(memoryPoolInfo.UsingMemoryCount.ToString(), GUILayout.Width(60f)); GUILayout.Label(memoryPoolInfo.UsingMemoryCount.ToString(), GUILayout.Width(60f));
GUILayout.Label(memoryPoolInfo.AcquireMemoryCount.ToString(), GUILayout.Width(60f)); GUILayout.Label(memoryPoolInfo.AcquireMemoryCount.ToString(), GUILayout.Width(60f));

View File

@@ -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<NetworkComponent>();
// if (m_NetworkComponent == null)
// {
// Log.Fatal("Network component is invalid.");
// return;
// }
// }
//
// protected override void OnDrawScrollableWindow()
// {
// GUILayout.Label("<b>Network Information</b>");
// 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("<b>Network Channel: {0} ({1})</b>", 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();
// }
// }
// }
// }

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 91eb2683b03a4eb0afdd2edd034df2cc
timeCreated: 1680489774

View File

@@ -6,7 +6,7 @@ namespace TEngine
{ {
private sealed class QualityInformationWindow : ScrollableDebuggerWindowBase private sealed class QualityInformationWindow : ScrollableDebuggerWindowBase
{ {
private bool m_ApplyExpensiveChanges = false; private bool _applyExpensiveChanges = false;
protected override void OnDrawScrollableWindow() protected override void OnDrawScrollableWindow()
{ {
@@ -16,12 +16,12 @@ namespace TEngine
int currentQualityLevel = QualitySettings.GetQualityLevel(); int currentQualityLevel = QualitySettings.GetQualityLevel();
DrawItem("Current Quality Level", QualitySettings.names[currentQualityLevel]); 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"); int newQualityLevel = GUILayout.SelectionGrid(currentQualityLevel, QualitySettings.names, 3, "toggle");
if (newQualityLevel != currentQualityLevel) if (newQualityLevel != currentQualityLevel)
{ {
QualitySettings.SetQualityLevel(newQualityLevel, m_ApplyExpensiveChanges); QualitySettings.SetQualityLevel(newQualityLevel, _applyExpensiveChanges);
} }
} }
GUILayout.EndVertical(); GUILayout.EndVertical();

View File

@@ -6,24 +6,24 @@
{ {
private sealed class Sample private sealed class Sample
{ {
private readonly string m_Name; private readonly string _name;
private readonly string m_Type; private readonly string _type;
private readonly long m_Size; private readonly long _size;
private bool m_Highlight; private bool _highlight;
public Sample(string name, string type, long size) public Sample(string name, string type, long size)
{ {
m_Name = name; _name = name;
m_Type = type; _type = type;
m_Size = size; _size = size;
m_Highlight = false; _highlight = false;
} }
public string Name public string Name
{ {
get get
{ {
return m_Name; return _name;
} }
} }
@@ -31,7 +31,7 @@
{ {
get get
{ {
return m_Type; return _type;
} }
} }
@@ -39,7 +39,7 @@
{ {
get get
{ {
return m_Size; return _size;
} }
} }
@@ -47,11 +47,11 @@
{ {
get get
{ {
return m_Highlight; return _highlight;
} }
set set
{ {
m_Highlight = value; _highlight = value;
} }
} }
} }

View File

@@ -13,12 +13,12 @@ namespace TEngine
{ {
private const int ShowSampleCount = 300; private const int ShowSampleCount = 300;
private readonly List<Sample> m_Samples = new List<Sample>(); private readonly List<Sample> _samples = new List<Sample>();
private readonly Comparison<Sample> m_SampleComparer = SampleComparer; private readonly Comparison<Sample> _sampleComparer = SampleComparer;
private DateTime m_SampleTime = DateTime.MinValue; private DateTime _sampleTime = DateTime.MinValue;
private long m_SampleSize = 0L; private long _sampleSize = 0L;
private long m_DuplicateSampleSize = 0L; private long _duplicateSampleSize = 0L;
private int m_DuplicateSimpleCount = 0; private int _duplicateSimpleCount = 0;
protected override void OnDrawScrollableWindow() protected override void OnDrawScrollableWindow()
{ {
@@ -31,22 +31,22 @@ namespace TEngine
TakeSample(); TakeSample();
} }
if (m_SampleTime <= DateTime.MinValue) if (_sampleTime <= DateTime.MinValue)
{ {
GUILayout.Label(Utility.Text.Format("<b>Please take sample for {0} first.</b>", typeName)); GUILayout.Label(Utility.Text.Format("<b>Please take sample for {0} first.</b>", typeName));
} }
else else
{ {
if (m_DuplicateSimpleCount > 0) if (_duplicateSimpleCount > 0)
{ {
GUILayout.Label(Utility.Text.Format("<b>{0} {1}s ({2}) obtained at {3:yyyy-MM-dd HH:mm:ss}, while {4} {1}s ({5}) might be duplicated.</b>", m_Samples.Count, typeName, GetByteLengthString(m_SampleSize), m_SampleTime.ToLocalTime(), m_DuplicateSimpleCount, GetByteLengthString(m_DuplicateSampleSize))); GUILayout.Label(Utility.Text.Format("<b>{0} {1}s ({2}) obtained at {3:yyyy-MM-dd HH:mm:ss}, while {4} {1}s ({5}) might be duplicated.</b>", _samples.Count, typeName, GetByteLengthString(_sampleSize), _sampleTime.ToLocalTime(), _duplicateSimpleCount, GetByteLengthString(_duplicateSampleSize)));
} }
else else
{ {
GUILayout.Label(Utility.Text.Format("<b>{0} {1}s ({2}) obtained at {3:yyyy-MM-dd HH:mm:ss}.</b>", m_Samples.Count, typeName, GetByteLengthString(m_SampleSize), m_SampleTime.ToLocalTime())); GUILayout.Label(Utility.Text.Format("<b>{0} {1}s ({2}) obtained at {3:yyyy-MM-dd HH:mm:ss}.</b>", _samples.Count, typeName, GetByteLengthString(_sampleSize), _sampleTime.ToLocalTime()));
} }
if (m_Samples.Count > 0) if (_samples.Count > 0)
{ {
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
{ {
@@ -58,13 +58,13 @@ namespace TEngine
} }
int count = 0; int count = 0;
for (int i = 0; i < m_Samples.Count; i++) for (int i = 0; i < _samples.Count; i++)
{ {
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
{ {
GUILayout.Label(m_Samples[i].Highlight ? Utility.Text.Format("<color=yellow>{0}</color>", m_Samples[i].Name) : m_Samples[i].Name); GUILayout.Label(_samples[i].Highlight ? Utility.Text.Format("<color=yellow>{0}</color>", _samples[i].Name) : _samples[i].Name);
GUILayout.Label(m_Samples[i].Highlight ? Utility.Text.Format("<color=yellow>{0}</color>", m_Samples[i].Type) : m_Samples[i].Type, GUILayout.Width(240f)); GUILayout.Label(_samples[i].Highlight ? Utility.Text.Format("<color=yellow>{0}</color>", _samples[i].Type) : _samples[i].Type, GUILayout.Width(240f));
GUILayout.Label(m_Samples[i].Highlight ? Utility.Text.Format("<color=yellow>{0}</color>", GetByteLengthString(m_Samples[i].Size)) : GetByteLengthString(m_Samples[i].Size), GUILayout.Width(80f)); GUILayout.Label(_samples[i].Highlight ? Utility.Text.Format("<color=yellow>{0}</color>", GetByteLengthString(_samples[i].Size)) : GetByteLengthString(_samples[i].Size), GUILayout.Width(80f));
} }
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
@@ -81,11 +81,11 @@ namespace TEngine
private void TakeSample() private void TakeSample()
{ {
m_SampleTime = DateTime.UtcNow; _sampleTime = DateTime.UtcNow;
m_SampleSize = 0L; _sampleSize = 0L;
m_DuplicateSampleSize = 0L; _duplicateSampleSize = 0L;
m_DuplicateSimpleCount = 0; _duplicateSimpleCount = 0;
m_Samples.Clear(); _samples.Clear();
T[] samples = Resources.FindObjectsOfTypeAll<T>(); T[] samples = Resources.FindObjectsOfTypeAll<T>();
for (int i = 0; i < samples.Length; i++) for (int i = 0; i < samples.Length; i++)
@@ -96,19 +96,19 @@ namespace TEngine
#else #else
sampleSize = Profiler.GetRuntimeMemorySize(samples[i]); sampleSize = Profiler.GetRuntimeMemorySize(samples[i]);
#endif #endif
m_SampleSize += sampleSize; _sampleSize += sampleSize;
m_Samples.Add(new Sample(samples[i].name, samples[i].GetType().Name, 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; _samples[i].Highlight = true;
m_DuplicateSampleSize += m_Samples[i].Size; _duplicateSampleSize += _samples[i].Size;
m_DuplicateSimpleCount++; _duplicateSimpleCount++;
} }
} }
} }

View File

@@ -6,22 +6,22 @@
{ {
private sealed class Record private sealed class Record
{ {
private readonly string m_Name; private readonly string _name;
private int m_Count; private int _count;
private long m_Size; private long _size;
public Record(string name) public Record(string name)
{ {
m_Name = name; _name = name;
m_Count = 0; _count = 0;
m_Size = 0L; _size = 0L;
} }
public string Name public string Name
{ {
get get
{ {
return m_Name; return _name;
} }
} }
@@ -29,11 +29,11 @@
{ {
get get
{ {
return m_Count; return _count;
} }
set set
{ {
m_Count = value; _count = value;
} }
} }
@@ -41,11 +41,11 @@
{ {
get get
{ {
return m_Size; return _size;
} }
set set
{ {
m_Size = value; _size = value;
} }
} }
} }

View File

@@ -11,11 +11,11 @@ namespace TEngine
{ {
private sealed partial class RuntimeMemorySummaryWindow : ScrollableDebuggerWindowBase private sealed partial class RuntimeMemorySummaryWindow : ScrollableDebuggerWindowBase
{ {
private readonly List<Record> m_Records = new List<Record>(); private readonly List<Record> _records = new List<Record>();
private readonly Comparison<Record> m_RecordComparer = RecordComparer; private readonly Comparison<Record> _recordComparer = RecordComparer;
private DateTime m_SampleTime = DateTime.MinValue; private DateTime _sampleTime = DateTime.MinValue;
private int m_SampleCount = 0; private int _sampleCount = 0;
private long m_SampleSize = 0L; private long _sampleSize = 0L;
protected override void OnDrawScrollableWindow() protected override void OnDrawScrollableWindow()
{ {
@@ -27,13 +27,13 @@ namespace TEngine
TakeSample(); TakeSample();
} }
if (m_SampleTime <= DateTime.MinValue) if (_sampleTime <= DateTime.MinValue)
{ {
GUILayout.Label("<b>Please take sample first.</b>"); GUILayout.Label("<b>Please take sample first.</b>");
} }
else else
{ {
GUILayout.Label(Utility.Text.Format("<b>{0} Objects ({1}) obtained at {2:yyyy-MM-dd HH:mm:ss}.</b>", m_SampleCount, GetByteLengthString(m_SampleSize), m_SampleTime.ToLocalTime())); GUILayout.Label(Utility.Text.Format("<b>{0} Objects ({1}) obtained at {2:yyyy-MM-dd HH:mm:ss}.</b>", _sampleCount, GetByteLengthString(_sampleSize), _sampleTime.ToLocalTime()));
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
{ {
@@ -43,13 +43,13 @@ namespace TEngine
} }
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
for (int i = 0; i < m_Records.Count; i++) for (int i = 0; i < _records.Count; i++)
{ {
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
{ {
GUILayout.Label(m_Records[i].Name); GUILayout.Label(_records[i].Name);
GUILayout.Label(m_Records[i].Count.ToString(), GUILayout.Width(120f)); GUILayout.Label(_records[i].Count.ToString(), GUILayout.Width(120f));
GUILayout.Label(GetByteLengthString(m_Records[i].Size), GUILayout.Width(120f)); GUILayout.Label(GetByteLengthString(_records[i].Size), GUILayout.Width(120f));
} }
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
} }
@@ -60,10 +60,10 @@ namespace TEngine
private void TakeSample() private void TakeSample()
{ {
m_Records.Clear(); _records.Clear();
m_SampleTime = DateTime.UtcNow; _sampleTime = DateTime.UtcNow;
m_SampleCount = 0; _sampleCount = 0;
m_SampleSize = 0L; _sampleSize = 0L;
UnityEngine.Object[] samples = Resources.FindObjectsOfTypeAll<UnityEngine.Object>(); UnityEngine.Object[] samples = Resources.FindObjectsOfTypeAll<UnityEngine.Object>();
for (int i = 0; i < samples.Length; i++) for (int i = 0; i < samples.Length; i++)
@@ -75,11 +75,11 @@ namespace TEngine
sampleSize = Profiler.GetRuntimeMemorySize(samples[i]); sampleSize = Profiler.GetRuntimeMemorySize(samples[i]);
#endif #endif
string name = samples[i].GetType().Name; string name = samples[i].GetType().Name;
m_SampleCount++; _sampleCount++;
m_SampleSize += sampleSize; _sampleSize += sampleSize;
Record record = null; Record record = null;
foreach (Record r in m_Records) foreach (Record r in _records)
{ {
if (r.Name == name) if (r.Name == name)
{ {
@@ -91,14 +91,14 @@ namespace TEngine
if (record == null) if (record == null)
{ {
record = new Record(name); record = new Record(name);
m_Records.Add(record); _records.Add(record);
} }
record.Count++; record.Count++;
record.Size += sampleSize; record.Size += sampleSize;
} }
m_Records.Sort(m_RecordComparer); _records.Sort(_recordComparer);
} }
private static int RecordComparer(Record a, Record b) private static int RecordComparer(Record a, Record b)

View File

@@ -7,7 +7,7 @@ namespace TEngine
private abstract class ScrollableDebuggerWindowBase : IDebuggerWindow private abstract class ScrollableDebuggerWindowBase : IDebuggerWindow
{ {
private const float TitleWidth = 240f; private const float TitleWidth = 240f;
private Vector2 m_ScrollPosition = Vector2.zero; private Vector2 _scrollPosition = Vector2.zero;
public virtual void Initialize(params object[] args) public virtual void Initialize(params object[] args)
{ {
@@ -31,7 +31,7 @@ namespace TEngine
public void OnDraw() public void OnDraw()
{ {
m_ScrollPosition = GUILayout.BeginScrollView(m_ScrollPosition); _scrollPosition = GUILayout.BeginScrollView(_scrollPosition);
{ {
OnDrawScrollableWindow(); OnDrawScrollableWindow();
} }

View File

@@ -8,13 +8,13 @@ namespace TEngine
private sealed class SettingsWindow : ScrollableDebuggerWindowBase private sealed class SettingsWindow : ScrollableDebuggerWindowBase
{ {
private Debugger _debugger = null; private Debugger _debugger = null;
private float m_LastIconX = 0f; private float _lastIconX = 0f;
private float m_LastIconY = 0f; private float _lastIconY = 0f;
private float m_LastWindowX = 0f; private float _lastWindowX = 0f;
private float m_LastWindowY = 0f; private float _lastWindowY = 0f;
private float m_LastWindowWidth = 0f; private float _lastWindowWidth = 0f;
private float m_LastWindowHeight = 0f; private float _lastWindowHeight = 0f;
private float m_LastWindowScale = 0f; private float _lastWindowScale = 0f;
public override void Initialize(params object[] args) public override void Initialize(params object[] args)
{ {
@@ -25,59 +25,59 @@ namespace TEngine
return; return;
} }
m_LastIconX = PlayerPrefs.GetFloat("Debugger.Icon.X", DefaultIconRect.x); _lastIconX = PlayerPrefs.GetFloat("Debugger.Icon.X", DefaultIconRect.x);
m_LastIconY = PlayerPrefs.GetFloat("Debugger.Icon.Y", DefaultIconRect.y); _lastIconY = PlayerPrefs.GetFloat("Debugger.Icon.Y", DefaultIconRect.y);
m_LastWindowX = PlayerPrefs.GetFloat("Debugger.Window.X", DefaultWindowRect.x); _lastWindowX = PlayerPrefs.GetFloat("Debugger.Window.X", DefaultWindowRect.x);
m_LastWindowY = PlayerPrefs.GetFloat("Debugger.Window.Y", DefaultWindowRect.y); _lastWindowY = PlayerPrefs.GetFloat("Debugger.Window.Y", DefaultWindowRect.y);
m_LastWindowWidth = PlayerPrefs.GetFloat("Debugger.Window.Width", DefaultWindowRect.width); _lastWindowWidth = PlayerPrefs.GetFloat("Debugger.Window.Width", DefaultWindowRect.width);
m_LastWindowHeight = PlayerPrefs.GetFloat("Debugger.Window.Height", DefaultWindowRect.height); _lastWindowHeight = PlayerPrefs.GetFloat("Debugger.Window.Height", DefaultWindowRect.height);
_debugger.WindowScale = m_LastWindowScale = PlayerPrefs.GetFloat("Debugger.Window.Scale", DefaultWindowScale); _debugger.WindowScale = _lastWindowScale = PlayerPrefs.GetFloat("Debugger.Window.Scale", DefaultWindowScale);
_debugger.IconRect = new Rect(m_LastIconX, m_LastIconY, DefaultIconRect.width, DefaultIconRect.height); _debugger.IconRect = new Rect(_lastIconX, _lastIconY, DefaultIconRect.width, DefaultIconRect.height);
_debugger.WindowRect = new Rect(m_LastWindowX, m_LastWindowY, m_LastWindowWidth, m_LastWindowHeight); _debugger.WindowRect = new Rect(_lastWindowX, _lastWindowY, _lastWindowWidth, _lastWindowHeight);
} }
public override void OnUpdate(float elapseSeconds, float realElapseSeconds) 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); 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); 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); 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); 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); 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); 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); PlayerPrefs.SetFloat("Debugger.Window.Scale", _debugger.WindowScale);
} }
} }

View File

@@ -1,4 +1,5 @@
using UnityEngine; using System.Globalization;
using UnityEngine;
namespace TEngine namespace TEngine
{ {
@@ -12,30 +13,30 @@ namespace TEngine
GUILayout.BeginVertical("box"); GUILayout.BeginVertical("box");
{ {
DrawItem("Time Scale", Utility.Text.Format("{0} [{1}]", Time.timeScale, GetTimeScaleDescription(Time.timeScale))); DrawItem("Time Scale", Utility.Text.Format("{0} [{1}]", Time.timeScale, GetTimeScaleDescription(Time.timeScale)));
DrawItem("Realtime Since Startup", Time.realtimeSinceStartup.ToString()); DrawItem("Realtime Since Startup", Time.realtimeSinceStartup.ToString(CultureInfo.InvariantCulture));
DrawItem("Time Since Level Load", Time.timeSinceLevelLoad.ToString()); DrawItem("Time Since Level Load", Time.timeSinceLevelLoad.ToString(CultureInfo.InvariantCulture));
DrawItem("Time", Time.time.ToString()); DrawItem("Time", Time.time.ToString(CultureInfo.InvariantCulture));
DrawItem("Fixed Time", Time.fixedTime.ToString()); DrawItem("Fixed Time", Time.fixedTime.ToString(CultureInfo.InvariantCulture));
DrawItem("Unscaled Time", Time.unscaledTime.ToString()); DrawItem("Unscaled Time", Time.unscaledTime.ToString(CultureInfo.InvariantCulture));
#if UNITY_5_6_OR_NEWER #if UNITY_5_6_OR_NEWER
DrawItem("Fixed Unscaled Time", Time.fixedUnscaledTime.ToString()); DrawItem("Fixed Unscaled Time", Time.fixedUnscaledTime.ToString(CultureInfo.InvariantCulture));
#endif #endif
DrawItem("Delta Time", Time.deltaTime.ToString()); DrawItem("Delta Time", Time.deltaTime.ToString(CultureInfo.InvariantCulture));
DrawItem("Fixed Delta Time", Time.fixedDeltaTime.ToString()); DrawItem("Fixed Delta Time", Time.fixedDeltaTime.ToString(CultureInfo.InvariantCulture));
DrawItem("Unscaled Delta Time", Time.unscaledDeltaTime.ToString()); DrawItem("Unscaled Delta Time", Time.unscaledDeltaTime.ToString(CultureInfo.InvariantCulture));
#if UNITY_5_6_OR_NEWER #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 #endif
DrawItem("Smooth Delta Time", Time.smoothDeltaTime.ToString()); DrawItem("Smooth Delta Time", Time.smoothDeltaTime.ToString(CultureInfo.InvariantCulture));
DrawItem("Maximum Delta Time", Time.maximumDeltaTime.ToString()); DrawItem("Maximum Delta Time", Time.maximumDeltaTime.ToString(CultureInfo.InvariantCulture));
#if UNITY_5_5_OR_NEWER #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 #endif
DrawItem("Frame Count", Time.frameCount.ToString()); DrawItem("Frame Count", Time.frameCount.ToString());
DrawItem("Rendered Frame Count", Time.renderedFrameCount.ToString()); DrawItem("Rendered Frame Count", Time.renderedFrameCount.ToString());
DrawItem("Capture Framerate", Time.captureFramerate.ToString()); DrawItem("Capture Framerate", Time.captureFramerate.ToString());
#if UNITY_2019_2_OR_NEWER #if UNITY_2019_2_OR_NEWER
DrawItem("Capture Delta Time", Time.captureDeltaTime.ToString()); DrawItem("Capture Delta Time", Time.captureDeltaTime.ToString(CultureInfo.InvariantCulture));
#endif #endif
#if UNITY_5_6_OR_NEWER #if UNITY_5_6_OR_NEWER
DrawItem("In Fixed Time Step", Time.inFixedTimeStep.ToString()); DrawItem("In Fixed Time Step", Time.inFixedTimeStep.ToString());

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Serialization;
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
namespace TEngine namespace TEngine
@@ -31,56 +32,55 @@ namespace TEngine
private static TextEditor s_TextEditor = null; private static TextEditor s_TextEditor = null;
private IDebuggerModule _debuggerModule = null; private IDebuggerModule _debuggerModule = null;
private Rect m_DragRect = new Rect(0f, 0f, float.MaxValue, 25f); private readonly Rect _dragRect = new Rect(0f, 0f, float.MaxValue, 25f);
private Rect m_IconRect = DefaultIconRect; private Rect _iconRect = DefaultIconRect;
private Rect m_WindowRect = DefaultWindowRect; private Rect _windowRect = DefaultWindowRect;
private float m_WindowScale = DefaultWindowScale; private float _windowScale = DefaultWindowScale;
[SerializeField] [SerializeField]
private GUISkin m_Skin = null; private GUISkin skin = null;
[SerializeField] [SerializeField]
private DebuggerActiveWindowType m_ActiveWindow = DebuggerActiveWindowType.AlwaysOpen; private DebuggerActiveWindowType activeWindow = DebuggerActiveWindowType.AlwaysOpen;
public DebuggerActiveWindowType ActiveWindowType => m_ActiveWindow; public DebuggerActiveWindowType ActiveWindowType => activeWindow;
[SerializeField] [SerializeField]
private bool m_ShowFullWindow = false; private bool _showFullWindow = false;
[SerializeField] [SerializeField]
private ConsoleWindow m_ConsoleWindow = new ConsoleWindow(); private ConsoleWindow _consoleWindow = new ConsoleWindow();
private SystemInformationWindow m_SystemInformationWindow = new SystemInformationWindow(); private SystemInformationWindow _systemInformationWindow = new SystemInformationWindow();
private EnvironmentInformationWindow m_EnvironmentInformationWindow = new EnvironmentInformationWindow(); private EnvironmentInformationWindow _environmentInformationWindow = new EnvironmentInformationWindow();
private ScreenInformationWindow m_ScreenInformationWindow = new ScreenInformationWindow(); private ScreenInformationWindow _screenInformationWindow = new ScreenInformationWindow();
private GraphicsInformationWindow m_GraphicsInformationWindow = new GraphicsInformationWindow(); private GraphicsInformationWindow _graphicsInformationWindow = new GraphicsInformationWindow();
private InputSummaryInformationWindow m_InputSummaryInformationWindow = new InputSummaryInformationWindow(); private InputSummaryInformationWindow _inputSummaryInformationWindow = new InputSummaryInformationWindow();
private InputTouchInformationWindow m_InputTouchInformationWindow = new InputTouchInformationWindow(); private InputTouchInformationWindow _inputTouchInformationWindow = new InputTouchInformationWindow();
private InputLocationInformationWindow m_InputLocationInformationWindow = new InputLocationInformationWindow(); private InputLocationInformationWindow _inputLocationInformationWindow = new InputLocationInformationWindow();
private InputAccelerationInformationWindow m_InputAccelerationInformationWindow = new InputAccelerationInformationWindow(); private InputAccelerationInformationWindow _inputAccelerationInformationWindow = new InputAccelerationInformationWindow();
private InputGyroscopeInformationWindow m_InputGyroscopeInformationWindow = new InputGyroscopeInformationWindow(); private InputGyroscopeInformationWindow _inputGyroscopeInformationWindow = new InputGyroscopeInformationWindow();
private InputCompassInformationWindow m_InputCompassInformationWindow = new InputCompassInformationWindow(); private InputCompassInformationWindow _inputCompassInformationWindow = new InputCompassInformationWindow();
private PathInformationWindow m_PathInformationWindow = new PathInformationWindow(); private PathInformationWindow _pathInformationWindow = new PathInformationWindow();
private SceneInformationWindow m_SceneInformationWindow = new SceneInformationWindow(); private SceneInformationWindow _sceneInformationWindow = new SceneInformationWindow();
private TimeInformationWindow m_TimeInformationWindow = new TimeInformationWindow(); private TimeInformationWindow _timeInformationWindow = new TimeInformationWindow();
private QualityInformationWindow m_QualityInformationWindow = new QualityInformationWindow(); private QualityInformationWindow _qualityInformationWindow = new QualityInformationWindow();
private ProfilerInformationWindow m_ProfilerInformationWindow = new ProfilerInformationWindow(); private ProfilerInformationWindow _profilerInformationWindow = new ProfilerInformationWindow();
private RuntimeMemorySummaryWindow m_RuntimeMemorySummaryWindow = new RuntimeMemorySummaryWindow(); private RuntimeMemorySummaryWindow _runtimeMemorySummaryWindow = new RuntimeMemorySummaryWindow();
private RuntimeMemoryInformationWindow<Object> m_RuntimeMemoryAllInformationWindow = new RuntimeMemoryInformationWindow<Object>(); private RuntimeMemoryInformationWindow<Object> _runtimeMemoryAllInformationWindow = new RuntimeMemoryInformationWindow<Object>();
private RuntimeMemoryInformationWindow<Texture> m_RuntimeMemoryTextureInformationWindow = new RuntimeMemoryInformationWindow<Texture>(); private RuntimeMemoryInformationWindow<Texture> _runtimeMemoryTextureInformationWindow = new RuntimeMemoryInformationWindow<Texture>();
private RuntimeMemoryInformationWindow<Mesh> m_RuntimeMemoryMeshInformationWindow = new RuntimeMemoryInformationWindow<Mesh>(); private RuntimeMemoryInformationWindow<Mesh> _runtimeMemoryMeshInformationWindow = new RuntimeMemoryInformationWindow<Mesh>();
private RuntimeMemoryInformationWindow<Material> m_RuntimeMemoryMaterialInformationWindow = new RuntimeMemoryInformationWindow<Material>(); private RuntimeMemoryInformationWindow<Material> _runtimeMemoryMaterialInformationWindow = new RuntimeMemoryInformationWindow<Material>();
private RuntimeMemoryInformationWindow<Shader> m_RuntimeMemoryShaderInformationWindow = new RuntimeMemoryInformationWindow<Shader>(); private RuntimeMemoryInformationWindow<Shader> _runtimeMemoryShaderInformationWindow = new RuntimeMemoryInformationWindow<Shader>();
private RuntimeMemoryInformationWindow<AnimationClip> m_RuntimeMemoryAnimationClipInformationWindow = new RuntimeMemoryInformationWindow<AnimationClip>(); private RuntimeMemoryInformationWindow<AnimationClip> _runtimeMemoryAnimationClipInformationWindow = new RuntimeMemoryInformationWindow<AnimationClip>();
private RuntimeMemoryInformationWindow<AudioClip> m_RuntimeMemoryAudioClipInformationWindow = new RuntimeMemoryInformationWindow<AudioClip>(); private RuntimeMemoryInformationWindow<AudioClip> _runtimeMemoryAudioClipInformationWindow = new RuntimeMemoryInformationWindow<AudioClip>();
private RuntimeMemoryInformationWindow<Font> m_RuntimeMemoryFontInformationWindow = new RuntimeMemoryInformationWindow<Font>(); private RuntimeMemoryInformationWindow<Font> _runtimeMemoryFontInformationWindow = new RuntimeMemoryInformationWindow<Font>();
private RuntimeMemoryInformationWindow<TextAsset> m_RuntimeMemoryTextAssetInformationWindow = new RuntimeMemoryInformationWindow<TextAsset>(); private RuntimeMemoryInformationWindow<TextAsset> _runtimeMemoryTextAssetInformationWindow = new RuntimeMemoryInformationWindow<TextAsset>();
private RuntimeMemoryInformationWindow<ScriptableObject> m_RuntimeMemoryScriptableObjectInformationWindow = new RuntimeMemoryInformationWindow<ScriptableObject>(); private RuntimeMemoryInformationWindow<ScriptableObject> _runtimeMemoryScriptableObjectInformationWindow = new RuntimeMemoryInformationWindow<ScriptableObject>();
private MemoryPoolPoolInformationWindow _mMemoryPoolPoolInformationWindow = new MemoryPoolPoolInformationWindow(); private MemoryPoolPoolInformationWindow _memoryPoolPoolInformationWindow = new MemoryPoolPoolInformationWindow();
// private NetworkInformationWindow m_NetworkInformationWindow = new NetworkInformationWindow(); private SettingsWindow _settingsWindow = new SettingsWindow();
private SettingsWindow m_SettingsWindow = new SettingsWindow();
private FpsCounter m_FpsCounter = null; private FpsCounter _fpsCounter = null;
/// <summary> /// <summary>
/// 获取或设置调试器窗口是否激活。 /// 获取或设置调试器窗口是否激活。
@@ -100,14 +100,14 @@ namespace TEngine
/// </summary> /// </summary>
public bool ShowFullWindow public bool ShowFullWindow
{ {
get => m_ShowFullWindow; get => _showFullWindow;
set set
{ {
if (_eventSystem != null) if (_eventSystem != null)
{ {
_eventSystem.SetActive(!value); _eventSystem.SetActive(!value);
} }
m_ShowFullWindow = value; _showFullWindow = value;
} }
} }
@@ -116,8 +116,8 @@ namespace TEngine
/// </summary> /// </summary>
public Rect IconRect public Rect IconRect
{ {
get => m_IconRect; get => _iconRect;
set => m_IconRect = value; set => _iconRect = value;
} }
/// <summary> /// <summary>
@@ -125,8 +125,8 @@ namespace TEngine
/// </summary> /// </summary>
public Rect WindowRect public Rect WindowRect
{ {
get => m_WindowRect; get => _windowRect;
set => m_WindowRect = value; set => _windowRect = value;
} }
/// <summary> /// <summary>
@@ -134,8 +134,8 @@ namespace TEngine
/// </summary> /// </summary>
public float WindowScale public float WindowScale
{ {
get => m_WindowScale; get => _windowScale;
set => m_WindowScale = value; set => _windowScale = value;
} }
private GameObject _eventSystem; private GameObject _eventSystem;
@@ -164,7 +164,7 @@ namespace TEngine
return; return;
} }
m_FpsCounter = new FpsCounter(0.5f); _fpsCounter = new FpsCounter(0.5f);
var lastIconX = PlayerPrefs.GetFloat("Debugger.Icon.X", DefaultIconRect.x); var lastIconX = PlayerPrefs.GetFloat("Debugger.Icon.X", DefaultIconRect.x);
var lastIconY = PlayerPrefs.GetFloat("Debugger.Icon.Y", DefaultIconRect.y); 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 lastWindowY = PlayerPrefs.GetFloat("Debugger.Window.Y", DefaultWindowRect.y);
var lastWindowWidth = PlayerPrefs.GetFloat("Debugger.Window.Width", DefaultWindowRect.width); var lastWindowWidth = PlayerPrefs.GetFloat("Debugger.Window.Width", DefaultWindowRect.width);
var lastWindowHeight = PlayerPrefs.GetFloat("Debugger.Window.Height", DefaultWindowRect.height); var lastWindowHeight = PlayerPrefs.GetFloat("Debugger.Window.Height", DefaultWindowRect.height);
m_WindowScale = PlayerPrefs.GetFloat("Debugger.Window.Scale", DefaultWindowScale); _windowScale = PlayerPrefs.GetFloat("Debugger.Window.Scale", DefaultWindowScale);
m_WindowRect = new Rect(lastIconX, lastIconY, DefaultIconRect.width, DefaultIconRect.height); _windowRect = new Rect(lastIconX, lastIconY, DefaultIconRect.width, DefaultIconRect.height);
m_WindowRect = new Rect(lastWindowX, lastWindowY, lastWindowWidth, lastWindowHeight); _windowRect = new Rect(lastWindowX, lastWindowY, lastWindowWidth, lastWindowHeight);
} }
private void Start() private void Start()
{ {
Initialize(); Initialize();
RegisterDebuggerWindow("Console", m_ConsoleWindow); RegisterDebuggerWindow("Console", _consoleWindow);
RegisterDebuggerWindow("Information/System", m_SystemInformationWindow); RegisterDebuggerWindow("Information/System", _systemInformationWindow);
RegisterDebuggerWindow("Information/Environment", m_EnvironmentInformationWindow); RegisterDebuggerWindow("Information/Environment", _environmentInformationWindow);
RegisterDebuggerWindow("Information/Screen", m_ScreenInformationWindow); RegisterDebuggerWindow("Information/Screen", _screenInformationWindow);
RegisterDebuggerWindow("Information/Graphics", m_GraphicsInformationWindow); RegisterDebuggerWindow("Information/Graphics", _graphicsInformationWindow);
RegisterDebuggerWindow("Information/Input/Summary", m_InputSummaryInformationWindow); RegisterDebuggerWindow("Information/Input/Summary", _inputSummaryInformationWindow);
RegisterDebuggerWindow("Information/Input/Touch", m_InputTouchInformationWindow); RegisterDebuggerWindow("Information/Input/Touch", _inputTouchInformationWindow);
RegisterDebuggerWindow("Information/Input/Location", m_InputLocationInformationWindow); RegisterDebuggerWindow("Information/Input/Location", _inputLocationInformationWindow);
RegisterDebuggerWindow("Information/Input/Acceleration", m_InputAccelerationInformationWindow); RegisterDebuggerWindow("Information/Input/Acceleration", _inputAccelerationInformationWindow);
RegisterDebuggerWindow("Information/Input/Gyroscope", m_InputGyroscopeInformationWindow); RegisterDebuggerWindow("Information/Input/Gyroscope", _inputGyroscopeInformationWindow);
RegisterDebuggerWindow("Information/Input/Compass", m_InputCompassInformationWindow); RegisterDebuggerWindow("Information/Input/Compass", _inputCompassInformationWindow);
RegisterDebuggerWindow("Information/Other/Scene", m_SceneInformationWindow); RegisterDebuggerWindow("Information/Other/Scene", _sceneInformationWindow);
RegisterDebuggerWindow("Information/Other/Path", m_PathInformationWindow); RegisterDebuggerWindow("Information/Other/Path", _pathInformationWindow);
RegisterDebuggerWindow("Information/Other/Time", m_TimeInformationWindow); RegisterDebuggerWindow("Information/Other/Time", _timeInformationWindow);
RegisterDebuggerWindow("Information/Other/Quality", m_QualityInformationWindow); RegisterDebuggerWindow("Information/Other/Quality", _qualityInformationWindow);
RegisterDebuggerWindow("Profiler/Summary", m_ProfilerInformationWindow); RegisterDebuggerWindow("Profiler/Summary", _profilerInformationWindow);
RegisterDebuggerWindow("Profiler/Memory/Summary", m_RuntimeMemorySummaryWindow); RegisterDebuggerWindow("Profiler/Memory/Summary", _runtimeMemorySummaryWindow);
RegisterDebuggerWindow("Profiler/Memory/All", m_RuntimeMemoryAllInformationWindow); RegisterDebuggerWindow("Profiler/Memory/All", _runtimeMemoryAllInformationWindow);
RegisterDebuggerWindow("Profiler/Memory/Texture", m_RuntimeMemoryTextureInformationWindow); RegisterDebuggerWindow("Profiler/Memory/Texture", _runtimeMemoryTextureInformationWindow);
RegisterDebuggerWindow("Profiler/Memory/Mesh", m_RuntimeMemoryMeshInformationWindow); RegisterDebuggerWindow("Profiler/Memory/Mesh", _runtimeMemoryMeshInformationWindow);
RegisterDebuggerWindow("Profiler/Memory/Material", m_RuntimeMemoryMaterialInformationWindow); RegisterDebuggerWindow("Profiler/Memory/Material", _runtimeMemoryMaterialInformationWindow);
RegisterDebuggerWindow("Profiler/Memory/Shader", m_RuntimeMemoryShaderInformationWindow); RegisterDebuggerWindow("Profiler/Memory/Shader", _runtimeMemoryShaderInformationWindow);
RegisterDebuggerWindow("Profiler/Memory/AnimationClip", m_RuntimeMemoryAnimationClipInformationWindow); RegisterDebuggerWindow("Profiler/Memory/AnimationClip", _runtimeMemoryAnimationClipInformationWindow);
RegisterDebuggerWindow("Profiler/Memory/AudioClip", m_RuntimeMemoryAudioClipInformationWindow); RegisterDebuggerWindow("Profiler/Memory/AudioClip", _runtimeMemoryAudioClipInformationWindow);
RegisterDebuggerWindow("Profiler/Memory/Font", m_RuntimeMemoryFontInformationWindow); RegisterDebuggerWindow("Profiler/Memory/Font", _runtimeMemoryFontInformationWindow);
RegisterDebuggerWindow("Profiler/Memory/TextAsset", m_RuntimeMemoryTextAssetInformationWindow); RegisterDebuggerWindow("Profiler/Memory/TextAsset", _runtimeMemoryTextAssetInformationWindow);
RegisterDebuggerWindow("Profiler/Memory/ScriptableObject", m_RuntimeMemoryScriptableObjectInformationWindow); RegisterDebuggerWindow("Profiler/Memory/ScriptableObject", _runtimeMemoryScriptableObjectInformationWindow);
RegisterDebuggerWindow("Profiler/Reference Pool", _mMemoryPoolPoolInformationWindow); RegisterDebuggerWindow("Profiler/Reference Pool", _memoryPoolPoolInformationWindow);
// RegisterDebuggerWindow("Profiler/Network", m_NetworkInformationWindow); RegisterDebuggerWindow("Other/Settings", _settingsWindow);
RegisterDebuggerWindow("Other/Settings", m_SettingsWindow);
switch (m_ActiveWindow) switch (activeWindow)
{ {
case DebuggerActiveWindowType.AlwaysOpen: case DebuggerActiveWindowType.AlwaysOpen:
ActiveWindow = true; ActiveWindow = true;
@@ -233,7 +232,7 @@ namespace TEngine
private void Update() private void Update()
{ {
m_FpsCounter.Update(Time.deltaTime, Time.unscaledDeltaTime); _fpsCounter.Update(Time.deltaTime, Time.unscaledDeltaTime);
} }
private void OnGUI() private void OnGUI()
@@ -246,16 +245,16 @@ namespace TEngine
GUISkin cachedGuiSkin = GUI.skin; GUISkin cachedGuiSkin = GUI.skin;
Matrix4x4 cachedMatrix = GUI.matrix; Matrix4x4 cachedMatrix = GUI.matrix;
GUI.skin = m_Skin; GUI.skin = skin;
GUI.matrix = Matrix4x4.Scale(new Vector3(m_WindowScale, m_WindowScale, 1f)); GUI.matrix = Matrix4x4.Scale(new Vector3(_windowScale, _windowScale, 1f));
if (m_ShowFullWindow) if (_showFullWindow)
{ {
m_WindowRect = GUILayout.Window(0, m_WindowRect, DrawWindow, "<b>DEBUGGER</b>"); _windowRect = GUILayout.Window(0, _windowRect, DrawWindow, "<b>DEBUGGER</b>");
} }
else else
{ {
m_IconRect = GUILayout.Window(0, m_IconRect, DrawDebuggerWindowIcon, "<b>DEBUGGER</b>"); _iconRect = GUILayout.Window(0, _iconRect, DrawDebuggerWindowIcon, "<b>DEBUGGER</b>");
} }
GUI.matrix = cachedMatrix; GUI.matrix = cachedMatrix;
@@ -319,7 +318,7 @@ namespace TEngine
/// <param name="results">要获取的日志。</param> /// <param name="results">要获取的日志。</param>
public void GetRecentLogs(List<LogNode> results) public void GetRecentLogs(List<LogNode> results)
{ {
m_ConsoleWindow.GetRecentLogs(results); _consoleWindow.GetRecentLogs(results);
} }
/// <summary> /// <summary>
@@ -329,12 +328,12 @@ namespace TEngine
/// <param name="count">要获取最近日志的数量。</param> /// <param name="count">要获取最近日志的数量。</param>
public void GetRecentLogs(List<LogNode> results, int count) public void GetRecentLogs(List<LogNode> results, int count)
{ {
m_ConsoleWindow.GetRecentLogs(results, count); _consoleWindow.GetRecentLogs(results, count);
} }
private void DrawWindow(int windowId) private void DrawWindow(int windowId)
{ {
GUI.DragWindow(m_DragRect); GUI.DragWindow(_dragRect);
DrawDebuggerWindowGroup(_debuggerModule.DebuggerWindowRoot); DrawDebuggerWindowGroup(_debuggerModule.DebuggerWindowRoot);
} }
@@ -387,28 +386,28 @@ namespace TEngine
private void DrawDebuggerWindowIcon(int windowId) private void DrawDebuggerWindowIcon(int windowId)
{ {
GUI.DragWindow(m_DragRect); GUI.DragWindow(_dragRect);
GUILayout.Space(5); GUILayout.Space(5);
Color32 color = Color.white; Color32 color = Color.white;
m_ConsoleWindow.RefreshCount(); _consoleWindow.RefreshCount();
if (m_ConsoleWindow.FatalCount > 0) 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 else
{ {
color = m_ConsoleWindow.GetLogStringColor(LogType.Log); color = _consoleWindow.GetLogStringColor(LogType.Log);
} }
string title = Utility.Text.Format("<color=#{0:x2}{1:x2}{2:x2}{3:x2}><b>FPS: {4:F2}</b></color>", color.r, color.g, color.b, color.a, m_FpsCounter.CurrentFps); string title = Utility.Text.Format("<color=#{0:x2}{1:x2}{2:x2}{3:x2}><b>FPS: {4:F2}</b></color>", color.r, color.g, color.b, color.a, _fpsCounter.CurrentFps);
if (GUILayout.Button(title, GUILayout.Width(100f), GUILayout.Height(40f))) if (GUILayout.Button(title, GUILayout.Width(100f), GUILayout.Height(40f)))
{ {
ShowFullWindow = true; ShowFullWindow = true;

View File

@@ -25,69 +25,69 @@ namespace TEngine
private bool _lastFatalFilter = true; private bool _lastFatalFilter = true;
[SerializeField] [SerializeField]
private bool m_LockScroll = true; private bool lockScroll = true;
[SerializeField] [SerializeField]
private int m_MaxLine = 100; private int maxLine = 100;
[SerializeField] [SerializeField]
private bool m_InfoFilter = true; private bool infoFilter = true;
[SerializeField] [SerializeField]
private bool m_WarningFilter = true; private bool warningFilter = true;
[SerializeField] [SerializeField]
private bool m_ErrorFilter = true; private bool errorFilter = true;
[SerializeField] [SerializeField]
private bool m_FatalFilter = true; private bool fatalFilter = true;
[SerializeField] [SerializeField]
private Color32 m_InfoColor = Color.white; private Color32 infoColor = Color.white;
[SerializeField] [SerializeField]
private Color32 m_WarningColor = Color.yellow; private Color32 warningColor = Color.yellow;
[SerializeField] [SerializeField]
private Color32 m_ErrorColor = Color.red; private Color32 errorColor = Color.red;
[SerializeField] [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 public bool LockScroll
{ {
get => m_LockScroll; get => lockScroll;
set => m_LockScroll = value; set => lockScroll = value;
} }
public int MaxLine public int MaxLine
{ {
get => m_MaxLine; get => maxLine;
set => m_MaxLine = value; set => maxLine = value;
} }
public bool InfoFilter public bool InfoFilter
{ {
get => m_InfoFilter; get => infoFilter;
set => m_InfoFilter = value; set => infoFilter = value;
} }
public bool WarningFilter public bool WarningFilter
{ {
get => m_WarningFilter; get => warningFilter;
set => m_WarningFilter = value; set => warningFilter = value;
} }
public bool ErrorFilter public bool ErrorFilter
{ {
get => m_ErrorFilter; get => errorFilter;
set => m_ErrorFilter = value; set => errorFilter = value;
} }
public bool FatalFilter public bool FatalFilter
{ {
get => m_FatalFilter; get => fatalFilter;
set => m_FatalFilter = value; set => fatalFilter = value;
} }
public int InfoCount => _infoCount; public int InfoCount => _infoCount;
@@ -100,36 +100,36 @@ namespace TEngine
public Color32 InfoColor public Color32 InfoColor
{ {
get => m_InfoColor; get => infoColor;
set => m_InfoColor = value; set => infoColor = value;
} }
public Color32 WarningColor public Color32 WarningColor
{ {
get => m_WarningColor; get => warningColor;
set => m_WarningColor = value; set => warningColor = value;
} }
public Color32 ErrorColor public Color32 ErrorColor
{ {
get => m_ErrorColor; get => errorColor;
set => m_ErrorColor = value; set => errorColor = value;
} }
public Color32 FatalColor public Color32 FatalColor
{ {
get => m_FatalColor; get => fatalColor;
set => m_FatalColor = value; set => fatalColor = value;
} }
public void Initialize(params object[] args) public void Initialize(params object[] args)
{ {
Application.logMessageReceived += OnLogMessageReceived; Application.logMessageReceived += OnLogMessageReceived;
m_LockScroll = _lastLockScroll = PlayerPrefs.GetInt("Debugger.Console.LockScroll", 1) == 1; lockScroll = _lastLockScroll = PlayerPrefs.GetInt("Debugger.Console.LockScroll", 1) == 1;
m_InfoFilter = _lastInfoFilter = PlayerPrefs.GetInt("Debugger.Console.InfoFilter", 1) == 1; infoFilter = _lastInfoFilter = PlayerPrefs.GetInt("Debugger.Console.InfoFilter", 1) == 1;
m_WarningFilter = _lastWarningFilter = PlayerPrefs.GetInt("Debugger.Console.WarningFilter", 1) == 1; warningFilter = _lastWarningFilter = PlayerPrefs.GetInt("Debugger.Console.WarningFilter", 1) == 1;
m_ErrorFilter = _lastErrorFilter = PlayerPrefs.GetInt("Debugger.Console.ErrorFilter", 1) == 1; errorFilter = _lastErrorFilter = PlayerPrefs.GetInt("Debugger.Console.ErrorFilter", 1) == 1;
m_FatalFilter = _lastFatalFilter = PlayerPrefs.GetInt("Debugger.Console.FatalFilter", 1) == 1; fatalFilter = _lastFatalFilter = PlayerPrefs.GetInt("Debugger.Console.FatalFilter", 1) == 1;
} }
public void Shutdown() public void Shutdown()
@@ -148,34 +148,34 @@ namespace TEngine
public void OnUpdate(float elapseSeconds, float realElapseSeconds) public void OnUpdate(float elapseSeconds, float realElapseSeconds)
{ {
if (_lastLockScroll != m_LockScroll) if (_lastLockScroll != lockScroll)
{ {
_lastLockScroll = m_LockScroll; _lastLockScroll = lockScroll;
PlayerPrefs.SetInt("Debugger.Console.LockScroll", m_LockScroll ? 1 : 0); PlayerPrefs.SetInt("Debugger.Console.LockScroll", lockScroll ? 1 : 0);
} }
if (_lastInfoFilter != m_InfoFilter) if (_lastInfoFilter != infoFilter)
{ {
_lastInfoFilter = m_InfoFilter; _lastInfoFilter = infoFilter;
PlayerPrefs.SetInt("Debugger.Console.InfoFilter", m_InfoFilter ? 1 : 0); PlayerPrefs.SetInt("Debugger.Console.InfoFilter", infoFilter ? 1 : 0);
} }
if (_lastWarningFilter != m_WarningFilter) if (_lastWarningFilter != warningFilter)
{ {
_lastWarningFilter = m_WarningFilter; _lastWarningFilter = warningFilter;
PlayerPrefs.SetInt("Debugger.Console.WarningFilter", m_WarningFilter ? 1 : 0); PlayerPrefs.SetInt("Debugger.Console.WarningFilter", warningFilter ? 1 : 0);
} }
if (_lastErrorFilter != m_ErrorFilter) if (_lastErrorFilter != errorFilter)
{ {
_lastErrorFilter = m_ErrorFilter; _lastErrorFilter = errorFilter;
PlayerPrefs.SetInt("Debugger.Console.ErrorFilter", m_ErrorFilter ? 1 : 0); PlayerPrefs.SetInt("Debugger.Console.ErrorFilter", errorFilter ? 1 : 0);
} }
if (_lastFatalFilter != m_FatalFilter) if (_lastFatalFilter != fatalFilter)
{ {
_lastFatalFilter = m_FatalFilter; _lastFatalFilter = fatalFilter;
PlayerPrefs.SetInt("Debugger.Console.FatalFilter", m_FatalFilter ? 1 : 0); PlayerPrefs.SetInt("Debugger.Console.FatalFilter", fatalFilter ? 1 : 0);
} }
} }
@@ -189,18 +189,18 @@ namespace TEngine
{ {
Clear(); Clear();
} }
m_LockScroll = GUILayout.Toggle(m_LockScroll, "Lock Scroll", GUILayout.Width(90f)); lockScroll = GUILayout.Toggle(lockScroll, "Lock Scroll", GUILayout.Width(90f));
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
m_InfoFilter = GUILayout.Toggle(m_InfoFilter, Utility.Text.Format("Info ({0})", _infoCount), GUILayout.Width(90f)); infoFilter = GUILayout.Toggle(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)); warningFilter = GUILayout.Toggle(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)); errorFilter = GUILayout.Toggle(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)); fatalFilter = GUILayout.Toggle(fatalFilter, Utility.Text.Format("Fatal ({0})", _fatalCount), GUILayout.Width(90f));
} }
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
GUILayout.BeginVertical("box"); GUILayout.BeginVertical("box");
{ {
if (m_LockScroll) if (lockScroll)
{ {
_logScrollPosition.y = float.MaxValue; _logScrollPosition.y = float.MaxValue;
} }
@@ -213,28 +213,28 @@ namespace TEngine
switch (logNode.LogType) switch (logNode.LogType)
{ {
case LogType.Log: case LogType.Log:
if (!m_InfoFilter) if (!infoFilter)
{ {
continue; continue;
} }
break; break;
case LogType.Warning: case LogType.Warning:
if (!m_WarningFilter) if (!warningFilter)
{ {
continue; continue;
} }
break; break;
case LogType.Error: case LogType.Error:
if (!m_ErrorFilter) if (!errorFilter)
{ {
continue; continue;
} }
break; break;
case LogType.Exception: case LogType.Exception:
if (!m_FatalFilter) if (!fatalFilter)
{ {
continue; continue;
} }
@@ -367,7 +367,7 @@ namespace TEngine
} }
_logNodes.Enqueue(LogNode.Create(logType, logMessage, stackTrace)); _logNodes.Enqueue(LogNode.Create(logType, logMessage, stackTrace));
while (_logNodes.Count > m_MaxLine) while (_logNodes.Count > maxLine)
{ {
MemoryPool.Release(_logNodes.Dequeue()); MemoryPool.Release(_logNodes.Dequeue());
} }
@@ -385,19 +385,19 @@ namespace TEngine
switch (logType) switch (logType)
{ {
case LogType.Log: case LogType.Log:
color = m_InfoColor; color = infoColor;
break; break;
case LogType.Warning: case LogType.Warning:
color = m_WarningColor; color = warningColor;
break; break;
case LogType.Error: case LogType.Error:
color = m_ErrorColor; color = errorColor;
break; break;
case LogType.Exception: case LogType.Exception:
color = m_FatalColor; color = fatalColor;
break; break;
} }

View File

@@ -9,16 +9,9 @@ namespace TEngine
/// </summary> /// </summary>
private sealed class DebuggerWindowGroup : IDebuggerWindowGroup private sealed class DebuggerWindowGroup : IDebuggerWindowGroup
{ {
private readonly List<KeyValuePair<string, IDebuggerWindow>> _debuggerWindows; private readonly List<KeyValuePair<string, IDebuggerWindow>> _debuggerWindows = new();
private int _selectedIndex; private int _selectedIndex = 0;
private string[] _debuggerWindowNames; private string[] _debuggerWindowNames = null;
public DebuggerWindowGroup()
{
_debuggerWindows = new List<KeyValuePair<string, IDebuggerWindow>>();
_selectedIndex = 0;
_debuggerWindowNames = null;
}
/// <summary> /// <summary>
/// 获取调试器窗口数量。 /// 获取调试器窗口数量。

View File

@@ -9,12 +9,12 @@ namespace TEngine
[StructLayout(LayoutKind.Auto)] [StructLayout(LayoutKind.Auto)]
public struct ObjectInfo public struct ObjectInfo
{ {
private readonly string m_Name; private readonly string _name;
private readonly bool m_Locked; private readonly bool _locked;
private readonly bool m_CustomCanReleaseFlag; private readonly bool _customCanReleaseFlag;
private readonly int m_Priority; private readonly int _priority;
private readonly DateTime m_LastUseTime; private readonly DateTime _lastUseTime;
private readonly int m_SpawnCount; private readonly int _spawnCount;
/// <summary> /// <summary>
/// 初始化对象信息的新实例。 /// 初始化对象信息的新实例。
@@ -27,47 +27,47 @@ namespace TEngine
/// <param name="spawnCount">对象的获取计数。</param> /// <param name="spawnCount">对象的获取计数。</param>
public ObjectInfo(string name, bool locked, bool customCanReleaseFlag, int priority, DateTime lastUseTime, int spawnCount) public ObjectInfo(string name, bool locked, bool customCanReleaseFlag, int priority, DateTime lastUseTime, int spawnCount)
{ {
m_Name = name; _name = name;
m_Locked = locked; _locked = locked;
m_CustomCanReleaseFlag = customCanReleaseFlag; _customCanReleaseFlag = customCanReleaseFlag;
m_Priority = priority; _priority = priority;
m_LastUseTime = lastUseTime; _lastUseTime = lastUseTime;
m_SpawnCount = spawnCount; _spawnCount = spawnCount;
} }
/// <summary> /// <summary>
/// 获取对象名称。 /// 获取对象名称。
/// </summary> /// </summary>
public string Name => m_Name; public string Name => _name;
/// <summary> /// <summary>
/// 获取对象是否被加锁。 /// 获取对象是否被加锁。
/// </summary> /// </summary>
public bool Locked => m_Locked; public bool Locked => _locked;
/// <summary> /// <summary>
/// 获取对象自定义释放检查标记。 /// 获取对象自定义释放检查标记。
/// </summary> /// </summary>
public bool CustomCanReleaseFlag => m_CustomCanReleaseFlag; public bool CustomCanReleaseFlag => _customCanReleaseFlag;
/// <summary> /// <summary>
/// 获取对象的优先级。 /// 获取对象的优先级。
/// </summary> /// </summary>
public int Priority => m_Priority; public int Priority => _priority;
/// <summary> /// <summary>
/// 获取对象上次使用时间。 /// 获取对象上次使用时间。
/// </summary> /// </summary>
public DateTime LastUseTime => m_LastUseTime; public DateTime LastUseTime => _lastUseTime;
/// <summary> /// <summary>
/// 获取对象是否正在使用。 /// 获取对象是否正在使用。
/// </summary> /// </summary>
public bool IsInUse => m_SpawnCount > 0; public bool IsInUse => _spawnCount > 0;
/// <summary> /// <summary>
/// 获取对象的获取计数。 /// 获取对象的获取计数。
/// </summary> /// </summary>
public int SpawnCount => m_SpawnCount; public int SpawnCount => _spawnCount;
} }
} }

View File

@@ -7,7 +7,7 @@ namespace TEngine
/// </summary> /// </summary>
public abstract class ObjectPoolBase public abstract class ObjectPoolBase
{ {
private readonly string m_Name; private readonly string _name;
/// <summary> /// <summary>
/// 初始化对象池基类的新实例。 /// 初始化对象池基类的新实例。
@@ -23,18 +23,18 @@ namespace TEngine
/// <param name="name">对象池名称。</param> /// <param name="name">对象池名称。</param>
public ObjectPoolBase(string name) public ObjectPoolBase(string name)
{ {
m_Name = name ?? string.Empty; _name = name ?? string.Empty;
} }
/// <summary> /// <summary>
/// 获取对象池名称。 /// 获取对象池名称。
/// </summary> /// </summary>
public string Name => m_Name; public string Name => _name;
/// <summary> /// <summary>
/// 获取对象池完整名称。 /// 获取对象池完整名称。
/// </summary> /// </summary>
public string FullName => new TypeNamePair(ObjectType, m_Name).ToString(); public string FullName => new TypeNamePair(ObjectType, _name).ToString();
/// <summary> /// <summary>
/// 获取对象池对象类型。 /// 获取对象池对象类型。

View File

@@ -1,19 +0,0 @@
using System;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 内置资源清单
/// </summary>
public class BuildinFileManifest : ScriptableObject
{
[Serializable]
public class Element
{
public string PackageName;
public string FileName;
public string FileCRC32;
}
public List<Element> BuildinFiles = new List<Element>();
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: cc7dcf335fa34c189b66b9b8446f12e9
timeCreated: 1705979503

View File

@@ -5,9 +5,9 @@ namespace TEngine
/// </summary> /// </summary>
public sealed class LoadAssetCallbacks public sealed class LoadAssetCallbacks
{ {
private readonly LoadAssetSuccessCallback m_LoadAssetSuccessCallback; private readonly LoadAssetSuccessCallback _loadAssetSuccessCallback;
private readonly LoadAssetFailureCallback m_LoadAssetFailureCallback; private readonly LoadAssetFailureCallback _loadAssetFailureCallback;
private readonly LoadAssetUpdateCallback m_LoadAssetUpdateCallback; private readonly LoadAssetUpdateCallback _loadAssetUpdateCallback;
/// <summary> /// <summary>
/// 初始化加载资源回调函数集的新实例。 /// 初始化加载资源回调函数集的新实例。
@@ -51,9 +51,9 @@ namespace TEngine
throw new GameFrameworkException("Load asset success callback is invalid."); throw new GameFrameworkException("Load asset success callback is invalid.");
} }
m_LoadAssetSuccessCallback = loadAssetSuccessCallback; _loadAssetSuccessCallback = loadAssetSuccessCallback;
m_LoadAssetFailureCallback = loadAssetFailureCallback; _loadAssetFailureCallback = loadAssetFailureCallback;
m_LoadAssetUpdateCallback = loadAssetUpdateCallback; _loadAssetUpdateCallback = loadAssetUpdateCallback;
} }
/// <summary> /// <summary>
@@ -63,7 +63,7 @@ namespace TEngine
{ {
get get
{ {
return m_LoadAssetSuccessCallback; return _loadAssetSuccessCallback;
} }
} }
@@ -74,7 +74,7 @@ namespace TEngine
{ {
get get
{ {
return m_LoadAssetFailureCallback; return _loadAssetFailureCallback;
} }
} }
@@ -85,7 +85,7 @@ namespace TEngine
{ {
get get
{ {
return m_LoadAssetUpdateCallback; return _loadAssetUpdateCallback;
} }
} }
} }

View File

@@ -5,9 +5,9 @@
/// </summary> /// </summary>
public sealed class LoadSceneCallbacks public sealed class LoadSceneCallbacks
{ {
private readonly LoadSceneSuccessCallback m_LoadSceneSuccessCallback; private readonly LoadSceneSuccessCallback _loadSceneSuccessCallback;
private readonly LoadSceneFailureCallback m_LoadSceneFailureCallback; private readonly LoadSceneFailureCallback _loadSceneFailureCallback;
private readonly LoadSceneUpdateCallback m_LoadSceneUpdateCallback; private readonly LoadSceneUpdateCallback _loadSceneUpdateCallback;
/// <summary> /// <summary>
/// 初始化加载场景回调函数集的新实例。 /// 初始化加载场景回调函数集的新实例。
@@ -51,9 +51,9 @@
throw new GameFrameworkException("Load scene success callback is invalid."); throw new GameFrameworkException("Load scene success callback is invalid.");
} }
m_LoadSceneSuccessCallback = loadSceneSuccessCallback; _loadSceneSuccessCallback = loadSceneSuccessCallback;
m_LoadSceneFailureCallback = loadSceneFailureCallback; _loadSceneFailureCallback = loadSceneFailureCallback;
m_LoadSceneUpdateCallback = loadSceneUpdateCallback; _loadSceneUpdateCallback = loadSceneUpdateCallback;
} }
/// <summary> /// <summary>
@@ -63,7 +63,7 @@
{ {
get get
{ {
return m_LoadSceneSuccessCallback; return _loadSceneSuccessCallback;
} }
} }
@@ -74,7 +74,7 @@
{ {
get get
{ {
return m_LoadSceneFailureCallback; return _loadSceneFailureCallback;
} }
} }
@@ -85,7 +85,7 @@
{ {
get get
{ {
return m_LoadSceneUpdateCallback; return _loadSceneUpdateCallback;
} }
} }
} }

View File

@@ -5,8 +5,8 @@
/// </summary> /// </summary>
public sealed class UnloadSceneCallbacks public sealed class UnloadSceneCallbacks
{ {
private readonly UnloadSceneSuccessCallback m_UnloadSceneSuccessCallback; private readonly UnloadSceneSuccessCallback _unloadSceneSuccessCallback;
private readonly UnloadSceneFailureCallback m_UnloadSceneFailureCallback; private readonly UnloadSceneFailureCallback _unloadSceneFailureCallback;
/// <summary> /// <summary>
/// 初始化卸载场景回调函数集的新实例。 /// 初始化卸载场景回调函数集的新实例。
@@ -29,8 +29,8 @@
throw new GameFrameworkException("Unload scene success callback is invalid."); throw new GameFrameworkException("Unload scene success callback is invalid.");
} }
m_UnloadSceneSuccessCallback = unloadSceneSuccessCallback; _unloadSceneSuccessCallback = unloadSceneSuccessCallback;
m_UnloadSceneFailureCallback = unloadSceneFailureCallback; _unloadSceneFailureCallback = unloadSceneFailureCallback;
} }
/// <summary> /// <summary>
@@ -40,7 +40,7 @@
{ {
get get
{ {
return m_UnloadSceneSuccessCallback; return _unloadSceneSuccessCallback;
} }
} }
@@ -51,7 +51,7 @@
{ {
get get
{ {
return m_UnloadSceneFailureCallback; return _unloadSceneFailureCallback;
} }
} }
} }

View File

@@ -20,86 +20,86 @@ namespace TEngine
#if ODIN_INSPECTOR #if ODIN_INSPECTOR
[ShowInInspector] [ShowInInspector]
#endif #endif
private SetType setType; private SetType _setType;
#if ODIN_INSPECTOR #if ODIN_INSPECTOR
[ShowInInspector] [ShowInInspector]
#endif #endif
private Image m_Image; private Image _image;
#if ODIN_INSPECTOR #if ODIN_INSPECTOR
[ShowInInspector] [ShowInInspector]
#endif #endif
private SpriteRenderer m_SpriteRenderer; private SpriteRenderer _spriteRenderer;
#if ODIN_INSPECTOR #if ODIN_INSPECTOR
[ShowInInspector] [ShowInInspector]
#endif #endif
private Sprite Sprite; private Sprite _sprite;
public string Location { get; private set; } public string Location { get; private set; }
private bool m_SetNativeSize = false; private bool _setNativeSize = false;
public void SetAsset(Object asset) public void SetAsset(Object asset)
{ {
Sprite = (Sprite)asset; _sprite = (Sprite)asset;
if (m_Image != null) if (_image != null)
{ {
m_Image.sprite = Sprite; _image.sprite = _sprite;
if (m_SetNativeSize) 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() public bool IsCanRelease()
{ {
if (setType == SetType.Image) if (_setType == SetType.Image)
{ {
return m_Image == null || m_Image.sprite == null || return _image == null || _image.sprite == null ||
(Sprite != null && m_Image.sprite != Sprite); (_sprite != null && _image.sprite != _sprite);
} }
else if (setType == SetType.SpriteRender) else if (_setType == SetType.SpriteRender)
{ {
return m_SpriteRenderer == null || m_SpriteRenderer.sprite == null || return _spriteRenderer == null || _spriteRenderer.sprite == null ||
(Sprite != null && m_SpriteRenderer.sprite != Sprite); (_sprite != null && _spriteRenderer.sprite != _sprite);
} }
return true; return true;
} }
public void Clear() public void Clear()
{ {
m_SpriteRenderer = null; _spriteRenderer = null;
m_Image = null; _image = null;
Location = null; Location = null;
Sprite = null; _sprite = null;
setType = SetType.None; _setType = SetType.None;
m_SetNativeSize = false; _setNativeSize = false;
} }
public static SetSpriteObject Create(Image image, string location, bool setNativeSize = false) public static SetSpriteObject Create(Image image, string location, bool setNativeSize = false)
{ {
SetSpriteObject item = MemoryPool.Acquire<SetSpriteObject>(); SetSpriteObject item = MemoryPool.Acquire<SetSpriteObject>();
item.m_Image = image; item._image = image;
item.m_SetNativeSize = setNativeSize; item._setNativeSize = setNativeSize;
item.Location = location; item.Location = location;
item.setType = SetType.Image; item._setType = SetType.Image;
return item; return item;
} }
public static SetSpriteObject Create(SpriteRenderer spriteRenderer, string location) public static SetSpriteObject Create(SpriteRenderer spriteRenderer, string location)
{ {
SetSpriteObject item = MemoryPool.Acquire<SetSpriteObject>(); SetSpriteObject item = MemoryPool.Acquire<SetSpriteObject>();
item.m_SpriteRenderer = spriteRenderer; item._spriteRenderer = spriteRenderer;
item.Location = location; item.Location = location;
item.setType = SetType.SpriteRender; item._setType = SetType.SpriteRender;
return item; return item;
} }
} }

View File

@@ -7,32 +7,32 @@ namespace TEngine
/// <summary> /// <summary>
/// 资源组件。 /// 资源组件。
/// </summary> /// </summary>
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() private void InitializedResources()
{ {
m_ResourceModule = ModuleSystem.GetModule<IResourceModule>(); _resourceModule = ModuleSystem.GetModule<IResourceModule>();
m_LoadAssetCallbacks = new LoadAssetCallbacks(OnLoadAssetSuccess, OnLoadAssetFailure); _loadAssetCallbacks = new LoadAssetCallbacks(OnLoadAssetSuccess, OnLoadAssetFailure);
} }
private void OnLoadAssetFailure(string assetName, LoadResourceStatus status, string errormessage, object userdata) 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); 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) private void OnLoadAssetSuccess(string assetName, object asset, float duration, object userdata)
{ {
m_AssetLoadingList.Remove(assetName); _assetLoadingList.Remove(assetName);
ISetAssetObject setAssetObject = (ISetAssetObject)userdata; ISetAssetObject setAssetObject = (ISetAssetObject)userdata;
UnityEngine.Object assetObject = asset as UnityEngine.Object; UnityEngine.Object assetObject = asset as UnityEngine.Object;
if (assetObject != null) if (assetObject != null)
{ {
m_AssetItemPool.Register(AssetItemObject.Create(setAssetObject.Location, assetObject), true); _assetItemPool.Register(AssetItemObject.Create(setAssetObject.Location, assetObject), true);
SetAsset(setAssetObject, assetObject); SetAsset(setAssetObject, assetObject);
} }
else else
@@ -49,15 +49,15 @@ namespace TEngine
{ {
await TryWaitingLoading(setAssetObject.Location); 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); SetAsset(setAssetObject, assetObject);
} }
else else
{ {
m_AssetLoadingList.Add(setAssetObject.Location); _assetLoadingList.Add(setAssetObject.Location);
m_ResourceModule.LoadAssetAsync(setAssetObject.Location, 0, m_LoadAssetCallbacks, setAssetObject); _resourceModule.LoadAssetAsync(setAssetObject.Location, 0, _loadAssetCallbacks, setAssetObject);
} }
} }
} }

View File

@@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using Cysharp.Threading.Tasks; using Cysharp.Threading.Tasks;
using UnityEngine; using UnityEngine;
using UnityEngine.Serialization;
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
#if ODIN_INSPECTOR #if ODIN_INSPECTOR
using Sirenix.OdinInspector; using Sirenix.OdinInspector;
@@ -18,24 +19,24 @@ namespace TEngine
{ {
public static ResourceExtComponent Instance { private set; get; } public static ResourceExtComponent Instance { private set; get; }
private readonly TimeoutController m_TimeoutController = new TimeoutController(); private readonly TimeoutController _timeoutController = new TimeoutController();
/// <summary> /// <summary>
/// 正在加载的资源列表。 /// 正在加载的资源列表。
/// </summary> /// </summary>
private readonly HashSet<string> m_AssetLoadingList = new HashSet<string>(); private readonly HashSet<string> _assetLoadingList = new HashSet<string>();
/// <summary> /// <summary>
/// 检查是否可以释放间隔 /// 检查是否可以释放间隔
/// </summary> /// </summary>
[SerializeField] private float m_CheckCanReleaseInterval = 30f; [SerializeField] private float checkCanReleaseInterval = 30f;
private float m_CheckCanReleaseTime = 0.0f; private float _checkCanReleaseTime = 0.0f;
/// <summary> /// <summary>
/// 对象池自动释放时间间隔 /// 对象池自动释放时间间隔
/// </summary> /// </summary>
[SerializeField] private float m_AutoReleaseInterval = 60f; [SerializeField] private float autoReleaseInterval = 60f;
/// <summary> /// <summary>
/// 保存加载的图片对象 /// 保存加载的图片对象
@@ -43,19 +44,19 @@ namespace TEngine
#if ODIN_INSPECTOR #if ODIN_INSPECTOR
[ShowInInspector] [ShowInInspector]
#endif #endif
private LinkedList<LoadAssetObject> m_LoadAssetObjectsLinkedList; private LinkedList<LoadAssetObject> _loadAssetObjectsLinkedList;
/// <summary> /// <summary>
/// 散图集合对象池 /// 散图集合对象池
/// </summary> /// </summary>
private IObjectPool<AssetItemObject> m_AssetItemPool; private IObjectPool<AssetItemObject> _assetItemPool;
#if UNITY_EDITOR #if UNITY_EDITOR
public LinkedList<LoadAssetObject> LoadAssetObjectsLinkedList public LinkedList<LoadAssetObject> LoadAssetObjectsLinkedList
{ {
get => m_LoadAssetObjectsLinkedList; get => _loadAssetObjectsLinkedList;
set => m_LoadAssetObjectsLinkedList = value; set => _loadAssetObjectsLinkedList = value;
} }
#endif #endif
private IEnumerator Start() private IEnumerator Start()
@@ -63,18 +64,18 @@ namespace TEngine
Instance = this; Instance = this;
yield return new WaitForEndOfFrame(); yield return new WaitForEndOfFrame();
IObjectPoolModule objectPoolComponent = ModuleSystem.GetModule<IObjectPoolModule>(); IObjectPoolModule objectPoolComponent = ModuleSystem.GetModule<IObjectPoolModule>();
m_AssetItemPool = objectPoolComponent.CreateMultiSpawnObjectPool<AssetItemObject>( _assetItemPool = objectPoolComponent.CreateMultiSpawnObjectPool<AssetItemObject>(
"SetAssetPool", "SetAssetPool",
m_AutoReleaseInterval, 16, 60, 0); autoReleaseInterval, 16, 60, 0);
m_LoadAssetObjectsLinkedList = new LinkedList<LoadAssetObject>(); _loadAssetObjectsLinkedList = new LinkedList<LoadAssetObject>();
InitializedResources(); InitializedResources();
} }
private void Update() private void Update()
{ {
m_CheckCanReleaseTime += Time.unscaledDeltaTime; _checkCanReleaseTime += Time.unscaledDeltaTime;
if (m_CheckCanReleaseTime < (double)m_CheckCanReleaseInterval) if (_checkCanReleaseTime < (double)checkCanReleaseInterval)
{ {
return; return;
} }
@@ -90,45 +91,45 @@ namespace TEngine
#endif #endif
public void ReleaseUnused() public void ReleaseUnused()
{ {
if (m_LoadAssetObjectsLinkedList == null) if (_loadAssetObjectsLinkedList == null)
{ {
return; return;
} }
LinkedListNode<LoadAssetObject> current = m_LoadAssetObjectsLinkedList.First; LinkedListNode<LoadAssetObject> current = _loadAssetObjectsLinkedList.First;
while (current != null) while (current != null)
{ {
var next = current.Next; var next = current.Next;
if (current.Value.AssetObject.IsCanRelease()) if (current.Value.AssetObject.IsCanRelease())
{ {
m_AssetItemPool.Unspawn(current.Value.AssetTarget); _assetItemPool.Unspawn(current.Value.AssetTarget);
MemoryPool.Release(current.Value.AssetObject); MemoryPool.Release(current.Value.AssetObject);
m_LoadAssetObjectsLinkedList.Remove(current); _loadAssetObjectsLinkedList.Remove(current);
} }
current = next; current = next;
} }
m_CheckCanReleaseTime = 0f; _checkCanReleaseTime = 0f;
} }
private void SetAsset(ISetAssetObject setAssetObject, Object assetObject) private void SetAsset(ISetAssetObject setAssetObject, Object assetObject)
{ {
m_LoadAssetObjectsLinkedList.AddLast(new LoadAssetObject(setAssetObject, assetObject)); _loadAssetObjectsLinkedList.AddLast(new LoadAssetObject(setAssetObject, assetObject));
setAssetObject.SetAsset(assetObject); setAssetObject.SetAsset(assetObject);
} }
private async UniTask TryWaitingLoading(string assetObjectKey) private async UniTask TryWaitingLoading(string assetObjectKey)
{ {
if (m_AssetLoadingList.Contains(assetObjectKey)) if (_assetLoadingList.Contains(assetObjectKey))
{ {
try try
{ {
await UniTask.WaitUntil( await UniTask.WaitUntil(
() => !m_AssetLoadingList.Contains(assetObjectKey)) () => !_assetLoadingList.Contains(assetObjectKey))
#if UNITY_EDITOR #if UNITY_EDITOR
.AttachExternalCancellation(m_TimeoutController.Timeout(TimeSpan.FromSeconds(60))); .AttachExternalCancellation(_timeoutController.Timeout(TimeSpan.FromSeconds(60)));
m_TimeoutController.Reset(); _timeoutController.Reset();
#else #else
; ;
#endif #endif
@@ -136,7 +137,7 @@ namespace TEngine
} }
catch (OperationCanceledException ex) catch (OperationCanceledException ex)
{ {
if (m_TimeoutController.IsTimeout()) if (_timeoutController.IsTimeout())
{ {
Log.Error($"LoadAssetAsync Waiting {assetObjectKey} timeout. reason:{ex.Message}"); Log.Error($"LoadAssetAsync Waiting {assetObjectKey} timeout. reason:{ex.Message}");
} }

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.Serialization;
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
namespace TEngine namespace TEngine
@@ -21,9 +22,9 @@ namespace TEngine
public sealed class AssetsReference : MonoBehaviour public sealed class AssetsReference : MonoBehaviour
{ {
[SerializeField] private GameObject _sourceGameObject; [SerializeField] private GameObject sourceGameObject;
[SerializeField] private List<AssetsRefInfo> _refAssetInfoList; [SerializeField] private List<AssetsRefInfo> refAssetInfoList;
private IResourceModule _resourceModule; private IResourceModule _resourceModule;
@@ -39,9 +40,9 @@ namespace TEngine
throw new GameFrameworkException($"resourceModule is null."); throw new GameFrameworkException($"resourceModule is null.");
} }
if (_sourceGameObject != null) if (sourceGameObject != null)
{ {
_resourceModule.UnloadAsset(_sourceGameObject); _resourceModule.UnloadAsset(sourceGameObject);
} }
ReleaseRefAssetInfoList(); ReleaseRefAssetInfoList();
@@ -49,14 +50,14 @@ namespace TEngine
private void ReleaseRefAssetInfoList() private void ReleaseRefAssetInfoList()
{ {
if (_refAssetInfoList != null) if (refAssetInfoList != null)
{ {
foreach (var refInfo in _refAssetInfoList) foreach (var refInfo in refAssetInfoList)
{ {
_resourceModule.UnloadAsset(refInfo.refAsset); _resourceModule.UnloadAsset(refInfo.refAsset);
} }
_refAssetInfoList.Clear(); refAssetInfoList.Clear();
} }
} }
@@ -73,7 +74,7 @@ namespace TEngine
} }
_resourceModule = resourceModule; _resourceModule = resourceModule;
_sourceGameObject = source; sourceGameObject = source;
return this; return this;
} }
@@ -85,11 +86,11 @@ namespace TEngine
} }
_resourceModule = resourceModule; _resourceModule = resourceModule;
if (_refAssetInfoList == null) if (refAssetInfoList == null)
{ {
_refAssetInfoList = new List<AssetsRefInfo>(); refAssetInfoList = new List<AssetsRefInfo>();
} }
_refAssetInfoList.Add(new AssetsRefInfo(source)); refAssetInfoList.Add(new AssetsRefInfo(source));
return this; return this;
} }

View File

@@ -10,14 +10,8 @@ namespace TEngine
/// </summary> /// </summary>
private sealed class AssetObject : ObjectBase private sealed class AssetObject : ObjectBase
{ {
private AssetHandle m_AssetHandle; private AssetHandle _assetHandle = null;
private ResourceModule m_ResourceManager; private ResourceModule _resourceModule;
public AssetObject()
{
m_AssetHandle = null;
}
public static AssetObject Create(string name, object target, object assetHandle, 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>(); AssetObject assetObject = MemoryPool.Acquire<AssetObject>();
assetObject.Initialize(name, target); assetObject.Initialize(name, target);
assetObject.m_AssetHandle = (AssetHandle)assetHandle; assetObject._assetHandle = (AssetHandle)assetHandle;
assetObject.m_ResourceManager = resourceModule; assetObject._resourceModule = resourceModule;
return assetObject; return assetObject;
} }
public override void Clear() public override void Clear()
{ {
base.Clear(); base.Clear();
m_AssetHandle = null; _assetHandle = null;
} }
protected internal override void OnUnspawn() protected internal override void OnUnspawn()
@@ -53,7 +47,7 @@ namespace TEngine
{ {
if (!isShutdown) if (!isShutdown)
{ {
AssetHandle handle = m_AssetHandle; AssetHandle handle = _assetHandle;
if (handle is { IsValid: true }) if (handle is { IsValid: true })
{ {
handle.Dispose(); handle.Dispose();

View File

@@ -2,15 +2,15 @@
{ {
internal partial class ResourceModule internal partial class ResourceModule
{ {
private IObjectPool<AssetObject> m_AssetPool; private IObjectPool<AssetObject> _assetPool;
/// <summary> /// <summary>
/// 获取或设置资源对象池自动释放可释放对象的间隔秒数。 /// 获取或设置资源对象池自动释放可释放对象的间隔秒数。
/// </summary> /// </summary>
public float AssetAutoReleaseInterval public float AssetAutoReleaseInterval
{ {
get => m_AssetPool.AutoReleaseInterval; get => _assetPool.AutoReleaseInterval;
set => m_AssetPool.AutoReleaseInterval = value; set => _assetPool.AutoReleaseInterval = value;
} }
/// <summary> /// <summary>
@@ -18,8 +18,8 @@
/// </summary> /// </summary>
public int AssetCapacity public int AssetCapacity
{ {
get => m_AssetPool.Capacity; get => _assetPool.Capacity;
set => m_AssetPool.Capacity = value; set => _assetPool.Capacity = value;
} }
/// <summary> /// <summary>
@@ -27,8 +27,8 @@
/// </summary> /// </summary>
public float AssetExpireTime public float AssetExpireTime
{ {
get => m_AssetPool.ExpireTime; get => _assetPool.ExpireTime;
set => m_AssetPool.ExpireTime = value; set => _assetPool.ExpireTime = value;
} }
/// <summary> /// <summary>
@@ -36,8 +36,8 @@
/// </summary> /// </summary>
public int AssetPriority public int AssetPriority
{ {
get => m_AssetPool.Priority; get => _assetPool.Priority;
set => m_AssetPool.Priority = value; set => _assetPool.Priority = value;
} }
/// <summary> /// <summary>
@@ -46,9 +46,9 @@
/// <param name="asset">要卸载的资源。</param> /// <param name="asset">要卸载的资源。</param>
public void UnloadAsset(object asset) 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."); throw new GameFrameworkException("Object pool manager is invalid.");
} }
m_AssetPool = objectPoolModule.CreateMultiSpawnObjectPool<AssetObject>("Asset Pool"); _assetPool = objectPoolModule.CreateMultiSpawnObjectPool<AssetObject>("Asset Pool");
} }
} }
} }

View File

@@ -49,19 +49,19 @@ namespace TEngine
public string FallbackHostServerURL { get; set; } public string FallbackHostServerURL { get; set; }
private string m_ApplicableGameVersion; private string _applicableGameVersion;
private int m_InternalResourceVersion; private int _internalResourceVersion;
/// <summary> /// <summary>
/// 获取当前资源适用的游戏版本号。 /// 获取当前资源适用的游戏版本号。
/// </summary> /// </summary>
public string ApplicableGameVersion => m_ApplicableGameVersion; public string ApplicableGameVersion => _applicableGameVersion;
/// <summary> /// <summary>
/// 获取当前内部资源版本号。 /// 获取当前内部资源版本号。
/// </summary> /// </summary>
public int InternalResourceVersion => m_InternalResourceVersion; public int InternalResourceVersion => _internalResourceVersion;
/// <summary> /// <summary>
/// 当前最新的包裹版本。 /// 当前最新的包裹版本。
@@ -318,10 +318,10 @@ namespace TEngine
public void OnLowMemory() public void OnLowMemory()
{ {
Log.Warning("Low memory reported..."); Log.Warning("Low memory reported...");
m_ForceUnloadUnusedAssetsAction?.Invoke(true); _forceUnloadUnusedAssetsAction?.Invoke(true);
} }
private Action<bool> m_ForceUnloadUnusedAssetsAction; private Action<bool> _forceUnloadUnusedAssetsAction;
/// <summary> /// <summary>
/// 低内存回调保护。 /// 低内存回调保护。
@@ -329,7 +329,7 @@ namespace TEngine
/// <param name="action">低内存行为。</param> /// <param name="action">低内存行为。</param>
public void SetForceUnloadUnusedAssetsAction(Action<bool> action) public void SetForceUnloadUnusedAssetsAction(Action<bool> action)
{ {
m_ForceUnloadUnusedAssetsAction = action; _forceUnloadUnusedAssetsAction = action;
} }
/// <summary> /// <summary>
@@ -337,7 +337,7 @@ namespace TEngine
/// </summary> /// </summary>
public void UnloadUnusedAssets() public void UnloadUnusedAssets()
{ {
m_AssetPool.ReleaseAllUnused(); _assetPool.ReleaseAllUnused();
foreach (var package in PackageMap.Values) foreach (var package in PackageMap.Values)
{ {
if (package is { InitializeStatus: EOperationStatus.Succeed }) if (package is { InitializeStatus: EOperationStatus.Succeed })
@@ -369,7 +369,7 @@ namespace TEngine
public void ForceUnloadUnusedAssets(bool performGCCollect) public void ForceUnloadUnusedAssets(bool performGCCollect)
{ {
m_ForceUnloadUnusedAssetsAction?.Invoke(performGCCollect); _forceUnloadUnusedAssetsAction?.Invoke(performGCCollect);
} }
#region Public Methods #region Public Methods
@@ -623,7 +623,7 @@ namespace TEngine
} }
string assetObjectKey = GetCacheKey(location, packageName); string assetObjectKey = GetCacheKey(location, packageName);
AssetObject assetObject = m_AssetPool.Spawn(assetObjectKey); AssetObject assetObject = _assetPool.Spawn(assetObjectKey);
if (assetObject != null) if (assetObject != null)
{ {
return assetObject.Target as T; return assetObject.Target as T;
@@ -634,7 +634,7 @@ namespace TEngine
T ret = handle.AssetObject as T; T ret = handle.AssetObject as T;
assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this); assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this);
m_AssetPool.Register(assetObject, true); _assetPool.Register(assetObject, true);
return ret; return ret;
} }
@@ -647,7 +647,7 @@ namespace TEngine
} }
string assetObjectKey = GetCacheKey(location, packageName); string assetObjectKey = GetCacheKey(location, packageName);
AssetObject assetObject = m_AssetPool.Spawn(assetObjectKey); AssetObject assetObject = _assetPool.Spawn(assetObjectKey);
if (assetObject != null) if (assetObject != null)
{ {
return AssetsReference.Instantiate(assetObject.Target as GameObject, parent, this).gameObject; 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; GameObject gameObject = AssetsReference.Instantiate(handle.AssetObject as GameObject, parent, this).gameObject;
assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this); assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this);
m_AssetPool.Register(assetObject, true); _assetPool.Register(assetObject, true);
return gameObject; return gameObject;
} }
@@ -687,7 +687,7 @@ namespace TEngine
await TryWaitingLoading(assetObjectKey); await TryWaitingLoading(assetObjectKey);
AssetObject assetObject = m_AssetPool.Spawn(assetObjectKey); AssetObject assetObject = _assetPool.Spawn(assetObjectKey);
if (assetObject != null) if (assetObject != null)
{ {
await UniTask.Yield(); await UniTask.Yield();
@@ -706,7 +706,7 @@ namespace TEngine
if (assetHandle.AssetObject != null) if (assetHandle.AssetObject != null)
{ {
assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this); assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this);
m_AssetPool.Register(assetObject, true); _assetPool.Register(assetObject, true);
callback?.Invoke(assetObject.Target as T); callback?.Invoke(assetObject.Target as T);
} }
@@ -748,7 +748,7 @@ namespace TEngine
await TryWaitingLoading(assetObjectKey); await TryWaitingLoading(assetObjectKey);
AssetObject assetObject = m_AssetPool.Spawn(assetObjectKey); AssetObject assetObject = _assetPool.Spawn(assetObjectKey);
if (assetObject != null) if (assetObject != null)
{ {
await UniTask.Yield(); await UniTask.Yield();
@@ -768,7 +768,7 @@ namespace TEngine
} }
assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this); assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this);
m_AssetPool.Register(assetObject, true); _assetPool.Register(assetObject, true);
_assetLoadingList.Remove(assetObjectKey); _assetLoadingList.Remove(assetObjectKey);
@@ -786,7 +786,7 @@ namespace TEngine
await TryWaitingLoading(assetObjectKey); await TryWaitingLoading(assetObjectKey);
AssetObject assetObject = m_AssetPool.Spawn(assetObjectKey); AssetObject assetObject = _assetPool.Spawn(assetObjectKey);
if (assetObject != null) if (assetObject != null)
{ {
await UniTask.Yield(); await UniTask.Yield();
@@ -808,7 +808,7 @@ namespace TEngine
GameObject gameObject = AssetsReference.Instantiate(handle.AssetObject as GameObject, parent, this).gameObject; GameObject gameObject = AssetsReference.Instantiate(handle.AssetObject as GameObject, parent, this).gameObject;
assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this); assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this);
m_AssetPool.Register(assetObject, true); _assetPool.Register(assetObject, true);
_assetLoadingList.Remove(assetObjectKey); _assetLoadingList.Remove(assetObjectKey);
@@ -844,7 +844,7 @@ namespace TEngine
float duration = Time.time; float duration = Time.time;
AssetObject assetObject = m_AssetPool.Spawn(assetObjectKey); AssetObject assetObject = _assetPool.Spawn(assetObjectKey);
if (assetObject != null) if (assetObject != null)
{ {
await UniTask.Yield(); await UniTask.Yield();
@@ -895,7 +895,7 @@ namespace TEngine
else else
{ {
assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this); assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this);
m_AssetPool.Register(assetObject, true); _assetPool.Register(assetObject, true);
_assetLoadingList.Remove(assetObjectKey); _assetLoadingList.Remove(assetObjectKey);
@@ -934,7 +934,7 @@ namespace TEngine
float duration = Time.time; float duration = Time.time;
AssetObject assetObject = m_AssetPool.Spawn(assetObjectKey); AssetObject assetObject = _assetPool.Spawn(assetObjectKey);
if (assetObject != null) if (assetObject != null)
{ {
await UniTask.Yield(); await UniTask.Yield();
@@ -985,7 +985,7 @@ namespace TEngine
else else
{ {
assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this); assetObject = AssetObject.Create(assetObjectKey, handle.AssetObject, handle, this);
m_AssetPool.Register(assetObject, true); _assetPool.Register(assetObject, true);
_assetLoadingList.Remove(assetObjectKey); _assetLoadingList.Remove(assetObjectKey);

View File

@@ -1,5 +1,6 @@
using System; using System;
using UnityEngine; using UnityEngine;
using UnityEngine.Serialization;
using YooAsset; using YooAsset;
namespace TEngine namespace TEngine
@@ -14,23 +15,23 @@ namespace TEngine
private const int DefaultPriority = 0; 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;
/// <summary> /// <summary>
/// 当前最新的包裹版本。 /// 当前最新的包裹版本。
@@ -87,54 +88,54 @@ namespace TEngine
/// <summary> /// <summary>
/// 是否支持边玩边下载。 /// 是否支持边玩边下载。
/// </summary> /// </summary>
[SerializeField] private bool m_UpdatableWhilePlaying = false; [SerializeField] private bool updatableWhilePlaying = false;
/// <summary> /// <summary>
/// 是否支持边玩边下载。 /// 是否支持边玩边下载。
/// </summary> /// </summary>
public bool UpdatableWhilePlaying => m_UpdatableWhilePlaying; public bool UpdatableWhilePlaying => updatableWhilePlaying;
/// <summary> /// <summary>
/// 设置异步系统参数,每帧执行消耗的最大时间切片(单位:毫秒) /// 设置异步系统参数,每帧执行消耗的最大时间切片(单位:毫秒)
/// </summary> /// </summary>
[SerializeField] public long Milliseconds = 30; [SerializeField] public long milliseconds = 30;
public int m_DownloadingMaxNum = 10; public int downloadingMaxNum = 10;
/// <summary> /// <summary>
/// 获取或设置同时最大下载数目。 /// 获取或设置同时最大下载数目。
/// </summary> /// </summary>
public int DownloadingMaxNum public int DownloadingMaxNum
{ {
get => m_DownloadingMaxNum; get => downloadingMaxNum;
set => m_DownloadingMaxNum = value; set => downloadingMaxNum = value;
} }
public int m_FailedTryAgain = 3; [SerializeField] public int failedTryAgain = 3;
public int FailedTryAgain public int FailedTryAgain
{ {
get => m_FailedTryAgain; get => failedTryAgain;
set => m_FailedTryAgain = value; set => failedTryAgain = value;
} }
/// <summary> /// <summary>
/// 获取当前资源适用的游戏版本号。 /// 获取当前资源适用的游戏版本号。
/// </summary> /// </summary>
public string ApplicableGameVersion => m_ResourceModule.ApplicableGameVersion; public string ApplicableGameVersion => _resourceModule.ApplicableGameVersion;
/// <summary> /// <summary>
/// 获取当前内部资源版本号。 /// 获取当前内部资源版本号。
/// </summary> /// </summary>
public int InternalResourceVersion => m_ResourceModule.InternalResourceVersion; public int InternalResourceVersion => _resourceModule.InternalResourceVersion;
/// <summary> /// <summary>
/// 获取或设置无用资源释放的最小间隔时间,以秒为单位。 /// 获取或设置无用资源释放的最小间隔时间,以秒为单位。
/// </summary> /// </summary>
public float MinUnloadUnusedAssetsInterval public float MinUnloadUnusedAssetsInterval
{ {
get => m_MinUnloadUnusedAssetsInterval; get => minUnloadUnusedAssetsInterval;
set => m_MinUnloadUnusedAssetsInterval = value; set => minUnloadUnusedAssetsInterval = value;
} }
/// <summary> /// <summary>
@@ -142,8 +143,8 @@ namespace TEngine
/// </summary> /// </summary>
public float MaxUnloadUnusedAssetsInterval public float MaxUnloadUnusedAssetsInterval
{ {
get => m_MaxUnloadUnusedAssetsInterval; get => maxUnloadUnusedAssetsInterval;
set => m_MaxUnloadUnusedAssetsInterval = value; set => maxUnloadUnusedAssetsInterval = value;
} }
/// <summary> /// <summary>
@@ -151,30 +152,30 @@ namespace TEngine
/// </summary> /// </summary>
public bool UseSystemUnloadUnusedAssets public bool UseSystemUnloadUnusedAssets
{ {
get => m_UseSystemUnloadUnusedAssets; get => useSystemUnloadUnusedAssets;
set => m_UseSystemUnloadUnusedAssets = value; set => useSystemUnloadUnusedAssets = value;
} }
/// <summary> /// <summary>
/// 获取无用资源释放的等待时长,以秒为单位。 /// 获取无用资源释放的等待时长,以秒为单位。
/// </summary> /// </summary>
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;
/// <summary> /// <summary>
/// 获取或设置资源对象池自动释放可释放对象的间隔秒数。 /// 获取或设置资源对象池自动释放可释放对象的间隔秒数。
/// </summary> /// </summary>
public float AssetAutoReleaseInterval public float AssetAutoReleaseInterval
{ {
get => m_ResourceModule.AssetAutoReleaseInterval; get => _resourceModule.AssetAutoReleaseInterval;
set => m_ResourceModule.AssetAutoReleaseInterval = m_AssetAutoReleaseInterval = value; set => _resourceModule.AssetAutoReleaseInterval = assetAutoReleaseInterval = value;
} }
/// <summary> /// <summary>
@@ -182,8 +183,8 @@ namespace TEngine
/// </summary> /// </summary>
public int AssetCapacity public int AssetCapacity
{ {
get => m_ResourceModule.AssetCapacity; get => _resourceModule.AssetCapacity;
set => m_ResourceModule.AssetCapacity = m_AssetCapacity = value; set => _resourceModule.AssetCapacity = assetCapacity = value;
} }
/// <summary> /// <summary>
@@ -191,8 +192,8 @@ namespace TEngine
/// </summary> /// </summary>
public float AssetExpireTime public float AssetExpireTime
{ {
get => m_ResourceModule.AssetExpireTime; get => _resourceModule.AssetExpireTime;
set => m_ResourceModule.AssetExpireTime = m_AssetExpireTime = value; set => _resourceModule.AssetExpireTime = assetExpireTime = value;
} }
/// <summary> /// <summary>
@@ -200,16 +201,16 @@ namespace TEngine
/// </summary> /// </summary>
public int AssetPriority public int AssetPriority
{ {
get => m_ResourceModule.AssetPriority; get => _resourceModule.AssetPriority;
set => m_ResourceModule.AssetPriority = m_AssetPriority = value; set => _resourceModule.AssetPriority = assetPriority = value;
} }
#endregion #endregion
private void Start() private void Start()
{ {
m_ResourceModule = ModuleSystem.GetModule<IResourceModule>(); _resourceModule = ModuleSystem.GetModule<IResourceModule>();
if (m_ResourceModule == null) if (_resourceModule == null)
{ {
Log.Fatal("Resource module is invalid."); Log.Fatal("Resource module is invalid.");
return; return;
@@ -223,20 +224,20 @@ namespace TEngine
#endif #endif
} }
m_ResourceModule.DefaultPackageName = PackageName; _resourceModule.DefaultPackageName = PackageName;
m_ResourceModule.PlayMode = PlayMode; _resourceModule.PlayMode = PlayMode;
m_ResourceModule.Milliseconds = Milliseconds; _resourceModule.Milliseconds = milliseconds;
m_ResourceModule.HostServerURL = Settings.UpdateSetting.GetResDownLoadPath(); _resourceModule.HostServerURL = Settings.UpdateSetting.GetResDownLoadPath();
m_ResourceModule.FallbackHostServerURL = Settings.UpdateSetting.GetFallbackResDownLoadPath(); _resourceModule.FallbackHostServerURL = Settings.UpdateSetting.GetFallbackResDownLoadPath();
m_ResourceModule.DownloadingMaxNum = DownloadingMaxNum; _resourceModule.DownloadingMaxNum = DownloadingMaxNum;
m_ResourceModule.FailedTryAgain = FailedTryAgain; _resourceModule.FailedTryAgain = FailedTryAgain;
m_ResourceModule.UpdatableWhilePlaying = UpdatableWhilePlaying; _resourceModule.UpdatableWhilePlaying = UpdatableWhilePlaying;
m_ResourceModule.Initialize(); _resourceModule.Initialize();
m_ResourceModule.AssetAutoReleaseInterval = m_AssetAutoReleaseInterval; _resourceModule.AssetAutoReleaseInterval = assetAutoReleaseInterval;
m_ResourceModule.AssetCapacity = m_AssetCapacity; _resourceModule.AssetCapacity = assetCapacity;
m_ResourceModule.AssetExpireTime = m_AssetExpireTime; _resourceModule.AssetExpireTime = assetExpireTime;
m_ResourceModule.AssetPriority = m_AssetPriority; _resourceModule.AssetPriority = assetPriority;
m_ResourceModule.SetForceUnloadUnusedAssetsAction(ForceUnloadUnusedAssets); _resourceModule.SetForceUnloadUnusedAssetsAction(ForceUnloadUnusedAssets);
Log.Info($"ResourceModule Run Mode{PlayMode}"); Log.Info($"ResourceModule Run Mode{PlayMode}");
} }
@@ -248,38 +249,38 @@ namespace TEngine
/// <param name="performGCCollect">是否使用垃圾回收。</param> /// <param name="performGCCollect">是否使用垃圾回收。</param>
public void ForceUnloadUnusedAssets(bool performGCCollect) public void ForceUnloadUnusedAssets(bool performGCCollect)
{ {
m_ForceUnloadUnusedAssets = true; _forceUnloadUnusedAssets = true;
if (performGCCollect) if (performGCCollect)
{ {
m_PerformGCCollect = true; _performGCCollect = true;
} }
} }
private void Update() private void Update()
{ {
m_LastUnloadUnusedAssetsOperationElapseSeconds += Time.unscaledDeltaTime; _lastUnloadUnusedAssetsOperationElapseSeconds += Time.unscaledDeltaTime;
if (m_AsyncOperation == null && (m_ForceUnloadUnusedAssets || m_LastUnloadUnusedAssetsOperationElapseSeconds >= m_MaxUnloadUnusedAssetsInterval || if (_asyncOperation == null && (_forceUnloadUnusedAssets || _lastUnloadUnusedAssetsOperationElapseSeconds >= maxUnloadUnusedAssetsInterval ||
m_PreorderUnloadUnusedAssets && m_LastUnloadUnusedAssetsOperationElapseSeconds >= m_MinUnloadUnusedAssetsInterval)) _preorderUnloadUnusedAssets && _lastUnloadUnusedAssetsOperationElapseSeconds >= minUnloadUnusedAssetsInterval))
{ {
Log.Info("Unload unused assets..."); Log.Info("Unload unused assets...");
m_ForceUnloadUnusedAssets = false; _forceUnloadUnusedAssets = false;
m_PreorderUnloadUnusedAssets = false; _preorderUnloadUnusedAssets = false;
m_LastUnloadUnusedAssetsOperationElapseSeconds = 0f; _lastUnloadUnusedAssetsOperationElapseSeconds = 0f;
m_AsyncOperation = Resources.UnloadUnusedAssets(); _asyncOperation = Resources.UnloadUnusedAssets();
if (m_UseSystemUnloadUnusedAssets) if (useSystemUnloadUnusedAssets)
{ {
m_ResourceModule.UnloadUnusedAssets(); _resourceModule.UnloadUnusedAssets();
} }
} }
if (m_AsyncOperation is { isDone: true }) if (_asyncOperation is { isDone: true })
{ {
m_AsyncOperation = null; _asyncOperation = null;
if (m_PerformGCCollect) if (_performGCCollect)
{ {
Log.Info("GC.Collect..."); Log.Info("GC.Collect...");
m_PerformGCCollect = false; _performGCCollect = false;
GC.Collect(); GC.Collect();
} }
} }

View File

@@ -9,41 +9,33 @@ namespace TEngine
[DisallowMultipleComponent] [DisallowMultipleComponent]
public sealed class RootModule : MonoBehaviour 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] [SerializeField] private Language editorLanguage = Language.Unspecified;
private Language m_EditorLanguage = Language.Unspecified;
[SerializeField] [SerializeField] private string textHelperTypeName = "TEngine.DefaultTextHelper";
private string m_TextHelperTypeName = "TEngine.DefaultTextHelper";
[SerializeField] [SerializeField] private string logHelperTypeName = "TEngine.DefaultLogHelper";
private string m_LogHelperTypeName = "TEngine.DefaultLogHelper";
[SerializeField] [SerializeField] private string jsonHelperTypeName = "TEngine.DefaultJsonHelper";
private string m_JsonHelperTypeName = "TEngine.DefaultJsonHelper";
[SerializeField] [SerializeField] private int frameRate = 120;
private int m_FrameRate = 120;
[SerializeField] [SerializeField] private float gameSpeed = 1f;
private float m_GameSpeed = 1f;
[SerializeField] [SerializeField] private bool runInBackground = true;
private bool m_RunInBackground = true;
[SerializeField] [SerializeField] private bool neverSleep = true;
private bool m_NeverSleep = true;
/// <summary> /// <summary>
/// 获取或设置编辑器语言(仅编辑器内有效)。 /// 获取或设置编辑器语言(仅编辑器内有效)。
/// </summary> /// </summary>
public Language EditorLanguage public Language EditorLanguage
{ {
get => m_EditorLanguage; get => editorLanguage;
set => m_EditorLanguage = value; set => editorLanguage = value;
} }
/// <summary> /// <summary>
@@ -51,8 +43,8 @@ namespace TEngine
/// </summary> /// </summary>
public int FrameRate public int FrameRate
{ {
get => m_FrameRate; get => frameRate;
set => Application.targetFrameRate = m_FrameRate = value; set => Application.targetFrameRate = frameRate = value;
} }
/// <summary> /// <summary>
@@ -60,27 +52,27 @@ namespace TEngine
/// </summary> /// </summary>
public float GameSpeed public float GameSpeed
{ {
get => m_GameSpeed; get => gameSpeed;
set => Time.timeScale = m_GameSpeed = value >= 0f ? value : 0f; set => Time.timeScale = gameSpeed = value >= 0f ? value : 0f;
} }
/// <summary> /// <summary>
/// 获取游戏是否暂停。 /// 获取游戏是否暂停。
/// </summary> /// </summary>
public bool IsGamePaused => m_GameSpeed <= 0f; public bool IsGamePaused => gameSpeed <= 0f;
/// <summary> /// <summary>
/// 获取是否正常游戏速度。 /// 获取是否正常游戏速度。
/// </summary> /// </summary>
public bool IsNormalGameSpeed => Math.Abs(m_GameSpeed - 1f) < 0.01f; public bool IsNormalGameSpeed => Math.Abs(gameSpeed - 1f) < 0.01f;
/// <summary> /// <summary>
/// 获取或设置是否允许后台运行。 /// 获取或设置是否允许后台运行。
/// </summary> /// </summary>
public bool RunInBackground public bool RunInBackground
{ {
get => m_RunInBackground; get => runInBackground;
set => Application.runInBackground = m_RunInBackground = value; set => Application.runInBackground = runInBackground = value;
} }
/// <summary> /// <summary>
@@ -88,10 +80,10 @@ namespace TEngine
/// </summary> /// </summary>
public bool NeverSleep public bool NeverSleep
{ {
get => m_NeverSleep; get => neverSleep;
set set
{ {
m_NeverSleep = value; neverSleep = value;
Screen.sleepTimeout = value ? SleepTimeout.NeverSleep : SleepTimeout.SystemSetting; Screen.sleepTimeout = value ? SleepTimeout.NeverSleep : SleepTimeout.SystemSetting;
} }
} }
@@ -113,10 +105,10 @@ namespace TEngine
Utility.Converter.ScreenDpi = DefaultDpi; Utility.Converter.ScreenDpi = DefaultDpi;
} }
Application.targetFrameRate = m_FrameRate; Application.targetFrameRate = frameRate;
Time.timeScale = m_GameSpeed; Time.timeScale = gameSpeed;
Application.runInBackground = m_RunInBackground; Application.runInBackground = runInBackground;
Screen.sleepTimeout = m_NeverSleep ? SleepTimeout.NeverSleep : SleepTimeout.SystemSetting; Screen.sleepTimeout = neverSleep ? SleepTimeout.NeverSleep : SleepTimeout.SystemSetting;
Application.lowMemory += OnLowMemory; Application.lowMemory += OnLowMemory;
GameTime.StartFrame(); GameTime.StartFrame();
@@ -161,7 +153,7 @@ namespace TEngine
return; return;
} }
m_GameSpeedBeforePause = GameSpeed; _gameSpeedBeforePause = GameSpeed;
GameSpeed = 0f; GameSpeed = 0f;
} }
@@ -175,7 +167,7 @@ namespace TEngine
return; return;
} }
GameSpeed = m_GameSpeedBeforePause; GameSpeed = _gameSpeedBeforePause;
} }
/// <summary> /// <summary>
@@ -198,22 +190,22 @@ namespace TEngine
private void InitTextHelper() private void InitTextHelper()
{ {
if (string.IsNullOrEmpty(m_TextHelperTypeName)) if (string.IsNullOrEmpty(textHelperTypeName))
{ {
return; return;
} }
Type textHelperType = Utility.Assembly.GetType(m_TextHelperTypeName); Type textHelperType = Utility.Assembly.GetType(textHelperTypeName);
if (textHelperType == null) 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; return;
} }
Utility.Text.ITextHelper textHelper = (Utility.Text.ITextHelper)Activator.CreateInstance(textHelperType); Utility.Text.ITextHelper textHelper = (Utility.Text.ITextHelper)Activator.CreateInstance(textHelperType);
if (textHelper == null) 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; return;
} }
@@ -222,21 +214,24 @@ namespace TEngine
private void InitLogHelper() private void InitLogHelper()
{ {
if (string.IsNullOrEmpty(m_LogHelperTypeName)) if (string.IsNullOrEmpty(logHelperTypeName))
{ {
return; return;
} }
Type logHelperType = Utility.Assembly.GetType(m_LogHelperTypeName); Type logHelperType = Utility.Assembly.GetType(logHelperTypeName);
if (logHelperType == null) 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) 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); GameFrameworkLog.SetLogHelper(logHelper);
@@ -244,22 +239,22 @@ namespace TEngine
private void InitJsonHelper() private void InitJsonHelper()
{ {
if (string.IsNullOrEmpty(m_JsonHelperTypeName)) if (string.IsNullOrEmpty(jsonHelperTypeName))
{ {
return; return;
} }
Type jsonHelperType = Utility.Assembly.GetType(m_JsonHelperTypeName); Type jsonHelperType = Utility.Assembly.GetType(jsonHelperTypeName);
if (jsonHelperType == null) 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; return;
} }
Utility.Json.IJsonHelper jsonHelper = (Utility.Json.IJsonHelper)Activator.CreateInstance(jsonHelperType); Utility.Json.IJsonHelper jsonHelper = (Utility.Json.IJsonHelper)Activator.CreateInstance(jsonHelperType);
if (jsonHelper == null) 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; return;
} }

View File

@@ -1,6 +1,4 @@
using System; using UnityEngine;
using UnityEngine;
using UnityEngine.Serialization;
namespace TEngine namespace TEngine
{ {

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 2e3cd0841baf4f42a5ac166b4a9fce2b
timeCreated: 1705927238

View File

@@ -1,7 +0,0 @@
namespace TEngine
{
public interface IUIModule
{
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 20e1c311409e4636a6f6b07c843e6aa7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -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<IResourceModule>();
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: f42e54968df4423eac3a935f0f06b904
timeCreated: 1705927246

View File

@@ -13,35 +13,35 @@ MonoBehaviour:
m_Name: AudioSetting m_Name: AudioSetting
m_EditorClassIdentifier: m_EditorClassIdentifier:
audioGroupConfigs: audioGroupConfigs:
- m_Name: Music - name: Music
m_Mute: 0 mute: 0
m_Volume: 0.5 volume: 0.5
m_AgentHelperCount: 1 agentHelperCount: 1
AudioType: 2 audioType: 2
audioRolloffMode: 1 audioRolloffMode: 1
minDistance: 15 minDistance: 15
maxDistance: 50 maxDistance: 50
- m_Name: Sound - name: Sound
m_Mute: 0 mute: 0
m_Volume: 0.5 volume: 0.5
m_AgentHelperCount: 4 agentHelperCount: 4
AudioType: 0 audioType: 0
audioRolloffMode: 0 audioRolloffMode: 0
minDistance: 1 minDistance: 1
maxDistance: 500 maxDistance: 500
- m_Name: UISound - name: UISound
m_Mute: 0 mute: 0
m_Volume: 0.5 volume: 0.5
m_AgentHelperCount: 4 agentHelperCount: 4
AudioType: 1 audioType: 1
audioRolloffMode: 0 audioRolloffMode: 0
minDistance: 1 minDistance: 1
maxDistance: 500 maxDistance: 500
- m_Name: Voice - name: Voice
m_Mute: 0 mute: 0
m_Volume: 0.5 volume: 0.5
m_AgentHelperCount: 1 agentHelperCount: 1
AudioType: 3 audioType: 3
audioRolloffMode: 0 audioRolloffMode: 0
minDistance: 1 minDistance: 1
maxDistance: 500 maxDistance: 500

View File

@@ -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: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0135d4f2f69a1d04aa9d82d50d3763db
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant: