Add toggle ghost visibility button to ghost GUI (#12325)

* Add toggle ghost visibility button to ghosts

* Rename to toggleghosts
This commit is contained in:
Jacob Tong
2022-11-01 18:14:06 -07:00
committed by GitHub
parent 4cb96dba6d
commit 9f485d7124
6 changed files with 41 additions and 0 deletions

View File

@@ -99,6 +99,7 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
Gui.RequestWarpsPressed += RequestWarps;
Gui.ReturnToBodyPressed += ReturnToBody;
Gui.GhostRolesPressed += GhostRolesPressed;
Gui.ToggleGhostVisibility += ToggleGhostVisibility;
Gui.TargetWindow.WarpClicked += OnWarpClicked;
UpdateGui();
@@ -112,6 +113,7 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
Gui.RequestWarpsPressed -= RequestWarps;
Gui.ReturnToBodyPressed -= ReturnToBody;
Gui.GhostRolesPressed -= GhostRolesPressed;
Gui.ToggleGhostVisibility -= ToggleGhostVisibility;
Gui.TargetWindow.WarpClicked -= OnWarpClicked;
Gui.Hide();
@@ -133,4 +135,9 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
{
_system?.OpenGhostRoles();
}
private void ToggleGhostVisibility()
{
_system?.ToggleGhostVisibility();
}
}

View File

@@ -5,5 +5,6 @@
<Button Name="ReturnToBodyButton" Text="{Loc ghost-gui-return-to-body-button}" />
<Button Name="GhostWarpButton" Text="{Loc ghost-gui-ghost-warp-button}" />
<Button Name="GhostRolesButton" />
<Button Name="ToggleGhostVisibilityButton" Text="{Loc ghost-gui-toggle-ghost-visibility-button}" />
</BoxContainer>
</widgets:GhostGui>

View File

@@ -14,6 +14,7 @@ public sealed partial class GhostGui : UIWidget
public event Action? RequestWarpsPressed;
public event Action? ReturnToBodyPressed;
public event Action? GhostRolesPressed;
public event Action? ToggleGhostVisibility;
public GhostGui()
{
@@ -26,6 +27,7 @@ public sealed partial class GhostGui : UIWidget
GhostWarpButton.OnPressed += _ => RequestWarpsPressed?.Invoke();
ReturnToBodyButton.OnPressed += _ => ReturnToBodyPressed?.Invoke();
GhostRolesButton.OnPressed += _ => GhostRolesPressed?.Invoke();
ToggleGhostVisibilityButton.OnPressed += _ => ToggleGhostVisibility?.Invoke();
}
public void Hide()