示例#1
0
        /// <summary>
        ///     Get local player general high score from player preferences.
        ///     The general high score refers to the highest score achieved in all of the available games.
        /// </summary>
        public void GetPlayerGeneralHighScore()
        {
            if (!PlayerStatisticsUtil.IsReturningUser(PlayerStatisticsUtil.PlayerGeneralHighScoreKey))
            {
                GeneralHighScoreText.text = PlayerStatisticsUtil.FirstTimeUserMessage;
                return;
            }
            var highScore = PlayerStatisticsUtil.GeTotaltHighScoreFromPlayerPreferences();

            GeneralHighScoreText.text = highScore.ToString(CultureInfo.InvariantCulture);
        }
示例#2
0
        /// <summary>
        ///     Get local player high score and played time from player preferences for an individual game.
        ///     Set the score text to the saved high scored in PlayerPrefs
        ///     Set the timer text to the saved played time in PlayerPrefs
        /// </summary>
        public void GetIndividualPlayerStatistics()
        {
            if (!PlayerStatisticsUtil.IsReturningUser(GameName))
            {
                _gameHighScoreText.text = PlayerStatisticsUtil.FirstTimeUserMessage;
                _timerText.text         = PlayerStatisticsUtil.FirstTimeUserMessage;
                return;
            }
            var highScore = PlayerStatisticsUtil.GetGameHighScoreFromPlayerPreferences(GameName);

            _gameHighScoreText.text = highScore.ToString();
            var playedTime = PlayerStatisticsUtil.GetPlayedTimeFromPlayerPreferences(GameName);

            _timerText.text = PlayerStatisticsUtil.PlayedTimeToFormatedTimeSpan(playedTime);
        }