Exemplo n.º 1
0
    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;
    }
Exemplo n.º 2
0
    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();
    }
Exemplo n.º 3
0
    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();
    }
Exemplo n.º 4
0
    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;
    }
Exemplo n.º 5
0
    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);
    }
Exemplo n.º 6
0
    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);
    }