|
@@ -1,6 +1,5 @@
|
|
|
using System.Collections.Generic;
|
|
|
using UnityEngine;
|
|
|
-using UI.Common;
|
|
|
using System;
|
|
|
|
|
|
namespace GFGGame
|
|
@@ -12,9 +11,8 @@ namespace GFGGame
|
|
|
public const string _log = "Log";
|
|
|
public const int _maxCount = 100;
|
|
|
|
|
|
- public Dictionary<string, List<string>> msgDic = new Dictionary<string, List<string>>();
|
|
|
|
|
|
- // private UI_BtnLog _btnLog;
|
|
|
+ public Dictionary<string, List<string>> msgDic = new Dictionary<string, List<string>>();
|
|
|
|
|
|
public void Init()
|
|
|
{
|
|
@@ -22,10 +20,6 @@ namespace GFGGame
|
|
|
msgDic.Add(_all, new List<string>());
|
|
|
msgDic.Add(_error, new List<string>());
|
|
|
msgDic.Add(_log, new List<string>());
|
|
|
- if (LauncherConfig.onDebug == 1)
|
|
|
- {
|
|
|
- this.CreatBtnLog();
|
|
|
- }
|
|
|
|
|
|
this.AddMsgListener();
|
|
|
}
|
|
@@ -33,6 +27,10 @@ namespace GFGGame
|
|
|
{
|
|
|
Application.logMessageReceived += (condition, stackTrace, type) =>
|
|
|
{
|
|
|
+ if (LauncherConfig.onDebug < 2)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (type == LogType.Error || type == LogType.Exception || type == LogType.Log)
|
|
|
{
|
|
|
this.AddMsgToDic(condition, stackTrace, type);
|
|
@@ -64,61 +62,26 @@ namespace GFGGame
|
|
|
msgDic[_all].Add(msg);
|
|
|
msgDic[_error].Add(msg);
|
|
|
|
|
|
- // if (_btnLog != null)
|
|
|
- // {
|
|
|
- // _btnLog.m_c1.selectedIndex = 1;
|
|
|
- // _btnLog.target.alpha = 1;
|
|
|
- // }
|
|
|
- if (LauncherConfig.onDebug >= 1)
|
|
|
- {
|
|
|
#if !UNITY_EDITOR
|
|
|
- ViewManager.Show(ViewName.LOG_VIEW);
|
|
|
+ ViewManager.Show(ViewName.LOG_VIEW);
|
|
|
#endif
|
|
|
- }
|
|
|
break;
|
|
|
default:
|
|
|
- if (LauncherConfig.onDebug >= 1)
|
|
|
+ if (msgDic[_all].Count == _maxCount)
|
|
|
{
|
|
|
- if (msgDic[_all].Count == _maxCount)
|
|
|
- {
|
|
|
- msgDic[_all].RemoveAt(0);
|
|
|
- }
|
|
|
- if (msgDic[_log].Count == _maxCount)
|
|
|
- {
|
|
|
- msgDic[_log].RemoveAt(0);
|
|
|
- }
|
|
|
- msg = string.Format("log@{2}\n{0}\n{1}", condition, stackTrace, time);
|
|
|
- msgDic[_all].Add(msg);
|
|
|
- msgDic[_log].Add(msg);
|
|
|
+ msgDic[_all].RemoveAt(0);
|
|
|
}
|
|
|
+ if (msgDic[_log].Count == _maxCount)
|
|
|
+ {
|
|
|
+ msgDic[_log].RemoveAt(0);
|
|
|
+ }
|
|
|
+ msg = string.Format("log@{2}\n{0}\n{1}", condition, stackTrace, time);
|
|
|
+ msgDic[_all].Add(msg);
|
|
|
+ msgDic[_log].Add(msg);
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- private void CreatBtnLog()
|
|
|
- {
|
|
|
- // if (_btnLog == null)
|
|
|
- // {
|
|
|
- // _btnLog = UI_BtnLog.Create();
|
|
|
- // ViewManager.AddChildToDebugLayer(_btnLog.target);
|
|
|
- // this.SetBtnLogVisable(false);
|
|
|
- // _btnLog.target.x = 50;
|
|
|
- // _btnLog.target.y = 1880;
|
|
|
- // _btnLog.target.onClick.Add(this.OnBtnLogClick);
|
|
|
- // }
|
|
|
- }
|
|
|
- private void OnBtnLogClick()
|
|
|
- {
|
|
|
- ViewManager.Show(ViewName.LOG_VIEW);
|
|
|
- // _btnLog.m_c1.selectedIndex = 0;
|
|
|
- // _btnLog.target.alpha = 0;
|
|
|
- }
|
|
|
-
|
|
|
- public void SetBtnLogVisable(bool visable)
|
|
|
- {
|
|
|
- // _btnLog.target.visible = visable;
|
|
|
- }
|
|
|
}
|
|
|
}
|