コード例 #1
0
    public void QueueNotification(
        string title,
        string description,
        double score,
        UINotificationTipType notificationType,
        bool immediate)
    {
        UINotificationTipItem notification = new UINotificationTipItem();

        notification.title            = title;
        notification.description      = description;
        notification.notificationType = notificationType;
        notification.score            = score.ToString("N0");
        notification.immediate        = immediate;
        QueueNotification(notification);
    }
コード例 #2
0
    public void QueueNotification(UINotificationTipItem notificationItem)
    {
        notificationQueue.Enqueue(notificationItem);

        LogUtil.Log("Notification Queue("
                    + notificationQueue.Count + ") "
                    + "Notification Added:title:"
                    + notificationItem.title
                    + " notificationType:"
                    + notificationItem.notificationType

                    );

        if (notificationItem.immediate)
        {
            HideDialog();
        }

        ProcessNotifications();
    }
コード例 #3
0
    public void ProcessNextNotification()
    {
        if (!Paused)
        {
            if (notificationQueue.Count > 0)
            {
                UINotificationTipItem notificationItem = notificationQueue.Dequeue();
                bool found = false;


                if (notificationItem.notificationType == UINotificationTipType.Achievement)
                {
                    ShowNotificationContainerType(notificationItem.notificationType);
                    UIUtil.SetLabelValue(achievementTitle, notificationItem.title);
                    UIUtil.SetLabelValue(achievementDescription, notificationItem.description);
                    UIUtil.SetLabelValue(achievementScore, notificationItem.score);

                    found = true;
                }
                else if (notificationItem.notificationType == UINotificationTipType.Point)
                {
                    ShowNotificationContainerType(notificationItem.notificationType);
                    UIUtil.SetLabelValue(pointTitle, notificationItem.title);
                    UIUtil.SetLabelValue(pointDescription, notificationItem.description);
                    UIUtil.SetLabelValue(pointScore, notificationItem.score);

                    found = true;
                }
                else if (notificationItem.notificationType == UINotificationTipType.Info)
                {
                    ShowNotificationContainerType(notificationItem.notificationType);
                    UIUtil.SetLabelValue(infoTitle, notificationItem.title);
                    UIUtil.SetLabelValue(infoDescription, notificationItem.description);
                    UIUtil.SetLabelValue(infoScore, notificationItem.score);


                    found = true;
                }
                else if (notificationItem.notificationType == UINotificationTipType.Tip)
                {
                    ShowNotificationContainerType(notificationItem.notificationType);
                    UIUtil.SetLabelValue(tipTitle, notificationItem.title);
                    UIUtil.SetLabelValue(tipDescription, notificationItem.description);
                    UIUtil.SetLabelValue(tipScore, notificationItem.score);

                    found = true;
                }
                else if (notificationItem.notificationType == UINotificationTipType.Error)
                {
                    ShowNotificationContainerType(notificationItem.notificationType);
                    UIUtil.SetLabelValue(errorTitle, notificationItem.title);
                    UIUtil.SetLabelValue(errorDescription, notificationItem.description);
                    UIUtil.SetLabelValue(errorScore, notificationItem.score);

                    found = true;
                }

                if (found)
                {
                    LogUtil.Log("Notification Queue("
                                + notificationQueue.Count + ") "
                                + "Notification Removed:title:"
                                + notificationItem.title
                                + " notificationType:"
                                + notificationItem.notificationType

                                );

                    ShowDialog();
                }

                currentItem = notificationItem;
            }
        }
    }
コード例 #4
0
    public void QueueAchievement(string achievementCode)
    {
        string packCode          = GamePacks.Current.code;
        string app_state         = AppStates.Current.code;
        string app_content_state = AppContentStates.Current.code;

        LogUtil.Log("QueueAchievement:",
                    " achievementCode:" + achievementCode
                    + " packCode:" + packCode
                    + " app_state:" + app_state
                    + " app_content_state:" + app_content_state
                    );

        string achievementBaseCode = achievementCode;

        achievementBaseCode = achievementBaseCode.Replace("-" + app_state, "");
        achievementBaseCode = achievementBaseCode.Replace("_" + GameAchievementCodes.formatAchievementCode(app_state), "");
        achievementBaseCode = achievementBaseCode.Replace("-" + app_content_state, "");
        achievementBaseCode = achievementBaseCode.Replace("_" + GameAchievementCodes.formatAchievementCode(app_content_state), "");
        achievementBaseCode = achievementBaseCode.Replace("-" + packCode, "");
        achievementBaseCode = achievementBaseCode.Replace("_" + GameAchievementCodes.formatAchievementCode(packCode), "");

        LogUtil.Log("QueueAchievement2:",
                    " achievementCode:" + achievementCode
                    + " achievementBaseCode:" + achievementBaseCode
                    );

        GameAchievement achievement
            = GameAchievements.Instance.GetByCodeAndPack(
                  achievementBaseCode,
                  packCode,
                  app_content_state
                  );


        if (achievement != null)
        {
            //achievement.description = GameAchievements.Instance.FormatAchievementTags(
            //  app_state,
            //  app_content_state,
            //  achievement.description);
            //LogUtil.Log("Queueing Achievement display:" + achievement.display_name);
        }
        else
        {
            LogUtil.Log("Achievement not found:" + achievementCode);
        }

        if (achievement != null)
        {
            UINotificationTipItem item = new UINotificationTipItem();
            item.code             = achievement.code;
            item.description      = achievement.description;
            item.icon             = "";
            item.notificationType = UINotificationTipType.Achievement;
            item.score            = achievement.data.points.ToString();
            item.title            = achievement.display_name;
            QueueNotification(item);
        }

        if (achievementCode == "achieve_test1")
        {
            UINotificationTipItem item = new UINotificationTipItem();
            item.code             = achievementCode;
            item.description      = "This is an achievement test, you did awesome!";
            item.icon             = "";
            item.notificationType = UINotificationTipType.Achievement;
            item.score            = 3.ToString();
            item.title            = "First Achievement Tested";
            QueueNotification(item);
        }
    }