From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Assets/Scripts/XMainClient/XCommandPrefab.cs | 142 +++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/XCommandPrefab.cs (limited to 'Client/Assets/Scripts/XMainClient/XCommandPrefab.cs') diff --git a/Client/Assets/Scripts/XMainClient/XCommandPrefab.cs b/Client/Assets/Scripts/XMainClient/XCommandPrefab.cs new file mode 100644 index 00000000..c240956f --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/XCommandPrefab.cs @@ -0,0 +1,142 @@ +using System; +using UILib; +using UnityEngine; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUpdater; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XCommandPrefab : XBaseCommand + { + private GameObject _Prefab; + + private uint _time = 0u; + + private uint _time2 = 0u; + + public override bool Execute() + { + bool flag = this._cmd.param2 == "SelectSight"; + bool result; + if (flag) + { + bool pause = this._cmd.pause; + if (pause) + { + XSingleton.singleton.Pause = true; + } + DlgBase.singleton.SetVisibleWithAnimation(true, null); + result = true; + } + else + { + bool flag2 = this._cmd.param2 == "SelectSkipTutorial"; + if (flag2) + { + DlgBase.singleton.SetVisibleWithAnimation(true, null); + result = true; + } + else + { + this._time = XSingleton.singleton.SetTimer(this._cmd.interalDelay, new XTimerMgr.ElapsedEventHandler(this.ShowVT), null); + base.publicModule(); + result = true; + } + } + return result; + } + + protected void ShowVT(object o) + { + base.SetOverlay(); + this.ShowPic(); + bool pause = this._cmd.pause; + if (pause) + { + XSingleton.singleton.Pause = true; + } + } + + protected void ShowPic() + { + bool flag = this._Prefab == null; + if (flag) + { + this._Prefab = (XSingleton.singleton.CreateFromPrefab(this._cmd.param1, true, false) as GameObject); + } + XSingleton.singleton.AddChild(XBaseCommand._Overlay, this._Prefab); + IXUITweenTool ixuitweenTool = this._Prefab.GetComponent("XUIPlayTween") as IXUITweenTool; + bool flag2 = this._cmd.param2 == "Time"; + if (flag2) + { + this._time2 = XSingleton.singleton.SetTimer(float.Parse(this._cmd.param3), new XTimerMgr.ElapsedEventHandler(this.TweenFinish), null); + } + else + { + bool flag3 = this._cmd.param2 == "PlayFinished"; + if (flag3) + { + ixuitweenTool.RegisterOnFinishEventHandler(new OnTweenFinishEventHandler(this.OnTweenFinish)); + } + else + { + XSingleton.singleton.AddErrorLog("Tutorial ShowPrefab No Finish Way!\nTag:" + this._cmd.tag, null, null, null, null, null); + } + } + ixuitweenTool.PlayTween(true, -1f); + } + + protected void TweenFinish(object o) + { + this.RegisterOnMouseClick(); + } + + protected void OnTweenFinish(IXUITweenTool tool) + { + this.RegisterOnMouseClick(); + } + + protected void RegisterOnMouseClick() + { + bool flag = this._Prefab != null; + if (flag) + { + IXUISprite ixuisprite = this._Prefab.transform.Find("Bg").GetComponent("XUISprite") as IXUISprite; + ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnMouseClick)); + } + else + { + this.OnMouseClick(null); + } + } + + protected override void OnMouseClick(IXUISprite sp) + { + base.OnMouseClick(sp); + XSingleton.singleton.OnCmdFinished(); + } + + public override void Stop() + { + bool flag = this._time > 0u; + if (flag) + { + XSingleton.singleton.KillTimer(this._time); + this._time = 0u; + } + bool flag2 = this._time2 > 0u; + if (flag2) + { + XSingleton.singleton.KillTimer(this._time2); + this._time2 = 0u; + } + XResourceLoaderMgr.SafeDestroy(ref this._Prefab, false); + base.DestroyAilin(); + base.DestroyOverlay(); + XSingleton.singleton.Pause = false; + XSingleton.singleton.Exculsive = false; + } + } +} -- cgit v1.1-26-g67d0