コード例 #1
0
 // Start is called before the first frame update
 void Start()
 {
     if (SceneManager.GetActiveScene().buildIndex == 0)
     {
         int highscore = PlayerPrefsController.GetHighscore();
         GetComponent <TextMeshProUGUI>().text = highscore.ToString("00000");
     }
     else
     {
         int currentscore = PlayerPrefsController.GetCurrentScore();
         GetComponent <TextMeshProUGUI>().text = currentscore.ToString("00000");
     }
 }
コード例 #2
0
 void Update()
 {
     if (!enterWasPressed)
     {
         if (Input.GetKeyDown(KeyCode.Return))
         {
             GetComponent <InputField>().readOnly = true;
             int    playerNumber = PlayerPrefsController.SetScore(PlayerPrefsController.GetCurrentScore());
             string playerName   = mainText.GetComponent <Text>().text;
             int    levelNumber  = PlayerPrefsController.GetCurrentLevel();
             string levelText    = "Level " + levelNumber.ToString();
             PlayerPrefsController.SetPlayer(playerNumber, playerName);
             PlayerPrefsController.SetLevel(playerNumber, levelText);
             FindObjectOfType <HighestScoreTable>().SetPlayerNameAndScore();
             enterWasPressed = true;
         }
     }
 }
コード例 #3
0
ファイル: ScoreDisplay.cs プロジェクト: AntonGames/Tetris
 void Update()
 {
     scoreText.text = PlayerPrefsController.GetCurrentScore().ToString();
 }