| | 1 | | using System; |
| | 2 | | using TMPro; |
| | 3 | | using UnityEngine; |
| | 4 | | using UnityEngine.UI; |
| | 5 | |
|
| | 6 | | namespace DCL.MyAccount |
| | 7 | | { |
| | 8 | | public class UpdateEmailConfirmationHUDComponentView : BaseComponentView, IUpdateEmailConfirmationHUDComponentView |
| | 9 | | { |
| | 10 | | [SerializeField] internal Image actionLogoImage; |
| | 11 | | [SerializeField] internal TMP_Text confirmationText; |
| | 12 | | [SerializeField] internal Button backgroundButton; |
| | 13 | | [SerializeField] internal Button noButton; |
| | 14 | | [SerializeField] internal Button yesButton; |
| | 15 | |
|
| | 16 | | public event Action<bool> OnConfirmationModalAccepted; |
| | 17 | |
|
| | 18 | | public override void Awake() |
| | 19 | | { |
| 0 | 20 | | base.Awake(); |
| | 21 | |
|
| 0 | 22 | | backgroundButton.onClick.AddListener(RejectConfirmation); |
| | 23 | |
|
| 0 | 24 | | noButton.onClick.AddListener(RejectConfirmation); |
| 0 | 25 | | yesButton.onClick.AddListener(AcceptConfirmation); |
| 0 | 26 | | } |
| | 27 | |
|
| | 28 | | public override void Dispose() |
| | 29 | | { |
| 0 | 30 | | noButton.onClick.RemoveAllListeners(); |
| 0 | 31 | | yesButton.onClick.RemoveAllListeners(); |
| 0 | 32 | | base.Dispose(); |
| 0 | 33 | | } |
| | 34 | |
|
| 0 | 35 | | public override void RefreshControl() { } |
| | 36 | |
|
| | 37 | | public void ShowConfirmationModal(Sprite actionLogo, string text) |
| | 38 | | { |
| 0 | 39 | | actionLogoImage.sprite = actionLogo; |
| 0 | 40 | | confirmationText.text = text; |
| 0 | 41 | | Show(); |
| 0 | 42 | | } |
| | 43 | |
|
| | 44 | | public void HideConfirmationModal() => |
| 0 | 45 | | Hide(); |
| | 46 | |
|
| | 47 | | private void AcceptConfirmation() |
| | 48 | | { |
| 0 | 49 | | HideConfirmationModal(); |
| 0 | 50 | | OnConfirmationModalAccepted?.Invoke(true); |
| 0 | 51 | | } |
| | 52 | |
|
| | 53 | | private void RejectConfirmation() |
| | 54 | | { |
| 0 | 55 | | HideConfirmationModal(); |
| 0 | 56 | | OnConfirmationModalAccepted?.Invoke(false); |
| 0 | 57 | | } |
| | 58 | | } |
| | 59 | | } |