From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../XMainClient/BiochemicalHellDogDocument.cs | 301 +++++++++++++++++++++ 1 file changed, 301 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/BiochemicalHellDogDocument.cs (limited to 'Client/Assets/Scripts/XMainClient/BiochemicalHellDogDocument.cs') diff --git a/Client/Assets/Scripts/XMainClient/BiochemicalHellDogDocument.cs b/Client/Assets/Scripts/XMainClient/BiochemicalHellDogDocument.cs new file mode 100644 index 00000000..a1bd67ac --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/BiochemicalHellDogDocument.cs @@ -0,0 +1,301 @@ +using System; +using System.Collections.Generic; +using KKSG; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class BiochemicalHellDogDocument : XDocComponent + { + public override uint ID + { + get + { + return BiochemicalHellDogDocument.uuID; + } + } + + public XThemeActivityDocument ActDoc + { + get + { + return XSingleton.singleton.Doc.GetXComponent(XThemeActivityDocument.uuID) as XThemeActivityDocument; + } + } + + public List RewardTableData + { + get + { + bool flag = this._RewardTableData != null; + List rewardTableData; + if (flag) + { + rewardTableData = this._RewardTableData; + } + else + { + this._RewardTableData = XTempActivityDocument.Doc.GetDataByActivityType(this.ActInfo.actid); + rewardTableData = this._RewardTableData; + } + return rewardTableData; + } + } + + public SuperActivityTime.RowData ActInfo + { + get + { + bool flag = this._actInfo != null; + SuperActivityTime.RowData actInfo; + if (flag) + { + actInfo = this._actInfo; + } + else + { + XTempActivityDocument specificDocument = XDocuments.GetSpecificDocument(XTempActivityDocument.uuID); + this._actInfo = specificDocument.GetDataBySystemID((uint)this.systemID); + bool flag2 = this._actInfo == null; + if (flag2) + { + XSingleton.singleton.AddErrorLog("SuperActivityTime SystemID:" + this.systemID + "No Find", null, null, null, null, null); + } + actInfo = this._actInfo; + } + return actInfo; + } + } + + public FirstPassRankList RankList + { + get + { + return this._rankList; + } + } + + public new static readonly uint uuID = XSingleton.singleton.XHash("BiochemicalHellDogDocument"); + + public int curTime; + + public int systemID = XFastEnumIntEqualityComparer.ToInt(XSysDefine.XSys_ThemeActivity_HellDog); + + public string[] sceneID = XSingleton.singleton.GetValue("BioHellSceneStage").Split(new char[] + { + '|' + }); + + public string[] tex = XSingleton.singleton.GetValue("BioHellTex").Split(new char[] + { + '|' + }); + + public static readonly uint REWARD_MAX = 3u; + + private List _RewardTableData; + + private SuperActivityTime.RowData _actInfo = null; + + private FirstPassRankList _rankList = new FirstPassRankList(); + + private List m_titleRowList; + + public enum Stage + { + Ready, + Processing, + End + } + + protected override void OnReconnected(XReconnectedEventArgs arg) + { + } + + protected override void EventSubscribe() + { + base.EventSubscribe(); + base.RegisterEvent(XEventDefine.XEvent_ActivityTaskUpdate, new XComponent.XEventHandler(this.OnTaskChange)); + } + + private bool OnTaskChange(XEventArgs e) + { + XActivityTaskUpdatedArgs xactivityTaskUpdatedArgs = e as XActivityTaskUpdatedArgs; + bool flag = xactivityTaskUpdatedArgs.xActID == this.ActInfo.actid; + if (flag) + { + bool flag2 = DlgBase.singleton.m_HellDogHandler != null && DlgBase.singleton.m_HellDogHandler.m_HelpRewardHandler != null && DlgBase.singleton.m_HellDogHandler.m_HelpRewardHandler.IsVisible(); + if (flag2) + { + DlgBase.singleton.m_HellDogHandler.m_HelpRewardHandler.SetData(this.GetRewardData()); + } + bool flag3 = DlgBase.singleton.m_HellDogHandler != null; + if (flag3) + { + DlgBase.singleton.m_HellDogHandler.RefreshRedPoint(); + } + } + return true; + } + + public void RecordActivityPastTime(uint time, SeqListRef timestage) + { + this.curTime = (int)(time / 3600u); + XSingleton.singleton.AddGreenLog("time:" + time, null, null, null, null, null); + } + + public bool GetRedPoint() + { + int i = 0; + int count = this.RewardTableData.Count; + while (i < count) + { + bool flag = XTempActivityDocument.Doc.GetActivityState(this.RewardTableData[i].actid, this.RewardTableData[i].taskid) == 1u; + if (flag) + { + return true; + } + i++; + } + return false; + } + + public BiochemicalHellDogDocument.Stage GetStage(int type) + { + BiochemicalHellDogDocument.Stage result; + int num; + int num2; + this.GetTime(type, out result, out num, out num2); + return result; + } + + public void GetTime(int type, out BiochemicalHellDogDocument.Stage timeStage, out int actStartTime, out int actEndTime) + { + actStartTime = 0; + actEndTime = 0; + for (int i = 0; i < this.sceneID.Length; i++) + { + bool flag = i != 0; + if (flag) + { + actStartTime += (int)this.ActInfo.timestage[i - 1, 0]; + } + actEndTime += (int)this.ActInfo.timestage[i, 0]; + bool flag2 = i == type; + if (flag2) + { + break; + } + } + bool flag3 = this.curTime < actStartTime; + if (flag3) + { + timeStage = BiochemicalHellDogDocument.Stage.Ready; + } + else + { + bool flag4 = this.curTime < actEndTime; + if (flag4) + { + timeStage = BiochemicalHellDogDocument.Stage.Processing; + } + else + { + timeStage = BiochemicalHellDogDocument.Stage.End; + } + } + } + + public List GetRewardData() + { + List list = new List(); + bool flag = this.RewardTableData != null; + if (flag) + { + int i = 0; + int count = this.RewardTableData.Count; + while (i < count) + { + ActivityHelpReward activityHelpReward = new ActivityHelpReward(); + activityHelpReward.index = i; + activityHelpReward.tableData = this.RewardTableData[i]; + activityHelpReward.state = XTempActivityDocument.Doc.GetActivityState(this.RewardTableData[i].actid, this.RewardTableData[i].taskid); + activityHelpReward.sort = (int)activityHelpReward.state; + bool flag2 = (long)activityHelpReward.sort == 2L; + if (flag2) + { + activityHelpReward.sort = -1; + } + activityHelpReward.progress = XTempActivityDocument.Doc.GetActivityProgress(this.RewardTableData[i].actid, this.RewardTableData[i].taskid); + list.Add(activityHelpReward); + i++; + } + } + return list; + } + + public void SendRankList() + { + RpcC2M_ClientQueryRankListNtf rpcC2M_ClientQueryRankListNtf = new RpcC2M_ClientQueryRankListNtf(); + rpcC2M_ClientQueryRankListNtf.oArg.RankType = (uint)XFastEnumIntEqualityComparer.ToInt(RankeType.BioHelllRank); + XSingleton.singleton.Send(rpcC2M_ClientQueryRankListNtf); + } + + public void ReceiveRankList(ClientQueryRankListRes oRes) + { + bool flag = oRes.ErrorCode > ErrorCode.ERR_SUCCESS; + if (flag) + { + XSingleton.singleton.ShowSystemTip(oRes.ErrorCode, "fece00"); + } + else + { + this._rankList.Init(oRes, false); + bool flag2 = DlgBase.singleton.IsVisible(); + if (flag2) + { + DlgBase.singleton.FillContent(); + } + } + } + + public DesignationTable.RowData GetTittleNameByRank(int rank) + { + bool flag = this.m_titleRowList == null; + if (flag) + { + XDesignationDocument xdesignationDocument = XSingleton.singleton.Doc.GetXComponent(XDesignationDocument.uuID) as XDesignationDocument; + this.m_titleRowList = new List(); + int @int = XSingleton.singleton.GetInt("BiochemicalHellTitleType"); + for (int i = 0; i < xdesignationDocument._DesignationTable.Table.Length; i++) + { + DesignationTable.RowData rowData = xdesignationDocument._DesignationTable.Table[i]; + bool flag2 = rowData != null && rowData.CompleteType == @int; + if (flag2) + { + bool flag3 = !this.m_titleRowList.Contains(rowData); + if (flag3) + { + this.m_titleRowList.Add(rowData); + } + } + } + } + for (int j = 0; j < this.m_titleRowList.Count; j++) + { + bool flag4 = this.m_titleRowList[j].CompleteValue != null && this.m_titleRowList[j].CompleteValue.Length == 2; + if (flag4) + { + bool flag5 = rank >= this.m_titleRowList[j].CompleteValue[0] && rank <= this.m_titleRowList[j].CompleteValue[1]; + if (flag5) + { + return this.m_titleRowList[j]; + } + } + } + return null; + } + } +} -- cgit v1.1-26-g67d0