| | 1 | | using DCL.Helpers; |
| | 2 | | using DCL.Interface; |
| | 3 | | using UnityEngine; |
| | 4 | | using UnityEngine.UI; |
| | 5 | |
|
| | 6 | | public class GraphicCardNotification : Notification |
| | 7 | | { |
| | 8 | | // Filling this with the URL will automatically make the button visible |
| | 9 | | private const string MORE_INFO_URL = "https://docs.decentraland.org/decentraland/hardware-acceleration/"; |
| | 10 | | private const string DONT_SHOW_GRAPHIC_CARD_POPUP_KEY = "DONT_SHOW_GRAPHIC_CARD_POPUP"; |
| | 11 | | [SerializeField] private Button moreInfoButton; |
| | 12 | | [SerializeField] private Toggle dontShowAgain; |
| | 13 | |
|
| | 14 | | private void Awake() |
| | 15 | | { |
| 0 | 16 | | moreInfoButton.gameObject.SetActive(!string.IsNullOrEmpty(MORE_INFO_URL)); |
| 0 | 17 | | moreInfoButton.onClick.AddListener(OpenMoreInfoUrl); |
| 0 | 18 | | } |
| | 19 | |
|
| | 20 | | private void OpenMoreInfoUrl() |
| | 21 | | { |
| 0 | 22 | | WebInterface.OpenURL(MORE_INFO_URL); |
| 0 | 23 | | Dismiss(); |
| 0 | 24 | | } |
| | 25 | |
|
| | 26 | | protected override void Dismiss() |
| | 27 | | { |
| 0 | 28 | | PlayerPrefsUtils.SetInt(DONT_SHOW_GRAPHIC_CARD_POPUP_KEY, dontShowAgain.isOn ? 1 : 0); |
| 0 | 29 | | base.Dismiss(); |
| 0 | 30 | | } |
| | 31 | |
|
| 1 | 32 | | public static bool CanShowGraphicCardPopup() => PlayerPrefs.GetInt(DONT_SHOW_GRAPHIC_CARD_POPUP_KEY, 0) == 0; |
| | 33 | | } |