[add] New ghostrespawn system

This commit is contained in:
rhailrake
2023-04-28 07:13:28 +06:00
committed by Aviu00
parent 35e533b865
commit e458ec9fcd
9 changed files with 119 additions and 0 deletions

View File

@@ -120,6 +120,8 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
Gui.ReturnToBodyPressed += ReturnToBody;
Gui.GhostRolesPressed += GhostRolesPressed;
Gui.TargetWindow.WarpClicked += OnWarpClicked;
Gui.ReturnToRoundPressed += ReturnToRound;
UpdateGui();
}
@@ -133,6 +135,8 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
Gui.ReturnToBodyPressed -= ReturnToBody;
Gui.GhostRolesPressed -= GhostRolesPressed;
Gui.TargetWindow.WarpClicked -= OnWarpClicked;
Gui.ReturnToRoundPressed -= ReturnToRound;
Gui.Hide();
}
@@ -142,6 +146,11 @@ public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSyst
_system?.ReturnToBody();
}
private void ReturnToRound()
{
_system?.ReturnToRound();
}
private void RequestWarps()
{
_system?.RequestWarps();

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="ReturnToRound" Text="{Loc ghost-gui-return-to-round-button}" />
</BoxContainer>
</widgets:GhostGui>

View File

@@ -15,6 +15,9 @@ public sealed partial class GhostGui : UIWidget
public event Action? ReturnToBodyPressed;
public event Action? GhostRolesPressed;
public event Action? ReturnToRoundPressed;
public GhostGui()
{
RobustXamlLoader.Load(this);
@@ -26,6 +29,7 @@ public sealed partial class GhostGui : UIWidget
GhostWarpButton.OnPressed += _ => RequestWarpsPressed?.Invoke();
ReturnToBodyButton.OnPressed += _ => ReturnToBodyPressed?.Invoke();
GhostRolesButton.OnPressed += _ => GhostRolesPressed?.Invoke();
ReturnToRound.OnPressed += _ => ReturnToRoundPressed?.Invoke();
}
public void Hide()