PlayAreaOKState.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. public class PlayAreaOKState : AbstractPlayAreaState<SafetyAreaMono>
  5. {
  6. public override void OnStateEnter(object data)
  7. {
  8. ShowPlayAreaOKUI();
  9. reference.playAreaOKUI.OnRedrawAreaClick += ChangePrepareDrawPlayAreaState;
  10. reference.playAreaOKUI.OnBackClick += ChangePrepareDrawPlayAreaState;
  11. reference.playAreaOKUI.OnContinueClick += SwitchToConfirmPlayAreaStep;
  12. }
  13. public override void OnStateExit(object data)
  14. {
  15. reference.playAreaOKUI.OnRedrawAreaClick -= ChangePrepareDrawPlayAreaState;
  16. reference.playAreaOKUI.OnBackClick -= ChangePrepareDrawPlayAreaState;
  17. reference.playAreaOKUI.OnContinueClick -= SwitchToConfirmPlayAreaStep;
  18. HidePlayAreaOKUI();
  19. }
  20. private void ChangePrepareDrawPlayAreaState()
  21. {
  22. reference.ClearPlaneColor();
  23. reference.ChangePlayAreaState(PlayAreaStateEnum.WaitingDraw);
  24. }
  25. private void SwitchToConfirmPlayAreaStep()
  26. {
  27. SafetyAreaManager.Instance.ChangeStep(SafetyAreaStepEnum.ConfirmPlayArea);
  28. }
  29. public void ShowPlayAreaOKUI()
  30. {
  31. reference.playAreaOKUI.gameObject.SetActive(true);
  32. reference.playAreaOKUI.Init();
  33. }
  34. public void HidePlayAreaOKUI()
  35. {
  36. reference.playAreaOKUI.Release();
  37. reference.playAreaOKUI.gameObject.SetActive(false);
  38. }
  39. }