// --------------------------------------------------------------------- void Start() { // 重置按钮 if (showResetButton) { resetButton.SetActive(true); } else { resetButton.SetActive(false); } //首先确定排行榜已经初始化 _scoreManager.SetUpScores(); // 调用本地FinalScore finalGameScore = PlayerPrefs.GetInt("finalScore"); // 判断是否刷新榜单,是否需要输入名字 newHighScore = _scoreManager.DidGetHighScore(finalGameScore); Debug.Log(">StandardHighScores.cs>This is a high score? " + newHighScore); UpdateUIText(); // 检查是否需要弹出输入名字的框 // 并确定分数不为0 if (newHighScore && finalGameScore != 0) { ShowEnterNamePanel(); } else { HideEnterNamePanel(); } }
// --------------------------------------------------------------------- void Start() { // show or hide the reset leaderboard button (useful for development) if (showResetButton) { resetButton.SetActive(true); } else { resetButton.SetActive(false); } // first thing we need to do is make sure that the leaderboard is initialized. _scoreManager.SetUpScores(); // when the game ends, it saves the final score into a player pref. we pick up the // final score out of the player pref to use here on the game over screen: finalGameScore = PlayerPrefs.GetFloat("finalScore"); // did the user get a high score? do they need to enter their name? newHighScore = _scoreManager.DidGetHighScore(finalGameScore); // a little debug message so we can easily see what's going on in the editor Debug.Log(">StandardHighScores.cs>This is a high score? " + newHighScore); // before we do anything else, populate the ui text fields UpdateUIText(); // check to see if we need to display the enter name dialog box // but also making sure that the score is not zero (we don't want to submit zero scores, right?) if (newHighScore && finalGameScore != 0) { ShowEnterNamePanel(); } else { HideEnterNamePanel(); } }