blob: 144ee83e5db41693117bce3cc52b7749bc877ae8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
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);
}
}
}
|