From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/XSkyArenaBattleDocument.cs | 273 +++++++++++++++++++++ 1 file changed, 273 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XSkyArenaBattleDocument.cs (limited to 'Client/Assets/Scripts/XMainClient/XSkyArenaBattleDocument.cs') diff --git a/Client/Assets/Scripts/XMainClient/XSkyArenaBattleDocument.cs b/Client/Assets/Scripts/XMainClient/XSkyArenaBattleDocument.cs new file mode 100644 index 00000000..3e3f8935 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XSkyArenaBattleDocument.cs @@ -0,0 +1,273 @@ +using System; +using System.Collections.Generic; +using KKSG; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XSkyArenaBattleDocument : XDocComponent + { + public override uint ID + { + get + { + return XSkyArenaBattleDocument.uuID; + } + } + + public ulong myId + { + get + { + return XSingleton.singleton.XPlayerData.RoleID; + } + } + + public int MyTeam + { + get + { + return this._MyTeam; + } + } + + public uint Floor + { + get + { + return this._Floor; + } + } + + public uint Stage + { + get + { + return this._Stage; + } + } + + public XBetterDictionary UserIdToRole + { + get + { + return this._UserIdToRole; + } + } + + public new static readonly uint uuID = XSingleton.singleton.XHash("XSkyArenaBattleDocument"); + + public SkyArenaBattleHandler BattleHandler = null; + + public SkyArenaInfoHandler InfoHandler = null; + + private int _MyTeam = 0; + + private uint _Floor = 0u; + + private uint _Stage = 0u; + + public uint ShowAddStage = 0u; + + private XBetterDictionary _UserIdToRole = new XBetterDictionary(0); + + private bool _CanPlayAnim = false; + + public struct RoleData + { + public ulong uid; + + public string name; + + public int teamid; + + public uint lv; + + public uint job; + + public uint ppt; + + public bool online; + } + + public override void OnAttachToHost(XObject host) + { + base.OnAttachToHost(host); + } + + public override void OnEnterSceneFinally() + { + bool flag = XSingleton.singleton.SceneType == SceneType.SKYCITY_FIGHTING; + if (flag) + { + bool flag2 = this.InfoHandler == null; + if (!flag2) + { + bool canPlayAnim = this._CanPlayAnim; + if (canPlayAnim) + { + this.InfoHandler.PlayStartTween(); + this._CanPlayAnim = false; + } + else + { + XSingleton.singleton.AddErrorLog("No Receive TeamData", null, null, null, null, null); + this.ReqSkyArenaBattleAllInfo(); + } + DlgBase.singleton.uiBehaviour.m_SkyAreanStage.SetText(string.Format(XSingleton.singleton.GetString("SKY_ARENA_STAGE"), this.Stage.ToString())); + } + } + } + + public override void Update(float fDeltaT) + { + base.Update(fDeltaT); + } + + protected override void OnReconnected(XReconnectedEventArgs arg) + { + bool flag = XSingleton.singleton.SceneType == SceneType.SKYCITY_FIGHTING; + if (flag) + { + this.ReqSkyArenaBattleAllInfo(); + } + } + + public void ReqSkyArenaBattleAllInfo() + { + RpcC2G_SkyCityAllInfoReq rpc = new RpcC2G_SkyCityAllInfoReq(); + XSingleton.singleton.Send(rpc); + } + + protected override void EventSubscribe() + { + base.EventSubscribe(); + } + + public void SetBattleTeamInfo(PtcG2C_SkyCityTeamRes roPtc) + { + bool flag = roPtc.Data == null; + if (!flag) + { + this.SetBattleTeamInfo(roPtc.Data); + this._CanPlayAnim = true; + } + } + + public void SetBattleTeamInfo(SkyCityAllTeamBaseInfo data) + { + bool flag = data == null; + if (!flag) + { + this._Stage = data.games; + this._Floor = data.floor; + this._UserIdToRole.Clear(); + for (int i = 0; i < data.info.Count; i++) + { + XSkyArenaBattleDocument.RoleData roleData; + roleData.uid = data.info[i].uid; + roleData.name = data.info[i].name; + roleData.job = data.info[i].job; + roleData.lv = data.info[i].lv; + roleData.online = data.info[i].online; + roleData.ppt = data.info[i].ppt; + roleData.teamid = data.info[i].teamid; + this._UserIdToRole.Add(roleData.uid, roleData); + bool flag2 = this.myId == roleData.uid; + if (flag2) + { + this._MyTeam = roleData.teamid; + } + } + bool flag3 = this._MyTeam == 0; + if (flag3) + { + XSingleton.singleton.AddErrorLog("No Find My Team", null, null, null, null, null); + } + } + } + + public void SetBattleInfo(PtcG2C_SkyCityBattleDataNtf roPtc) + { + this.SetBattleInfo(roPtc.Data); + } + + public void SetBattleInfo(SkyCityAllInfo data) + { + bool flag = data == null; + if (!flag) + { + bool flag2 = this.BattleHandler == null; + if (!flag2) + { + this.BattleHandler.RefreshStatusTime(data.timetype, data.lefttime); + bool flag3 = data.timetype == SkyCityTimeType.SecondWaiting; + if (!flag3) + { + List groupdata = data.groupdata; + for (int i = 0; i < groupdata.Count; i++) + { + this.BattleHandler.SetDamage((ulong)groupdata[i].totaldamage, (ulong)groupdata[i].teamid == (ulong)((long)this._MyTeam)); + this.BattleHandler.SetScore(groupdata[i].killcount, (ulong)groupdata[i].teamid == (ulong)((long)this._MyTeam)); + } + } + } + } + } + + public void SetBattleAllInfo(SkyCityArg oArg, SkyCityRes oRes) + { + this.SetBattleTeamInfo(oRes.baseinfo); + this.SetBattleInfo(oRes.allinfo); + } + + public void SetBattleEndInfo(PtcG2C_SkyCityEstimateRes roPtc) + { + bool flag = this.InfoHandler != null; + if (flag) + { + this.InfoHandler.PlayEndTween(roPtc.Data); + } + } + + public void HideVSInfo() + { + bool flag = this.InfoHandler != null; + if (flag) + { + XSingleton.singleton.AddGreenLog("HideVSInfo", null, null, null, null, null); + this.InfoHandler.CloseTween(); + } + } + + public void HideTime() + { + bool flag = this.BattleHandler != null; + if (flag) + { + this.BattleHandler.HideTime(); + } + } + + public void StageEnd() + { + bool flag = DlgBase.singleton.uiBehaviour == null; + if (!flag) + { + bool flag2 = DlgBase.singleton.uiBehaviour.m_SkyAreanStage != null; + if (flag2) + { + DlgBase.singleton.uiBehaviour.m_SkyAreanStage.SetText(string.Format(XSingleton.singleton.GetString("SKY_ARENA_STAGE"), (this.Stage + 1u).ToString())); + } + SceneTable.RowData sceneData = XSingleton.singleton.GetSceneData(XSingleton.singleton.SceneID + this.ShowAddStage); + bool flag3 = sceneData != null && DlgBase.singleton.uiBehaviour.m_SceneName != null; + if (flag3) + { + DlgBase.singleton.uiBehaviour.m_SceneName.SetText(sceneData.Comment); + } + } + } + } +} -- cgit v1.1-26-g67d0