summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/XProfessionChangeDocument.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-01-25 14:28:30 +0800
committerchai <chaifix@163.com>2021-01-25 14:28:30 +0800
commit6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch)
tree7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/XProfessionChangeDocument.cs
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/XProfessionChangeDocument.cs')
-rw-r--r--Client/Assets/Scripts/XMainClient/XProfessionChangeDocument.cs92
1 files changed, 92 insertions, 0 deletions
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<XCommon>.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<XGlobalConfig>.singleton.GetInt("ProfessionChangeTaskID");
+ this.SceneID = uint.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("ProfessionChangeSceneID"));
+ }
+
+ public override void OnEnterSceneFinally()
+ {
+ base.OnEnterSceneFinally();
+ bool flag = XSingleton<XScene>.singleton.SceneID == this.SceneID;
+ if (flag)
+ {
+ XSingleton<XUICacheMgr>.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<ProfessionChangeDlg, ProfessionChangeBehaviour>.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<XClientNetwork>.singleton.Send(rpcC2G_ChangeProfession);
+ }
+
+ protected override void OnReconnected(XReconnectedEventArgs arg)
+ {
+ }
+ }
+}