예제 #1
0
        public IEnumerator NotificationHud_ShowNotification()
        {
            var controller = new NotificationHUDController();

            Notification.Model model = new Notification.Model()
            {
                type    = NotificationFactory.Type.GENERIC,
                message = "text",
                timer   = -1,
                scene   = ""
            };

            controller.ShowNotification(model);

            yield return(null);

            Notification[] notifications = GameObject.FindObjectsOfType <Notification>();
            Assert.AreEqual(notifications.Length, 1);

            Notification n = notifications[0];

            Assert.AreEqual(n.model.type, model.type);
            Assert.AreEqual(n.model.message, model.message);
            Assert.AreEqual(n.model.timer, model.timer);
            Assert.AreEqual(n.model.scene, model.scene);
        }
예제 #2
0
    public void TryStartEnterEditMode(bool activateCamera)
    {
        if (sceneToEditId != null)
        {
            return;
        }

        FindSceneToEdit();

        if (!UserHasPermissionOnParcelScene(sceneToEdit))
        {
            Notification.Model notificationModel = new Notification.Model();
            notificationModel.message = "You don't have permissions to operate this land";
            notificationModel.type    = NotificationFactory.Type.GENERIC;
            HUDController.i.notificationHud.ShowNotification(notificationModel);
            return;
        }

        initialLoadingController.Show();

        //Note (Adrian) this should handle different when we have the full flow of the feature
        if (activateCamera)
        {
            editorMode.ActivateCamera(sceneToEdit);
        }

        if (catalogAdded)
        {
            StartEditMode();
        }
    }
    public void ShowWelcomeNotification()
    {
        if (disableWelcomeNotification)
        {
            return;
        }

        //TODO(Brian): This should be triggered entirely by kernel
        string     notificationText = $"Welcome, {UserProfile.GetOwnUserProfile().userName}!";
        Vector2Int currentCoords    = CommonScriptableObjects.playerCoords.Get();
        string     parcelName       = MinimapMetadata.GetMetadata().GetSceneInfo(currentCoords.x, currentCoords.y)?.name;

        if (!string.IsNullOrEmpty(parcelName))
        {
            notificationText += $" You are in {parcelName} {currentCoords.x}, {currentCoords.y}";
        }

        Notification.Model model = new Notification.Model()
        {
            message = notificationText,
            scene   = "",
            type    = NotificationFactory.Type.GENERIC_WITHOUT_BUTTON,
            timer   = NOTIFICATION_DURATION
        };

        controller.ShowNotification(model);
    }
예제 #4
0
        public IEnumerator NotificationHud_ShowSeveralNotifications()
        {
            var controller = new NotificationHUDController();

            Notification.Model model = new Notification.Model()
            {
                type    = NotificationFactory.Type.GENERIC,
                message = "text",
                timer   = -1,
                scene   = ""
            };

            controller.ShowNotification(model);

            Notification.Model model2 = new Notification.Model()
            {
                type    = NotificationFactory.Type.SCRIPTING_ERROR,
                message = "text",
                timer   = -1,
                scene   = ""
            };

            controller.ShowNotification(model2);

            yield return(null);

            Notification[] notifications = GameObject.FindObjectsOfType <Notification>();
            Assert.AreEqual(2, notifications.Length);
        }
예제 #5
0
        public IEnumerator NotificationHud_ShowTimedNotification()
        {
            var controller = new NotificationHUDController();

            Notification.Model model = new Notification.Model()
            {
                type    = NotificationFactory.Type.GENERIC,
                message = "text",
                timer   = 3,
                scene   = ""
            };

            controller.ShowNotification(model);
            yield return(null);

            Notification[] notifications = GameObject.FindObjectsOfType <Notification>();
            Assert.AreEqual(notifications.Length, 1);
            Assert.AreEqual(controller.model.notifications.Count, 1);

            yield return(new WaitForSeconds(4));

            notifications = GameObject.FindObjectsOfType <Notification>();
            Assert.AreEqual(notifications.Length, 0);
            Assert.AreEqual(controller.model.notifications.Count, 0);
        }
    public void TryStartEnterEditMode(bool activateCamera)
    {
        if (sceneToEditId != null)
        {
            return;
        }

        FindSceneToEdit();

        if (!UserHasPermissionOnParcelScene(sceneToEdit))
        {
            Notification.Model notificationModel = new Notification.Model();
            notificationModel.message = "You don't have permissions to operate this land";
            notificationModel.type    = NotificationFactory.Type.GENERIC;
            HUDController.i.notificationHud.ShowNotification(notificationModel);
            return;
        }

        if (activateCamera)
        {
            editorMode.ActivateCamera(sceneToEdit);
        }

        if (catalogAdded)
        {
            StartEnterEditMode();
        }
    }
 private static void ShowGenericNotification(string message)
 {
     Notification.Model notificationModel = new Notification.Model();
     notificationModel.message = message;
     notificationModel.type    = NotificationFactory.Type.GENERIC;
     notificationModel.timer   = BIWSettings.LAND_NOTIFICATIONS_TIMER;
     HUDController.i.notificationHud.ShowNotification(notificationModel);
 }
예제 #8
0
    public void Show(Notification.Model model)
    {
        gameObject.SetActive(true);

        if (showHideAnimator == null)
        {
            showHideAnimator = GetComponent <ShowHideAnimator>();
        }

        if (showHideAnimator != null)
        {
            showHideAnimator.OnWillFinishHide -= DismissInternal;
            showHideAnimator.Show();
        }

        this.model = model;

        Debug.Log("Notification Initialize... destroy on finish: " + model.destroyOnFinish);

        if (!string.IsNullOrEmpty(this.model.message))
        {
            messageLabel.text = this.model.message;
        }

        if (!string.IsNullOrEmpty(this.model.buttonMessage))
        {
            actionButtonLabel.text = this.model.buttonMessage;
        }

        if (this.model.timer > 0)
        {
            StopTimer();
            timerCoroutine = CoroutineStarter.Start(TimerCoroutine(this.model.timer));
        }

        if (!string.IsNullOrEmpty(this.model.scene))
        {
            string sceneID = CommonScriptableObjects.sceneID ?? string.Empty;
            CurrentSceneUpdated(sceneID, string.Empty);
        }

        if (actionButton != null)
        {
            if (this.model.callback != null)
            {
                actionButton.onClick.AddListener(this.model.callback.Invoke);
            }

            if (!string.IsNullOrEmpty(this.model.externalCallbackID))
            {
                actionButton.onClick.AddListener(() =>
                {
                    // TODO: send message to kernel with callbackID
                });
            }
        }
    }
예제 #9
0
    public void ShowNotification(Notification.Model notification)
    {
        if (!allowNotifications)
        {
            return;
        }

        controller?.ShowNotification(notification);
    }
예제 #10
0
    public void ShowNotificationFromJson(string notificationJson)
    {
        if (!allowNotifications)
        {
            return;
        }

        Notification.Model model = JsonUtility.FromJson <Notification.Model>(notificationJson);
        ShowNotification(model);
    }
    public Notification ShowNotification(Notification.Model notificationModel)
    {
        if (notificationModel == null)
        {
            return(null);
        }

        Notification notification = notificationFactory.CreateNotificationFromType(notificationModel.type, notificationPanel);

        notificationModel.destroyOnFinish = true;
        ShowNotification(notification, notificationModel);
        return(notification);
    }
예제 #12
0
    public void ShowNotification(Notification.Model model)
    {
        if (!string.IsNullOrEmpty(model.groupID))
        {
            //NOTE(Brian): If more notifications of the same group are visible, hide them.
            //             This works when having notifications in different contexts (i.e. FriendsHUD vs global notifications)
            DismissAllNotifications(model.groupID);
        }

        var notification = view.ShowNotification(model);

        this.model.notifications.Add(notification);
    }
    public void ShowNotification(Notification notification, Notification.Model model = null)
    {
        if (notification == null)
        {
            return;
        }

        notification.OnNotificationDismissed += OnNotificationDismissed;

        if (model != null)
        {
            notification.Show(model);
        }
    }
예제 #14
0
        public IEnumerator NotificationHud_ShowTimedNotification()
        {
            Notification.Model model = new Notification.Model()
            {
                type    = NotificationFactory.Type.GENERIC,
                message = "text",
                timer   = 0.25f,
                scene   = ""
            };

            controller.ShowNotification(model);
            yield return(null);

            Notification[] notifications = GameObject.FindObjectsOfType <Notification>();
            Assert.AreEqual(notifications.Length, 1);
            Assert.AreEqual(controller.model.notifications.Count, 1);

            yield return(new DCL.WaitUntil(() => notifications.Length == 0, 0.5f));

            notifications = GameObject.FindObjectsOfType <Notification>();
            Assert.AreEqual(notifications.Length, 0);
            Assert.AreEqual(controller.model.notifications.Count, 0);
        }
예제 #15
0
    public void TryStartEnterEditMode(bool activateCamera)
    {
        if (sceneToEditId != null)
        {
            return;
        }

        FindSceneToEdit();

        if (!UserHasPermissionOnParcelScene(sceneToEdit))
        {
            Notification.Model notificationModel = new Notification.Model();
            notificationModel.message = "You don't have permissions to operate this land";
            notificationModel.type    = NotificationFactory.Type.GENERIC;
            HUDController.i.notificationHud.ShowNotification(notificationModel);
            return;
        }

        previousAllUIHidden = CommonScriptableObjects.allUIHidden.Get();
        NotificationsController.i.allowNotifications = false;
        CommonScriptableObjects.allUIHidden.Set(true);
        NotificationsController.i.allowNotifications = true;
        inputController.inputTypeMode = InputTypeMode.BUILD_MODE_LOADING;
        initialLoadingController.Show();
        initialLoadingController.SetPercentage(0f);

        //Note (Adrian) this should handle different when we have the full flow of the feature
        if (activateCamera)
        {
            editorMode.ActivateCamera(sceneToEdit);
        }

        if (catalogAdded)
        {
            StartEditMode();
        }
    }
 public void ShowNotification(Notification.Model notification)
 {
     controller?.ShowNotification(notification);
 }
 public void ShowNotificationFromJson(string notificationJson)
 {
     Notification.Model model = JsonUtility.FromJson <Notification.Model>(notificationJson);
     ShowNotification(model);
 }