Пример #1
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);
        }
Пример #2
0
    public void ShowNotification(Notification.Model notification)
    {
        if (!allowNotifications)
        {
            return;
        }

        controller?.ShowNotification(notification);
    }
    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_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);
        }
Пример #5
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);
        }
 public void ShowNotification(Notification.Model notification)
 {
     controller?.ShowNotification(notification);
 }