コード例 #1
0
    private void InitializeHighscoresTable()
    {
        noHighscoresTextGameObjects.SetActive(false);
        foreach (GameObject scoreLine in highscoresTextGameObjects)
        {
            scoreLine.SetActive(false);
        }
        highscoresList = HighscoreSystem.LoadHighscoresList();
        if (highscoresList == null || highscoresList.GetCount() == 0)
        {
            noHighscoresTextGameObjects.SetActive(true);
            return;
        }
        int highscoresCount = highscoresList.GetCount() <= highscoresTextGameObjects.Length
            ? highscoresList.GetCount()
            : highscoresTextGameObjects.Length;
        List <HighscoreData> highscores = highscoresList.GetHighscoreDataList();

        for (int i = 0; i < highscoresCount; i++)
        {
            Text highscoreText = highscoresTextGameObjects[i].GetComponent <Text>();
            highscoreText.text = "" + (i + 1).ToString() + ")\t\t\t" + highscores[i].score + "\t\t\t" +
                                 highscores[i].date;
            highscoresTextGameObjects[i].SetActive(true);
        }
    }
コード例 #2
0
    private void PrintHighscores()
    {
        HighscoresList hsl = HighscoreSystem.LoadHighscoresList();

        if (hsl == null)
        {
            print("hsl = null");
            return;
        }
        List <HighscoreData> highscores = hsl.GetHighscoreDataList();

        print("\t --- HIGHSCORES ---");
        for (int i = 0; i < highscores.Count; i++)
        {
            print("\t" + highscores[i].name + "\t --- \t" + highscores[i].score + "\t --- \t" + highscores[i].date);
        }
        print("\t ++++++++++++++++++");
    }