Beispiel #1
0
 public void QueueNotification(GameNotificationItem notification)
 {
     notificationQueue.Enqueue(notification);
     LogUtil.Log("Notification Queue(" + notificationQueue.Count + ") Notification Added :" + notification.title);
     ProcessNotifications();
     GameAudio.PlayEffect(GameAudioEffects.audio_effect_ui_button_1);
 }
Beispiel #2
0
    public bool SetAchievementContent(string achievementCode)
    {
        GameAchievement achievementMeta = GameAchievements.Instance.GetById(achievementCode);

        if (achievementMeta == null)
        {
            string tempCode = achievementCode.Replace("_" + GamePacks.Current.code, "");
            achievementMeta = GameAchievements.Instance.GetById(tempCode);
        }

        if (achievementMeta != null)
        {
            GameNotificationItem item = new GameNotificationItem();
            item.title            = achievementMeta.display_name;
            item.description      = FormatUtil.GetStringTrimmedWithBreaks(achievementMeta.description, 40);
            item.score            = "+" + achievementMeta.data.points.ToString();
            item.notificationType = GameNotificationType.Achievement;
            QueueNotification(item);

            return(true);
        }
        else
        {
            LogUtil.Log("SetAchievmentContent:: null achievementMeta: " + achievementCode);
            return(false);
        }
    }
Beispiel #3
0
    public void ProcessNextNotification()
    {
        if (Paused)
        {
            return;
        }

        if (notificationQueue.Count > 0)
        {
            GameNotificationItem notificationItem = notificationQueue.Dequeue();

            UIUtil.SetLabelValue(labelDisplayName, notificationItem.title);
            UIUtil.SetLabelValue(labelDescription, notificationItem.description);
            UIUtil.SetLabelValue(labelScore, notificationItem.score);

            if (notificationItem.notificationType == GameNotificationType.Achievement)
            {
                UIUtil.SetLabelValue(labelTitle, "ACHIEVEMENT");
                UIUtil.ShowLabel(labelScore);
                if (iconObject != null)
                {
                    iconObject.Show();
                }
            }
            else if (notificationItem.notificationType == GameNotificationType.Info)
            {
                UIUtil.SetLabelValue(labelTitle, "INFORMATION");
                UIUtil.HideLabel(labelScore);
                if (iconObject != null)
                {
                    iconObject.Hide();
                }
            }
            else if (notificationItem.notificationType == GameNotificationType.Tip)
            {
                UIUtil.SetLabelValue(labelTitle, "TIP");
                UIUtil.HideLabel(labelScore);
                if (iconObject != null)
                {
                    iconObject.Hide();
                }
            }
            else if (notificationItem.notificationType == GameNotificationType.Error)
            {
                UIUtil.SetLabelValue(labelTitle, "ERROR");
                UIUtil.HideLabel(labelScore);
                if (iconObject != null)
                {
                    iconObject.Hide();
                }
            }

            LogUtil.Log("Notification Queue(" + notificationQueue.Count + ") Notification Removed :" + notificationItem.title);

            ShowDialog();
        }
    }
Beispiel #4
0
    public void QueueNotification(string title, string description, GameNotificationType notificationType)
    {
        GameNotificationItem notification = new GameNotificationItem();

        notification.title            = title;
        notification.description      = description;
        notification.notificationType = notificationType;
        UIGameNotification.Instance.QueueNotification(notification);
    }