| | 1 | | using System; |
| | 2 | |
|
| | 3 | | public interface IExtraActionsController |
| | 4 | | { |
| | 5 | | event Action OnControlsClick, |
| | 6 | | OnHideUIClick, |
| | 7 | | OnTutorialClick, |
| | 8 | | OnResetClick, |
| | 9 | | OnResetCameraClick; |
| | 10 | |
|
| | 11 | | void Initialize(IExtraActionsView extraActionsView); |
| | 12 | | void Dispose(); |
| | 13 | | void SetActive(bool isActive); |
| | 14 | | void ControlsClicked(); |
| | 15 | | void HideUIClicked(); |
| | 16 | | void TutorialClicked(); |
| | 17 | | void ResetCameraClicked(); |
| | 18 | | void SetResetButtonInteractable(bool isEnabled); |
| | 19 | | } |
| | 20 | |
|
| | 21 | | public class ExtraActionsController : IExtraActionsController |
| | 22 | | { |
| | 23 | | public event Action OnControlsClick, |
| | 24 | | OnHideUIClick, |
| | 25 | | OnTutorialClick, |
| | 26 | | OnResetClick, |
| | 27 | | OnResetCameraClick; |
| | 28 | |
|
| | 29 | | internal IExtraActionsView extraActionsView; |
| | 30 | |
|
| | 31 | | public void Initialize(IExtraActionsView extraActionsView) |
| | 32 | | { |
| 8 | 33 | | this.extraActionsView = extraActionsView; |
| | 34 | |
|
| 8 | 35 | | extraActionsView.OnControlsClicked += ControlsClicked; |
| 8 | 36 | | extraActionsView.OnHideUIClicked += HideUIClicked; |
| 8 | 37 | | extraActionsView.OnTutorialClicked += TutorialClicked; |
| 8 | 38 | | extraActionsView.OnResetClicked += ResetClicked; |
| 8 | 39 | | extraActionsView.OnResetCameraClicked += ResetCameraClicked; |
| 8 | 40 | | } |
| | 41 | |
|
| | 42 | | public void Dispose() |
| | 43 | | { |
| 8 | 44 | | extraActionsView.OnControlsClicked -= ControlsClicked; |
| 8 | 45 | | extraActionsView.OnHideUIClicked -= HideUIClicked; |
| 8 | 46 | | extraActionsView.OnTutorialClicked -= TutorialClicked; |
| 8 | 47 | | extraActionsView.OnResetClicked -= ResetClicked; |
| 8 | 48 | | extraActionsView.OnResetCameraClicked -= ResetCameraClicked; |
| 8 | 49 | | } |
| | 50 | |
|
| | 51 | | public void SetActive(bool isActive) |
| | 52 | | { |
| 24 | 53 | | if (extraActionsView != null) |
| 6 | 54 | | extraActionsView.SetActive(isActive); |
| 24 | 55 | | } |
| | 56 | |
|
| | 57 | | public void ResetClicked() |
| | 58 | | { |
| 0 | 59 | | OnResetClick?.Invoke(); |
| 0 | 60 | | SetActive(false); |
| 0 | 61 | | } |
| | 62 | |
|
| | 63 | | public void ControlsClicked() |
| | 64 | | { |
| 1 | 65 | | OnControlsClick?.Invoke(); |
| 1 | 66 | | SetActive(false); |
| 1 | 67 | | } |
| | 68 | |
|
| | 69 | | public void HideUIClicked() |
| | 70 | | { |
| 1 | 71 | | OnHideUIClick?.Invoke(); |
| 1 | 72 | | SetActive(false); |
| 1 | 73 | | } |
| | 74 | |
|
| | 75 | | public void TutorialClicked() |
| | 76 | | { |
| 1 | 77 | | OnTutorialClick?.Invoke(); |
| 1 | 78 | | SetActive(false); |
| 1 | 79 | | } |
| | 80 | |
|
| | 81 | | public void ResetCameraClicked() |
| | 82 | | { |
| 1 | 83 | | OnResetCameraClick?.Invoke(); |
| 1 | 84 | | SetActive(false); |
| 1 | 85 | | } |
| | 86 | |
|
| 4 | 87 | | public void SetResetButtonInteractable(bool isInteractable) { extraActionsView.SetResetButtonInteractable(isInteract |
| | 88 | | } |