Ejemplo n.º 1
0
    public void CreateScore()
    {
        string[,] scores = ScoreLogic.StringToList(PlayerPrefs.GetString("HighScore"));

        string[] tempUser = new string[2] {
            writtenName.text, currentScore.text
        };
        for (int i = 0; i < scores.GetLength(0); i++)
        {
            listedUser[0] = scores[i, 0];
            listedUser[1] = scores[i, 1];

            if (listedUser[1].Equals("") || Int16.Parse(tempUser[1]) > Int16.Parse(listedUser[1]))
            {
                scores[i, 0] = tempUser[0];
                scores[i, 1] = tempUser[1];

                tempUser[0] = listedUser[0];
                tempUser[1] = listedUser[1];
            }
        }

        PlayerPrefs.SetString("HighScore", ScoreLogic.ListToString(scores));
        StaticData.ResetScores();
        SceneManager.LoadScene("TheHub", LoadSceneMode.Single);
    }