| | 1 | | using System; |
| | 2 | | using TMPro; |
| | 3 | | using UIComponents.Scripts.Components; |
| | 4 | | using UnityEngine; |
| | 5 | |
|
| | 6 | | namespace DCL.ConfirmationPopup |
| | 7 | | { |
| | 8 | | public class ConfirmationPopupHUDComponentView : BaseComponentView<ConfirmationPopupHUDViewModel>, IConfirmationPopu |
| | 9 | | { |
| | 10 | | [SerializeField] internal TMP_Text titleLabel; |
| | 11 | | [SerializeField] internal TMP_Text bodyLabel; |
| | 12 | | [SerializeField] internal TMP_Text confirmLabel; |
| | 13 | | [SerializeField] internal TMP_Text cancelLabel; |
| | 14 | | [SerializeField] internal ButtonComponentView confirmButton; |
| | 15 | | [SerializeField] internal ButtonComponentView cancelButton; |
| | 16 | |
|
| | 17 | | public event Action OnConfirm; |
| | 18 | | public event Action OnCancel; |
| | 19 | |
|
| | 20 | | public static ConfirmationPopupHUDComponentView Create() => |
| 4 | 21 | | Instantiate(Resources.Load<ConfirmationPopupHUDComponentView>("GenericConfirmationPopup")); |
| | 22 | |
|
| | 23 | | public override void Awake() |
| | 24 | | { |
| 4 | 25 | | base.Awake(); |
| | 26 | |
|
| 5 | 27 | | confirmButton.onClick.AddListener(() => OnConfirm?.Invoke()); |
| 5 | 28 | | cancelButton.onClick.AddListener(() => OnCancel?.Invoke()); |
| 4 | 29 | | } |
| | 30 | |
|
| | 31 | | public override void RefreshControl() |
| | 32 | | { |
| 2 | 33 | | titleLabel.text = model.Title; |
| 2 | 34 | | bodyLabel.text = model.Body; |
| 2 | 35 | | confirmLabel.text = model.ConfirmButton; |
| 2 | 36 | | cancelLabel.text = model.CancelButton; |
| 2 | 37 | | } |
| | 38 | | } |
| | 39 | | } |