示例#1
0
    //Reads the ranking to get the info.
    void readRanking()
    {
        //Path the our text file.
        string path = "./Dance Kingdom_Data/Resources/ranking.txt";

        //Reader to read from our text file.
        StreamReader reader = new StreamReader(path, true);

        //Counter to iterate on the lines.
        int counter = 0;

        //Level to iterate on game levels.
        int lvl = -1;

        //AuxArray to iterate on the array.
        int auxArray = 0;

        //We read options from the text file.
        while (!reader.EndOfStream)
        {
            string[] line = reader.ReadLine().Split(':');
            if (line[0].Equals("-"))
            {
                lvl++;
            }
            else
            {
                switch (lvl)
                {
                case 0:
                    auxArray = (counter - 1);
                    break;

                case 1:
                    auxArray = (counter - 12);
                    break;

                case 2:
                    auxArray = (counter - 23);
                    break;
                }

                rankings[lvl, auxArray]               = new RankingScores();
                rankings[lvl, auxArray].initials      = line[1];
                rankings[lvl, auxArray].timeToWin     = int.Parse(line[2]);
                rankings[lvl, auxArray].generatedGold = int.Parse(line[3]);
                rankings[lvl, auxArray].cc            = bool.Parse(line[4]);
            }

            counter++;
        }
        reader.Close();
    }
 private void OnGetScoresFromLeaderboardSuccess(RankingScores rankingScores)
 {
     Debug.Log("HMS Games: GetScoresFromLeaderboard SUCCESS ");
 }