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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
using System;
using System.Collections.Generic;
using KKSG;
using UnityEngine;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient
{
internal class XSpectateLevelRewardDocument : XDocComponent
{
public override uint ID
{
get
{
return XSpectateLevelRewardDocument.uuID;
}
}
public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("SpectateLevelRewardDocument");
public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader();
private static SpectateLevelRewardConfig _levelRewardConfig = new SpectateLevelRewardConfig();
public List<BattleStatisticsData> DataList;
public Dictionary<ulong, uint> StarDict = new Dictionary<ulong, uint>();
public uint WatchNum;
public uint CommendNum;
public ulong WinUid;
public ulong MvpUid;
public int[] DataType;
public List<int> WidthList = new List<int>();
public int WidthTotal;
public int WinTag;
public double DamageSum;
private float LastLevelSceneTime = 0f;
public static void Execute(OnLoadedCallback callback = null)
{
XSpectateLevelRewardDocument.AsyncLoader.AddTask("Table/SpectateLevelRewardConfig", XSpectateLevelRewardDocument._levelRewardConfig, false);
XSpectateLevelRewardDocument.AsyncLoader.Execute(callback);
}
public bool InitData()
{
this.DamageSum = 0.0;
for (int i = 0; i < this.DataList.Count; i++)
{
this.DamageSum += this.DataList[i].damageall;
}
int key = XFastEnumIntEqualityComparer<SceneType>.ToInt(XSingleton<XScene>.singleton.SceneType);
SpectateLevelRewardConfig.RowData bySceneType = XSpectateLevelRewardDocument._levelRewardConfig.GetBySceneType(key);
bool flag = bySceneType == null;
bool result;
if (flag)
{
XSingleton<XDebug>.singleton.AddLog("SpectateLevelRewardConfig can't find by sceneType = ", key.ToString(), null, null, null, null, XDebugColor.XDebug_None);
result = false;
}
else
{
this.DataType = bySceneType.DataConfig;
this.SetWidth();
result = true;
}
return result;
}
public void SetWidth()
{
this.WidthList.Clear();
this.WidthTotal = 0;
bool flag = this.DataType != null;
if (flag)
{
int i = 0;
while (i < this.DataType.Length)
{
int num = 0;
switch (this.DataType[i])
{
case 3:
num = 332;
break;
case 4:
goto IL_B6;
case 5:
num = 116;
break;
case 6:
num = 140;
break;
case 7:
num = 120;
break;
case 8:
num = 112;
break;
case 9:
num = 108;
break;
case 10:
num = 124;
break;
case 11:
num = 160;
break;
case 12:
num = 140;
this.CalWinOrLoseMess();
break;
case 13:
num = 135;
break;
default:
goto IL_B6;
}
IL_DD:
this.WidthTotal += num;
this.WidthList.Add(num);
i++;
continue;
IL_B6:
XSingleton<XDebug>.singleton.AddErrorLog("SpectateLevelRewardConfig DataConfig Error! Can't find width of type = ", this.DataType[i].ToString(), null, null, null, null);
goto IL_DD;
}
}
}
protected override void OnReconnected(XReconnectedEventArgs arg)
{
}
public void SetData(BattleWatcherNtf ntf)
{
this.DataList = ntf.data;
this.StarDict.Clear();
bool flag = ntf.star != null;
if (flag)
{
for (int i = 0; i < ntf.star.Count; i++)
{
this.StarDict[ntf.star[i].roleid] = ntf.star[i].star;
}
}
this.WinUid = ntf.winuid;
this.MvpUid = ntf.mvp;
this.WatchNum = ntf.watchinfo.wathccount;
this.CommendNum = ntf.watchinfo.likecount;
bool flag2 = DlgBase<XChatView, XChatBehaviour>.singleton.IsVisible();
if (flag2)
{
DlgBase<XChatView, XChatBehaviour>.singleton.SetVisible(false, true);
}
bool flag3 = !this.InitData();
if (!flag3)
{
DlgBase<SpectateLevelRewardView, SpectateLevelRewardBehaviour>.singleton.ShowData();
}
}
public void LevelScene()
{
bool flag = Time.time - this.LastLevelSceneTime < 5f;
if (!flag)
{
this.LastLevelSceneTime = Time.time;
XSingleton<XScene>.singleton.ReqLeaveScene();
}
}
private void CalWinOrLoseMess()
{
bool flag = this.WinUid == 0UL;
if (flag)
{
this.WinTag = 0;
}
else
{
XSpectateSceneDocument specificDocument = XDocuments.GetSpecificDocument<XSpectateSceneDocument>(XSpectateSceneDocument.uuID);
bool flag2 = true;
bool flag3 = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_HEROBATTLE;
if (flag3)
{
XHeroBattleDocument specificDocument2 = XDocuments.GetSpecificDocument<XHeroBattleDocument>(XHeroBattleDocument.uuID);
flag2 = (specificDocument2.MyTeam == (uint)this.WinUid);
}
else
{
bool flag4 = !specificDocument.IsBlueTeamDict.TryGetValue(this.WinUid, out flag2);
if (flag4)
{
XSingleton<XDebug>.singleton.AddErrorLog("spectate level reward can't find this winer's team, winer uid = ", this.WinUid.ToString(), null, null, null, null);
}
}
this.WinTag = (flag2 ? 1 : -1);
}
}
}
}
|