| | 1 | | using System; |
| | 2 | | using TMPro; |
| | 3 | | using UnityEngine; |
| | 4 | | using UnityEngine.UI; |
| | 5 | |
|
| | 6 | | namespace DCL.ContentModeration |
| | 7 | | { |
| | 8 | | public class AdultContentSceneWarningComponentView : BaseComponentView, IAdultContentSceneWarningComponentView |
| | 9 | | { |
| | 10 | | [SerializeField] internal Button backgroundButton; |
| | 11 | | [SerializeField] internal ButtonComponentView gotItButton; |
| | 12 | | [SerializeField] internal ButtonComponentView cancelButton; |
| | 13 | | [SerializeField] internal ButtonComponentView goToSettingsButton; |
| | 14 | | [SerializeField] internal TMP_Text subTitle; |
| | 15 | |
|
| | 16 | | private const string RESTRICTED_MODE_SUBTITLE = "This scene has been restricted by our community as it potential |
| | 17 | | private const string ADULT_MODE_SUBTITLE = @"This scene has been flagged by the community as containing 18+ Adul |
| | 18 | |
|
| | 19 | | public event Action OnGoToSettingsClicked; |
| | 20 | |
|
| | 21 | | public override void Awake() |
| | 22 | | { |
| 0 | 23 | | base.Awake(); |
| 0 | 24 | | backgroundButton.onClick.AddListener(HideModal); |
| 0 | 25 | | cancelButton.onClick.AddListener(HideModal); |
| 0 | 26 | | gotItButton.onClick.AddListener(HideModal); |
| 0 | 27 | | goToSettingsButton.onClick.AddListener(GoToSettings); |
| 0 | 28 | | } |
| | 29 | |
|
| | 30 | | public override void Dispose() |
| | 31 | | { |
| 0 | 32 | | backgroundButton.onClick.RemoveAllListeners(); |
| 0 | 33 | | cancelButton.onClick.RemoveAllListeners(); |
| 0 | 34 | | gotItButton.onClick.RemoveAllListeners(); |
| 0 | 35 | | goToSettingsButton.onClick.RemoveAllListeners(); |
| 0 | 36 | | base.Dispose(); |
| 0 | 37 | | } |
| | 38 | |
|
| 0 | 39 | | public override void RefreshControl() { } |
| | 40 | |
|
| | 41 | | public void ShowModal() => |
| 0 | 42 | | Show(); |
| | 43 | |
|
| | 44 | | public void HideModal() => |
| 0 | 45 | | Hide(); |
| | 46 | |
|
| | 47 | | public void SetRestrictedMode(bool isRestricted) |
| | 48 | | { |
| 0 | 49 | | gotItButton.gameObject.SetActive(isRestricted); |
| 0 | 50 | | cancelButton.gameObject.SetActive(!isRestricted); |
| 0 | 51 | | goToSettingsButton.gameObject.SetActive(!isRestricted); |
| 0 | 52 | | subTitle.text = isRestricted ? RESTRICTED_MODE_SUBTITLE : ADULT_MODE_SUBTITLE; |
| 0 | 53 | | } |
| | 54 | |
|
| | 55 | | private void GoToSettings() => |
| 0 | 56 | | OnGoToSettingsClicked?.Invoke(); |
| | 57 | | } |
| | 58 | | } |