public static void SaveNewScore(int score) { var appReader = new ApplicationDataReader <HighScoreData>(); var highScoreData = appReader.LoadData(highScoreDataFilePath); if (highScoreData != null) { var scores = highScoreData.GetScores(); for (int i = 0; i < scores.Length; i++) { if (score > scores[i]) { scores[i] = score; break; } } highScoreData.SetScores(scores.OrderByDescending(x => x).ToArray()); } else { var scores = new int[10]; scores[0] = score; highScoreData = new HighScoreData(); highScoreData.SetScores(scores); } appReader.SaveData(highScoreData, highScoreDataFilePath); }
public static void SetSfx(bool sfxStatus) { var appReader = new ApplicationDataReader <AudioData>(); var data = appReader.LoadData(audioDataFilePath); data.isSfxOn = sfxStatus; appReader.SaveData(data, audioDataFilePath); }
public static void SetMusic(bool musicStatus) { var appReader = new ApplicationDataReader <AudioData>(); var data = appReader.LoadData(audioDataFilePath); data.isMusicOn = musicStatus; appReader.SaveData(data, audioDataFilePath); }
public static void CreateInitialLoad() { var appReader = new ApplicationDataReader <AudioData>(); AudioData data = new AudioData() { isMusicOn = true, isSfxOn = true }; appReader.SaveData(data, audioDataFilePath); }