Cleaner BoundUserInterfaces (#17736)

This commit is contained in:
TemporalOroboros
2023-07-08 09:02:17 -07:00
committed by GitHub
parent 55b4fb1649
commit 3ac4cf85db
137 changed files with 1069 additions and 972 deletions

View File

@@ -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 += _ =>

View File

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