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; } } }