private void SetTimeStrings() { List <TimeString> newRoomTimeStrings = new List <TimeString>(); LevelHighscores highscores = PlayerData.Instance.GetLevelHighscores(GetCurrentLevel()); for (int i = 0; i < highscores.NumberOfRooms; i++) { newRoomTimeStrings.Add(new TimeString("Room " + (i + 1), highscores.GetTime(i), false)); } RoomTimeStrings = newRoomTimeStrings; TotalTimeString = new TimeString("Level", highscores.TotalTime, false); }
public LevelEndScreen(Level level) { Center = new Vector2(-0.8f, -0.85f); if (level.Name == "Level 1") { PlayerData.Instance.UnlockLevel("Level 2"); } if (level.Name == "Level 2") { PlayerData.Instance.UnlockLevel("Level 3"); } LevelHighscores highscores = PlayerData.Instance.GetLevelHighscores(level.Name, level.Rooms.Count); List <TimeString> roomTimeStrings = new List <TimeString>(); for (int i = 0; i < level.Rooms.Count; i++) { float time = level.Times[i]; bool isNewRecord = highscores.CheckSingleTime(i, time); roomTimeStrings.Add(new TimeString("Room " + (i + 1), time, isNewRecord)); } RoomTimeStrings = roomTimeStrings; float totalTime = level.GetTotalTime(); bool isNewTotalRecord = highscores.CheckTotalTime(totalTime); TotalTimeString = new TimeString("Level", totalTime, isNewTotalRecord); PlayerData.WriteXML(); AddMainMenuButton("continue"); }