Phase1.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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 void 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 void OnStep101(UnityEngine.Object obj)
  62. {
  63. pgm.StepInit();
  64. GameObject gameObject = UIManager.Instance.GetComponent<AppBarPanel>().bnt_shengShi.gameObject;
  65. Vector3 localPos = pgm.WorldPosToLocalPos(gameObject.transform.position);
  66. Vector2 size = gameObject.GetComponent<RectTransform>().sizeDelta;
  67. pgm.SetfxTransVisiable(true);
  68. pgm.SetMaskTarget(gameObject);
  69. pgm.SetShowFramePosAndSize(localPos, size, 0, gameObject);
  70. // pgm.SetOnClickMask(true);
  71. await pgm.ConfigLogic(101, delegate() { });
  72. pgm.SetFingerPos(localPos);
  73. pgm.SetFingerVisiable(true);
  74. // pgm.SetOnClickMask(false);
  75. }
  76. /// <summary>
  77. /// 开始探索
  78. /// </summary>
  79. /// <param name="obj"></param>
  80. public async void OnStep102(UnityEngine.Object obj)
  81. {
  82. pgm.StepInit();
  83. GameObject gameObject = UIManager.Instance.GetComponent<DivineSenceInfoPanel>().Btn_Ok.gameObject;
  84. Vector3 localPos = pgm.WorldPosToLocalPos(gameObject.transform.position);
  85. Vector2 size = gameObject.GetComponent<RectTransform>().sizeDelta;
  86. pgm.SetfxTransVisiable(true);
  87. pgm.SetMaskTarget(gameObject);
  88. pgm.SetShowFramePosAndSize(localPos, size, 0, gameObject);
  89. await pgm.ConfigLogic(102, delegate() { });
  90. pgm.SetFingerPos(localPos);
  91. pgm.SetFingerVisiable(true);
  92. }
  93. /// <summary>
  94. /// 进入关卡按钮
  95. /// </summary>
  96. /// <param name="obj"></param>
  97. public async void OnStep103(UnityEngine.Object obj)
  98. {
  99. pgm.StepInit();
  100. await pgm.ConfigLogic(103, delegate()
  101. {
  102. pgm.SetfxTransVisiable(false);
  103. pgm.NextGuide();
  104. });
  105. }
  106. public async void OnStepEnd(UnityEngine.Object obj)
  107. {
  108. pgm.StepInit();
  109. pgm.SetBlackBaseVisiable(false);
  110. ForceGuideOver();
  111. }
  112. /// <summary>
  113. /// 引导完成
  114. /// </summary>
  115. private void ForceGuideOver()
  116. {
  117. pgm.CloseForceGuide();
  118. pgm.RestGuide();
  119. }
  120. }
  121. }