mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
ErrorLogger
ErrorLogger
This commit is contained in:
3
Assets/GameScripts/HotFix/GameLogic/ErrorLogger.meta
Normal file
3
Assets/GameScripts/HotFix/GameLogic/ErrorLogger.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6fca85e737d54de0a3ed4bd7e7836fa4
|
||||||
|
timeCreated: 1681807710
|
@@ -0,0 +1,26 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9ccc9fc5faf14d93baec285acaa97907
|
||||||
|
timeCreated: 1681807720
|
33
Assets/GameScripts/HotFix/GameLogic/ErrorLogger/LogUI.cs
Normal file
33
Assets/GameScripts/HotFix/GameLogic/ErrorLogger/LogUI.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
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(OnClickCloseBtn);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 事件
|
||||||
|
|
||||||
|
private void OnClickCloseBtn()
|
||||||
|
{
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public override void OnRefresh()
|
||||||
|
{
|
||||||
|
m_textError.text = UserData.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: faa647c543e54de9b2d55e189aef0eff
|
||||||
|
timeCreated: 1681807986
|
Reference in New Issue
Block a user