Ejemplo n.º 1
0
    // Load replays from files.
    void LoadReplays()
    {
        scores = null;

        if (locality == Locality.Local)
        {
            recordings = HighScores.GetHighScores(oldLevel, scoreType);

            // Generate an array of names for the GUI stuff
            names = new string[recordings.Count];
            for (int i = 0; i < names.Length; ++i)
            {
                if (scoreType == HighScores.ScoreType.Speed)
                {
                    names[i] += recordings[i].playername + ": " + recordings[i].score.speed.ToString(".#") + "%";
                }
                else
                {
                    names[i] += recordings[i].playername + ": " + recordings[i].score.time.ToString(".#") + " seconds";
                }
            }
        }
        else
        {
            // We need to get scores from the interwebs.
            names = new string[] { "Retrieving scores..." };
            cache.GetScore(oldLevel.name, scoreType);
        }
    }
    // Use this for initialization
    void Start()
    {
        scores = HighScores.GetHighScores();

        if (scores[0] != null)
        {
            score1.text = scores[0].getScoredBy() + ": " + scores[0].getScore();
        }
        else
        {
            score1.text = "";
        }
        if (scores[1] != null)
        {
            score2.text = scores[1].getScoredBy() + ": " + scores[1].getScore();
        }
        else
        {
            score2.text = "";
        }
        if (scores[3] != null)
        {
            score3.text = scores[2].getScoredBy() + ": " + scores[2].getScore();
        }
        else
        {
            score3.text = "";
        }
        if (scores[3] != null)
        {
            score4.text = scores[3].getScoredBy() + ": " + scores[3].getScore();
        }
        else
        {
            score4.text = "";
        }
        if (scores[4] != null)
        {
            score5.text = scores[4].getScoredBy() + ": " + scores[4].getScore();
        }
        else
        {
            score5.text = "";
        }
    }
Ejemplo n.º 3
0
        private void LoadFormData()
        {
            this.lblPlayers.Text = "";
            this.lblPoints.Text  = "";

            try
            {
                HighScores highScores = new HighScores();
                List <HighScores.HighScoreItem> highScoresItems = highScores.GetHighScores();

                for (int i = 0; i < highScoresItems.Count; i++)
                {
                    this.lblPlayers.Text += highScoresItems[i].Name + "\n";
                    this.lblPoints.Text  += highScoresItems[i].Points.ToString().PadLeft(5, '0') + "\n";
                }
            }
            catch (Exception ex) { throw ex; }
        }
Ejemplo n.º 4
0
    public void LoadStats()
    {
        gamesPlayed.text = PlayerPrefs.GetInt("GamesPlayed").ToString();
        int i = 0;

        int[] highScores = HighScores.GetHighScores();
        foreach (var item in highScores)
        {
            Debug.Log(item);
        }
        foreach (var hsTb in highScoresTextBoxes)
        {
            if (i < highScores.Length)
            {
                hsTb.gameObject.SetActive(true);
                hsTb.text = (i + 1) + ". " + highScores[i].ToString();
            }
            else
            {
                hsTb.gameObject.SetActive(false);
            }
            i++;
        }
    }