| | 1 | | public class GraphicCardWarningHUDController : IHUD |
| | 2 | | { |
| | 3 | | private const string GRAPHIC_CARD_MESSAGE = "Your machine is not using a dedicated graphics card to run Decentraland |
| | 4 | |
|
| 0 | 5 | | public GraphicCardWarningHUDController() { } |
| | 6 | |
|
| | 7 | | public void SetVisibility(bool visible) |
| | 8 | | { |
| 1 | 9 | | CommonScriptableObjects.tutorialActive.OnChange -= TutorialActiveChanged; |
| 1 | 10 | | CommonScriptableObjects.rendererState.OnChange -= RendererStateChanged; |
| | 11 | |
|
| 1 | 12 | | if (!visible) |
| 0 | 13 | | return; |
| | 14 | |
|
| 1 | 15 | | if (!CommonScriptableObjects.tutorialActive.Get() && CommonScriptableObjects.rendererState) |
| | 16 | | { |
| 1 | 17 | | TryShowNotification(); |
| 1 | 18 | | } |
| | 19 | | else |
| | 20 | | { |
| 0 | 21 | | if (CommonScriptableObjects.tutorialActive) |
| 0 | 22 | | CommonScriptableObjects.tutorialActive.OnChange += TutorialActiveChanged; |
| | 23 | | else |
| 0 | 24 | | CommonScriptableObjects.rendererState.OnChange += RendererStateChanged; |
| | 25 | |
|
| | 26 | | } |
| | 27 | |
|
| 0 | 28 | | } |
| | 29 | |
|
| | 30 | | private void TutorialActiveChanged(bool newState, bool oldState) |
| | 31 | | { |
| 0 | 32 | | if (newState) |
| 0 | 33 | | return; |
| | 34 | |
|
| 0 | 35 | | CommonScriptableObjects.tutorialActive.OnChange -= TutorialActiveChanged; |
| 0 | 36 | | TryShowNotification(); |
| 0 | 37 | | } |
| | 38 | |
|
| | 39 | | private void RendererStateChanged(bool newState, bool oldState) |
| | 40 | | { |
| 0 | 41 | | if (!newState) |
| 0 | 42 | | return; |
| | 43 | |
|
| 0 | 44 | | CommonScriptableObjects.rendererState.OnChange -= RendererStateChanged; |
| 0 | 45 | | TryShowNotification(); |
| 0 | 46 | | } |
| | 47 | |
|
| | 48 | | private void TryShowNotification() |
| | 49 | | { |
| 1 | 50 | | if (GraphicCardNotification.CanShowGraphicCardPopup() && IsIntegratedGraphicCard()) |
| | 51 | | { |
| 0 | 52 | | NotificationsController.i.ShowNotification(new DCL.NotificationModel.Model |
| | 53 | | { |
| | 54 | | buttonMessage = "Dismiss", |
| | 55 | | destroyOnFinish = true, |
| | 56 | | groupID = "GraphicCard", |
| | 57 | | message = GRAPHIC_CARD_MESSAGE, |
| | 58 | | timer = 0, |
| | 59 | | type = DCL.NotificationModel.Type.GRAPHIC_CARD_WARNING |
| | 60 | | }); |
| | 61 | | } |
| 1 | 62 | | } |
| | 63 | |
|
| 1 | 64 | | private bool IsIntegratedGraphicCard() => DCL.Interface.WebInterface.GetGraphicCard().ToLower().Contains("intel"); |
| | 65 | |
|
| 1 | 66 | | public void Dispose() { } |
| | 67 | | } |