public static void SetLevelChallengeCompleted(int challengeId) { var storage = new StorageHandler(); storage.SetChallengeCompleted(challengeId); for (int i = 0; i < CurrentChapter.Levels.Count; i++) { var level = CurrentChapter.Levels[i]; if (level.Challenges != null) { for (int j = 0; j < level.Challenges.Count; j++) { var challenge = level.Challenges[j]; if (challenge.Id == challengeId) { challenge.IsCompleted = true; i = CurrentChapter.Levels.Count; break; } } } } }
public Level02() { storage = new StorageHandler(); }
public static void UpdateLevelScore(int levelId, int score) { for (int i = 0; i < CurrentChapter.Levels.Count; i++) { var level = CurrentChapter.Levels[i]; if (level.Id == levelId) { if (level.Score < score) { level.Score = score; var storage = new StorageHandler(); storage.SetLevelScore(levelId, score); } break; } } }