diff options
author | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
commit | 6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch) | |
tree | 7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/UI/GVGCombatInfoDisplay.cs |
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/UI/GVGCombatInfoDisplay.cs')
-rw-r--r-- | Client/Assets/Scripts/XMainClient/UI/GVGCombatInfoDisplay.cs | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/UI/GVGCombatInfoDisplay.cs b/Client/Assets/Scripts/XMainClient/UI/GVGCombatInfoDisplay.cs new file mode 100644 index 00000000..aba484a6 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/GVGCombatInfoDisplay.cs @@ -0,0 +1,116 @@ +using System;
+using KKSG;
+using UILib;
+using UnityEngine;
+
+namespace XMainClient.UI
+{
+ internal class GVGCombatInfoDisplay
+ {
+ public uint RoomID
+ {
+ get
+ {
+ return this.m_battleID;
+ }
+ }
+
+ public uint BattleID
+ {
+ get
+ {
+ return this.m_battleID;
+ }
+ }
+
+ private GVGCombatGuildDisplay m_guildMemberA;
+
+ private GVGCombatGuildDisplay m_guildMemberB;
+
+ private IXUIButton m_watchBtn;
+
+ private int m_combatID;
+
+ private int m_index;
+
+ private uint m_battleID;
+
+ public void Setup(Transform t)
+ {
+ this.m_watchBtn = (t.Find("btn_Watch").GetComponent("XUIButton") as IXUIButton);
+ this.m_guildMemberA = new GVGCombatGuildDisplay();
+ this.m_guildMemberA.Setup(t.Find("Team1"));
+ this.m_guildMemberB = new GVGCombatGuildDisplay();
+ this.m_guildMemberB.Setup(t.Find("Team2"));
+ this.m_watchBtn.SetVisible(false);
+ this.m_watchBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnWatchClick));
+ }
+
+ public void Set(int combat, int index)
+ {
+ this.m_combatID = combat;
+ this.m_index = index;
+ switch (combat)
+ {
+ case 0:
+ this.m_battleID = (uint)(index + 1);
+ break;
+ case 1:
+ this.m_battleID = (uint)(index + 5);
+ break;
+ case 2:
+ this.m_battleID = 7u;
+ break;
+ }
+ }
+
+ public void SetGroup(XGVGCombatGroupData combat)
+ {
+ bool flag = combat == null;
+ if (flag)
+ {
+ this.m_watchBtn.ID = 0UL;
+ this.SetCombatState((CrossGvgRoomState)0, 0u);
+ }
+ else
+ {
+ this.m_watchBtn.ID = (ulong)combat.WatchID;
+ this.m_guildMemberA.SetGuildMember(combat.GuildOne, combat.Winner, false);
+ this.m_guildMemberB.SetGuildMember(combat.GuildTwo, combat.Winner, false);
+ this.SetCombatState(combat.RoomState, combat.WatchID);
+ }
+ }
+
+ public void SetCombatState(CrossGvgRoomState state, uint watchID = 0u)
+ {
+ this.m_watchBtn.SetVisible(state == CrossGvgRoomState.CGRS_Fighting && watchID > 0u);
+ }
+
+ public void Recycle()
+ {
+ bool flag = this.m_guildMemberA != null;
+ if (flag)
+ {
+ this.m_guildMemberA.Recycle();
+ this.m_guildMemberA = null;
+ }
+ bool flag2 = this.m_guildMemberB != null;
+ if (flag2)
+ {
+ this.m_guildMemberB.Recycle();
+ this.m_guildMemberB = null;
+ }
+ }
+
+ private bool OnWatchClick(IXUIButton watchBtn)
+ {
+ bool flag = watchBtn.ID > 0UL;
+ if (flag)
+ {
+ XSpectateDocument specificDocument = XDocuments.GetSpecificDocument<XSpectateDocument>(XSpectateDocument.uuID);
+ specificDocument.EnterSpectateBattle((uint)watchBtn.ID, LiveType.LIVE_CROSSGVG);
+ }
+ return false;
+ }
+ }
+}
|