summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/BattleShowInfoHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/BattleShowInfoHandler.cs')
-rw-r--r--Client/Assets/Scripts/XMainClient/BattleShowInfoHandler.cs143
1 files changed, 143 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/BattleShowInfoHandler.cs b/Client/Assets/Scripts/XMainClient/BattleShowInfoHandler.cs
new file mode 100644
index 00000000..144ee83e
--- /dev/null
+++ b/Client/Assets/Scripts/XMainClient/BattleShowInfoHandler.cs
@@ -0,0 +1,143 @@
+using System;
+using System.Collections.Generic;
+using KKSG;
+using UILib;
+using UnityEngine;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class BattleShowInfoHandler : DlgHandlerBase
+ {
+ protected override string FileName
+ {
+ get
+ {
+ return "Battle/BattleShowGameInfo";
+ }
+ }
+
+ public static readonly uint GAME_INFO_MAX = 3u;
+
+ public static readonly uint CLEAR_GAME_INFO_TIME = 10u;
+
+ private uint m_ShowInfoTimerID = 0u;
+
+ private Queue<string> qInfo = new Queue<string>();
+
+ private float lastShowInfoTime;
+
+ private bool isChange = false;
+
+ public static readonly string red = "[ef2717]";
+
+ public static readonly string blue = "[21b2ff]";
+
+ public IXPositionGroup m_pauseGroup;
+
+ public XUIPool m_InfoPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
+
+ protected override void Init()
+ {
+ base.Init();
+ this.m_pauseGroup = (base.transform.Find("Bg").GetComponent("PositionGroup") as IXPositionGroup);
+ Transform transform = base.transform.Find("Bg/InfoTpl");
+ this.m_InfoPool.SetupPool(null, transform.gameObject, BattleShowInfoHandler.GAME_INFO_MAX, false);
+ }
+
+ protected override void OnShow()
+ {
+ base.OnShow();
+ XSingleton<XTimerMgr>.singleton.KillTimer(this.m_ShowInfoTimerID);
+ this.RefreshInfo();
+ bool flag = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_SURVIVE;
+ if (flag)
+ {
+ this.m_pauseGroup.SetGroup(1);
+ }
+ else
+ {
+ this.m_pauseGroup.SetGroup(0);
+ }
+ }
+
+ protected override void OnHide()
+ {
+ XSingleton<XTimerMgr>.singleton.KillTimer(this.m_ShowInfoTimerID);
+ this.m_ShowInfoTimerID = 0u;
+ base.OnHide();
+ }
+
+ public override void OnUnload()
+ {
+ XSingleton<XTimerMgr>.singleton.KillTimer(this.m_ShowInfoTimerID);
+ this.m_ShowInfoTimerID = 0u;
+ base.OnUnload();
+ }
+
+ public override void OnUpdate()
+ {
+ base.OnUpdate();
+ bool flag = Time.time > this.lastShowInfoTime + BattleShowInfoHandler.CLEAR_GAME_INFO_TIME;
+ if (flag)
+ {
+ while (this.qInfo.Count != 0)
+ {
+ this.qInfo.Clear();
+ this.isChange = true;
+ }
+ }
+ bool flag2 = this.isChange;
+ if (flag2)
+ {
+ this.RefreshInfo();
+ this.isChange = false;
+ }
+ }
+
+ public void AddInfo(string newInfo)
+ {
+ this.lastShowInfoTime = Time.time;
+ this.qInfo.Enqueue(newInfo);
+ bool flag = (long)this.qInfo.Count > (long)((ulong)BattleShowInfoHandler.GAME_INFO_MAX);
+ if (flag)
+ {
+ this.qInfo.Dequeue();
+ }
+ this.RefreshInfo();
+ }
+
+ private void RefreshInfo()
+ {
+ this.m_InfoPool.FakeReturnAll();
+ int num = 0;
+ while ((long)num < (long)((ulong)BattleShowInfoHandler.GAME_INFO_MAX))
+ {
+ GameObject gameObject = this.m_InfoPool.FetchGameObject(false);
+ bool flag = this.qInfo.Count <= num;
+ if (flag)
+ {
+ gameObject.transform.localPosition = XGameUI.Far_Far_Away;
+ }
+ else
+ {
+ gameObject.transform.localPosition = new Vector3(0f, (float)(-(float)this.m_InfoPool.TplHeight * num), 0f);
+ int num2 = 0;
+ foreach (string text in this.qInfo)
+ {
+ bool flag2 = num2 == num;
+ if (flag2)
+ {
+ IXUILabel ixuilabel = gameObject.transform.Find("info").GetComponent("XUILabel") as IXUILabel;
+ ixuilabel.SetText(text);
+ break;
+ }
+ num2++;
+ }
+ }
+ num++;
+ }
+ this.m_InfoPool.ActualReturnAll(false);
+ }
+ }
+}