Cleaner BoundUserInterfaces (#17736)
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
using Content.Shared.Gravity;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
|
||||
namespace Content.Client.Gravity.UI
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public sealed class GravityGeneratorBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[ViewVariables]
|
||||
private GravityGeneratorWindow? _window;
|
||||
|
||||
public GravityGeneratorBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base (owner, uiKey)
|
||||
public GravityGeneratorBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace Content.Client.Gravity.UI
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_window = new GravityGeneratorWindow(this, Owner);
|
||||
_window = new GravityGeneratorWindow(this);
|
||||
|
||||
/*
|
||||
_window.Switch.OnPressed += _ =>
|
||||
|
||||
@@ -14,12 +14,12 @@ namespace Content.Client.Gravity.UI
|
||||
|
||||
private readonly GravityGeneratorBoundUserInterface _owner;
|
||||
|
||||
public GravityGeneratorWindow(GravityGeneratorBoundUserInterface ui, ClientUserInterfaceComponent component)
|
||||
public GravityGeneratorWindow(GravityGeneratorBoundUserInterface owner)
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
_owner = ui;
|
||||
_owner = owner;
|
||||
|
||||
OnButton.Group = _buttonGroup;
|
||||
OffButton.Group = _buttonGroup;
|
||||
@@ -27,7 +27,7 @@ namespace Content.Client.Gravity.UI
|
||||
OnButton.OnPressed += _ => _owner.SetPowerSwitch(true);
|
||||
OffButton.OnPressed += _ => _owner.SetPowerSwitch(false);
|
||||
|
||||
EntityView.Sprite = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(component.Owner);
|
||||
EntityView.SetEntity(owner.Owner);
|
||||
}
|
||||
|
||||
public void UpdateState(SharedGravityGeneratorComponent.GeneratorState state)
|
||||
|
||||
Reference in New Issue
Block a user