From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/XOnlineRewardDocument.cs | 119 +++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XOnlineRewardDocument.cs (limited to 'Client/Assets/Scripts/XMainClient/XOnlineRewardDocument.cs') diff --git a/Client/Assets/Scripts/XMainClient/XOnlineRewardDocument.cs b/Client/Assets/Scripts/XMainClient/XOnlineRewardDocument.cs new file mode 100644 index 00000000..006fe6e5 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XOnlineRewardDocument.cs @@ -0,0 +1,119 @@ +using System; +using System.Collections.Generic; +using KKSG; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XOnlineRewardDocument : XDocComponent + { + public override uint ID + { + get + { + return XOnlineRewardDocument.uuID; + } + } + + public int CurrentID { get; set; } + + public new static readonly uint uuID = XSingleton.singleton.XHash("OnlineRewardDocument"); + + public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader(); + + public static OnlineRewardTable RewardTable = new OnlineRewardTable(); + + public List Status = new List(); + + public List LeftTime = new List(); + + public static void Execute(OnLoadedCallback callback = null) + { + XOnlineRewardDocument.AsyncLoader.AddTask("Table/OnlineReward", XOnlineRewardDocument.RewardTable, false); + XOnlineRewardDocument.AsyncLoader.Execute(callback); + } + + public void SendGetReward(int index) + { + RpcC2G_GetOnlineReward rpcC2G_GetOnlineReward = new RpcC2G_GetOnlineReward(); + rpcC2G_GetOnlineReward.oArg.index = (uint)index; + XSingleton.singleton.Send(rpcC2G_GetOnlineReward); + } + + public void QueryStatus() + { + PtcC2G_OnlineRewardReport proto = new PtcC2G_OnlineRewardReport(); + XSingleton.singleton.Send(proto); + } + + public void RefreshStatus(List status, List leftTime) + { + this.Status.Clear(); + this.LeftTime.Clear(); + for (int i = 0; i < status.Count; i++) + { + this.Status.Add((int)status[i]); + this.LeftTime.Add((int)leftTime[i]); + } + bool flag = this.Status.Count == 0; + if (flag) + { + this.Status.Add(2); + this.LeftTime.Add(1); + } + this.CurrentID = this.Status.Count - 1; + for (int j = 0; j < this.Status.Count; j++) + { + bool flag2 = this.Status[j] <= 1; + if (flag2) + { + this.CurrentID = j; + break; + } + } + XSingleton.singleton.OnlineRewardRemainTime = (float)this.LeftTime[this.CurrentID]; + bool flag3 = DlgBase.singleton.IsVisible() && XSingleton.singleton.SceneType == SceneType.SCENE_HALL; + if (flag3) + { + } + bool flag4 = !DlgBase.singleton.IsVisible(); + if (!flag4) + { + DlgBase.singleton.RefreshItemList(); + DlgBase.singleton.SetGetRewardLabel(this.Status[this.CurrentID]); + } + } + + private bool CanClaim() + { + for (int i = 0; i < this.Status.Count; i++) + { + bool flag = this.Status[i] == 1; + if (flag) + { + return true; + } + } + return false; + } + + public bool CheckOver() + { + for (int i = 0; i < this.Status.Count; i++) + { + bool flag = this.Status[i] != 2; + if (flag) + { + return true; + } + } + return false; + } + + protected override void OnReconnected(XReconnectedEventArgs arg) + { + } + } +} -- cgit v1.1-26-g67d0