Exemplo n.º 1
0
        /// <summary>
        /// Submit a control scheme to the ControlSchemeManager.
        /// </summary>
        public void SubmitScheme()
        {
            switch (Mode)
            {
            case ControlSchemeCreatorMode.Create:
            {
                ControlSchemeManager.Schemes.Add(_currentlyEditingScheme);
                ControlSchemeManager.UseScheme(ControlSchemeManager.Schemes.Count - 1);
                break;
            }

            case ControlSchemeCreatorMode.Edit:
            {
                ControlSchemeManager.Schemes[ControlSchemeManager.CurrentSchemeIndex] = _currentlyEditingScheme;
                break;
            }
            }
            ControlSchemeManager.SerializeControlSchemes(ControlSchemeManager.Schemes);
            ControlSchemeManager.ReloadSchemes();
            ControlSchemeDropdownPopulator.PopulateDropdown();
            Hide();
        }
Exemplo n.º 2
0
        /// <summary>
        /// Apply the game settings. This function propagates the given settings to all game systems that need them.
        /// </summary>
        /// <param name="settings">The settings to apply.</param>
        public static void ApplySettings(GameSettings settings)
        {
            // TODO: try and catch exceptions for erroneous loaded values (i.e. array idx) and reset to default if error

            // set the control scheme
            ControlSchemeManager.UseScheme(settings.CurrentControlSchemeIndex);

            // set the resolution
            if (settings.CurrentResolutionIndex > Screen.resolutions.Length)
            {
                // if the resolution is invalid, set it to the lowest resolution
                Screen.SetResolution(Screen.resolutions[0].width, Screen.resolutions[0].height, settings.Fullscreen);
            }
            else
            {
                Screen.SetResolution(Screen.resolutions[settings.CurrentResolutionIndex].width,
                                     Screen.resolutions[settings.CurrentResolutionIndex].height, settings.Fullscreen);
            }

            // set framerate to limit or not
            Application.targetFrameRate = settings.LimitFramerate ? FRAMERATE_LIMIT : -1;

            // set retro shader affine intensity
            Shader.SetGlobalFloat("AffineIntensity", settings.AffineIntensity);

            // set the current dream journal
            DreamJournalManager.SetJournal(settings.CurrentJournalIndex);

            // set volumes
            SetMusicVolume(settings.MusicVolume);
            SetSFXVolume(settings.SFXVolume);

            // set the graphics quality
            QualitySettings.SetQualityLevel(settings.CurrentQualityIndex, true);

            Debug.Log("Applying game settings...");
            Debug.Log("Affine intensity: " + settings.AffineIntensity);
        }