From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../XMainClient/XProfessionChangeDocument.cs | 92 ++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XProfessionChangeDocument.cs (limited to 'Client/Assets/Scripts/XMainClient/XProfessionChangeDocument.cs') diff --git a/Client/Assets/Scripts/XMainClient/XProfessionChangeDocument.cs b/Client/Assets/Scripts/XMainClient/XProfessionChangeDocument.cs new file mode 100644 index 00000000..70bed1c6 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XProfessionChangeDocument.cs @@ -0,0 +1,92 @@ +using System; +using KKSG; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XProfessionChangeDocument : XDocComponent + { + public override uint ID + { + get + { + return XProfessionChangeDocument.uuID; + } + } + + public new static readonly uint uuID = XSingleton.singleton.XHash("ProfessionChangeDocument"); + + public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader(); + + private int _taskID; + + public uint SceneID; + + public int SelectProfession = 1; + + public int LastExperienceProfID = 1; + + public static void Execute(OnLoadedCallback callback = null) + { + XProfessionChangeDocument.AsyncLoader.Execute(callback); + } + + protected override void EventSubscribe() + { + base.EventSubscribe(); + base.RegisterEvent(XEventDefine.XEvent_TaskStateChange, new XComponent.XEventHandler(this.OnProfChangeTaskFinish)); + } + + public override void OnAttachToHost(XObject host) + { + base.OnAttachToHost(host); + this._taskID = XSingleton.singleton.GetInt("ProfessionChangeTaskID"); + this.SceneID = uint.Parse(XSingleton.singleton.GetValue("ProfessionChangeSceneID")); + } + + public override void OnEnterSceneFinally() + { + base.OnEnterSceneFinally(); + bool flag = XSingleton.singleton.SceneID == this.SceneID; + if (flag) + { + XSingleton.singleton.CacheUI(XSysDefine.XSys_ProfessionChange, EXStage.Hall); + this.LastExperienceProfID = this.SelectProfession; + } + } + + public bool OnProfChangeTaskFinish(XEventArgs args) + { + XTaskStatusChangeArgs xtaskStatusChangeArgs = args as XTaskStatusChangeArgs; + bool flag = xtaskStatusChangeArgs.status != TaskStatus.TaskStatus_Over; + bool result; + if (flag) + { + result = false; + } + else + { + bool flag2 = xtaskStatusChangeArgs.id == (uint)this._taskID; + if (flag2) + { + DlgBase.singleton.SetVisibleWithAnimation(true, null); + } + result = false; + } + return result; + } + + public void QueryChangeProfession() + { + RpcC2G_ChangeProfession rpcC2G_ChangeProfession = new RpcC2G_ChangeProfession(); + rpcC2G_ChangeProfession.oArg.pro = (uint)this.SelectProfession; + XSingleton.singleton.Send(rpcC2G_ChangeProfession); + } + + protected override void OnReconnected(XReconnectedEventArgs arg) + { + } + } +} -- cgit v1.1-26-g67d0