コード例 #1
0
ファイル: Options.cs プロジェクト: aneurinhr/AlchemistsGolem
    public void LoadSettings()
    {
        string filePath = path + "/" + gameDataFileName;

        if (File.Exists(filePath))
        {
            string           dataAsJson = File.ReadAllText(filePath);
            SettingsSaveData saveData   = JsonUtility.FromJson <SettingsSaveData>(dataAsJson);

            FullscreenToggle(saveData.fullscreen);
            fullscreen.isOn = saveData.fullscreen;
            ChangeResolution(saveData.resolutionChoice);
            resolution.value = saveData.resolutionChoice;
            ChangeGraphics(saveData.qualityChoice);
            graphics.value = saveData.qualityChoice;
            ChangeMasterVol(saveData.MasterVol);
            master.value = saveData.MasterVol;
            ChangeSFXVol(saveData.SFXVol);
            sfx.value = saveData.SFXVol;
            ChangeUIVol(saveData.UIVol);
            ui.value = saveData.UIVol;
            ChangeMusicVol(saveData.MusicVol);
            music.value = saveData.MusicVol;
        }
    }
コード例 #2
0
ファイル: SaveManager.cs プロジェクト: NeoNova111/Portfolio
    public void LoadSettingsData()
    {
        if (!SettingsSaveFileExists())
        {
            Debug.LogWarning("save file does not exist");
            return;
        }

        string           json     = File.ReadAllText(Application.persistentDataPath + "/settingsSaveData.json");
        SettingsSaveData saveData = JsonUtility.FromJson <SettingsSaveData>(json);

        loadSettings = saveData;
    }
コード例 #3
0
        private void ActuallyLoad()
        {
            string filepath = $"{Fast.FastService.MApplication.PersistentDataPath}Fast/SettingsSaveData/data.save";

            SettingsSaveData loaded_file = null;
            bool             success     = Fast.Serializers.JSONSerializer.DeSerializeFromPath(filepath, out loaded_file);

            if (!success)
            {
                return;
            }

            on_load_data.Invoke(loaded_file);
        }
コード例 #4
0
        private void ActuallySave()
        {
            string filepath = $"{Fast.FastService.MApplication.PersistentDataPath}Fast/SettingsSaveData/data.save";

            SettingsSaveData loaded_file = last_loaded_file;

            if (loaded_file == null)
            {
                loaded_file = new SettingsSaveData();
            }

            on_save_data.Invoke(loaded_file);

            Fast.Serializers.JSONSerializer.SerializeToPath(filepath, loaded_file);
        }
コード例 #5
0
ファイル: Options.cs プロジェクト: aneurinhr/AlchemistsGolem
    public void SaveSettings()
    {
        SettingsSaveData saveData = new SettingsSaveData();

        saveData.fullscreen       = fullscreen.isOn;
        saveData.resolutionChoice = resolution.value;
        saveData.qualityChoice    = graphics.value;

        saveData.MasterVol = master.value;
        saveData.SFXVol    = sfx.value;
        saveData.UIVol     = ui.value;
        saveData.MusicVol  = music.value;

        string tempPath       = path + "/" + gameDataFileName;
        string saveDataString = JsonUtility.ToJson(saveData);

        File.WriteAllText(tempPath, saveDataString);
    }
コード例 #6
0
ファイル: SaveManager.cs プロジェクト: NeoNova111/Portfolio
    public void SaveSettingsData()
    {
        SettingsSaveData saveData = new SettingsSaveData();

        if (AudioManager.instance)
        {
            AudioManager managerInstance = AudioManager.instance;
            saveData.masterVolume = managerInstance.currentSoundSettings.masterVolume;
            saveData.musicVolume  = managerInstance.currentSoundSettings.musicVolume;
            saveData.sfxVolume    = managerInstance.currentSoundSettings.sfxVolume;
            saveData.voiceVolume  = managerInstance.currentSoundSettings.voiceoverVolume;
        }
        else
        {
            Debug.LogWarning("can't save settings in current state");
        }

        string json = JsonUtility.ToJson(saveData);

        File.WriteAllText(Application.persistentDataPath + "/settingsSaveData.json", json);
    }
コード例 #7
0
 private void LoadSettingsData()
 {
     settingsData = SettingsSaveSystem.Load();
 }