Exemple #1
0
    public void SaveSetting()
    {
        BinaryFormatter   B              = new BinaryFormatter();
        FileStream        file           = File.Create(Application.persistentDataPath + fileName);
        SerilizedSettings settingstosave = new SerilizedSettings(Brightness, masterVolumn);

        B.Serialize(file, settingstosave);
        file.Close();
    }
Exemple #2
0
    public SerilizedSettings LoadSettings()
    {
        SerilizedSettings loadedSettings = new SerilizedSettings();

        if (File.Exists(Application.persistentDataPath + fileName))
        {
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(Application.persistentDataPath + fileName, FileMode.Open);
            loadedSettings = bf.Deserialize(file) as SerilizedSettings;
            file.Close();
        }
        return(loadedSettings);
    }
Exemple #3
0
    // Start is called before the first frame update
    void Start()
    {
        SerilizedSettings loadedsettings = masterSettings.LoadSettings();

        if (loadedsettings == null)
        {
            Brightness.value = Brightness.maxValue;
            Volumn.value     = Volumn.maxValue;
        }
        else
        {
            Brightness.value = loadedsettings.Brightness;
            Volumn.value     = loadedsettings.Volumn;
        }
    }