//-------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------- public void OnShow() { m_GraphicEnum.RegisterDelegate(OnGraphicChanged); m_AutoDetectButton.RegisterReleaseDelegate(OnDetectGraphicButton); m_ShowHintsSwitch.RegisterDelegate(OnShowHintChanged); m_LanguageEnum.RegisterDelegate(OnLanguageChanged); }
public static GUIBase_Enum PrepareEnum(GUIBase_Layout layout, string name, GUIBase_Enum.ChangeValueDelegate d) { GUIBase_Enum control = GetControl <GUIBase_Enum>(layout, name); if (control != null) { control.RegisterDelegate(d); } else { Debug.LogError("Can't find enum '" + name + "'"); } return(control); }
//-------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------- public void OnShow() { m_GraphicEnum.RegisterDelegate(OnGraphicChanged); m_AutoDetectButton.RegisterReleaseDelegate(OnDetectGraphicButton); m_ShowHintsSwitch.RegisterDelegate(OnShowHintChanged); m_LanguageEnum.RegisterDelegate(OnLanguageChanged); m_FullscreenSwitch.RegisterDelegate(OnFullscreenToggled); m_ResolutionEnum.RegisterDelegate(OnResolutionChanged); m_ApplyButton.RegisterReleaseDelegate(OnApplyButton); if (GuiOptions.fullScreenResolution.width <= 0 || GuiOptions.fullScreenResolution.height <= 0) { GuiOptions.fullScreenResolution = Screen.resolutions[Screen.resolutions.Length - 1]; } m_FullscreenSwitch.SetValue(Screen.fullScreen); m_ResolutionEnumSelection = -1; m_ResolutionMax = Screen.resolutions.Length - 1; m_CurrentResolution.width = Screen.width; m_CurrentResolution.height = Screen.height; m_ResolutionLabels[m_ResolutionEnum.Selection].SetNewText(m_CurrentResolution.width + "x" + m_CurrentResolution.height); for (int i = 0; i < Screen.resolutions.Length; i++) { if (Screen.resolutions[i].width == m_CurrentResolution.width && Screen.resolutions[i].height == m_CurrentResolution.height) { m_ResolutionEnumSelection = i; break; } } SetApplyButton(); }
// PRIVATE METHODS void BindControls(bool state) { // bind callbacks #if MADFINGER_KEYBOARD_MOUSE m_KeyboardButton.RegisterReleaseDelegate(state ? OnKeyboardPressed : (GUIBase_Button.ReleaseDelegate)null); #else if (!GamepadInputManager.Instance.IsNvidiaShield()) { m_ControlSchemeEnum.RegisterDelegate(state ? OnControlSchemeChanged : (GUIBase_Enum.ChangeValueDelegate)null); m_FireButtonSize.RegisterChangeValueDelegate(state ? OnFireButtonSize : (GUIBase_Slider.ChangeValueDelegate)null); m_SwitchLefthanded.RegisterDelegate(state ? OnLefthandedToggled : (GUIBase_Switch.SwitchDelegate)null); m_CustomizeButton.RegisterReleaseDelegate(state ? OnCustomizePressed : (GUIBase_Button.ReleaseDelegate)null); m_MogaHelpButton.RegisterReleaseDelegate(state ? OnMogaHelpPressed : (GUIBase_Button.ReleaseDelegate)null); // enable/disable controls m_CustomizeButton.SetDisabled(m_CustomizeControls != null ? false : true); m_CustomizeButton.Widget.Show((m_CustomizeControls != null), true); } #endif m_SliderSensitivity.RegisterChangeValueDelegate(state ? OnSensitivityChanged : (GUIBase_Slider.ChangeValueDelegate)null); m_SwitchYAxis.RegisterDelegate(state ? OnInvertYToggled : (GUIBase_Switch.SwitchDelegate)null); m_GamepadButton.RegisterReleaseDelegate(state ? OnGamepadPressed : (GUIBase_Button.ReleaseDelegate)null); }