IEnumerator StartOptions() { yield return(null); SerializedOptions loaded = Load(); brightness.value = loaded.Brightness; musicVolume.value = loaded.MusicVolume; sfxVolume.value = loaded.SFXVolume; switch (loaded.TextSpeed) { case TextSpeed.Slow: tsSlow.isOn = true; tsNorm.isOn = false; tsFast.isOn = false; break; case TextSpeed.Normal: tsSlow.isOn = false; tsNorm.isOn = true; tsFast.isOn = false; break; case TextSpeed.Fast: tsSlow.isOn = false; tsNorm.isOn = false; tsFast.isOn = true; break; } antiAliasing.isOn = loaded.AntiAliasing; resolution.value = (int)loaded.Res; }
public void Save() { BinaryFormatter BF = new BinaryFormatter(); FileStream file = File.Create(GetFileName()); SerializedOptions CurrentOptions = new SerializedOptions(Brightness.value, MasterVolume.value, fullscreenToggle.isOn, resDropdown.value, Sensitivity.value); BF.Serialize(file, CurrentOptions); file.Close(); }
public void SaveSettings() { BinaryFormatter bf = new BinaryFormatter(); FileStream f = File.Create(Application.persistentDataPath + "/Settings.dat"); SerializedOptions current = new SerializedOptions(settings); bf.Serialize(f, current); f.Close(); }
public void Start() { SerializedOptions LoadedOptions = Load(); Brightness.value = LoadedOptions.Brightness; MasterVolume.value = LoadedOptions.MasterVolume; fullscreenToggle.isOn = LoadedOptions.Fullscreen; windowedToggle.isOn = !LoadedOptions.Fullscreen; resDropdown.value = LoadedOptions.Resolution; Sensitivity.value = LoadedOptions.Sensitivity; }
private SerializedOptions Load() { SerializedOptions LoadedOptions = new SerializedOptions(); if (File.Exists(GetFileName())) { BinaryFormatter BF = new BinaryFormatter(); FileStream file = File.Open(GetFileName(), FileMode.Open); LoadedOptions = BF.Deserialize(file) as SerializedOptions; file.Close(); } return(LoadedOptions); }
SerializedOptions Load() { SerializedOptions loaded = new SerializedOptions(); if (File.Exists(Application.persistentDataPath + "/Settings.dat")) { BinaryFormatter bf = new BinaryFormatter(); FileStream f = File.Open(Application.persistentDataPath + "/Settings.dat", FileMode.Open); loaded = bf.Deserialize(f) as SerializedOptions; f.Close(); } return(loaded); }