diff --git a/Content.Client/Chemistry/UI/ReagentCardControl.xaml b/Content.Client/Chemistry/UI/ReagentCardControl.xaml index 41bf884b60c..430adb01723 100644 --- a/Content.Client/Chemistry/UI/ReagentCardControl.xaml +++ b/Content.Client/Chemistry/UI/ReagentCardControl.xaml @@ -5,39 +5,31 @@ SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com> SPDX-License-Identifier: AGPL-3.0-or-later --> + - - + diff --git a/Content.Client/Chemistry/UI/ReagentCardControl.xaml.cs b/Content.Client/Chemistry/UI/ReagentCardControl.xaml.cs index 93e24ac5e6a..d90aa8d9a1b 100644 --- a/Content.Client/Chemistry/UI/ReagentCardControl.xaml.cs +++ b/Content.Client/Chemistry/UI/ReagentCardControl.xaml.cs @@ -3,7 +3,10 @@ // // SPDX-License-Identifier: AGPL-3.0-or-later +// Maid START PR №21 + using Content.Shared.Chemistry; +using Content.Shared.Chemistry.Reagent; using Content.Shared.Storage; using Robust.Client.AutoGenerated; using Robust.Client.Graphics; @@ -15,24 +18,23 @@ namespace Content.Client.Chemistry.UI; [GenerateTypedNameReferences] public sealed partial class ReagentCardControl : Control { - public ItemStorageLocation StorageLocation { get; } - public Action? OnPressed; - public Action? OnEjectButtonPressed; + public ReagentId ReagentId { get; private init; } + public Action? OnPressed; - public ReagentCardControl(ReagentInventoryItem item) + public ReagentCardControl(ReagentId reagentId, ReagentPrototype? prototype, int cost) { RobustXamlLoader.Load(this); - StorageLocation = item.StorageLocation; - ColorPanel.PanelOverride = new StyleBoxFlat { BackgroundColor = item.ReagentColor }; - ReagentNameLabel.Text = item.ReagentLabel; - 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; + ReagentId = reagentId; + ReagentNameLabel.Text = prototype?.LocalizedName ?? Loc.GetString("reagent-dispenser-window-reagent-name-not-found-text"); + MainButton.OnPressed += args => OnPressed?.Invoke(ReagentId); - MainButton.OnPressed += args => OnPressed?.Invoke(StorageLocation); - EjectButton.OnPressed += args => OnEjectButtonPressed?.Invoke(StorageLocation); + ReagentCostLabel.Text = cost.ToString(); + if (cost == 0) + { + ReagentCostControl.Visible = false; + } } -} \ No newline at end of file +} + +// Maid END diff --git a/Content.Client/Chemistry/UI/ReagentDispenserBoundUserInterface.cs b/Content.Client/Chemistry/UI/ReagentDispenserBoundUserInterface.cs index 9d6ed87fa34..99284980c7b 100644 --- a/Content.Client/Chemistry/UI/ReagentDispenserBoundUserInterface.cs +++ b/Content.Client/Chemistry/UI/ReagentDispenserBoundUserInterface.cs @@ -68,8 +68,13 @@ protected override void Open() _window.AmountGrid.OnButtonPressed += s => SendMessage(new ReagentDispenserSetDispenseAmountMessage(s)); + // Maid START PR №21 + /* _window.OnDispenseReagentButtonPressed += (location) => SendMessage(new ReagentDispenserDispenseReagentMessage(location)); _window.OnEjectJugButtonPressed += (location) => SendMessage(new ReagentDispenserEjectContainerMessage(location)); + */ + _window.OnDispenseReagentButtonPressed += (reagent) => SendMessage(new ReagentDispenserDispenseReagentMessage(reagent)); + // Maid END } /// @@ -87,4 +92,4 @@ protected override void UpdateState(BoundUserInterfaceState state) _window?.UpdateState(castState); //Update window state } } -} \ No newline at end of file +} diff --git a/Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml b/Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml index af778556c01..f6591866252 100644 --- a/Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml +++ b/Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml @@ -14,65 +14,70 @@ SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com> SPDX-License-Identifier: AGPL-3.0-or-later --> - + - - -