Hud refactor (#7202)
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com> Co-authored-by: Jezithyr <jmaster9999@gmail.com> Co-authored-by: Jezithyr <Jezithyr@gmail.com> Co-authored-by: Visne <39844191+Visne@users.noreply.github.com> Co-authored-by: wrexbe <wrexbe@protonmail.com> Co-authored-by: wrexbe <81056464+wrexbe@users.noreply.github.com>
This commit is contained in:
@@ -10,15 +10,13 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class GhostTargetWindow : DefaultWindow
|
||||
{
|
||||
private readonly IEntityNetworkManager _netManager;
|
||||
|
||||
private List<(string, EntityUid)> _warps = new();
|
||||
|
||||
public GhostTargetWindow(IEntityNetworkManager netManager)
|
||||
public event Action<EntityUid>? WarpClicked;
|
||||
|
||||
public GhostTargetWindow()
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
|
||||
_netManager = netManager;
|
||||
}
|
||||
|
||||
public void UpdateWarps(IEnumerable<GhostWarp> warps)
|
||||
@@ -47,7 +45,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls
|
||||
|
||||
private void AddButtons()
|
||||
{
|
||||
foreach (var (name, warp) in _warps)
|
||||
foreach (var (name, warpTarget) in _warps)
|
||||
{
|
||||
var currentButtonRef = new Button
|
||||
{
|
||||
@@ -60,11 +58,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls
|
||||
ClipText = true,
|
||||
};
|
||||
|
||||
currentButtonRef.OnPressed += _ =>
|
||||
{
|
||||
var msg = new GhostWarpToTargetRequestEvent(warp);
|
||||
_netManager.SendSystemNetworkMessage(msg);
|
||||
};
|
||||
currentButtonRef.OnPressed += _ => WarpClicked?.Invoke(warpTarget);
|
||||
|
||||
ButtonContainer.AddChild(currentButtonRef);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user