Ejemplo n.º 1
0
    /// <summary>
    /// Shows the calculated values, the total score and the rank.
    /// </summary>
    /// <returns></returns>
    private IEnumerator StartAnimationPhase03()
    {
        ScoreContainer    score = DataCollector.instance.getScoreContainer();
        Queue <ScoreData> animationWorkQueue = new Queue <ScoreData>();
        string            onlineRankString;

        if (BaseSteamManager.Instance.GetRank() == 0)
        {
            onlineRankString = "";
        }
        else
        {
            onlineRankString = string.Format(rankString, BaseSteamManager.Instance.GetRank());
        }

        RegisterAnimationQueue(animationWorkQueue, score);

        confetti.Play();

        // Set each score values to the calculated score
        foreach (var highscoreEntry in highscoreEntries)
        {
            ScoreData currentScore = animationWorkQueue.Dequeue();
            highscoreEntry.Value.scoreText.text = string.Format("{0:0,0}", currentScore.scoreValue);
            DoScaleTween(highscoreEntry.Value.scoreText.rectTransform, scaleTime, upScale);
            countFinishedSound.Play();
            yield return(waitForNextLine);
        }

        // Set score
        StringBuilder timeString = null;

        scoreSound.Play();
        if (score.getGameMode() == GameMode.NormalMode)
        {
            scoreText.text = CreateHighscoreString((int)score.getWave(), score.getScoreSum(), "");
        }
        else
        {
            TimeUtil time = TimeUtil.MillisToTime(score.getYoloScore());
            timeString = new StringBuilder(string.Format("{0:00}", time.Minute))
                         .Append(":")
                         .Append(string.Format("{0:00}", time.Second))
                         .Append(":")
                         .Append(string.Format("{0:000}", time.Milliseconds));
            scoreText.text = CreateHighscoreString(timeString.ToString(), score.getScoreSum(), "");
        }

        DoScaleTween(scoreText.rectTransform, scaleTime, scoreTextUpScale);
        yield return(new WaitForSeconds(totalScoreTime));

        endOfAnimationReached = true;

        // Set online rank
        scoreSound.Play();
        if (score.getGameMode() == GameMode.NormalMode)
        {
            scoreText.text = CreateHighscoreString((int)score.getWave(), score.getScoreSum(), onlineRankString);
        }
        else
        {
            scoreText.text = CreateHighscoreString(timeString.ToString(), score.getScoreSum(), onlineRankString);
        }

        DoScaleTween(scoreText.rectTransform, scaleTime, scoreTextUpScale);
    }