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:
Jezithyr
2022-10-12 01:16:23 -07:00
committed by GitHub
parent d09fbc1849
commit 571dd4e6d5
168 changed files with 6940 additions and 7817 deletions

View File

@@ -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);
}

View File

@@ -1,13 +1,12 @@
using Content.Shared.CCVar;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Configuration;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Content.Shared.CCVar;
using Robust.Shared.Configuration;
namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles
{
[GenerateTypedNameReferences]

View File

@@ -1,4 +1,3 @@
using System;
using Content.Shared.Ghost.Roles;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;

View File

@@ -1,4 +1,3 @@
using System;
using Content.Shared.Ghost.Roles;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;

View File

@@ -4,8 +4,6 @@ using Content.Shared.Ghost.Roles;
using JetBrains.Annotations;
using Robust.Client.Console;
using Robust.Client.Player;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Utility;
namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles

View File

@@ -1,7 +1,6 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.GameObjects;
using static Robust.Client.UserInterface.Controls.BaseButton;
namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles