Ejemplo n.º 1
0
    public void Init(int points)
    {
        this.points     = points;
        _pointText.text = points + "dmg";

        // show 10 highscores.
        var highscores = HighscoreManager.GetHighscores();

        if (highscores != null)
        {
            for (int i = 0; i < highscores.Count; i++)
            {
                var highscore = highscores[i];
                _highScoreText.text += string.Format("#{0}: {1} \t - {2}dmg\n",
                                                     i + 1, highscore.Name, highscore.Points);
            }
        }

        // get rank, if its lower than 11, show the form!
        int rank = HighscoreManager.GetHighscoreRank(new Highscore(null, points), false);

        if (rank < 11)
        {
            _submitForm.SetActive(true);
            _headerText.text = "You're in!";
        }
        else
        {
            _submitForm.SetActive(false);
            _headerText.text = "Maybe another time!";
        }
    }
Ejemplo n.º 2
0
    private IEnumerator GetAddShowScore(int score)
    {
        yield return(HighscoreManager.AddHighscore(playerName, score));

        yield return(HighscoreManager.GetHighscores());

        for (int i = 0; i < HighscoreManager.highscores.Count; i++)
        {
            highScoreText.text += HighscoreManager.highscores[i].name + ": " + HighscoreManager.highscores[i].score + "\n";
        }
    }
Ejemplo n.º 3
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        StartCoroutine(HighscoreManager.GetHighscores());
    }