Skip to content

Commit

Permalink
Fix OAB for realsies
Browse files Browse the repository at this point in the history
  • Loading branch information
cheese3660 committed Jun 27, 2023
1 parent 957ad03 commit 474dc84
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions SpaceWarp/Backend/UI/Appbar/AppbarBackend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ private static GameObject CreateOABTray()
?.SetValue(tooltip, "App Tray");

// Clone the tray from the flight UI.
var trayButton = GameManager.Instance.Game.UI.GetPopupCanvas().gameObject.GetChild("BTN-App-Tray");
var trayButton = GameManager.Instance.Game.UI.GetScaledPopupCanvas().gameObject.GetChild("BTN-App-Tray");
var oabTray = UnityObject.Instantiate(trayButton.GetChild("appbar-others-group"), oabTrayButton.transform);
oabTray.name = "OAB-AppTray";

Expand Down Expand Up @@ -258,7 +258,11 @@ public static void AddOABButton(string buttonText, Sprite buttonIcon, string but

// Add our function call to the toggle.
var utoggle = appButton.GetComponent<ToggleExtended>();
utoggle.onValueChanged.AddListener(state => function(state));
utoggle.onValueChanged.AddListener(state =>
{
Logger.LogInfo($"{buttonId}({state})");
function(state);
});

// Set the initial state of the button.
var toggle = appButton.GetComponent<UIValue_WriteBool_Toggle>();
Expand All @@ -268,7 +272,7 @@ public static void AddOABButton(string buttonText, Sprite buttonIcon, string but
void Action() => SetOABTrayState(false);
appButton.GetComponent<UIAction_Void_Toggle>().BindAction(new DelegateAction((Action)Action));

Logger.LogInfo($"Added appbar button: {buttonId}");
Logger.LogInfo($"Added OAB appbar button: {buttonId}");
}

private static void SetOABTrayState(bool state)
Expand Down
2 changes: 1 addition & 1 deletion SpaceWarp/SpaceWarp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageReference Include="BepInEx.BaseLib" Version="5.4.21" Publicize="true" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="2.1.0" PrivateAssets="all" />
<PackageReference Include="HarmonyX" Version="2.10.1" />
<PackageReference Include="KerbalSpaceProgram2.GameLibs" Version="0.1.2" Publicize="true" PrivateAssets="all" />
<PackageReference Include="KerbalSpaceProgram2.GameLibs" Version="0.1.3" Publicize="true" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.5.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="UitkForKsp2" Version="1.2.0" />
Expand Down
Binary file not shown.

0 comments on commit 474dc84

Please sign in to comment.