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 0f4e435 commit 7921777
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 @@ -66,6 +67,17 @@ public override void OnInitialized()
}
);

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

// Register all Harmony patches in the project
Harmony.CreateAndPatchAll(typeof(SpaceWarpModPlugin).Assembly);

Expand Down

0 comments on commit 7921777

Please sign in to comment.