/// <summary> /// Initalizes the highscore list. /// </summary> void Start() { LoadData(); //LoadMockupData(); PlayerData currentPlayerData = PreferenceManager.ReadJsonFromPreferences <PlayerData>("player"); AddItem(currentPlayerData); if (highscoreItem != null) { UpdateListView(); } //Debug.Log("Finished Highscore Initialization"); }
/// <summary> /// Initializes the new Player with already stored player data or creates a new data instance. /// It also stores the start rotation and the start time. /// </summary> void Start() { data = PreferenceManager.ReadJsonFromPreferences <PlayerData>("player"); if (data == null) { data = new PlayerData(); } if (debugMode) { data = new PlayerData(); } startTime = Time.realtimeSinceStartup; startRotation = playerObject.transform.rotation; }
/// <summary> /// Loads the data from the player preferences. /// </summary> public void LoadData() { highscoreData = new List <PlayerData>(); for (int i = 0; i < ListSize; i++) { PlayerData data = PreferenceManager.ReadJsonFromPreferences <PlayerData>(PreferenceKey + i); if (data != null) { highscoreData.Add(data); } else { i = ListSize; } } }