From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/TaJieHelpDocument.cs | 273 +++++++++++++++++++++ 1 file changed, 273 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/TaJieHelpDocument.cs (limited to 'Client/Assets/Scripts/XMainClient/TaJieHelpDocument.cs') diff --git a/Client/Assets/Scripts/XMainClient/TaJieHelpDocument.cs b/Client/Assets/Scripts/XMainClient/TaJieHelpDocument.cs new file mode 100644 index 00000000..0f3589dc --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/TaJieHelpDocument.cs @@ -0,0 +1,273 @@ +using System; +using System.Collections.Generic; +using UnityEngine; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class TaJieHelpDocument : XDocComponent + { + public override uint ID + { + get + { + return TaJieHelpDocument.uuID; + } + } + + public static TaJieHelpDocument Doc + { + get + { + return XSingleton.singleton.Doc.GetXComponent(TaJieHelpDocument.uuID) as TaJieHelpDocument; + } + } + + public bool ShowHallBtn + { + get + { + bool flag = XSingleton.singleton.IsSystemOpened(XSysDefine.Xsys_TaJieHelp); + bool flag2 = !flag; + return !flag2 && this.m_showHallBtn; + } + set + { + bool flag = this.m_showHallBtn != value; + if (flag) + { + this.m_showHallBtn = value; + DlgBase.singleton.RefreshH5ButtonState(XSysDefine.Xsys_TaJieHelp, true); + } + } + } + + public int CurType + { + get + { + return this.m_curType; + } + set + { + this.m_curType = value; + } + } + + public new static readonly uint uuID = XSingleton.singleton.XHash("TaJieHelpDocument"); + + public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader(); + + private static TaJieHelpTab m_tajieHelpTable = new TaJieHelpTab(); + + private static TaJieHelpUrl m_tajieHelpUrl = new TaJieHelpUrl(); + + private int m_sceneId = 0; + + private int m_dragonStatus = 0; + + private int m_dragonWeakLeftTime = 0; + + private float m_getMesTime = 0f; + + private bool m_showHallBtn = false; + + private int m_curType = 0; + + public static void Execute(OnLoadedCallback callback = null) + { + TaJieHelpDocument.AsyncLoader.AddTask("Table/TaJieHelpTab", TaJieHelpDocument.m_tajieHelpTable, false); + TaJieHelpDocument.AsyncLoader.AddTask("Table/TaJieHelpUrl", TaJieHelpDocument.m_tajieHelpUrl, false); + TaJieHelpDocument.AsyncLoader.Execute(callback); + } + + public override void OnAttachToHost(XObject host) + { + base.OnAttachToHost(host); + } + + protected override void EventSubscribe() + { + base.EventSubscribe(); + } + + public override void OnDetachFromHost() + { + base.OnDetachFromHost(); + } + + protected override void OnReconnected(XReconnectedEventArgs arg) + { + } + + public override void OnEnterSceneFinally() + { + base.OnEnterSceneFinally(); + } + + public List GetTaJieHelpData() + { + List list = new List(); + bool inGuild = XGuildDocument.InGuild; + for (int i = 0; i < TaJieHelpDocument.m_tajieHelpTable.Table.Length; i++) + { + TaJieHelpTab.RowData rowData = TaJieHelpDocument.m_tajieHelpTable.Table[i]; + bool flag = rowData == null; + if (!flag) + { + bool flag2 = (ulong)rowData.SysID != (ulong)((long)XFastEnumIntEqualityComparer.ToInt(XSysDefine.XSys_GuildHall)) || !inGuild; + if (flag2) + { + for (int j = 0; j < rowData.Type.Length; j++) + { + bool flag3 = (ulong)rowData.Type[j] == (ulong)((long)this.m_curType); + if (flag3) + { + list.Add(rowData); + } + } + } + } + } + return list; + } + + public string GetUrl() + { + TaJieHelpUrl.RowData urlTabData = this.GetUrlTabData(); + bool flag = urlTabData != null; + string result; + if (flag) + { + result = urlTabData.Url; + } + else + { + result = ""; + } + return result; + } + + public string GetSceneName() + { + TaJieHelpUrl.RowData urlTabData = this.GetUrlTabData(); + bool flag = urlTabData != null; + string result; + if (flag) + { + result = urlTabData.Name; + } + else + { + result = ""; + } + return result; + } + + private TaJieHelpUrl.RowData GetUrlTabData() + { + for (int i = 0; i < TaJieHelpDocument.m_tajieHelpUrl.Table.Length; i++) + { + TaJieHelpUrl.RowData rowData = TaJieHelpDocument.m_tajieHelpUrl.Table[i]; + bool flag = rowData == null; + if (!flag) + { + bool flag2 = (ulong)rowData.SceneId == (ulong)((long)this.m_sceneId); + if (flag2) + { + return rowData; + } + } + } + return null; + } + + public string GetdDragonTips() + { + bool flag = this.m_dragonStatus == 0; + string result; + if (flag) + { + result = XSingleton.singleton.GetString("TaJieHelpTips1"); + } + else + { + bool flag2 = this.m_dragonStatus == 1; + if (flag2) + { + result = string.Format("{0}{1}", XSingleton.singleton.GetString("TaJieHelpTips2"), this.GetTime()); + } + else + { + bool flag3 = this.m_dragonStatus == 2; + if (flag3) + { + result = XSingleton.singleton.GetString("TaJieHelpTips3"); + } + else + { + result = ""; + } + } + } + return result; + } + + public string GetTime() + { + float num = (float)this.m_dragonWeakLeftTime - Time.realtimeSinceStartup + this.m_getMesTime; + int num2 = (int)(num / 3600f); + int num3 = num2 % 24; + bool flag = num % 3600f != 0f; + if (flag) + { + num3++; + } + int num4 = num2 / 24; + bool flag2 = num4 == 0; + string result; + if (flag2) + { + result = string.Format("{0}{1}", num3, XSingleton.singleton.GetString("HOUR_DUARATION")); + } + else + { + result = string.Format("{0}{1}{2}{3}", new object[] + { + num4, + XSingleton.singleton.GetString("DAY_DUARATION"), + num3, + XSingleton.singleton.GetString("HOUR_DUARATION") + }); + } + return result; + } + + public void OnGetPtcMes(PtcG2C_TajieHelpNotify msg) + { + bool flag = msg.Data.sceneID == this.m_sceneId; + if (flag) + { + this.ShowHallBtn = msg.Data.isIconAppear; + this.m_dragonStatus = msg.Data.dragonStatus; + this.m_dragonWeakLeftTime = msg.Data.dragonWeakLeftTime; + this.m_getMesTime = Time.realtimeSinceStartup; + } + else + { + bool isIconAppear = msg.Data.isIconAppear; + if (isIconAppear) + { + this.m_sceneId = msg.Data.sceneID; + this.m_curType = msg.Data.sceneType; + this.m_dragonStatus = msg.Data.dragonStatus; + this.m_dragonWeakLeftTime = msg.Data.dragonWeakLeftTime; + this.m_getMesTime = Time.realtimeSinceStartup; + this.ShowHallBtn = msg.Data.isIconAppear; + } + } + } + } +} -- cgit v1.1-26-g67d0