Cleaner BoundUserInterfaces (#17736)
This commit is contained in:
@@ -2,29 +2,28 @@
|
||||
using Content.Shared.APC;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Client.Power.APC
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class ApcBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[ViewVariables] private ApcMenu? _menu;
|
||||
[ViewVariables]
|
||||
private ApcMenu? _menu;
|
||||
|
||||
public ApcBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_menu = new ApcMenu(this,Owner);
|
||||
_menu = new ApcMenu(this);
|
||||
_menu.OnClose += Close;
|
||||
_menu.OpenCentered();
|
||||
}
|
||||
|
||||
public ApcBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
base.UpdateState(state);
|
||||
|
||||
@@ -18,12 +18,12 @@ namespace Content.Client.Power.APC.UI
|
||||
public sealed partial class ApcMenu : FancyWindow
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
public ApcMenu(ApcBoundUserInterface owner, ClientUserInterfaceComponent component)
|
||||
public ApcMenu(ApcBoundUserInterface owner)
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
RobustXamlLoader.Load(this);
|
||||
|
||||
EntityView.Sprite = _entityManager.GetComponent<SpriteComponent>(component.Owner);
|
||||
EntityView.SetEntity(owner.Owner);
|
||||
BreakerButton.OnPressed += _ => owner.BreakerPressed();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user