Ejemplo n.º 1
0
        private void EnsureBuildNotificationDisplayExists(Position position, ContentPresenter presenter)
        {
            if (presenter.Content != null)
            {
                return;
            }

            var display = new NotificationDisplay();

            if (Settings?.Style is Style displayStyle)
            {
                display.Style = displayStyle;
            }

            display.Position = position;
            if (!ItemsByPosition.TryGetValue(position, out var c))
            {
                c = new ObservableCollection <object>();
                if (!ItemsByPosition.TryAdd(position, c))
                {
                    c = ItemsByPosition[position];
                }

                c.CollectionChanged += (sender, args) => display.Visibility = c.Count > 0 ? Visibility.Visible : Visibility.Collapsed;
                display.ItemsSource  = c;
            }

            presenter.Content = display;
        }
Ejemplo n.º 2
0
    private void Start()
    {
        meow_delay        = Random.Range(8, 26);
        entering_new_room = true;

        audio_controller     = GetComponent <AudioController>();
        sprite_renderer      = GetComponentInChildren <SpriteRenderer>();
        notification_display = GetComponentInChildren <NotificationDisplay>();
        notification_display.gameObject.SetActive(false);

        animator_component = GetComponentInChildren <Animator>();

        animator = Resources.Load <RuntimeAnimatorController>(
            $"Animations/Cats/{this.name}/{this.name + "CatAnimator"}");
        animator_component.runtimeAnimatorController = animator;

        animations.Add("Walking", $"{this.name + "WalkAnimation"}");
        animations.Add("Eating", $"{this.name + "EatAnimation"}");
        animations.Add("Standing", $"{this.name + "IdleAnimation"}");
        animations.Add("Sleeping", $"{this.name + "RelaxAnimation"}");

        state = new CatWalking(animator, animations["Walking"]);

        waypoint = GetRandomWaypoint(false);

        if (model.cats.Contains(this) == false)
        {
            model.cats.Add(this);
        }
    }
Ejemplo n.º 3
0
        /// <summary>
        /// Tries to show the next alert.
        /// Adds alerts to a queue if showing failed.
        /// </summary>
        public void TryShowNextAlert()
        {
            AlertItem result = GetNextAlert();

            if (result == null)
            {
                return;
            }
            if (NotificationDisplay.TryShowNextAlert(result))
            {
                // Showing was successful, remove it from the queue
                alerts.TryDequeue(out result);
            }
        }
Ejemplo n.º 4
0
    private void FindDisplays()
    {
        Display[] displays = FindObjectsOfType <Display>();

        Debug.Log("HighScore found " + displays.Length + " Displays");

        foreach (Display display in displays)
        {
            switch (display.Name.ToLower())
            {
            case "highscore":
                Debug.Log("HS: Display: highscore");
                highScoreDisplay = display;
                break;

            case "highscorenotification":
                Debug.Log("HS: NotificationDisplay: highscore notification");
                highScoreNotificationDisplay = (NotificationDisplay)display;
                break;
            }
        }
    }
Ejemplo n.º 5
0
    private void AddNotification(Notification notification)
    {
        NotificationDisplay go = Instantiate(notificationObject, notificationParent);

        go.Init(notification);
    }