Skip to content

Commit

Permalink
Add Appbar.RegisterKSCAppButton example
Browse files Browse the repository at this point in the history
  • Loading branch information
Falki-git authored Sep 7, 2023
1 parent 8c8c897 commit 211493d
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down Expand Up @@ -56,6 +57,17 @@ public override void OnInitialized()

// Register OAB AppBar Button
Appbar.RegisterOABAppButton(
ModName,
ToolbarKscButtonID,
AssetManager.GetAsset<Texture2D>($"{Info.Metadata.GUID}/images/icon.png"),
() =>
{
_isWindowOpen = !_isWindowOpen;
}
);

// Register KSC AppBar Button
Appbar.RegisterKSCAppButton(
ModName,
ToolbarOabButtonID,
AssetManager.GetAsset<Texture2D>($"{Info.Metadata.GUID}/images/icon.png"),
Expand Down

0 comments on commit 211493d

Please sign in to comment.