[+] 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

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 6fca85e737d54de0a3ed4bd7e7836fa4
timeCreated: 1681807710

View File

@@ -1,26 +0,0 @@
using UnityEngine;
namespace GameLogic
{
public class ErrorLogger
{
public ErrorLogger()
{
Application.logMessageReceived += LogHandler;
}
~ErrorLogger()
{
Application.logMessageReceived -= LogHandler;
}
private void LogHandler(string condition, string stacktrace, LogType type)
{
if (type == LogType.Exception)
{
string des = $"客户端报错, \n#内容#---{condition} \n#位置#---{stacktrace}";
GameModule.UI.ShowUI<LogUI>(des);
}
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 9ccc9fc5faf14d93baec285acaa97907
timeCreated: 1681807720

View File

@@ -1,37 +0,0 @@
using System;
using Cysharp.Threading.Tasks;
using UnityEngine.UI;
using TEngine;
namespace GameLogic
{
[Window(UILayer.System)]
class LogUI : UIWindow
{
#region
private Text m_textError;
private Button m_btnClose;
public override void ScriptGenerator()
{
m_textError = FindChildComponent<Text>("m_textError");
m_btnClose = FindChildComponent<Button>("m_btnClose");
m_btnClose.onClick.AddListener(UniTask.UnityAction(OnClickCloseBtn));
}
#endregion
#region
private async UniTaskVoid OnClickCloseBtn()
{
await UniTask.Delay(TimeSpan.FromSeconds(0.5f));
Close();
}
#endregion
public override void OnRefresh()
{
m_textError.text = UserData.ToString();
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: faa647c543e54de9b2d55e189aef0eff
timeCreated: 1681807986