// 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"); } }
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; } } }
void Update() { scoreText.text = PlayerPrefsController.GetCurrentScore().ToString(); }