]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Reagent dispenser UI (Again) (#27958)
authorBrandon Li <48413902+aspiringLich@users.noreply.github.com>
Mon, 13 May 2024 21:46:16 +0000 (17:46 -0400)
committerGitHub <noreply@github.com>
Mon, 13 May 2024 21:46:16 +0000 (17:46 -0400)
* 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

Content.Client/Chemistry/UI/ReagentCardControl.xaml
Content.Client/Chemistry/UI/ReagentCardControl.xaml.cs
Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml
Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml.cs
Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs
Content.Shared/Chemistry/SharedReagentDispenser.cs

index 966c730140689c6d9f48a85bf587345851a5cc21..257b0b6c52ee8614dbef7935b8b8f95f305a540a 100644 (file)
@@ -1,7 +1,7 @@
-<Control xmlns="https://spacestation14.io">
+<Control xmlns="https://spacestation14.io" HorizontalExpand="True">
     <BoxContainer Name="MainContainer"
                   Orientation="Horizontal"
-                  SetWidth="160">
+                  HorizontalExpand="True">
         <PanelContainer Name="ColorPanel"
                         VerticalExpand="True"
                         SetWidth="7"
@@ -16,8 +16,7 @@
                               VerticalExpand="True"
                               HorizontalExpand="True"
                               Margin="-5 0 0 0">
-                    <Label Name="ReagentNameLabel"
-                           StyleClasses="LabelSubText" />
+                    <Label Name="ReagentNameLabel" />
                     <Label Name="FillLabel"
                            StyleClasses="LabelSubText"
                            Margin="0 -5 0 0" />
index 60336143fc754277c92def76f9e8eb78dd57e9b7..f7cadcc264d09c878b11b59ffe1d0f7fb5a906d4 100644 (file)
@@ -20,10 +20,12 @@ public sealed partial class ReagentCardControl : Control
         StorageSlotId = item.StorageSlotId;
         ColorPanel.PanelOverride = new StyleBoxFlat { BackgroundColor = item.ReagentColor };
         ReagentNameLabel.Text = item.ReagentLabel;
-        ReagentNameLabel.FontColorOverride = Color.White;
-        FillLabel.Text = item.StoredAmount;
+        FillLabel.Text = Loc.GetString("reagent-dispenser-window-quantity-label-text", ("quantity", item.Quantity));;
         EjectButtonIcon.Text = Loc.GetString("reagent-dispenser-window-eject-container-button");
 
+        if (item.Quantity == 0.0)
+            MainButton.Disabled = true;
+
         MainButton.OnPressed += args => OnPressed?.Invoke(StorageSlotId);
         EjectButton.OnPressed += args => OnEjectButtonPressed?.Invoke(StorageSlotId);
     }
index c900d7ecf2d0e118ccb0af0a15066b8afc095838..9da340f8a76e23347b0ee25746f56d67bc29a25c 100644 (file)
@@ -4,7 +4,8 @@
                       xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
                       xmlns:ui="clr-namespace:Content.Client.Chemistry.UI"
                       Title="{Loc 'reagent-dispenser-bound-user-interface-title'}"
-                      MinSize="680 460">
+                      MinSize="600 300"
+                      SetSize="800 500">
     <BoxContainer Orientation="Horizontal">
         <BoxContainer Orientation="Vertical" MinWidth="170">
             <Label Text="{Loc 'reagent-dispenser-window-amount-to-dispense-label'}" HorizontalAlignment="Center" />
index 305d39cdeb65956642498a1742cadd031ef599bc..c462dbfc6955e4d08faf6c7a877ff6ac70c2962b 100644 (file)
@@ -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 = "⏏";
-        }
-    }
 }
index c48bf086d39b336e80b53774a8c10bd8133afde2..18872e9dcf9bdbc37a1d88cf7b69cc57e91233c7 100644 (file)
@@ -107,9 +107,8 @@ namespace Content.Server.Chemistry.EntitySystems
                     quantity = sol.Volume;
                     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;
index 5de3f6cae352490da060b94dc3d06661c9798d95..c7ecd0ff439984af96eb84b31c5759056faa5bff 100644 (file)
@@ -1,4 +1,5 @@
 using Content.Shared.Chemistry.Reagent;
+using Content.Shared.FixedPoint;
 using Robust.Shared.Serialization;
 
 namespace Content.Shared.Chemistry
@@ -93,11 +94,11 @@ namespace Content.Shared.Chemistry
     }
 
     [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 ReagentLabel = reagentLabel;
-        public string StoredAmount = storedAmount;
+        public FixedPoint2 Quantity = quantity;
         public Color ReagentColor = reagentColor;
     }