コード例 #1
0
    void OnEnable()
    {
        gameSettings = new GameSettingsContainer();

        applyButton.onClick.AddListener(delegate { OnApplyButtonClick(); });
        backButton.onClick.AddListener(delegate { OnBackButtonClick(); });

        fullScreenToggle.onValueChanged.AddListener(delegate { OnFullScreenToggle(); });
        resolutionDropdown.onValueChanged.AddListener(delegate { OnResolutionChange(); });
        presetDropdown.onValueChanged.AddListener(delegate { OnPresetChange(); });
        //textureQualityDropdown.onValueChanged.AddListener (delegate {	OnTextureQualityChange ();	});
        //antialiasingDropdown.onValueChanged.AddListener (delegate {	OnAntialiasingChange ();	});
        vSyncDropdown.onValueChanged.AddListener(delegate { OnVSyncChange(); });
        musicVolumeSlider.onValueChanged.AddListener(delegate { OnMusicVolumeChange(); });
        showVRTutorialToggle.onValueChanged.AddListener(delegate { OnShowVRTutorialToggle(); });

        resolutions = Screen.resolutions;
        resolutionDropdown.options.Clear();
        foreach (Resolution res in resolutions)
        {
            resolutionDropdown.options.Add(new Dropdown.OptionData(res.ToString()));
        }

        presetDropdown.options.Clear();
        foreach (string presetName in QualitySettings.names)
        {
            presetDropdown.options.Add(new Dropdown.OptionData(presetName));
        }

        LoadSettings();
    }
コード例 #2
0
    public void LoadSetting()
    {
        GameSettingsContainer gameSettings = new GameSettingsContainer();

        if (File.Exists(Application.persistentDataPath + "/gamesettings.json"))
        {
            gameSettings = JsonUtility.FromJson <GameSettingsContainer> (File.ReadAllText(Application.persistentDataPath + "/gamesettings.json"));

            vol = gameSettings.musicVolume;
            AudioListener.volume = vol;
        }
    }
コード例 #3
0
    public void LoadSettings()
    {
        if (File.Exists(Application.persistentDataPath + "/gamesettings.json"))
        {
            MainMenu.s_Singleton.StartDisplayInfo("Loading Settings");
            gameSettings = JsonUtility.FromJson <GameSettingsContainer> (File.ReadAllText(Application.persistentDataPath + "/gamesettings.json"));

            //visual
            fullScreenToggle.isOn    = gameSettings.fullscreen;
            resolutionDropdown.value = gameSettings.resolutionIndex;
            //textureQualityDropdown.value = gameSettings.textureQuality;
            //antialiasingDropdown.value = gameSettings.antialiasing;
            vSyncDropdown.value       = gameSettings.vSync;
            presetDropdown.value      = gameSettings.presetIndex;
            showVRTutorialToggle.isOn = gameSettings.showVRTutorial;

            //audio controls
            musicVolumeSlider.value = gameSettings.musicVolume;
            dirtySetting            = false;
            MainMenu.s_Singleton.StopDisplayInfo();
        }
    }