Example #1
0
    /// <summary>
    /// When the corresponding button is clicked, post a new score on the given leaderboard for the current logged in gamer.
    /// </summary>
    public void Button_PostScore()
    {
        // Default hardcoded values to use if no InputField elements references are assigned
        string boardName        = "TestBoard";
        long   scoreValue       = 42L;
        string scoreDescription = "This is a test score";
        bool   forceSave        = false;

        // Check the boardName value
        if (postScore_BoardName == null)
        {
            Debug.LogWarning(string.Format(noReferenceFormat, "Leaderboard", "postScore_BoardName"));
        }
        else if (!string.IsNullOrEmpty(postScore_BoardName.text))
        {
            boardName = postScore_BoardName.text;
        }

        // Check the scoreValue value
        if (postScore_ScoreValue == null)
        {
            Debug.LogWarning(string.Format(noReferenceFormat, "Leaderboard", "postScore_ScoreValue"));
        }
        else if (!string.IsNullOrEmpty(postScore_ScoreValue.text))
        {
            scoreValue = long.Parse(postScore_ScoreValue.text);
        }

        // Check the scoreDescription value
        if (postScore_ScoreDescription == null)
        {
            Debug.LogWarning(string.Format(noReferenceFormat, "Leaderboard", "postScore_ScoreDescription"));
        }
        else
        {
            scoreDescription = postScore_ScoreDescription.text;
        }

        // Check the forceSave value
        if (postScore_ForceSave == null)
        {
            Debug.LogWarning(string.Format(noReferenceFormat, "Leaderboard", "postScore_ForceSave"));
        }
        else
        {
            forceSave = postScore_ForceSave.isOn;
        }

        // Call the template method
        LeaderboardFeatures.Handling_PostScore(boardName, scoreValue, scoreDescription, forceSave);
    }
Example #2
0
    /// <summary>
    /// When the corresponding button is clicked, get and display all current logged in gamer's friends' high scores from the given leaderboard.
    /// </summary>
    public void Button_DisplayFriendsHighScores()
    {
        // Default hardcoded values to use if no InputField elements references are assigned
        string boardName = "TestBoard";

        // Check the boardName value
        if (displayFriendsHighScores_BoardName == null)
        {
            Debug.LogWarning(string.Format(noReferenceFormat, "Leaderboard", "displayFriendsHighScores_BoardName"));
        }
        else if (!string.IsNullOrEmpty(displayFriendsHighScores_BoardName.text))
        {
            boardName = displayFriendsHighScores_BoardName.text;
        }

        // Call the template method
        LeaderboardFeatures.Handling_DisplayFriendsHighScores(boardName);
    }
Example #3
0
    public void Button_DisplayAllHighScores(string boarding)
    {
        // Default hardcoded values to use if no InputField elements references are assigned
        string boardName     = boarding;
        int    scoresPerPage = 10;
        bool   centeredBoard = false;

        // Check the boardName value
        if (displayAllHighScores_BoardName == null)
        {
            Debug.LogWarning(string.Format(noReferenceFormat, "Leaderboard", "displayAllHighScores_BoardName"));
        }
        else if (!string.IsNullOrEmpty(displayAllHighScores_BoardName.text))
        {
            boardName = displayAllHighScores_BoardName.text;
        }

        // Check the scoresPerPage value
        if (displayAllHighScores_ScoresPerPage == null)
        {
            Debug.LogWarning(string.Format(noReferenceFormat, "Leaderboard", "displayAllHighScores_ScoresPerPage"));
        }
        else if (!string.IsNullOrEmpty(displayAllHighScores_ScoresPerPage.text))
        {
            scoresPerPage = int.Parse(displayAllHighScores_ScoresPerPage.text);
        }

        // Check the centeredBoard value
        if (displayAllHighScores_CenteredBoard == null)
        {
            Debug.LogWarning(string.Format(noReferenceFormat, "Leaderboard", "displayAllHighScores_CenteredBoard"));
        }
        else
        {
            centeredBoard = displayAllHighScores_CenteredBoard.isOn;
        }

        // Call the template method
        LeaderboardFeatures.Handling_DisplayAllHighScores(boardName, scoresPerPage, centeredBoard);
    }
Example #4
0
 /// <summary>
 /// When the corresponding button is clicked, get and display the current logged in gamer's best scores from all leaderboards in which he scored at least once.
 /// </summary>
 public void Button_DisplayGamerHighScores()
 {
     // Call the template method
     LeaderboardFeatures.Handling_DisplayGamerHighScores();
 }