コード例 #1
0
    // Start is called before the first frame update
    void Start()
    {
        List <HighScore> highscores = HighscoresManager.Load();

        if (highscores != null)
        {
            foreach (HighScore score in highscores)
            {
                GameObject  ui     = Instantiate(prefabHighscoreUI, gameObject.transform);
                HighScoreUI uiCode = ui.GetComponent <HighScoreUI>();
                if (uiCode != null)
                {
                    uiCode.SetupUI(score);
                }
            }
        }
        else
        {
            GameObject  ui     = Instantiate(prefabHighscoreUI, gameObject.transform);
            HighScoreUI uiCode = ui.GetComponent <HighScoreUI>();
            if (uiCode != null)
            {
                uiCode.SetupWithoutHighScore("No Highscores");
            }
        }
    }
コード例 #2
0
    // Start is called before the first frame update
    void Start()
    {
        text = GetComponent <Text>();
        gmc  = FindObjectOfType <GameManager>();

        List <HighScore> listScore = HighscoresManager.Load();
        string           txt       = "";

        if (listScore != null)
        {
            HighScore best = listScore[0];
            txt = best.getName() + " got " + best.getScore();
        }
        else
        {
            txt = "You have not played the game yet!";
        }

        text.text = txt;
    }