Exemple #1
0
 public virtual void UpdateMenuOptions()
 {
     if (this.m_OptionsObjects.Count > 0)
     {
         if (GreenHellGame.IsPCControllerActive())
         {
             this.m_ActiveMenuOption = null;
             foreach (MenuBase.MenuOptionData data in this.m_OptionsObjects.Values)
             {
                 this.UpdateActiveMenuOption(data);
             }
         }
         foreach (MenuBase.MenuOptionData data2 in this.m_OptionsObjects.Values)
         {
             this.UpdateMenuOptionAnimation(data2);
         }
         if (!GreenHellGame.IsYesNoDialogActive())
         {
             CursorManager cursorManager = CursorManager.Get();
             if (cursorManager == null)
             {
                 return;
             }
             cursorManager.SetCursor((this.m_ActiveMenuOption != null && this.m_ActiveMenuOptionCanInteract && !GreenHellGame.GetFadeSystem().IsFadeVisible()) ? CursorManager.TYPE.MouseOver : CursorManager.TYPE.Normal);
         }
     }
 }
 protected override void Update()
 {
     base.Update();
     this.UpdateSlots();
     if (!GreenHellGame.IsYesNoDialogActive())
     {
         CursorManager.Get().SetCursor(((this.m_ActiveMenuOption != null && this.m_ActiveMenuOption.m_Button != null) || this.m_HLSlotIdx >= 0) ? CursorManager.TYPE.MouseOver : CursorManager.TYPE.Normal);
     }
     if (GreenHellGame.IsPadControllerActive())
     {
         CursorManager.Get().SetCursorPos(Vector2.zero);
     }
 }
Exemple #3
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;
    }
Exemple #4
0
 public override void OnInputAction(InputActionData action_data)
 {
     if (action_data.m_Action == InputsManager.InputAction.Button_A)
     {
         if (this.m_ActiveMenuOption != null && this.m_ActiveMenuOption.m_Button && !GreenHellGame.IsYesNoDialogActive())
         {
             this.m_ActiveMenuOption.m_Button.onClick.Invoke();
             return;
         }
     }
     else
     {
         base.OnInputAction(action_data);
     }
 }
Exemple #5
0
 public virtual void OnInputAction(InputActionData action_data)
 {
     if (action_data.m_Action == InputsManager.InputAction.Button_B)
     {
         if (!GreenHellGame.GetYesNoDialog().gameObject.activeSelf)
         {
             this.OnBack();
             return;
         }
     }
     else if (action_data.m_Action == InputsManager.InputAction.Button_X)
     {
         if (!GreenHellGame.GetYesNoDialog().gameObject.activeSelf)
         {
             this.OnAccept();
             return;
         }
     }
     else if (action_data.m_Action == InputsManager.InputAction.Button_A)
     {
         if (this.m_ActiveMenuOption != null && this.m_ActiveMenuOption.m_Button && !GreenHellGame.IsYesNoDialogActive())
         {
             string persistentMethodName = this.m_ActiveMenuOption.m_Button.onClick.GetPersistentMethodName(0);
             base.SendMessage(persistentMethodName);
             return;
         }
     }
     else if (action_data.m_Action == InputsManager.InputAction.LSRight || action_data.m_Action == InputsManager.InputAction.DPadRight)
     {
         if (this.m_ActiveMenuOption != null && this.m_ActiveMenuOption.m_SelectButton)
         {
             this.m_ActiveMenuOption.m_SelectButton.PressRightArrow();
             return;
         }
     }
     else if (action_data.m_Action == InputsManager.InputAction.LSLeft || action_data.m_Action == InputsManager.InputAction.DPadLeft)
     {
         if (this.m_ActiveMenuOption != null && this.m_ActiveMenuOption.m_SelectButton)
         {
             this.m_ActiveMenuOption.m_SelectButton.PressLeftArrow();
             return;
         }
     }
     else
     {
         if (action_data.m_Action == InputsManager.InputAction.LSBackward || action_data.m_Action == InputsManager.InputAction.DPadDown)
         {
             for (int i = 0; i < this.m_OptionsObjects.Values.Count; i++)
             {
                 MenuBase.MenuOptionData menuOptionData = this.m_OptionsObjects.Values.ElementAt(i);
                 if (this.m_ActiveMenuOption == menuOptionData)
                 {
                     for (int j = i + 1; j < this.m_OptionsObjects.Values.Count; j++)
                     {
                         menuOptionData = this.m_OptionsObjects.Values.ElementAt(j);
                         if (this.IsMenuButtonEnabled(menuOptionData.m_Button))
                         {
                             UIButtonEx component = menuOptionData.m_Button.GetComponent <UIButtonEx>();
                             if (!component || component.m_MoveWhenFocused)
                             {
                                 this.m_ActiveMenuOption = menuOptionData;
                                 return;
                             }
                         }
                         if (this.IsMenuSliderEnabled(menuOptionData.m_Slider))
                         {
                             this.m_ActiveMenuOption = menuOptionData;
                             return;
                         }
                         if (this.IsMenuSelectButtonEnabled(menuOptionData.m_SelectButton))
                         {
                             this.m_ActiveMenuOption = menuOptionData;
                             return;
                         }
                     }
                     return;
                 }
             }
             return;
         }
         if (action_data.m_Action == InputsManager.InputAction.LSForward || action_data.m_Action == InputsManager.InputAction.DPadUp)
         {
             for (int k = 0; k < this.m_OptionsObjects.Values.Count; k++)
             {
                 MenuBase.MenuOptionData menuOptionData2 = this.m_OptionsObjects.Values.ElementAt(k);
                 if (this.m_ActiveMenuOption == menuOptionData2)
                 {
                     for (int l = k - 1; l >= 0; l--)
                     {
                         menuOptionData2 = this.m_OptionsObjects.Values.ElementAt(l);
                         if (this.IsMenuButtonEnabled(menuOptionData2.m_Button))
                         {
                             UIButtonEx component2 = menuOptionData2.m_Button.GetComponent <UIButtonEx>();
                             if (!component2 || component2.m_MoveWhenFocused)
                             {
                                 this.m_ActiveMenuOption = menuOptionData2;
                                 return;
                             }
                         }
                         if (this.IsMenuSliderEnabled(menuOptionData2.m_Slider))
                         {
                             this.m_ActiveMenuOption = menuOptionData2;
                             return;
                         }
                         if (this.IsMenuSelectButtonEnabled(menuOptionData2.m_SelectButton))
                         {
                             this.m_ActiveMenuOption = menuOptionData2;
                             return;
                         }
                     }
                     return;
                 }
             }
         }
     }
 }