[+] UI ErrorLog

[+] UI ErrorLog
This commit is contained in:
ALEXTANG
2023-04-21 10:55:12 +08:00
parent f1c8a91660
commit cc5654b9ed
7 changed files with 12 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ namespace TEngine.Editor.Inspector
internal sealed class UIModuleInspector : GameFrameworkInspector internal sealed class UIModuleInspector : GameFrameworkInspector
{ {
private SerializedProperty m_InstanceRoot = null; private SerializedProperty m_InstanceRoot = null;
private SerializedProperty m_enableErrorLog = null;
private SerializedProperty m_dontDestroyUIRoot = null; private SerializedProperty m_dontDestroyUIRoot = null;
private SerializedProperty m_UICamera = null; private SerializedProperty m_UICamera = null;
@@ -20,6 +21,7 @@ namespace TEngine.Editor.Inspector
EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode); EditorGUI.BeginDisabledGroup(EditorApplication.isPlayingOrWillChangePlaymode);
{ {
EditorGUILayout.PropertyField(m_InstanceRoot); EditorGUILayout.PropertyField(m_InstanceRoot);
EditorGUILayout.PropertyField(m_enableErrorLog);
EditorGUILayout.PropertyField(m_dontDestroyUIRoot); EditorGUILayout.PropertyField(m_dontDestroyUIRoot);
EditorGUILayout.PropertyField(m_UICamera); EditorGUILayout.PropertyField(m_UICamera);
} }
@@ -40,6 +42,7 @@ namespace TEngine.Editor.Inspector
private void OnEnable() private void OnEnable()
{ {
m_InstanceRoot = serializedObject.FindProperty("m_InstanceRoot"); m_InstanceRoot = serializedObject.FindProperty("m_InstanceRoot");
m_enableErrorLog = serializedObject.FindProperty("m_enableErrorLog");
m_dontDestroyUIRoot = serializedObject.FindProperty("m_dontDestroyUIRoot"); m_dontDestroyUIRoot = serializedObject.FindProperty("m_dontDestroyUIRoot");
m_UICamera = serializedObject.FindProperty("m_UICamera"); m_UICamera = serializedObject.FindProperty("m_UICamera");

View File

@@ -1,6 +1,6 @@
using UnityEngine; using UnityEngine;
namespace GameLogic namespace TEngine
{ {
public class ErrorLogger public class ErrorLogger
{ {

View File

@@ -1,9 +1,8 @@
using System; using System;
using Cysharp.Threading.Tasks; using Cysharp.Threading.Tasks;
using UnityEngine.UI; using UnityEngine.UI;
using TEngine;
namespace GameLogic namespace TEngine
{ {
[Window(UILayer.System)] [Window(UILayer.System)]
class LogUI : UIWindow class LogUI : UIWindow
@@ -32,6 +31,5 @@ namespace GameLogic
{ {
m_textError.text = UserData.ToString(); m_textError.text = UserData.ToString();
} }
} }
} }

View File

@@ -18,6 +18,8 @@ namespace TEngine
[SerializeField] private bool m_dontDestroyUIRoot = true; [SerializeField] private bool m_dontDestroyUIRoot = true;
[SerializeField] private bool m_enableErrorLog = true;
[SerializeField] private Camera m_UICamera = null; [SerializeField] private Camera m_UICamera = null;
private readonly List<UIWindow> _stack = new List<UIWindow>(100); private readonly List<UIWindow> _stack = new List<UIWindow>(100);
@@ -61,6 +63,11 @@ namespace TEngine
m_InstanceRoot.gameObject.layer = LayerMask.NameToLayer("UI"); m_InstanceRoot.gameObject.layer = LayerMask.NameToLayer("UI");
UIRootStatic = m_InstanceRoot; UIRootStatic = m_InstanceRoot;
if (m_enableErrorLog)
{
ErrorLogger errorLogger = new ErrorLogger();
}
} }
private void OnDestroy() private void OnDestroy()