Exemple #1
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;
         }
     }
 }
Exemple #2
0
    private void UpdateLevelText()
    {
        int levelNumber = PlayerPrefsController.GetCurrentLevel();

        GetComponent <Text>().text = "Level " + levelNumber.ToString();
    }