Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 11 additions & 19 deletions Content.Client/Chemistry/UI/ReagentCardControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,31 @@ SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>
SPDX-License-Identifier: AGPL-3.0-or-later
-->

<!-- Maid START PR №21-->
<Control xmlns="https://spacestation14.io" HorizontalExpand="True">
<BoxContainer Name="MainContainer"
Orientation="Horizontal"
HorizontalExpand="True">
<PanelContainer Name="ColorPanel"
VerticalExpand="True"
SetWidth="7"
Margin="0 1 0 0" />
<Button Name="MainButton"
HorizontalExpand="True"
VerticalExpand="True"
StyleClasses="ButtonSquare"
Margin="-1 0 0 0">
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<BoxContainer Orientation="Vertical"
<BoxContainer Orientation="Horizontal"
VerticalExpand="True"
HorizontalExpand="True"
Margin="-5 0 0 0">
<Label Name="ReagentNameLabel" />
<Label Name="FillLabel"
StyleClasses="LabelSubText"
Margin="0 -5 0 0" />
Margin="0 0 0 0">
<Control HorizontalExpand="True"/>
<Label Name="ReagentNameLabel" VerticalAlignment="Center" />
<BoxContainer Name="ReagentCostControl" Orientation="Horizontal">
<Control MinSize="5 0"/>
<Label Name="ReagentCostLabel" StyleClasses="LabelSubText" VerticalAlignment="Bottom"/>
</BoxContainer>
<Control HorizontalExpand="True"/>
</BoxContainer>
</BoxContainer>
</Button>
<Button Name="EjectButton"
StyleClasses="OpenLeft"
VerticalExpand="True"
SetWidth="20">
<Label Name="EjectButtonIcon"
VerticalAlignment="Center"
HorizontalAlignment="Center"
Margin="-7 -4 0 0" />
</Button>
</BoxContainer>
</Control>
<!-- Maid END-->
32 changes: 17 additions & 15 deletions Content.Client/Chemistry/UI/ReagentCardControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Comment thread
CREAsTIVE marked this conversation as resolved.
using Robust.Client.AutoGenerated;
using Robust.Client.Graphics;
Expand All @@ -15,24 +18,23 @@ namespace Content.Client.Chemistry.UI;
[GenerateTypedNameReferences]
public sealed partial class ReagentCardControl : Control
{
public ItemStorageLocation StorageLocation { get; }
public Action<ItemStorageLocation>? OnPressed;
public Action<ItemStorageLocation>? OnEjectButtonPressed;
public ReagentId ReagentId { get; private init; }
public Action<ReagentId>? 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;
}
}
Comment thread
CREAsTIVE marked this conversation as resolved.
}
}

// Maid END
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +71 to +77

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Старый код можно удалять если новый окружен //Maid edit

}

/// <summary>
Expand All @@ -87,4 +92,4 @@ protected override void UpdateState(BoundUserInterfaceState state)
_window?.UpdateState(castState); //Update window state
}
}
}
}
92 changes: 49 additions & 43 deletions Content.Client/Chemistry/UI/ReagentDispenserWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,65 +14,70 @@ SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com>

SPDX-License-Identifier: AGPL-3.0-or-later
-->

<!-- Maid START PR №21 -->
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
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="600 300"
MinSize="450 300"
SetSize="800 500">
<BoxContainer Orientation="Horizontal">
<BoxContainer Orientation="Vertical" MinWidth="170">
<Label Text="{Loc 'reagent-dispenser-window-amount-to-dispense-label'}" HorizontalAlignment="Center" />
<BoxContainer Orientation="Vertical" Margin="5">
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'reagent-dispenser-window-amount-to-dispense-label'}"
Margin="5"/>
<ui:ButtonGrid
Name="AmountGrid"
Access="Public"
Columns="3"
Rows="1"
HorizontalAlignment="Center"
Margin="5"
ButtonList="1,5,10,15,20,25,30,50,100"
RadioGroup="True">
</ui:ButtonGrid>
<Control VerticalExpand="True" />
<Label Name="ContainerInfoName"
Access="Public"
Text=""
HorizontalAlignment="Center" />
<Label Name="ContainerInfoFill"
Access="Public"
Text=""
HorizontalAlignment="Center"
StyleClasses="LabelSubText" />
</BoxContainer>
<GridContainer Name="ReagentList"
HorizontalExpand="True"
Access="Public"
Columns="4" />
<BoxContainer Orientation="Horizontal" HorizontalExpand="True">
<BoxContainer Orientation="Vertical">
<Control VerticalExpand="True"/>
<BoxContainer Orientation="Horizontal" Margin="0 0 20 0">
<Button Name="ClearButton"
Access="Public"
Text="{Loc 'reagent-dispenser-window-clear-button'}"
StyleClasses="OpenRight" />
<Button Name="EjectButton"
Access="Public"
Text="{Loc 'reagent-dispenser-window-eject-button'}"
StyleClasses="OpenLeft" />
</BoxContainer>
<BoxContainer>
<Label Name="ContainerInfoName"
Access="Public"
Text="{Loc 'reagent-dispenser-window-no-container-loaded-text'}"/>
<Control MinSize="10 0"/>
<Label Name="ContainerInfoFill"
Access="Public"
Text=""
StyleClasses="LabelSubText"/>
</BoxContainer>
</BoxContainer>
<SpriteView Name="View"
Scale="4 4"
HorizontalAlignment="Center" />
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Center">
<Button Name="ClearButton"
Access="Public"
Text="{Loc 'reagent-dispenser-window-clear-button'}"
StyleClasses="OpenRight" />
<Button Name="EjectButton"
Access="Public"
Text="{Loc 'reagent-dispenser-window-eject-button'}"
StyleClasses="OpenLeft" />
Scale="2 2"/>
Comment thread
CREAsTIVE marked this conversation as resolved.
<Control HorizontalExpand="True"/>
<BoxContainer Name="ChargeAmount" Orientation="Horizontal">
<Label Text="{Loc 'reagent-dispenser-window-charge-amount'}"/>
<Label Text=": "/>
<Label Name="ChargeAmountLabel" Text="0"/>
</BoxContainer>
</BoxContainer>
<SplitContainer Orientation="Vertical"
HorizontalExpand="True"
VerticalExpand="True">
<ScrollContainer HScrollEnabled="False"
HorizontalExpand="True"
VerticalExpand="True"
MinHeight="50"
SizeFlagsStretchRatio="2.5">
<GridContainer Name="ReagentList"
HorizontalExpand="True"
VerticalExpand="True"
Access="Public"
Columns="3" />
</ScrollContainer>

<BoxContainer HorizontalExpand="True"
VerticalExpand="True"
Orientation="Horizontal">
<ScrollContainer HScrollEnabled="False"
HorizontalExpand="True"
VerticalExpand="True"
Expand All @@ -86,10 +91,11 @@ SPDX-License-Identifier: AGPL-3.0-or-later
HorizontalExpand="True"
VerticalExpand="True"
Margin="5">
<Label Text="{Loc 'reagent-dispenser-window-no-container-loaded-text'}" />
</BoxContainer>
</PanelContainer>
</ScrollContainer>
</SplitContainer>
<Control MinSize="5 0"/>
</BoxContainer>
</BoxContainer>
</controls:FancyWindow>
<!-- Maid END-->
Loading
Loading