예제 #1
0
 void intializeRanks()
 {
     for (int i = 0; i < scoresUI.Length; i++)
     {
         scoreProfiles[i] = new ScoreProfile(scoresUI[i].nameText.text, scoresUI[i].getTime());
     }
 }
예제 #2
0
    //Takes a new score profile and inserts it at rank, shuffling all the highscore under it down 1
    void insertNewRank(ScoreProfile newHighScore, int rank)
    {
        for (int i = scoreProfiles.Length - 1; i > rank; i--)
        {
            scoreProfiles[i] = scoreProfiles[i - 1];
        }

        scoreProfiles[rank] = newHighScore;
    }
예제 #3
0
    public IEnumerator setupHighScorePanel(float time)
    {
        int rank = checkIfHighScore(time);

        if (rank != -1)
        {
            inputPanel.gameObject.SetActive(true);

            yield return(new WaitUntil(() => inputPanel.isFinishedInput()));

            //Get the name of the profile and then remove the input panel
            string name = inputPanel.inputField.text;
            inputPanel.disable();

            ScoreProfile newProfile = new ScoreProfile(name, time);
            insertNewRank(newProfile, rank);

            //Save the new highscore table
            GameData.saveData <ScoreProfile>(scoreProfiles);

            updateUI();
        }
    }