using Fort23.Core; using Fort23.UTool; using UnityEngine; using UnityEngine.UI; namespace Fort23.Mono.Phases { public class Phase1 : IGuideLogic { public PlayerGuideManager pgm; public BetterList dialogList = new BetterList(); private bool once = false; public Phase1(PlayerGuideManager guideManager) { this.pgm = guideManager; once = true; } public override void Active() { base.Active(); actionList.Add(OnStep101); actionList.Add(OnStep102); actionList.Add(OnStep103); actionList.Add(OnStepEnd); } public override void Begin() { guideID = 1; guideIdx = -1; pgm.isForceDone = false; pgm.isTriggerDone = false; } public override void End() { } public override async void Guide() { if (actionList.Count > guideIdx) { pgm.ResetPlayerGuide(); guideIdx++; actionList[guideIdx](null); SaveStep(guideIdx); } else { LogTool.Error("没有引导了,强制结束。出错步骤,:" + pgm.curPhase + guideIdx); pgm.isForceDone = true; } } public override void LogicRelase() { actionList.Clear(); } public override void LogicUpdate() { } /// /// 点击主界面神识 /// /// public async void OnStep101(UnityEngine.Object obj) { pgm.StepInit(); GameObject gameObject = UIManager.Instance.GetComponent().bnt_shengShi.gameObject; Vector3 localPos = pgm.WorldPosToLocalPos(gameObject.transform.position); Vector2 size = gameObject.GetComponent().sizeDelta; pgm.SetfxTransVisiable(true); pgm.SetMaskTarget(gameObject); pgm.SetShowFramePosAndSize(localPos, size, 0, gameObject); // pgm.SetOnClickMask(true); await pgm.ConfigLogic(101, delegate() { }); pgm.SetFingerPos(localPos); pgm.SetFingerVisiable(true); // pgm.SetOnClickMask(false); } /// /// 开始探索 /// /// public async void OnStep102(UnityEngine.Object obj) { pgm.StepInit(); GameObject gameObject = UIManager.Instance.GetComponent().Btn_Ok.gameObject; Vector3 localPos = pgm.WorldPosToLocalPos(gameObject.transform.position); Vector2 size = gameObject.GetComponent().sizeDelta; pgm.SetfxTransVisiable(true); pgm.SetMaskTarget(gameObject); pgm.SetShowFramePosAndSize(localPos, size, 0, gameObject); await pgm.ConfigLogic(102, delegate() { }); pgm.SetFingerPos(localPos); pgm.SetFingerVisiable(true); } /// /// 进入关卡按钮 /// /// public async void OnStep103(UnityEngine.Object obj) { pgm.StepInit(); await pgm.ConfigLogic(103, delegate() { pgm.SetfxTransVisiable(false); pgm.NextGuide(); }); } public async void OnStepEnd(UnityEngine.Object obj) { pgm.StepInit(); pgm.SetBlackBaseVisiable(false); ForceGuideOver(); } /// /// 引导完成 /// private void ForceGuideOver() { pgm.CloseForceGuide(); pgm.RestGuide(); } } }