Skip to content

Commit

Permalink
Allows to close the vessel comms report from the toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
rockfactory committed Feb 17, 2024
1 parent c630dc7 commit 1cd26c9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Binary file modified plugin_template/assets/bundles/commnext_ui.bundle
Binary file not shown.
8 changes: 8 additions & 0 deletions src/CommNext/UI/MapToolbarWindowController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ private void OnEnable()
_vesselReportButton = _root.Q<Button>("vessel-report-button");
_vesselReportButton.clicked += () =>
{
// If the vessel report window is already open, close it
if (MainUIManager.Instance.VesselReportWindow!.IsWindowOpen)
{
MainUIManager.Instance.VesselReportWindow.IsWindowOpen = false;
return;
}
// Else, open it for the active vessel
if (!GameManager.Instance.Game.ViewController.TryGetActiveSimVessel(out var vessel))
{
Logger.LogWarning("No active vessel found");
Expand Down
4 changes: 1 addition & 3 deletions src/CommNext/UI/VesselReportWindowController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ public bool IsWindowOpen
}
else
{
_vessel = null;
var instance = ConnectionsRenderer.Instance;
if (instance != null) instance.ReportVessel = null;
Vessel = null;
}

MainUIManager.Instance.MapToolbarWindow!.UpdateButtonState();
Expand Down

0 comments on commit 1cd26c9

Please sign in to comment.