public static void SavePlayer(PlayerDataVolumes data) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(FilePath, FileMode.Create); formatter.Serialize(stream, data); stream.Close(); }
public void Load_Volumes() { PlayerDataVolumes loadedDataVolumes = SaveLoadVolumes.LoadPlayer(); sound_volume = loadedDataVolumes.s_volume; Set_Volume_Settings(); }
public void Save_Volumes() { PlayerDataVolumes SaveDataVolumes = new PlayerDataVolumes(); SaveDataVolumes.m_volume = music_volume; SaveDataVolumes.s_volume = sound_volume; SaveLoadVolumes.SavePlayer(SaveDataVolumes); Load_Volumes(); }
public void RESET_ALL() { PlayerDataCustomize SaveDataCustomize = new PlayerDataCustomize(); SaveDataCustomize.color_no = 0; SaveDataCustomize.selected_color = 0; SaveDataCustomize.trail_no = 0; SaveDataCustomize.selected_trail = 0; SaveLoadCustomize.SavePlayer(SaveDataCustomize); Player_Idle.GetComponent <Image>().color = Colors[0].gameObject.GetComponent <Image>().color; Change_Trail(0); PlayerDataLocked SaveDataLocked = new PlayerDataLocked(); SaveDataLocked.color_0_locked = false; SaveDataLocked.color_1_locked = true; SaveDataLocked.color_2_locked = true; SaveDataLocked.color_3_locked = true; SaveDataLocked.color_4_locked = true; SaveDataLocked.trail_0_locked = false; SaveDataLocked.trail_1_locked = true; SaveDataLocked.trail_2_locked = true; SaveLoadLocked.SavePlayer(SaveDataLocked); PlayerDataCoins SaveDataCoins = new PlayerDataCoins(); SaveDataCoins.coins = 0; SaveLoadCoins.SavePlayer(SaveDataCoins); PlayerDataHighscore SaveDataHighscore = new PlayerDataHighscore(); SaveDataHighscore.highscore = 0; SaveLoadHighscore.SavePlayer(SaveDataHighscore); PlayerDataVolumes SaveDataVolumes = new PlayerDataVolumes(); SaveDataVolumes.m_volume = 3; SaveDataVolumes.s_volume = 3; SaveLoadVolumes.SavePlayer(SaveDataVolumes); PlayerDataQuality SaveDataQuality = new PlayerDataQuality(); SaveDataQuality.quality_selection = 1; SaveLoadQuality.SavePlayer(SaveDataQuality); Load_Customization(); Load_PlayerCoins(); Load_Locked(); Load_Volumes(); Load_QualitySettings(); Load_Highscore(); }
public static PlayerDataVolumes LoadPlayer() { if (File.Exists(FilePath)) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(FilePath, FileMode.Open); PlayerDataVolumes loadedData = formatter.Deserialize(stream) as PlayerDataVolumes; stream.Close(); return(loadedData); } else { SavePlayer(PlayerDataVolumes.DefaultValues); return(PlayerDataVolumes.DefaultValues); } }