summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XBigMeleeBattleDocument.cs
blob: 86bc7e8fd953820b0f52e1a5fcb9dd2c75f32a98 (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
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
215
216
217
218
219
220
using System;
using System.Collections.Generic;
using KKSG;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;

namespace XMainClient
{
	internal class XBigMeleeBattleDocument : XDocComponent
	{
		public override uint ID
		{
			get
			{
				return XBigMeleeBattleDocument.uuID;
			}
		}

		public static XBigMeleeBattleDocument Doc
		{
			get
			{
				return XSingleton<XGame>.singleton.Doc.GetXComponent(XBigMeleeBattleDocument.uuID) as XBigMeleeBattleDocument;
			}
		}

		public uint Round
		{
			get
			{
				return this._Round;
			}
		}

		public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("XBigMeleeBattleDocument");

		public XBetterDictionary<ulong, XBigMeleeBattleDocument.RoleData> userIdToRole = new XBetterDictionary<ulong, XBigMeleeBattleDocument.RoleData>(0);

		public BigMeleeBattleHandler battleHandler = null;

		public static readonly int BATTLE_SHOW_RANK = 5;

		private uint _Round;

		public struct RoleData
		{
			public ulong roleID;

			public string name;

			public uint point;
		}

		public override void OnAttachToHost(XObject host)
		{
			base.OnAttachToHost(host);
		}

		public override void OnEnterSceneFinally()
		{
			bool flag = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_BIGMELEE_FIGHT;
			if (flag)
			{
				DlgBase<BattleContiDlg, BattleContiBehaviour>.singleton.ClearRevenge();
			}
		}

		protected override void OnReconnected(XReconnectedEventArgs arg)
		{
		}

		public void HideInfo()
		{
			bool flag = this.battleHandler != null;
			if (flag)
			{
				XSingleton<XDebug>.singleton.AddGreenLog("HideVSInfo", null, null, null, null, null);
				this.battleHandler.CloseVS(null);
			}
		}

		public void ReceiveBattleKillInfo(PvpBattleKill battleKillInfo)
		{
			bool flag = XSingleton<XScene>.singleton.SceneType != SceneType.SCENE_BIGMELEE_FIGHT;
			if (!flag)
			{
				GVGBattleSkill gvgbattleSkill = new GVGBattleSkill();
				gvgbattleSkill.killerID = battleKillInfo.killID;
				gvgbattleSkill.deadID = battleKillInfo.deadID;
				gvgbattleSkill.contiKillCount = battleKillInfo.contiKillCount;
				XEntity entityConsiderDeath = XSingleton<XEntityMgr>.singleton.GetEntityConsiderDeath(gvgbattleSkill.killerID);
				XEntity entityConsiderDeath2 = XSingleton<XEntityMgr>.singleton.GetEntityConsiderDeath(gvgbattleSkill.deadID);
				bool flag2 = entityConsiderDeath == null || entityConsiderDeath2 == null;
				if (flag2)
				{
					XSingleton<XDebug>.singleton.AddErrorLog("Killer id: " + gvgbattleSkill.killerID, " Dead id: " + gvgbattleSkill.deadID, null, null, null, null);
					bool flag3 = entityConsiderDeath == null;
					if (flag3)
					{
						XSingleton<XDebug>.singleton.AddErrorLog("kill_en id null", null, null, null, null, null);
					}
					bool flag4 = entityConsiderDeath2 == null;
					if (flag4)
					{
						XSingleton<XDebug>.singleton.AddErrorLog("dead_en id null", null, null, null, null, null);
					}
				}
				else
				{
					gvgbattleSkill.killerName = entityConsiderDeath.Name;
					gvgbattleSkill.deadName = entityConsiderDeath2.Name;
					gvgbattleSkill.killerPosition = XSingleton<XEntityMgr>.singleton.IsAlly(entityConsiderDeath);
					DlgBase<BattleContiDlg, BattleContiBehaviour>.singleton.AddBattleSkill(gvgbattleSkill);
					XSingleton<XDebug>.singleton.AddGreenLog(string.Format("ReceiveBattleKillInfo:{0} --- ,{1} ,.... {2}", gvgbattleSkill.killerName, gvgbattleSkill.deadName, gvgbattleSkill.contiKillCount), null, null, null, null, null);
				}
			}
		}

		public void SetRankData(QueryMayhemRankArg oArg, QueryMayhemRankRes oRes)
		{
			XRankDocument.ProcessRankListData(oRes.rank, XBigMeleeEntranceDocument.Doc.RankList);
			XBigMeleeEntranceDocument.Doc.RankList.myRankInfo = XBigMeleeEntranceDocument.Doc.RankList.CreateNewInfo();
			XBigMeleeRankInfo xbigMeleeRankInfo = XBigMeleeEntranceDocument.Doc.RankList.myRankInfo as XBigMeleeRankInfo;
			bool flag = oRes.selfinfo != null;
			if (flag)
			{
				xbigMeleeRankInfo.ProcessData(oRes.selfinfo);
			}
			else
			{
				xbigMeleeRankInfo.InitMyData();
			}
			bool flag2 = oRes.selfrank > 0;
			if (flag2)
			{
				xbigMeleeRankInfo.rank = (uint)(oRes.selfrank - 1);
			}
			else
			{
				xbigMeleeRankInfo.rank = XRankDocument.INVALID_RANK;
			}
			bool flag3 = this.battleHandler != null && this.battleHandler.PanelObject != null && this.battleHandler.IsVisible();
			if (flag3)
			{
				this.battleHandler.RefreshRank();
			}
		}

		public void SetBattleData(PtcG2C_BMRoleSceneSyncNtf roPtc)
		{
			this._Round = roPtc.Data.games;
			List<BMRoleEnter> roles = roPtc.Data.roles;
			for (int i = 0; i < roles.Count; i++)
			{
				XBigMeleeBattleDocument.RoleData roleData;
				roleData.roleID = roles[i].roleid;
				roleData.name = roles[i].name;
				roleData.point = roles[i].score;
				this.userIdToRole[roleData.roleID] = roleData;
				XBigMeleePointChange @event = XEventPool<XBigMeleePointChange>.GetEvent();
				XEntity entityConsiderDeath = XSingleton<XEntityMgr>.singleton.GetEntityConsiderDeath(roleData.roleID);
				@event.point = roleData.point;
				@event.Firer = entityConsiderDeath;
				XSingleton<XEventMgr>.singleton.FireEvent(@event);
				XSingleton<XDebug>.singleton.AddGreenLog(string.Concat(new object[]
				{
					"roleid:",
					roleData.roleID,
					"\npoint:",
					roleData.point
				}), null, null, null, null, null);
			}
			XSingleton<XDebug>.singleton.AddGreenLog("PtcG2C_BMRoleSceneSyncNtf _Round:" + this._Round, null, null, null, null, null);
			bool flag = this.battleHandler != null;
			if (flag)
			{
				this.battleHandler.RefreshStage();
			}
		}

		public void SetBattleTime(PtcG2C_BMFightTimeNtf roPtc)
		{
			bool flag = this.battleHandler == null;
			if (!flag)
			{
				this.battleHandler.RefreshStatusTime(roPtc.Data.type, roPtc.Data.time);
				this.battleHandler.ShieldMiniMapPlayer();
			}
		}

		public void SetReviveTime(PtcG2C_BigMeleeReliveNtf roPtc)
		{
			bool flag = this.battleHandler == null;
			if (!flag)
			{
				this.battleHandler.SetReviveTime(roPtc.Data.time);
			}
		}

		public void SetPoint(ulong roleid, uint point)
		{
			XBigMeleeBattleDocument.RoleData value = this.userIdToRole[roleid];
			value.point = point;
			this.userIdToRole[roleid] = value;
			XBigMeleePointChange @event = XEventPool<XBigMeleePointChange>.GetEvent();
			XEntity entityConsiderDeath = XSingleton<XEntityMgr>.singleton.GetEntityConsiderDeath(roleid);
			@event.point = point;
			@event.Firer = entityConsiderDeath;
			XSingleton<XEventMgr>.singleton.FireEvent(@event);
			XSingleton<XDebug>.singleton.AddGreenLog(string.Concat(new object[]
			{
				"roleid:",
				roleid,
				"\npoint:",
				point
			}), null, null, null, null, null);
		}
	}
}