From 79217779e9e5747f08d2d91c1d24291820761566 Mon Sep 17 00:00:00 2001 From: Falki <72734856+Falki-git@users.noreply.github.com> Date: Thu, 7 Sep 2023 20:45:45 +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..0e8d96e 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; } @@ -66,6 +67,17 @@ public override void OnInitialized() } ); + // Register KSC AppBar Button + Appbar.RegisterKSCAppButton( + ModName, + ToolbarKscButtonID, + AssetManager.GetAsset($"{Info.Metadata.GUID}/images/icon.png"), + () => + { + _isWindowOpen = !_isWindowOpen; + } + ); + // Register all Harmony patches in the project Harmony.CreateAndPatchAll(typeof(SpaceWarpModPlugin).Assembly);