Fix solution EUIs (#20033)
This commit is contained in:
@@ -21,14 +21,14 @@ namespace Content.Client.Administration.UI.ManageSolutions
|
|||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
|
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
|
||||||
|
|
||||||
private readonly EntityUid _targetEntity;
|
private readonly NetEntity _targetEntity;
|
||||||
private string _targetSolution;
|
private string _targetSolution;
|
||||||
private ReagentPrototype? _selectedReagent;
|
private ReagentPrototype? _selectedReagent;
|
||||||
|
|
||||||
// FloatSpinBox does not (yet?) play nice with xaml
|
// FloatSpinBox does not (yet?) play nice with xaml
|
||||||
private FloatSpinBox _quantitySpin = new(1, 2) { Value = 10, HorizontalExpand = true};
|
private FloatSpinBox _quantitySpin = new(1, 2) { Value = 10, HorizontalExpand = true};
|
||||||
|
|
||||||
public AddReagentWindow(EntityUid targetEntity, string targetSolution)
|
public AddReagentWindow(NetEntity targetEntity, string targetSolution)
|
||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
|
|||||||
@@ -12,11 +12,9 @@ namespace Content.Client.Administration.UI.ManageSolutions
|
|||||||
public sealed class EditSolutionsEui : BaseEui
|
public sealed class EditSolutionsEui : BaseEui
|
||||||
{
|
{
|
||||||
private readonly EditSolutionsWindow _window;
|
private readonly EditSolutionsWindow _window;
|
||||||
private IEntityManager _entManager;
|
|
||||||
|
|
||||||
public EditSolutionsEui()
|
public EditSolutionsEui()
|
||||||
{
|
{
|
||||||
_entManager = IoCManager.Resolve<IEntityManager>();
|
|
||||||
_window = new EditSolutionsWindow();
|
_window = new EditSolutionsWindow();
|
||||||
_window.OnClose += () => SendMessage(new CloseEuiMessage());
|
_window.OnClose += () => SendMessage(new CloseEuiMessage());
|
||||||
}
|
}
|
||||||
@@ -36,7 +34,7 @@ namespace Content.Client.Administration.UI.ManageSolutions
|
|||||||
public override void HandleState(EuiStateBase baseState)
|
public override void HandleState(EuiStateBase baseState)
|
||||||
{
|
{
|
||||||
var state = (EditSolutionsEuiState) baseState;
|
var state = (EditSolutionsEuiState) baseState;
|
||||||
_window.SetTargetEntity(_entManager.GetEntity(state.Target));
|
_window.SetTargetEntity(state.Target);
|
||||||
_window.UpdateSolutions(state.Solutions);
|
_window.UpdateSolutions(state.Solutions);
|
||||||
_window.UpdateReagents();
|
_window.UpdateReagents();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Content.Client.Administration.UI.ManageSolutions
|
|||||||
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
|
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
|
|
||||||
private EntityUid _target = EntityUid.Invalid;
|
private NetEntity _target = NetEntity.Invalid;
|
||||||
private string? _selectedSolution;
|
private string? _selectedSolution;
|
||||||
private AddReagentWindow? _addReagentWindow;
|
private AddReagentWindow? _addReagentWindow;
|
||||||
private Dictionary<string, Solution>? _solutions;
|
private Dictionary<string, Solution>? _solutions;
|
||||||
@@ -38,12 +38,13 @@ namespace Content.Client.Administration.UI.ManageSolutions
|
|||||||
_addReagentWindow?.Dispose();
|
_addReagentWindow?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetTargetEntity(EntityUid target)
|
public void SetTargetEntity(NetEntity target)
|
||||||
{
|
{
|
||||||
_target = target;
|
_target = target;
|
||||||
|
var uid = _entityManager.GetEntity(target);
|
||||||
|
|
||||||
var targetName = _entityManager.EntityExists(target)
|
var targetName = _entityManager.EntityExists(uid)
|
||||||
? IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(target).EntityName
|
? _entityManager.GetComponent<MetaDataComponent>(uid).EntityName
|
||||||
: string.Empty;
|
: string.Empty;
|
||||||
|
|
||||||
Title = Loc.GetString("admin-solutions-window-title", ("targetName", targetName));
|
Title = Loc.GetString("admin-solutions-window-title", ("targetName", targetName));
|
||||||
|
|||||||
Reference in New Issue
Block a user