From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/ArtifactRecastDocument.cs | 164 +++++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/ArtifactRecastDocument.cs (limited to 'Client/Assets/Scripts/XMainClient/ArtifactRecastDocument.cs') diff --git a/Client/Assets/Scripts/XMainClient/ArtifactRecastDocument.cs b/Client/Assets/Scripts/XMainClient/ArtifactRecastDocument.cs new file mode 100644 index 00000000..06fe10c1 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/ArtifactRecastDocument.cs @@ -0,0 +1,164 @@ +using System; +using KKSG; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class ArtifactRecastDocument : XDocComponent + { + public override uint ID + { + get + { + return ArtifactRecastDocument.uuID; + } + } + + public static ArtifactRecastDocument Doc + { + get + { + return XSingleton.singleton.Doc.GetXComponent(ArtifactRecastDocument.uuID) as ArtifactRecastDocument; + } + } + + public ulong SelectUid + { + get + { + return this.m_selectUid; + } + } + + public ulong LastSelectUid + { + get + { + return this.m_lastSelectUid; + } + } + + public new static readonly uint uuID = XSingleton.singleton.XHash("ArtifactRecastDocument"); + + public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader(); + + private ulong m_selectUid = 0UL; + + private ulong m_lastSelectUid = 0UL; + + public ArtifactRecastHandler Handler; + + public static void Execute(OnLoadedCallback callback = null) + { + ArtifactRecastDocument.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) + { + bool flag = this.m_selectUid > 0UL; + if (flag) + { + XItem itemByUID = XBagDocument.BagDoc.GetItemByUID(this.m_selectUid); + bool flag2 = itemByUID == null; + if (flag2) + { + this.m_selectUid = 0UL; + } + } + this.RefreshUi(); + } + + public override void OnEnterSceneFinally() + { + base.OnEnterSceneFinally(); + } + + public void RefreshUi() + { + bool flag = this.Handler != null && this.Handler.IsVisible(); + if (flag) + { + this.Handler.RefreshUi(); + } + ArtifactDeityStoveDocument.Doc.RefreshUi(); + } + + public bool IsSelectUid(ulong uid) + { + return this.m_selectUid == uid; + } + + public void ResetSelectUid(bool isRefeshUi) + { + this.m_selectUid = 0UL; + if (isRefeshUi) + { + this.RefreshUi(); + } + } + + public void AddItem(ulong uid) + { + bool flag = this.m_selectUid > 0UL; + if (flag) + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("FuseRepleaseSuc"), "fece00"); + } + this.m_selectUid = uid; + this.RefreshUi(); + } + + public void TakeOut(ulong uid) + { + this.m_selectUid = 0UL; + this.RefreshUi(); + } + + public void ReqRecast() + { + this.m_lastSelectUid = this.m_selectUid; + RpcC2G_ArtifactDeityStoveOp rpcC2G_ArtifactDeityStoveOp = new RpcC2G_ArtifactDeityStoveOp(); + rpcC2G_ArtifactDeityStoveOp.oArg.type = ArtifactDeityStoveOpType.ArtifactDeityStove_Recast; + rpcC2G_ArtifactDeityStoveOp.oArg.uid1 = this.m_selectUid; + XSingleton.singleton.Send(rpcC2G_ArtifactDeityStoveOp); + } + + public void OnReqRecastBack(ArtifactDeityStoveOpRes oRes) + { + bool flag = oRes.errorcode > ErrorCode.ERR_SUCCESS; + if (flag) + { + XSingleton.singleton.ShowSystemTip(oRes.errorcode, "fece00"); + } + else + { + XSingleton.singleton.ShowSystemTip(XSingleton.singleton.GetString("RecastSuccess"), "fece00"); + this.ResetSelectUid(true); + } + } + + public void ResetSetting() + { + DlgBase.singleton.ForceSetTipsValue(XTempTipDefine.OD_RECAST_CONFIRM, false); + XOptionsDocument specificDocument = XDocuments.GetSpecificDocument(XOptionsDocument.uuID); + specificDocument.SetValue(XOptionsDefine.OD_NO_RECAST_CONFIRM, 0, true); + } + } +} -- cgit v1.1-26-g67d0