Skip to content

Commit

Permalink
Merge pull request #22 from Bit-Studios/version-042
Browse files Browse the repository at this point in the history
Make UI reappear when leaving Flight/Map view
  • Loading branch information
NathanPeake authored Mar 19, 2023
2 parents a7badc2 + b025fd9 commit b144778
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/CommunityFixesMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class CommunityFixesMod : BaseSpaceWarpPlugin
{
public const string ModGuid = "com.github.communityfixes";
public const string ModName = "Community Fixes";
public const string ModVer = "0.4.1";
public const string ModVer = "0.4.2";

private static readonly Assembly Assembly = typeof(CommunityFixesMod).Assembly;
private CommunityFixesConfig _config;
Expand Down
9 changes: 9 additions & 0 deletions src/Fix/F2HideUIFix/F2HideUIFix.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using HarmonyLib;
using KSP.Game;
using KSP.Messages;
using KSP.UI.Flight;

namespace CommunityFixes.Fix.F2HideUIFix;
Expand All @@ -10,6 +11,14 @@ public class F2HideUIFix: BaseFix
public override void OnInitialized()
{
_harmony.PatchAll(typeof(F2HideUIFix));
Game.Messages.Subscribe<GameStateEnteredMessage>(msg =>
{
var message = (GameStateEnteredMessage)msg;
if (message.StateBeingEntered != GameState.FlightView && message.StateBeingEntered != GameState.Map3DView)
{
Game.UI.GetRootCanvas().worldCamera.enabled = true;
}
});
}

[HarmonyPatch(typeof(UIFlightHud), nameof(UIFlightHud.OnFlightHudCanvasActiveChanged))]
Expand Down
4 changes: 2 additions & 2 deletions swinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"name": "Community Fixes",
"description": "Community project that aims to bring together bug fixes for KSP 2.",
"source": "https://github.com/Bit-Studios/CommunityFixes",
"version": "0.4.0",
"version": "0.4.2",
"dependencies": [
{
"id": "SpaceWarp",
"version": {
"min": "0.4.1",
"min": "0.4.0",
"max": "*"
}
}
Expand Down

0 comments on commit b144778

Please sign in to comment.