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) { } } }