public static void Postfix(uGUI_OptionsPanel __instance) { nitroxSettingsManager ??= Resolve <NitroxSettingsManager>(true); int tabIndex = __instance.AddTab("Nitrox"); foreach (KeyValuePair <string, List <NitroxSettingsManager.Setting> > settingEntries in nitroxSettingsManager.NitroxSettings) { __instance.AddHeading(tabIndex, settingEntries.Key); foreach (NitroxSettingsManager.Setting setting in settingEntries.Value) { switch (setting.SettingType) { case NitroxSettingsManager.SettingType.TOGGLE: __instance.AddToggleOption(tabIndex, setting.Label, setting.GetValue <bool>(), (UnityAction <bool>)setting.Callback); break; case NitroxSettingsManager.SettingType.SLIDER: __instance.AddSliderOption(tabIndex, setting.Label, setting.GetValue <float>(), setting.SliderMinValue, setting.SliderMaxValue, setting.SliderDefaultValue, (UnityAction <float>)setting.Callback); break; case NitroxSettingsManager.SettingType.LIST: __instance.AddChoiceOption(tabIndex, setting.Label, setting.ListItems, setting.GetValue <int>(), (UnityAction <int>)setting.Callback); break; } } } }
internal static void Postfix(uGUI_OptionsPanel __instance) { int modsTab = __instance.AddTab("Mods"); __instance.AddHeading(modsTab, "QModManager"); bool enableDebugLogs = PlayerPrefsExtra.GetBool("QModManager_EnableDebugLogs", false); __instance.AddToggleOption(modsTab, "Enable debug logs", enableDebugLogs, new UnityAction <bool>(toggleVal => PlayerPrefsExtra.SetBool("QModManager_EnableDebugLogs", toggleVal))); bool updateCheck = PlayerPrefsExtra.GetBool("QModManager_EnableUpdateCheck", true); __instance.AddToggleOption(modsTab, "Check for updates", updateCheck, new UnityAction <bool>(toggleVal => PlayerPrefsExtra.SetBool("QModManager_EnableUpdateCheck", toggleVal))); bool enableDebugger = PlayerPrefsExtra.GetBool("QModManager_PrefabDebugger_EnableExperimental", false); __instance.AddToggleOption(modsTab, "Enable prefab debugger (experimental)", enableDebugger, new UnityAction <bool>(toggleVal => PlayerPrefsExtra.SetBool("QModManager_PrefabDebugger_EnableExperimental", toggleVal))); /*bool enableDebugger = PlayerPrefsExtra.GetBool("QModManager_PrefabDebugger_Enable", true); * __instance.AddToggleOption(modsTab, "Enable prefab debugger", enableDebugger, * new UnityAction<bool>(toggleVal => PlayerPrefsExtra.SetBool("QModManager_PrefabDebugger_Enable", toggleVal)));*/ }
internal static void Postfix(uGUI_OptionsPanel __instance) { ModsTab = __instance.AddTab("Mods"); __instance.AddHeading(ModsTab, "QModManager"); bool enableDebugLogs = PlayerPrefsExtra.GetBool("QModManager_EnableDebugLogs", false); __instance.AddToggleOption(ModsTab, "Enable debug logs", enableDebugLogs, new UnityAction <bool>(toggleVal => PlayerPrefsExtra.SetBool("QModManager_EnableDebugLogs", toggleVal))); bool updateCheck = PlayerPrefsExtra.GetBool("QModManager_EnableUpdateCheck", true); __instance.AddToggleOption(ModsTab, "Check for updates", updateCheck, new UnityAction <bool>(toggleVal => PlayerPrefsExtra.SetBool("QModManager_EnableUpdateCheck", toggleVal))); }
public static void AddJukeBoxTab(uGUI_OptionsPanel oPanel) { if (oPanel != null) { int tabIndex = oPanel.AddTab("Jukebox"); oPanel.AddHeading(tabIndex, "Jukebox Colors"); oPanel.AddToggleOption(tabIndex, "Toggle Jukebox Colors", JukeboxConfig.JBColor, (bool v) => JukeboxConfig.JBColor = ToggleColorChange(v), "Allows you to change the colors of the jukebox lights"); MainStoppedColor = oPanel.AddColorOption(tabIndex, "Color 1", JukeboxConfig.FlashColor0, (Color Color0) => JukeboxConfig.FlashColor0 = Color0); MainColor = oPanel.AddColorOption(tabIndex, "Color 2", JukeboxConfig.FlashColor2, (Color Color2) => JukeboxConfig.FlashColor2 = Color2); BeatColor = oPanel.AddColorOption(tabIndex, "Color 3", JukeboxConfig.FlashColor1, (Color Color1) => JukeboxConfig.FlashColor1 = Color1); oPanel.AddHeading(tabIndex, "Jukebox Options"); oPanel.AddToggleOption(tabIndex, "Toggle Party Mode", JukeboxConfig.PartyMode, (bool partyMode) => JukeboxConfig.PartyMode = partyMode, "Turns the rooms lights off the jukebox is in while playing"); ToggleColorChange(JukeboxConfig.JBColor); } }
private void AddTab() { m_tabIndex = -1; Transform tab; Text tabText; for (int i = 0; i < m_optionsPanel.tabsContainer.childCount; ++i) //search for "Mods" tab { tab = m_optionsPanel.tabsContainer.GetChild(i); tabText = tab.GetComponentInChildren <Text>(true); if (tabText != null && tabText.text == "Mods") { m_tabIndex = i; } } if (m_tabIndex == -1) //no existing mods tab found. add new { m_tabIndex = m_optionsPanel.AddTab("Mods"); } //add options m_optionsPanel.AddHeading(m_tabIndex, "Cyclops Strafe"); //m_optionsPanel.AddHeading(m_tabIndex, "Keyboard"); m_useModifierToggle = m_optionsPanel.AddToggleOption(m_tabIndex, "Use modifier key", m_config.UseModifier, OnStrafeUseModifierToggle); m_useModifierBindingOption = AddBinding(m_tabIndex, "Modifier", GetKeyCodeAsInputName(m_config.StrafeModifierKey), GameInput.Device.Keyboard, OnModifierBindingChange); AddBinding(m_tabIndex, "Strafe left key", GetKeyCodeAsInputName(m_config.StrafeLeftKey), GameInput.Device.Keyboard, OnStrafeLeftBindingChange); AddBinding(m_tabIndex, "Strafe right key", GetKeyCodeAsInputName(m_config.StrafeRightKey), GameInput.Device.Keyboard, OnStrafeRightBindingChange); //m_optionsPanel.AddHeading(m_tabIndex, "Controller"); //AddBinding(m_tabIndex, "Strafe left button", GetKeyCodeAsInputName(m_config.StrafeLeftButton), GameInput.Device.Controller, OnStrafeLeftButtonBindingChange); //AddBinding(m_tabIndex, "Strafe right button", GetKeyCodeAsInputName(m_config.StrafeRightButton), GameInput.Device.Controller, OnStrafeRightButtonBindingChange); //no speed editing for now //m_optionsPanel.AddSliderOption(m_tabIndex, "Strafe speed", m_config.StrafeSpeed, 0.01f, 2f, m_config.StrafeSpeed, OnStrafeSpeedValueChange); m_currentModifierBinding = System.Enum.GetName(typeof(KeyCode), m_config.StrafeModifierKey); m_modifierBindingOption = m_useModifierBindingOption.GetComponentInChildren <uGUI_Binding>(true); if (!m_config.UseModifier) { m_useModifierBindingOption.SetActive(false); } }
internal static void Postfix(uGUI_OptionsPanel __instance) { ModsTab = __instance.AddTab("Mods"); __instance.AddHeading(ModsTab, "QModManager"); __instance.AddToggleOption(ModsTab, "Check for updates", Config.CheckForUpdates, new UnityAction <bool>(value => Config.CheckForUpdates = value)); __instance.AddToggleOption(ModsTab, "Enable console", Config.EnableConsole, new UnityAction <bool>(value => { Config.EnableConsole = value; DevConsole.disableConsole = !value; UnityEngine.PlayerPrefs.SetInt("UWE.DisableConsole", value ? 0 : 1); })); __instance.AddToggleOption(ModsTab, "Enable debug logs", Config.EnableDebugLogs, new UnityAction <bool>(value => Config.EnableDebugLogs = value)); __instance.AddToggleOption(ModsTab, "Enable developer mode", Config.EnableDevMode, new UnityAction <bool>(value => Config.EnableDevMode = value)); }
internal static void AddTabs_Postfix(uGUI_OptionsPanel __instance) { uGUI_OptionsPanel optionsPanel = __instance; // Start the modsTab index at a value of -1 int modsTab = -1; // Loop through all of the tabs for (int i = 0; i < optionsPanel.tabsContainer.childCount; i++) { // Check if they are named "Mods" var text = optionsPanel.tabsContainer.GetChild(i).GetComponentInChildren <Text>(true); if (text != null && text.text == "Mods") { // Set the tab index to the found one and break modsTab = i; break; } } // If no tab was found, create one if (modsTab == -1) { modsTab = optionsPanel.AddTab("Mods"); } // Maybe this could be split into its own file to handle smlhelper options, or maybe it could be removed alltogether optionsPanel.AddHeading(modsTab, "SMLHelper"); optionsPanel.AddToggleOption(modsTab, "Enable debug logs", V2.Logger.EnableDebugging, V2.Logger.SetDebugging); optionsPanel.AddChoiceOption(modsTab, "Extra item info", new string[] { "Mod name (default)", "Mod name and item ID", "Nothing" }, (int)TooltipPatcher.ExtraItemInfoOption, (i) => TooltipPatcher.SetExtraItemInfo((TooltipPatcher.ExtraItemInfo)i)); // adding all other options here modOptions.Values.ForEach(options => options.AddOptionsToPanel(optionsPanel, modsTab)); }
internal static void Postfix(uGUI_OptionsPanel __instance) { ModsTab = __instance.AddTab("Mods"); __instance.AddHeading(ModsTab, "QModManager"); __instance.AddToggleOption(ModsTab, "Check for updates", Config.CheckForUpdates, new UnityAction <bool>(value => Config.CheckForUpdates = value)); __instance.AddToggleOption(ModsTab, "Enable console", Config.EnableConsole, new UnityAction <bool>(value => { Config.EnableConsole = value; #if SUBNAUTICA_STABLE DevConsole.disableConsole = !value; UnityEngine.PlayerPrefs.SetInt("UWE.DisableConsole", value ? 0 : 1); #elif BELOWZERO || SUBNAUTICA_EXP PlatformUtils.SetDevToolsEnabled(value); #endif })); __instance.AddToggleOption(ModsTab, "Enable debug logs", Config.EnableDebugLogs, new UnityAction <bool>(value => Config.EnableDebugLogs = value)); __instance.AddToggleOption(ModsTab, "Enable developer mode", Config.EnableDevMode, new UnityAction <bool>(value => Config.EnableDevMode = value)); }
internal static void AddTabs_Postfix(uGUI_OptionsPanel __instance) { uGUI_OptionsPanel optionsPanel = __instance; // Start the modsTab index at a value of -1 var modsTab = -1; // Loop through all of the tabs for (int i = 0; i < optionsPanel.tabsContainer.childCount; i++) { // Check if they are named "Mods" var text = optionsPanel.tabsContainer.GetChild(i).GetComponentInChildren <Text>(true); if (text != null && text.text == "Mods") { // Set the tab index to the found one and break modsTab = i; break; } } // If no tab was found, create one if (modsTab == -1) { modsTab = optionsPanel.AddTab("Mods"); } // Maybe this could be split into its own file to handle smlhelper options, or maybe it could be removed alltogether optionsPanel.AddHeading(modsTab, "SMLHelper"); optionsPanel.AddToggleOption(modsTab, "Enable debug logs", V2.Logger.EnableDebugging, V2.Logger.SetDebugging); foreach (ModOptions modOption in modOptions.Values) { optionsPanel.AddHeading(modsTab, modOption.Name); foreach (ModOption option in modOption.Options) { switch (option.Type) { case ModOptionType.Slider: var slider = (ModSliderOption)option; optionsPanel.AddSliderOption(modsTab, slider.Label, slider.Value, slider.MinValue, slider.MaxValue, slider.Value, new UnityAction <float>((float sliderVal) => modOption.OnSliderChange(slider.Id, sliderVal))); break; case ModOptionType.Toggle: var toggle = (ModToggleOption)option; optionsPanel.AddToggleOption(modsTab, toggle.Label, toggle.Value, new UnityAction <bool>((bool toggleVal) => modOption.OnToggleChange(toggle.Id, toggleVal))); break; case ModOptionType.Choice: var choice = (ModChoiceOption)option; optionsPanel.AddChoiceOption(modsTab, choice.Label, choice.Options, choice.Index, new UnityAction <int>((int index) => modOption.OnChoiceChange(choice.Id, index, choice.Options[index]))); break; case ModOptionType.Keybind: var keybind = (ModKeybindOption)option; ModKeybindOption.AddBindingOptionWithCallback(optionsPanel, modsTab, keybind.Label, keybind.Key, keybind.Device, new UnityAction <KeyCode>((KeyCode key) => modOption.OnKeybindChange(keybind.Id, key))); break; default: V2.Logger.Log($"Invalid ModOptionType detected for option: {option.Id} ({option.Type.ToString()})", LogLevel.Error); break; } } } }