From 211493d57ab324f0ed1c07bdf1485bd27e70f4fc Mon Sep 17 00:00:00 2001 From: Falki <72734856+Falki-git@users.noreply.github.com> Date: Thu, 7 Sep 2023 20:40:41 +0200 Subject: [PATCH] Add Appbar.RegisterKSCAppButton example Needs https://github.com/SpaceWarpDev/SpaceWarp/pull/261 --- .../src/SpaceWarpMod/SpaceWarpModPlugin.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/SpaceWarp.Template/templates/SpaceWarpMod/src/SpaceWarpMod/SpaceWarpModPlugin.cs b/SpaceWarp.Template/templates/SpaceWarpMod/src/SpaceWarpMod/SpaceWarpModPlugin.cs index b7064f9..8b9bee6 100644 --- a/SpaceWarp.Template/templates/SpaceWarpMod/src/SpaceWarpMod/SpaceWarpModPlugin.cs +++ b/SpaceWarp.Template/templates/SpaceWarpMod/src/SpaceWarpMod/SpaceWarpModPlugin.cs @@ -29,6 +29,7 @@ public class SpaceWarpModPlugin : BaseSpaceWarpPlugin // AppBar button IDs private const string ToolbarFlightButtonID = "BTN-SpaceWarpModFlight"; private const string ToolbarOabButtonID = "BTN-SpaceWarpModOAB"; + private const string ToolbarKscButtonID = "BTN-SpaceWarpModKSC"; // Singleton instance of the plugin class public static SpaceWarpModPlugin Instance { get; set; } @@ -56,6 +57,17 @@ public override void OnInitialized() // Register OAB AppBar Button Appbar.RegisterOABAppButton( + ModName, + ToolbarKscButtonID, + AssetManager.GetAsset($"{Info.Metadata.GUID}/images/icon.png"), + () => + { + _isWindowOpen = !_isWindowOpen; + } + ); + + // Register KSC AppBar Button + Appbar.RegisterKSCAppButton( ModName, ToolbarOabButtonID, AssetManager.GetAsset($"{Info.Metadata.GUID}/images/icon.png"),