Phase1.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. using Fort23.Core;
  2. using Fort23.UTool;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. namespace Fort23.Mono.Phases
  6. {
  7. public class Phase1 : IGuideLogic
  8. {
  9. public PlayerGuideManager pgm;
  10. public BetterList<string> dialogList = new BetterList<string>();
  11. private bool once = false;
  12. public Phase1(PlayerGuideManager guideManager)
  13. {
  14. this.pgm = guideManager;
  15. once = true;
  16. }
  17. public override void Active()
  18. {
  19. base.Active();
  20. actionList.Add(OnStep101);
  21. actionList.Add(OnStep102);
  22. actionList.Add(OnStep103);
  23. actionList.Add(OnStepEnd);
  24. }
  25. public override void Begin()
  26. {
  27. guideID = 1;
  28. guideIdx = -1;
  29. pgm.isForceDone = false;
  30. pgm.isTriggerDone = false;
  31. }
  32. public override void End()
  33. {
  34. }
  35. public override async CTask Guide()
  36. {
  37. if (actionList.Count > guideIdx)
  38. {
  39. pgm.ResetPlayerGuide();
  40. guideIdx++;
  41. actionList[guideIdx](null);
  42. SaveStep(guideIdx);
  43. }
  44. else
  45. {
  46. LogTool.Error("没有引导了,强制结束。出错步骤,:" + pgm.curPhase + guideIdx);
  47. pgm.isForceDone = true;
  48. }
  49. }
  50. public override void LogicRelase()
  51. {
  52. actionList.Clear();
  53. }
  54. public override void LogicUpdate()
  55. {
  56. }
  57. /// <summary>
  58. /// 点击主界面神识
  59. /// </summary>
  60. /// <param name="obj"></param>
  61. public async CTask OnStep101(UnityEngine.Object obj)
  62. {
  63. pgm.StepInit();
  64. UIManager.Instance.HideUIUIPanel<RewardsPanel>();
  65. await pgm.ConfigLogic(101, delegate() { });
  66. pgm.SetOnClickMask(true);
  67. TipMessagePanelType2 tipMessagePanelType2 =
  68. await TipMessagePanelType2.OpenTipMessagePanel(10131, isClose: false);
  69. await tipMessagePanelType2.UIClosed();
  70. if (PlayerGuideManager.Instance.GuideIsCanDo(1, 1))
  71. {
  72. PlayerGuideManager.Instance.NextGuide();
  73. }
  74. pgm.SetOnClickMask(false);
  75. }
  76. /// <summary>
  77. /// 开始探索
  78. /// </summary>
  79. /// <param name="obj"></param>
  80. public async CTask OnStep102(UnityEngine.Object obj)
  81. {
  82. pgm.StepInit();
  83. await pgm.ConfigLogic(102, delegate()
  84. {
  85. pgm.SetfxTransVisiable(false);
  86. pgm.NextGuide();
  87. });
  88. }
  89. public async CTask OnStep103(UnityEngine.Object obj)
  90. {
  91. pgm.StepInit();
  92. GameObject gameObject = UIManager.Instance.GetComponent<MainPanel>().Btn_StartEvent.gameObject;
  93. Vector3 localPos = pgm.WorldPosToLocalPos(gameObject.transform.position);
  94. Vector2 size = gameObject.GetComponent<RectTransform>().sizeDelta;
  95. pgm.SetfxTransVisiable(true);
  96. pgm.SetMaskTarget(gameObject);
  97. pgm.SetShowFramePosAndSize(localPos, size, 0, gameObject);
  98. await pgm.ConfigLogic(103, delegate() { });
  99. pgm.SetFingerPos(pgm.Setpos(localPos, size, gameObject));
  100. pgm.SetFingerVisiable(true);
  101. }
  102. public async CTask OnStepEnd(UnityEngine.Object obj)
  103. {
  104. pgm.StepInit();
  105. pgm.SetBlackBaseVisiable(false);
  106. ForceGuideOver();
  107. }
  108. /// <summary>
  109. /// 引导完成
  110. /// </summary>
  111. private void ForceGuideOver()
  112. {
  113. pgm.CloseForceGuide();
  114. pgm.RestGuide();
  115. }
  116. }
  117. }