Reagent dispenser UI (Again) (#27958)
* reagent dispenser: fancy window * reagent dispenser: dispense button grid * reagent dispenser: rearrange containers & info * reagent dispenser: remove `reagent-dispenser-window-container-label` * reagent dispenser: add `Scrollcontainer` on right side * reagent dispenser: get rid of pointless actions * reagent dispenser: cleanup actions and `inventory` field on bound ui state * reagent dispenser: cool reagent cards & finishing touches * reagent dispenser: final cleanup and formatting * reagent dispenser: `ButtonGrid` and `ReagentDispenserSetDispenseAmountMessage` refactor * reagent dispenser: cleanup code & address minor concerns * reagent dispenser: text in reagent cards no longer clips * reagent dispenser: oh wait i forgot to change this and thats why the builds keep failing probably * reagent dispenser mayybe this * reagent dispenser: remove `using FastAccessors;` * delete unused classes * disable reagent button when container is empty * Make things a bit bigger * remove obsolete text color override
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<Control xmlns="https://spacestation14.io">
|
<Control xmlns="https://spacestation14.io" HorizontalExpand="True">
|
||||||
<BoxContainer Name="MainContainer"
|
<BoxContainer Name="MainContainer"
|
||||||
Orientation="Horizontal"
|
Orientation="Horizontal"
|
||||||
SetWidth="160">
|
HorizontalExpand="True">
|
||||||
<PanelContainer Name="ColorPanel"
|
<PanelContainer Name="ColorPanel"
|
||||||
VerticalExpand="True"
|
VerticalExpand="True"
|
||||||
SetWidth="7"
|
SetWidth="7"
|
||||||
@@ -16,8 +16,7 @@
|
|||||||
VerticalExpand="True"
|
VerticalExpand="True"
|
||||||
HorizontalExpand="True"
|
HorizontalExpand="True"
|
||||||
Margin="-5 0 0 0">
|
Margin="-5 0 0 0">
|
||||||
<Label Name="ReagentNameLabel"
|
<Label Name="ReagentNameLabel" />
|
||||||
StyleClasses="LabelSubText" />
|
|
||||||
<Label Name="FillLabel"
|
<Label Name="FillLabel"
|
||||||
StyleClasses="LabelSubText"
|
StyleClasses="LabelSubText"
|
||||||
Margin="0 -5 0 0" />
|
Margin="0 -5 0 0" />
|
||||||
|
|||||||
@@ -20,10 +20,12 @@ public sealed partial class ReagentCardControl : Control
|
|||||||
StorageSlotId = item.StorageSlotId;
|
StorageSlotId = item.StorageSlotId;
|
||||||
ColorPanel.PanelOverride = new StyleBoxFlat { BackgroundColor = item.ReagentColor };
|
ColorPanel.PanelOverride = new StyleBoxFlat { BackgroundColor = item.ReagentColor };
|
||||||
ReagentNameLabel.Text = item.ReagentLabel;
|
ReagentNameLabel.Text = item.ReagentLabel;
|
||||||
ReagentNameLabel.FontColorOverride = Color.White;
|
FillLabel.Text = Loc.GetString("reagent-dispenser-window-quantity-label-text", ("quantity", item.Quantity));;
|
||||||
FillLabel.Text = item.StoredAmount;
|
|
||||||
EjectButtonIcon.Text = Loc.GetString("reagent-dispenser-window-eject-container-button");
|
EjectButtonIcon.Text = Loc.GetString("reagent-dispenser-window-eject-container-button");
|
||||||
|
|
||||||
|
if (item.Quantity == 0.0)
|
||||||
|
MainButton.Disabled = true;
|
||||||
|
|
||||||
MainButton.OnPressed += args => OnPressed?.Invoke(StorageSlotId);
|
MainButton.OnPressed += args => OnPressed?.Invoke(StorageSlotId);
|
||||||
EjectButton.OnPressed += args => OnEjectButtonPressed?.Invoke(StorageSlotId);
|
EjectButton.OnPressed += args => OnEjectButtonPressed?.Invoke(StorageSlotId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,8 @@
|
|||||||
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
|
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
|
||||||
xmlns:ui="clr-namespace:Content.Client.Chemistry.UI"
|
xmlns:ui="clr-namespace:Content.Client.Chemistry.UI"
|
||||||
Title="{Loc 'reagent-dispenser-bound-user-interface-title'}"
|
Title="{Loc 'reagent-dispenser-bound-user-interface-title'}"
|
||||||
MinSize="680 460">
|
MinSize="600 300"
|
||||||
|
SetSize="800 500">
|
||||||
<BoxContainer Orientation="Horizontal">
|
<BoxContainer Orientation="Horizontal">
|
||||||
<BoxContainer Orientation="Vertical" MinWidth="170">
|
<BoxContainer Orientation="Vertical" MinWidth="170">
|
||||||
<Label Text="{Loc 'reagent-dispenser-window-amount-to-dispense-label'}" HorizontalAlignment="Center" />
|
<Label Text="{Loc 'reagent-dispenser-window-amount-to-dispense-label'}" HorizontalAlignment="Center" />
|
||||||
|
|||||||
@@ -121,28 +121,4 @@ namespace Content.Client.Chemistry.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class DispenseReagentButton : Button
|
|
||||||
{
|
|
||||||
public string ReagentId { get; }
|
|
||||||
|
|
||||||
public DispenseReagentButton(string reagentId, string text, string amount)
|
|
||||||
{
|
|
||||||
AddStyleClass("OpenRight");
|
|
||||||
ReagentId = reagentId;
|
|
||||||
Text = text + " " + amount;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class EjectJugButton : Button
|
|
||||||
{
|
|
||||||
public string ReagentId { get; }
|
|
||||||
|
|
||||||
public EjectJugButton(string reagentId)
|
|
||||||
{
|
|
||||||
AddStyleClass("OpenLeft");
|
|
||||||
ReagentId = reagentId;
|
|
||||||
Text = "⏏";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,9 +107,8 @@ namespace Content.Server.Chemistry.EntitySystems
|
|||||||
quantity = sol.Volume;
|
quantity = sol.Volume;
|
||||||
reagentColor = sol.GetColor(_prototypeManager);
|
reagentColor = sol.GetColor(_prototypeManager);
|
||||||
}
|
}
|
||||||
var storedAmount = Loc.GetString("reagent-dispenser-window-quantity-label-text", ("quantity", quantity));
|
|
||||||
|
|
||||||
inventory.Add(new ReagentInventoryItem(storageSlotId, reagentLabel, storedAmount, reagentColor));
|
inventory.Add(new ReagentInventoryItem(storageSlotId, reagentLabel, quantity, reagentColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
return inventory;
|
return inventory;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Shared.Chemistry.Reagent;
|
using Content.Shared.Chemistry.Reagent;
|
||||||
|
using Content.Shared.FixedPoint;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Shared.Chemistry
|
namespace Content.Shared.Chemistry
|
||||||
@@ -93,11 +94,11 @@ namespace Content.Shared.Chemistry
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public sealed class ReagentInventoryItem(string storageSlotId, string reagentLabel, string storedAmount, Color reagentColor)
|
public sealed class ReagentInventoryItem(string storageSlotId, string reagentLabel, FixedPoint2 quantity, Color reagentColor)
|
||||||
{
|
{
|
||||||
public string StorageSlotId = storageSlotId;
|
public string StorageSlotId = storageSlotId;
|
||||||
public string ReagentLabel = reagentLabel;
|
public string ReagentLabel = reagentLabel;
|
||||||
public string StoredAmount = storedAmount;
|
public FixedPoint2 Quantity = quantity;
|
||||||
public Color ReagentColor = reagentColor;
|
public Color ReagentColor = reagentColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user