public override void OnShow()
    {
        base.OnShow();
        this.FillAvailableResolutions();
        this.m_Quality.SetByOption(QualitySettings.names[QualitySettings.GetQualityLevel()]);
        Resolution resolution = ResolutionExtension.SelectResolution((Screen.fullScreenMode == FullScreenMode.Windowed) ? ResolutionExtension.ResolutionFromString(GreenHellGame.Instance.m_Settings.m_Resolution) : Screen.currentResolution);
        string     byOption;
        string     text;

        resolution.ToString2(out byOption, out text);
        if (!this.m_Resolution.SetByOption(byOption))
        {
            Screen.currentResolution.ToString2(out byOption, out text);
            this.m_Resolution.SetByOption(byOption);
        }
        FullScreenMode fullScreenMode = Screen.fullScreenMode;

        this.m_Fullscreen.SetSelectedOptionEnumValue <FullScreenMode>(fullScreenMode);
        this.FillAvailableRefreshRate(resolution);
        this.m_VSync.SetSelectedOptionBoolValue(QualitySettings.vSyncCount != 0);
        this.m_ShadowDistance.value = GreenHellGame.Instance.m_Settings.m_ShadowDistance;
        this.m_AntiAliasing.SetSelectedOptionBoolValue(GreenHellGame.Instance.m_Settings.m_AntiAliasing);
        this.m_TextureQuality.SetByOption(GreenHellGame.Instance.m_Settings.m_TextureQuality);
        this.m_FOV.value = GreenHellGame.Instance.m_Settings.m_FOVChange;
        this.m_ObjectDrawDistance.value = GreenHellGame.Instance.m_Settings.m_ObjectDrawDistance;
        this.m_FovTitlePrefix           = GreenHellGame.Instance.GetLocalization().Get("MenuOptions_Graphics_FOV", true);
        this.OnSliderMoved(this.m_FOV);
        this.m_Brightness.value = GreenHellGame.Instance.m_Settings.m_BrightnessMul;
    }
 private void ApplyOptions()
 {
     QualitySettings.SetQualityLevel(this.m_Quality.m_SelectionIdx);
     GreenHellGame.Instance.m_Settings.m_Resolution         = ResolutionExtension.ToString(this.m_Resolution.GetSelectedOption(), this.m_RefreshRate.GetSelectedOption());
     GreenHellGame.Instance.m_Settings.m_Fullscreen         = this.m_Fullscreen.GetSelectedOptionEnumValue <FullScreenMode>().ToString();
     GreenHellGame.Instance.m_Settings.m_VSync              = this.m_VSync.GetSelectedOptionBoolValue();
     GreenHellGame.Instance.m_Settings.m_ShadowDistance     = this.m_ShadowDistance.value;
     GreenHellGame.Instance.m_Settings.m_AntiAliasing       = this.m_AntiAliasing.GetSelectedOptionBoolValue();
     GreenHellGame.Instance.m_Settings.m_FOVChange          = this.m_FOV.value;
     GreenHellGame.Instance.m_Settings.m_ObjectDrawDistance = this.m_ObjectDrawDistance.value;
     GreenHellGame.Instance.m_Settings.m_TextureQuality     = this.m_TextureQuality.GetSelectedOption();
     GreenHellGame.Instance.m_Settings.SaveSettings();
     GreenHellGame.Instance.m_Settings.ApplySettings(true);
 }
 public override void OnSelectionChanged(UISelectButton button, string option)
 {
     if (button == this.m_Resolution || button == this.m_Fullscreen)
     {
         Resolution current_res = ResolutionExtension.ResolutionFromString(ResolutionExtension.ToString(this.m_Resolution.GetSelectedOption(), this.m_RefreshRate.GetSelectedOption()));
         this.FillAvailableRefreshRate(current_res);
         return;
     }
     if (button == this.m_Quality)
     {
         Streamer[] array = Resources.FindObjectsOfTypeAll <Streamer>();
         for (int i = 0; i < array.Length; i++)
         {
             if (array[i] != null)
             {
                 array[i].SetQualitySettingsRanges(button.m_SelectionIdx);
             }
         }
     }
 }
 public static Resolution SelectResolution(string res_name)
 {
     return(ResolutionExtension.SelectResolution(ResolutionExtension.ResolutionFromString(res_name)));
 }
 public static void FromString(this Resolution res, string resolution_str)
 {
     res = ResolutionExtension.ResolutionFromString(resolution_str);
 }
示例#6
0
    private IEnumerator DelayedScreenSettingsChange(float exec_time)
    {
        if (this.m_ApplyingSettings)
        {
            yield break;
        }
        this.m_ApplyingSettings   = true;
        this.m_SettingsChangeTime = Time.realtimeSinceStartup;
        FullScreenMode full_screen;

        if (!Enum.TryParse <FullScreenMode>(this.m_Fullscreen, out full_screen))
        {
            full_screen = ((this.m_Fullscreen == "On") ? FullScreenMode.ExclusiveFullScreen : FullScreenMode.Windowed);
        }
        FullScreenMode fullScreenMode = Screen.fullScreenMode;
        Resolution     res            = ResolutionExtension.SelectResolution(this.m_Resolution);

        if (!res.Equals(Screen.currentResolution, false))
        {
            Screen.SetResolution(res.width, res.height, Screen.fullScreenMode, (Screen.fullScreenMode == FullScreenMode.ExclusiveFullScreen) ? res.refreshRate : Screen.currentResolution.refreshRate);
            while (!res.Equals(Screen.currentResolution, false) && this.m_SettingsChangeTime > Time.realtimeSinceStartup - 1f)
            {
                yield return(new WaitForEndOfFrame());
            }
            GreenHellGame.Instance.m_MenuResolutionX = res.width;
            GreenHellGame.Instance.m_MenuResolutionY = res.height;
            this.OnResolutionChanged(res.width, res.height);
            yield return(new WaitForEndOfFrame());
        }
        this.m_SettingsChangeTime = Time.realtimeSinceStartup;
        if (Screen.fullScreenMode != full_screen)
        {
            Screen.fullScreenMode = full_screen;
            while (Screen.fullScreenMode != full_screen && this.m_SettingsChangeTime > Time.realtimeSinceStartup - 1f)
            {
                yield return(new WaitForEndOfFrame());
            }
        }
        this.m_SettingsChangeTime = Time.realtimeSinceStartup;
        if (QualitySettings.vSyncCount != 0 != this.m_VSync)
        {
            if (this.m_VSync)
            {
                QualitySettings.vSyncCount = 1;
            }
            else
            {
                QualitySettings.vSyncCount = 0;
            }
            while (QualitySettings.vSyncCount != 0 != this.m_VSync && this.m_SettingsChangeTime > Time.realtimeSinceStartup - 1f)
            {
                yield return(new WaitForEndOfFrame());
            }
        }
        this.m_ApplyingSettings = false;
        string text = "";

        if (Screen.fullScreenMode == FullScreenMode.ExclusiveFullScreen && Screen.currentResolution.refreshRate != res.refreshRate)
        {
            text += "\n";
            text += GreenHellGame.Instance.GetLocalization().Get("MenuOptions_Graphics_RefreshRate", true);
        }
        if (Screen.fullScreenMode != full_screen)
        {
            text += "\n";
            text += GreenHellGame.Instance.GetLocalization().Get("MenuOptions_Graphics_Fullscreen", true);
        }
        if (text.Length > 0 && !GreenHellGame.IsYesNoDialogActive())
        {
            text += "\n";
            GreenHellGame.GetYesNoDialog().Show(null, DialogWindowType.Ok, GreenHellGame.Instance.GetLocalization().Get("YNDialog_OptionsGame_BackTitle", true), GreenHellGame.Instance.GetLocalization().GetMixed("MenuGraphics_SettingsChangeFailed", new string[]
            {
                text
            }), MainLevel.Instance == null);
        }
        yield break;
        yield break;
    }