public static bool HasSfxOn() { var appReader = new ApplicationDataReader <AudioData>(); var data = appReader.LoadData(audioDataFilePath); return(data.isSfxOn); }
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 SavePlayerStatus(PlayerStatusData playerStatusData = null) { var appDataReader = new ApplicationDataReader <PlayerStatusData>(); if (playerStatusData == null) { playerStatusData = appDataReader.LoadData(playerDataFilePath); } appDataReader.SaveDataAsync(playerStatusData, playerDataFilePath); }
public RatingRequest GetLastRequestData() { var appReader = new ApplicationDataReader <RatingRequest>(); var requestData = appReader.LoadData(ratingRequestDataFilePath); if (requestData == null) { requestData = new RatingRequest(); } return(requestData); }
public static void SaveTimeExperience(float timeExperience) { var appReader = new ApplicationDataReader <PlayerExperienceData>(); var data = appReader.LoadData(playerDataFilePath); if (data == null) { data = new PlayerExperienceData(); } data.InsertGameDuration(timeExperience); appReader.SaveDataAsync(data, playerDataFilePath); }
public static PlayerStatusData LoadPlayerStatus() { var appDataReader = new ApplicationDataReader <PlayerStatusData>(); if (!HasPlayerDataFile()) { PlayerStatusData playerData = CreateInitialPlayerStatus(appDataReader); _playerDataInstance = playerData; return(_playerDataInstance); } if (_playerDataInstance == null) { _playerDataInstance = appDataReader.LoadData(playerDataFilePath); } return(_playerDataInstance); }
public static bool HasAudioData() { var appReader = new ApplicationDataReader <AudioData>(); return(appReader.LoadData(audioDataFilePath) != null); }
public static int GetHighestScore() { var appReader = new ApplicationDataReader <HighScoreData>(); return(appReader.LoadData(highScoreDataFilePath).GetHighestScore()); }
public static PlayerExperienceData LoadTimeExperience() { var appReader = new ApplicationDataReader <PlayerExperienceData>(); return(appReader.LoadData(playerDataFilePath)); }