Add a container display to dispenser UI (#25391)
* Implemented contents display for dispenser UI * Update Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml.cs Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> * Resolve the netent into a euid first --------- Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com>
This commit is contained in:
@@ -32,19 +32,22 @@
|
||||
StyleClasses="OpenLeft"/>
|
||||
</BoxContainer>
|
||||
<Control MinSize="0 10"/>
|
||||
<ScrollContainer HScrollEnabled="False" HorizontalExpand="True" VerticalExpand="True" MinSize="0 160">
|
||||
<PanelContainer VerticalExpand="True"
|
||||
SizeFlagsStretchRatio="6"
|
||||
MinSize="0 150">
|
||||
<PanelContainer.PanelOverride>
|
||||
<gfx:StyleBoxFlat BackgroundColor="#1b1b1e" />
|
||||
</PanelContainer.PanelOverride>
|
||||
<BoxContainer Name="ContainerInfo"
|
||||
Orientation="Vertical"
|
||||
HorizontalExpand="True">
|
||||
<Label Text="{Loc 'reagent-dispenser-window-no-container-loaded-text'}"/>
|
||||
</BoxContainer>
|
||||
</PanelContainer>
|
||||
</ScrollContainer>
|
||||
<BoxContainer Orientation="Horizontal">
|
||||
<SpriteView Name="View" Scale="4 4" MinSize="150 150"/>
|
||||
<ScrollContainer HScrollEnabled="False" HorizontalExpand="True" VerticalExpand="True" MinSize="0 160">
|
||||
<PanelContainer VerticalExpand="True"
|
||||
SizeFlagsStretchRatio="6"
|
||||
MinSize="0 150">
|
||||
<PanelContainer.PanelOverride>
|
||||
<gfx:StyleBoxFlat BackgroundColor="#1b1b1e" />
|
||||
</PanelContainer.PanelOverride>
|
||||
<BoxContainer Name="ContainerInfo"
|
||||
Orientation="Vertical"
|
||||
HorizontalExpand="True">
|
||||
<Label Text="{Loc 'reagent-dispenser-window-no-container-loaded-text'}"/>
|
||||
</BoxContainer>
|
||||
</PanelContainer>
|
||||
</ScrollContainer>
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
</DefaultWindow>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Linq;
|
||||
using Content.Client.Stylesheets;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
@@ -19,6 +18,7 @@ namespace Content.Client.Chemistry.UI
|
||||
public sealed partial class ReagentDispenserWindow : DefaultWindow
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
public event Action<BaseButton.ButtonEventArgs, DispenseReagentButton>? OnDispenseReagentButtonPressed;
|
||||
public event Action<GUIMouseHoverEventArgs, DispenseReagentButton>? OnDispenseReagentButtonMouseEntered;
|
||||
public event Action<GUIMouseHoverEventArgs, DispenseReagentButton>? OnDispenseReagentButtonMouseExited;
|
||||
@@ -52,7 +52,7 @@ namespace Content.Client.Chemistry.UI
|
||||
/// Update the button grid of reagents which can be dispensed.
|
||||
/// </summary>
|
||||
/// <param name="inventory">Reagents which can be dispensed by this dispenser</param>
|
||||
public void UpdateReagentsList(List<KeyValuePair<string, KeyValuePair<string,string>>> inventory)
|
||||
public void UpdateReagentsList(List<KeyValuePair<string, KeyValuePair<string, string>>> inventory)
|
||||
{
|
||||
if (ChemicalList == null)
|
||||
return;
|
||||
@@ -86,6 +86,9 @@ namespace Content.Client.Chemistry.UI
|
||||
UpdateContainerInfo(castState);
|
||||
UpdateReagentsList(castState.Inventory);
|
||||
|
||||
_entityManager.TryGetEntity(castState.OutputContainerEntity, out var outputContainerEnt);
|
||||
View.SetEntity(outputContainerEnt);
|
||||
|
||||
// Disable the Clear & Eject button if no beaker
|
||||
ClearButton.Disabled = castState.OutputContainer is null;
|
||||
EjectButton.Disabled = castState.OutputContainer is null;
|
||||
@@ -134,7 +137,7 @@ namespace Content.Client.Chemistry.UI
|
||||
|
||||
if (state.OutputContainer is null)
|
||||
{
|
||||
ContainerInfo.Children.Add(new Label {Text = Loc.GetString("reagent-dispenser-window-no-container-loaded-text") });
|
||||
ContainerInfo.Children.Add(new Label { Text = Loc.GetString("reagent-dispenser-window-no-container-loaded-text") });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -159,11 +162,11 @@ namespace Content.Client.Chemistry.UI
|
||||
? p.LocalizedName
|
||||
: Loc.GetString("reagent-dispenser-window-reagent-name-not-found-text");
|
||||
|
||||
var nameLabel = new Label {Text = $"{localizedName}: "};
|
||||
var nameLabel = new Label { Text = $"{localizedName}: " };
|
||||
var quantityLabel = new Label
|
||||
{
|
||||
Text = Loc.GetString("reagent-dispenser-window-quantity-label-text", ("quantity", quantity)),
|
||||
StyleClasses = {StyleNano.StyleClassLabelSecondaryColor},
|
||||
StyleClasses = { StyleNano.StyleClassLabelSecondaryColor },
|
||||
};
|
||||
|
||||
ContainerInfo.Children.Add(new BoxContainer
|
||||
|
||||
Reference in New Issue
Block a user