public static void AddGeneralTab_Postfix(uGUI_OptionsPanel __instance) { __instance.AddHeading(MainPatcher.tabIndex, "Additional VR Options"); __instance.AddToggleOption(MainPatcher.tabIndex, "Enable VR Animations", GameOptions.enableVrAnimations, delegate(bool v) { GameOptions.enableVrAnimations = v; if (Player.main != null) { Player.main.playerAnimator.SetBool("vr_active", !v); } }); __instance.AddToggleOption(MainPatcher.tabIndex, "Look Down for HUD", MainPatcher.lookDownHUD, delegate(bool v) { MainPatcher.lookDownHUD = v; if (!v && MainPatcher.quickSlots != null && MainPatcher.barsPanel != null) { MainPatcher.quickSlots.transform.localScale = Vector3.one; MainPatcher.barsPanel.transform.localScale = Vector3.one; } }); #if SN1 __instance.AddSliderOption(MainPatcher.tabIndex, "Walk Speed(Default: 60%)", VROptions.groundMoveScale * 100f, 50f, 100f, 60f, delegate(float v) { VROptions.groundMoveScale = v / 100f; }); #elif BZ __instance.AddSliderOption(MainPatcher.tabIndex, "Walk Speed(Default: 60%)", VROptions.groundMoveScale * 100f, 50f, 100f, 60f, 1f, delegate(float v) { VROptions.groundMoveScale = v / 100f; }, SliderLabelMode.Int, "0"); #endif }
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; } } } }
//TODO: Create a new tab instead of using general for all the additional VR options and if possible move existing VR to the same tab static void Postfix(uGUI_OptionsPanel __instance) { __instance.AddHeading(generalTabIndex, "Additional VR Options");//add new heading under the General Tab __instance.AddToggleOption(generalTabIndex, "Enable VR Animations", GameOptions.enableVrAnimations, delegate(bool v) { GameOptions.enableVrAnimations = v; //playerAnimator vr_active is normally set in the Start function of Player so we need to update it if option changed during gameplay if (Player.main != null) { Player.main.playerAnimator.SetBool("vr_active", !v); } }); __instance.AddSliderOption(generalTabIndex, "Walk Speed(Default: 60%)", VROptions.groundMoveScale * 100, 50, 100, 60, delegate(float v) { VROptions.groundMoveScale = v / 100f; }); __instance.AddSliderOption(generalTabIndex, "Subtitle Height", subtitleYPos, 20, 75, 50, delegate(float v) { subtitleYPos = v; UIElementsFixes.SetSubtitleHeight(subtitleYPos); }); __instance.AddSliderOption(generalTabIndex, "Subtitle Scale", subtitleScale * 100, 50, 150, 100, delegate(float v) { subtitleScale = v / 100; UIElementsFixes.SetSubtitleScale(subtitleScale); }); __instance.AddSliderOption(generalTabIndex, "PDA Distance", PDA_Distance * 100f, 25, 40, 40, delegate(float v) { PDA_Distance = v / 100f; }); __instance.AddHeading(generalTabIndex, "VR HUD Options");//add new heading under the General Tab __instance.AddToggleOption(generalTabIndex, "Dynamic HUD", DynamicHUD, delegate(bool v) { DynamicHUD = v; if (!DynamicHUD) { VRHUD.UpdateHUDOpacity(HUDAlpha); } }); __instance.AddSliderOption(generalTabIndex, "HUD Opacity", HUDAlpha * 100f, 20, 100, 100, delegate(float v) { HUDAlpha = v / 100f; VRHUD.UpdateHUDOpacity(HUDAlpha); }); __instance.AddSliderOption(generalTabIndex, "HUD Distance", HUD_Distance / 0.5f, 1, 4, 2, delegate(float v) { HUD_Distance = v * 0.5f; VRHUD.UpdateHUDDistance(HUD_Distance); }); __instance.AddSliderOption(generalTabIndex, "HUD Scale", HUD_Scale / 0.5f, 1, 4, 2, delegate(float v) { HUD_Scale = v * 0.5f; VRHUD.UpdateHUDScale(HUD_Scale); }); }
static void Postfix(uGUI_OptionsPanel __instance) { __instance.AddHeading(generalTabIndex, "Misc VR Options"); __instance.AddToggleOption(generalTabIndex, "Disable Y-Axis Input", VROptions.disableInputPitch, (bool v) => VROptions.disableInputPitch = v); __instance.AddSliderOption(generalTabIndex, "Ground Speed Scale", VROptions.groundMoveScale, 0.6f, (float v) => { if (v <= 0f) { // Never allow 0 scale speed (immobile) v = .05f; } VROptions.groundMoveScale = v; } ); }
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; } } } }
public static void Postfix(uGUI_OptionsPanel __instance) { if (nullableModsTabIndex.HasValue) { var modsTabIndex = nullableModsTabIndex.Value; __instance.AddHeading(modsTabIndex, $"Terraforming"); #if BelowZero __instance.AddToggleOption(modsTabIndex, $"Rebuilding messages", Config.Instance.rebuildMessages, new UnityAction <bool>(value => Config.Instance.rebuildMessages = value), $"Shows terrain rebuilding message while terrain rebuilding is in progress. Enabled by default." ); __instance.AddToggleOption(modsTabIndex, $"Habitant modules burying", Config.Instance.habitantModulesPartialBurying, new UnityAction <bool>(value => Config.Instance.habitantModulesPartialBurying = value), $"Allows habitat burying into terrain and adjusts overlapping terrain around them. Enabled by default." ); __instance.AddSliderOption(modsTabIndex, $"Space between terrain and module", Config.Instance.spaceBetweenTerrainHabitantModule, 0.0f, 10.0f, DefaultConfig.spaceBetweenTerrainHabitantModule, 0.5f, new UnityAction <float>(value => Config.Instance.spaceBetweenTerrainHabitantModule = value), SliderLabelMode.Float, "0.0" ); __instance.AddToggleOption(modsTabIndex, $"Propulsion cannon terrain impact", Config.Instance.terrainImpactWithPropulsionCannon, new UnityAction <bool>(value => Config.Instance.terrainImpactWithPropulsionCannon = value), $"Causes the repulsion cannon to remove small portion of terrain after \"shooting\" pulse to spot. Enabled by default." ); __instance.AddToggleOption(modsTabIndex, $"Destroy obstacles on construction", Config.Instance.destroyLargerObstaclesOnConstruction, new UnityAction <bool>(value => Config.Instance.destroyLargerObstaclesOnConstruction = value), $"Disables restrictions of overlapping larger objects with placable habitat module. Destroys them when construction of module finishes. Enabled by default." ); #else __instance.AddToggleOption(modsTabIndex, $"Rebuilding messages", Config.Instance.rebuildMessages, new UnityAction <bool>(value => Config.Instance.rebuildMessages = value) ); __instance.AddToggleOption(modsTabIndex, $"Habitant modules burying", Config.Instance.habitantModulesPartialBurying, new UnityAction <bool>(value => Config.Instance.habitantModulesPartialBurying = value) ); __instance.AddSliderOption(modsTabIndex, $"Terrain vs module space", Config.Instance.spaceBetweenTerrainHabitantModule, 0.0f, 10.0f, DefaultConfig.spaceBetweenTerrainHabitantModule, new UnityAction <float>(value => Config.Instance.spaceBetweenTerrainHabitantModule = value) ); __instance.AddToggleOption(modsTabIndex, $"Repulsion terrain impact", Config.Instance.terrainImpactWithPropulsionCannon, new UnityAction <bool>(value => Config.Instance.terrainImpactWithPropulsionCannon = value) ); __instance.AddToggleOption(modsTabIndex, $"Destroy obstacles", Config.Instance.destroyLargerObstaclesOnConstruction, new UnityAction <bool>(value => Config.Instance.destroyLargerObstaclesOnConstruction = value) ); #endif } }
// Class: uGUI_OptionsPanel public static void AddGeneralTab_Postfix(uGUI_OptionsPanel __instance) { __instance.AddHeading(tabIndex, "Additional VR Options");//add new heading under the General Tab __instance.AddToggleOption(tabIndex, "Enable VR Animations", GameOptions.enableVrAnimations, delegate(bool v) { GameOptions.enableVrAnimations = v; //playerAnimator vr_active is normally set in the Start function of Player so we need to update it if option changed during gameplay if (Player.main != null) { Player.main.playerAnimator.SetBool("vr_active", !v); } }); __instance.AddToggleOption(tabIndex, "Look Down for HUD", lookDownHUD, delegate(bool v) { lookDownHUD = v; //immediated reenable the HUD if option toggled off if (!v && quickSlots != null && barsPanel != null) { MainPatcher.ConfigureHUD(1.0f); } }); __instance.AddSliderOption(tabIndex, "Walk Speed (Default: 60%)", VROptions.groundMoveScale * 100, 50, 100, 60, delegate(float v) { VROptions.groundMoveScale = v / 100f; }); /* Weird stuff was happening if the PDA was opened and when entering the Seamoth when pitch was changed with the mouse or controller * __instance.AddToggleOption(tabIndex, "Enable Pitch Control", !VROptions.disableInputPitch, delegate (bool v) * { * VROptions.disableInputPitch = !v; * //reset pitch to zero if pitch control is disabled. * if (VROptions.disableInputPitch) * { * Player.main.GetComponentInChildren<MainCameraControl>().ResetCamera(); * } * });*/ __instance.AddHeading(MainPatcher.tabIndex, "VR HUD"); __instance.AddSliderOption(MainPatcher.tabIndex, "Subtitles Vertical Offset", MainPatcher.subtitlesVerticalOffset, -1000f, 1000f, 800f, delegate(float v) { MainPatcher.subtitlesVerticalOffset = v; }); __instance.AddSliderOption(MainPatcher.tabIndex, "Subtitles Scale", MainPatcher.subtitlesScale * 100f, 10f, 200f, 100f, delegate(float v) { MainPatcher.subtitlesScale = v / 100f; }); __instance.AddSliderOption(MainPatcher.tabIndex, "PDA Scale", MainPatcher.pdaScale * 100f, 10f, 200f, 128f, delegate(float v) { MainPatcher.pdaScale = v / 100f; }); __instance.AddSliderOption(MainPatcher.tabIndex, "Menu Vertical Offset", MainPatcher.mainMenuVerticalOffset, -1000f, 1000f, 800f, delegate(float v) { MainPatcher.mainMenuVerticalOffset = v; }); foreach (KeyValuePair <string, HUDElementConfig> ElementConfig in HUDElements) { string LabelPrefix = ElementConfig.Key + " "; __instance.AddSliderOption(MainPatcher.tabIndex, LabelPrefix + "Horizontal Offset", ElementConfig.Value.Offset.x, -999f, 999f, 0f, delegate(float v) { ElementConfig.Value.Offset.x = v; }); __instance.AddSliderOption(MainPatcher.tabIndex, LabelPrefix + "Vertical Offset", ElementConfig.Value.Offset.y, -999f, 999f, 0f, delegate(float v) { ElementConfig.Value.Offset.y = v; }); __instance.AddSliderOption(MainPatcher.tabIndex, LabelPrefix + "Scale", ElementConfig.Value.Scale * 100f, 5f, 200f, 1f, delegate(float v) { ElementConfig.Value.Scale = v / 100f; }); } }