mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
bump
This commit is contained in:
parent
24d8c6a3ec
commit
65d325d4fd
11 changed files with 277 additions and 109 deletions
63
Blackout/Integrations/BTKUIAddon.cs
Normal file
63
Blackout/Integrations/BTKUIAddon.cs
Normal file
|
@ -0,0 +1,63 @@
|
|||
using BTKUILib;
|
||||
using BTKUILib.UIObjects;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace NAK.Melons.Blackout;
|
||||
|
||||
public static class BTKUIAddon
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
public static void Init()
|
||||
{
|
||||
//Add myself to the Misc Menu
|
||||
Page miscPage = QuickMenuAPI.MiscTabPage;
|
||||
Category miscCategory = miscPage.AddCategory(Blackout.SettingsCategory);
|
||||
|
||||
AddMelonToggle(ref miscCategory, Blackout.m_entryEnabled);
|
||||
|
||||
//Add my own page to not clog up Misc Menu
|
||||
|
||||
Page blackoutPage = miscCategory.AddPage("Blackout Settings", "", "Configure the settings for Blackout.", "Blackout");
|
||||
blackoutPage.MenuTitle = "Blackout Settings";
|
||||
blackoutPage.MenuSubtitle = "Dim screen after set time of sitting still, or configure with manual control. Should be nice for VR sleeping.";
|
||||
|
||||
Category blackoutCategory = blackoutPage.AddCategory("Blackout");
|
||||
|
||||
AddMelonToggle(ref blackoutCategory, Blackout.m_entryEnabled);
|
||||
|
||||
//manual state changing
|
||||
var state_Awake = blackoutCategory.AddButton("Awake State", null, "Enter the Awake State.");
|
||||
state_Awake.OnPress += () => BlackoutController.Instance?.ChangeBlackoutState(BlackoutController.BlackoutState.Awake);
|
||||
var state_Drowsy = blackoutCategory.AddButton("Drowsy State", null, "Enter the Drowsy State.");
|
||||
state_Drowsy.OnPress += () => BlackoutController.Instance?.ChangeBlackoutState(BlackoutController.BlackoutState.Drowsy);
|
||||
var state_Sleeping = blackoutCategory.AddButton("Sleeping State", null, "Enter the Sleeping State.");
|
||||
state_Sleeping.OnPress += () => BlackoutController.Instance?.ChangeBlackoutState(BlackoutController.BlackoutState.Sleeping);
|
||||
|
||||
//dimming strength
|
||||
AddMelonSlider(ref blackoutPage, Blackout.m_entryDrowsyDimStrength, 0f, 1f);
|
||||
|
||||
//velocity dim multiplier
|
||||
AddMelonToggle(ref blackoutCategory, Blackout.m_entryDrowsyVelocityMultiplier);
|
||||
|
||||
//hud messages
|
||||
AddMelonToggle(ref blackoutCategory, Blackout.m_entryHudMessages);
|
||||
|
||||
//lower fps while sleep (desktop)
|
||||
AddMelonToggle(ref blackoutCategory, Blackout.m_entryDropFPSOnSleep);
|
||||
|
||||
//auto sleep state
|
||||
AddMelonToggle(ref blackoutCategory, Blackout.m_entryAutoSleepState);
|
||||
|
||||
//i will add the rest of the settings once BTKUILib supports int input
|
||||
}
|
||||
|
||||
private static void AddMelonToggle(ref Category category, MelonLoader.MelonPreferences_Entry<bool> entry)
|
||||
{
|
||||
category.AddToggle(entry.DisplayName, entry.Description, entry.Value).OnValueUpdated += b => entry.Value = b;
|
||||
}
|
||||
|
||||
private static void AddMelonSlider(ref Page page, MelonLoader.MelonPreferences_Entry<float> entry, float min, float max)
|
||||
{
|
||||
page.AddSlider(entry.DisplayName, entry.Description, entry.Value, min, max).OnValueUpdated += f => entry.Value = f;
|
||||
}
|
||||
}
|
29
Blackout/Integrations/UIExpansionKitAddon.cs
Normal file
29
Blackout/Integrations/UIExpansionKitAddon.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using UIExpansionKit.API;
|
||||
|
||||
namespace NAK.Melons.Blackout;
|
||||
public static class UIExpansionKitAddon
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
public static void Init()
|
||||
{
|
||||
/**
|
||||
ive spent hours debugging this, and no matter what the buttons wont actually call the actions
|
||||
from logging shit to straight up closing the game, nothing
|
||||
|
||||
implementing btkuilib support, but gonna leave this shit as a reminder why to not use uiexpansionkit
|
||||
also because it **used to work**... a game update broke it and uiexpansionkit hasnt updated since
|
||||
|
||||
what pisses me off more, is that DesktopVRSwitch works, and that was originally copied from Blackout -_-
|
||||
https://github.com/NotAKidOnSteam/DesktopVRSwitch/blob/main/DesktopVRSwitch/UIExpansionKitAddon.cs
|
||||
**/
|
||||
var settings = ExpansionKitApi.GetSettingsCategory(Blackout.SettingsCategory);
|
||||
settings.AddSimpleButton("Awake State", AwakeState);
|
||||
settings.AddSimpleButton("Drowsy State", DrowsyState);
|
||||
settings.AddSimpleButton("Sleep State", SleepingState);
|
||||
}
|
||||
//UIExpansionKit actions
|
||||
internal static void AwakeState() => BlackoutController.Instance?.ChangeBlackoutState(BlackoutController.BlackoutState.Awake);
|
||||
internal static void DrowsyState() => BlackoutController.Instance?.ChangeBlackoutState(BlackoutController.BlackoutState.Drowsy);
|
||||
internal static void SleepingState() => BlackoutController.Instance?.ChangeBlackoutState(BlackoutController.BlackoutState.Sleeping);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue