public static void SavePlayer(PlayerDataQuality data) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(FilePath, FileMode.Create); formatter.Serialize(stream, data); stream.Close(); }
public void Save_Quality() { PlayerDataQuality SaveDataQuality = new PlayerDataQuality(); SaveDataQuality.quality_selection = quality_selection; SaveLoadQuality.SavePlayer(SaveDataQuality); Load_QualitySettings(); }
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 void Load_Quality() { PlayerDataQuality loadedDataQuality = SaveLoadQuality.LoadPlayer(); quality_selection = loadedDataQuality.quality_selection; if (quality_selection == 0) { Post_Processing.SetActive(false); } else if (quality_selection == 1) { Post_Processing.SetActive(true); } }
public void Load_QualitySettings() { PlayerDataQuality loadedDataQuality = SaveLoadQuality.LoadPlayer(); quality_selection = loadedDataQuality.quality_selection; if (quality_selection == 0) { Quality_Low.gameObject.GetComponent <Image>().sprite = quality_selected; Quality_High.gameObject.GetComponent <Image>().sprite = quality_unselected; } else if (quality_selection == 1) { Quality_Low.gameObject.GetComponent <Image>().sprite = quality_unselected; Quality_High.gameObject.GetComponent <Image>().sprite = quality_selected; } }
public static PlayerDataQuality LoadPlayer() { if (File.Exists(FilePath)) { BinaryFormatter formatter = new BinaryFormatter(); FileStream stream = new FileStream(FilePath, FileMode.Open); PlayerDataQuality loadedData = formatter.Deserialize(stream) as PlayerDataQuality; stream.Close(); return(loadedData); } else { SavePlayer(PlayerDataQuality.DefaultValues); return(PlayerDataQuality.DefaultValues); } }