Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChemMaster+ #2778

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7b5b033
ChemMaster+ (#1585)
sleepyyapril Jan 18, 2025
1191ca3
Fix for not having DiscardReagents
sleepyyapril Jan 20, 2025
3d75c9e
Merge branch 'master' of https://github.com/DeltaV-Station/Delta-v in…
sleepyyapril Jan 27, 2025
5454bf7
ChemMaster Improvements (#1650)
sleepyyapril Jan 25, 2025
291867f
Fixed network fuckery
sleepyyapril Jan 27, 2025
1d38c0c
Fix Chemmaster Two (#1667)
sleepyyapril Jan 26, 2025
19a842d
Merge branch 'master' of https://github.com/DeltaV-Station/Delta-v in…
sleepyyapril Jan 27, 2025
7ec1509
Use separate counts for the separate buffers.
sleepyyapril Jan 27, 2025
90997db
You want comments? I'll give you comments.
sleepyyapril Jan 27, 2025
6ee793a
Remove unnecessary addition
sleepyyapril Jan 27, 2025
edf0166
review stuff
sleepyyapril Feb 1, 2025
403c01e
Better comments?
sleepyyapril Feb 1, 2025
e5556c7
Merge branch 'master' into port-chemmaster-plus
sleepyyapril Feb 1, 2025
00c16f1
Delta-v is kill
sleepyyapril Feb 1, 2025
9f57f6f
Merge branch 'port-chemmaster-plus' of https://github.com/sleepyyapri…
sleepyyapril Feb 1, 2025
1b19442
comment here?
sleepyyapril Feb 1, 2025
25a66f1
Merge branch 'master' of https://github.com/DeltaV-Station/Delta-v in…
sleepyyapril Feb 2, 2025
ba20ef4
Bro made me comment
sleepyyapril Feb 2, 2025
851ec0a
fix deltav
sleepyyapril Feb 2, 2025
c30cca0
fully untouch ftl
sleepyyapril Feb 2, 2025
0cbdc39
touch less
sleepyyapril Feb 2, 2025
be19ae7
touch even less
sleepyyapril Feb 2, 2025
7705c63
even less
sleepyyapril Feb 2, 2025
57da8e9
less
sleepyyapril Feb 2, 2025
f9dc67b
comment more!
sleepyyapril Feb 2, 2025
914541b
Merge branch 'master' into port-chemmaster-plus
sleepyyapril Feb 2, 2025
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
13 changes: 4 additions & 9 deletions Content.Client/Chemistry/UI/ChemMasterBoundUserInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@ namespace Content.Client.Chemistry.UI
/// Initializes a <see cref="ChemMasterWindow"/> and updates it when new server messages are received.
/// </summary>
[UsedImplicitly]
public sealed class ChemMasterBoundUserInterface : BoundUserInterface
public sealed class ChemMasterBoundUserInterface(EntityUid owner, Enum uiKey) : BoundUserInterface(owner, uiKey) // Delta-v
{
[ViewVariables]
private ChemMasterWindow? _window;

public ChemMasterBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}
sleepyyapril marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Called each time a chem master UI instance is opened. Generates the window and fills it with
/// relevant info. Sets the actions for static buttons.
Expand All @@ -34,8 +30,6 @@ protected override void Open()
// Setup static button actions.
_window.InputEjectButton.OnPressed += _ => SendMessage(
new ItemSlotButtonPressedEvent(SharedChemMaster.InputSlotName));
_window.OutputEjectButton.OnPressed += _ => SendMessage(
new ItemSlotButtonPressedEvent(SharedChemMaster.OutputSlotName));
sleepyyapril marked this conversation as resolved.
Show resolved Hide resolved
_window.CreatePillButton.OnPressed += _ => SendMessage(
new ChemMasterCreatePillsMessage(
(uint) _window.PillDosage.Value, (uint) _window.PillNumber.Value, _window.LabelLine));
Expand All @@ -49,7 +43,9 @@ protected override void Open()
_window.PillTypeButtons[i].OnPressed += _ => SendMessage(new ChemMasterSetPillTypeMessage(pillType));
}

_window.OnReagentButtonPressed += (args, button) => SendMessage(new ChemMasterReagentAmountButtonMessage(button.Id, button.Amount, button.IsBuffer));
_window.OnReagentButtonPressed += (_, button, amount, isOutput) => SendMessage(new ChemMasterReagentAmountButtonMessage(button.Id, amount, button.IsBuffer, isOutput)); // Delta-v
_window.OnSortMethodChanged += sortMethod => SendMessage(new ChemMasterSortMethodUpdated(sortMethod)); // Delta-v
_window.OnTransferAmountChanged += amount => SendMessage(new ChemMasterTransferringAmountUpdated(amount)); // Delta-v
}

/// <summary>
Expand All @@ -64,7 +60,6 @@ protected override void UpdateState(BoundUserInterfaceState state)
base.UpdateState(state);

var castState = (ChemMasterBoundUserInterfaceState) state;

_window?.UpdateState(castState); // Update window state
}
}
Expand Down
223 changes: 120 additions & 103 deletions Content.Client/Chemistry/UI/ChemMasterWindow.xaml
sleepyyapril marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,126 +2,143 @@
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
MinSize="620 670"
MinSize="800 00"
Title="{Loc 'chem-master-bound-user-interface-title'}">
<TabContainer Name="Tabs" Margin="5 5 7 5">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" Margin="5" SeparationOverride="10">
<!-- Input container info -->
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'chem-master-window-container-label'}" />
<Control HorizontalExpand="True" />
<Button MinSize="80 0" Name="InputEjectButton" Access="Public" Text="{Loc 'chem-master-window-eject-button'}" />
</BoxContainer>

<PanelContainer VerticalExpand="True" MinSize="0 200">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#1B1B1E" />
</PanelContainer.PanelOverride>

<ScrollContainer HorizontalExpand="True" MinSize="0 200">
<!-- Initially empty, when server sends state data this will have container contents and fill volume.-->
<BoxContainer Name="InputContainerInfo" Orientation="Vertical" Margin="4" HorizontalExpand="True">
<Label Text="{Loc 'chem-master-window-no-container-loaded-text'}" />
</BoxContainer>
</ScrollContainer>
</PanelContainer>
<BoxContainer Orientation="Horizontal" VerticalExpand="true" MinSize="0 200">
<TabContainer Name="Tabs" Margin="5 5 7 5" HorizontalExpand="True">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" Margin="5" SeparationOverride="10">
<!-- Buffer -->
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'chem-master-window-buffer-text'}" />
<Control HorizontalExpand="True" />
<OptionButton Name="SortMethod" Access="Public" ToolTip="{Loc 'chem-master-window-sort-method-tooltip'}" StyleClasses="OpenRight" />
</BoxContainer>

<!-- Padding -->
<Control MinSize="0 10" />
<!-- Buffer info -->
<PanelContainer VerticalExpand="True" HorizontalExpand="True" MinSize="0 300">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#1B1B1E" />
</PanelContainer.PanelOverride>

<ScrollContainer HorizontalExpand="True" MinSize="0 300">
<!-- Buffer reagent list -->
<BoxContainer Name="BufferInfo" Orientation="Vertical" Margin="4" HorizontalExpand="True">
<Label Text="{Loc 'chem-master-window-buffer-empty-text'}" />
</BoxContainer>
</ScrollContainer>
</PanelContainer>
</BoxContainer>

<!-- Buffer -->
<Label Text="{Loc 'chem-master-window-buffer-text'}" />
<BoxContainer Orientation="Vertical" HorizontalExpand="True" Margin="5" SeparationOverride="10">
<!-- Pill Buffer -->
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'chem-master-window-pill-buffer-text'}" />
<Control HorizontalExpand="True" />
<OptionButton Name="PillSortMethod" Access="Public" ToolTip="{Loc 'chem-master-window-sort-method-tooltip'}" StyleClasses="OpenRight" />
</BoxContainer>

<!-- Buffer info -->
<PanelContainer VerticalExpand="True" MinSize="0 200">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#1B1B1E" />
</PanelContainer.PanelOverride>
<!-- Pill Buffer info -->
<PanelContainer VerticalExpand="True" HorizontalExpand="True" MinSize="0 300">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#1B1B1E" />
</PanelContainer.PanelOverride>

<ScrollContainer HorizontalExpand="True" MinSize="0 300">
<!-- Pill Buffer reagent list -->
<BoxContainer Name="PillBufferInfo" Orientation="Vertical" Margin="4" HorizontalExpand="True">
<Label Text="{Loc 'chem-master-window-pill-buffer-empty-text'}" />
</BoxContainer>
</ScrollContainer>
</PanelContainer>

<!-- Padding -->
<Control MinSize="0 10" />

<!-- Packaging -->
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'chem-master-window-packaging-text'}" />
<Control HorizontalExpand="True"/>
<Label Text="{Loc 'chem-master-window-buffer-label'}" />
<Label Name="BufferCurrentVolume" StyleClasses="LabelSecondaryColor" />
</BoxContainer>

<ScrollContainer HorizontalExpand="True" MinSize="0 200">
<!-- Buffer reagent list -->
<BoxContainer Name="BufferInfo" Orientation="Vertical" Margin="4" HorizontalExpand="True">
<Label Text="{Loc 'chem-master-window-buffer-empty-text'}" />
<!-- Wrap the packaging info-->
<PanelContainer>
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#1B1B1E" />
</PanelContainer.PanelOverride>

<!-- Packaging Info -->
<BoxContainer Orientation="Vertical" Margin="4" HorizontalExpand="True" VerticalExpand="True" SeparationOverride="5">
<!-- Label for output -->
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'chem-master-current-text-label'}" />
<Control HorizontalExpand="True" MinSize="50 0"/>
<LineEdit Name="LabelLineEdit" SetWidth="455"/>
</BoxContainer>

<!-- Pills Type Buttons -->
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'chem-master-window-pill-type-label'}"/>
<Control HorizontalExpand="True" MinSize="50 0"/>
<GridContainer Name="Grid" Columns="10">
<!-- Pills type buttons are generated in the code -->
</GridContainer>
</BoxContainer>

<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'chem-master-window-pills-label'}" />
<Control HorizontalExpand="True" MinSize="50 0" />
<Label Text="{Loc 'chem-master-window-pills-number-label'}" Margin="5 0 0 0" StyleClasses="LabelSecondaryColor" />
<SpinBox MinSize="100 0" Name="PillNumber" Access="Public" Value="0" />
<Label Text="{Loc 'chem-master-window-dose-label'}" Margin="5 0 0 0" StyleClasses="LabelSecondaryColor" />
<SpinBox MinSize="100 0" Name="PillDosage" Access="Public" Value="1" />
<Button MinSize="80 0" Name="CreatePillButton" Access="Public" Text="{Loc 'chem-master-window-create-button'}" />
</BoxContainer>

<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'chem-master-window-bottles-label'}" />
<Control HorizontalExpand="True" MinSize="50 0" />
<Label Text="{Loc 'chem-master-window-dose-label'}" Margin="5 0 0 0" StyleClasses="LabelSecondaryColor" />
<SpinBox MinSize="100 0" Name="BottleDosage" Access="Public" Value="0" />
<Button MinSize="80 0" Name="CreateBottleButton" Access="Public" Text="{Loc 'chem-master-window-create-button'}" />
</BoxContainer>
</BoxContainer>
</ScrollContainer>
</PanelContainer>
</BoxContainer>

<BoxContainer Orientation="Vertical" HorizontalExpand="True" Margin="5" SeparationOverride="10">
<!-- Output container info -->
</PanelContainer>
</BoxContainer>
</TabContainer>
<BoxContainer Orientation="Vertical" Margin="5 5 7 5" MinSize="300 0">
<!-- Input container info -->
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'chem-master-window-container-label'}" />
<Control HorizontalExpand="True" />
<Button MinSize="80 0" Name="OutputEjectButton" Access="Public" Text="{Loc 'chem-master-window-eject-button'}" />
<Button MinSize="80 0" Name="InputEjectButton" Access="Public" Text="{Loc 'chem-master-window-eject-button'}" StyleClasses="OpenLeft" />
</BoxContainer>

<PanelContainer VerticalExpand="True" MinSize="0 200">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#1B1B1E" />
</PanelContainer.PanelOverride>

<ScrollContainer HorizontalExpand="True" MinSize="0 200">
<!-- Initially empty, when server sends state data this will have container contents and fill volume.-->
<BoxContainer Name="OutputContainerInfo" Orientation="Vertical" Margin="4" HorizontalExpand="True">
<Label Text="{Loc 'chem-master-window-no-container-loaded-text'}" />
</BoxContainer>
</ScrollContainer>
</PanelContainer>

<!-- Padding -->
<Control MinSize="0 10" />
<Control MinSize="0 5" />

<!-- Packaging -->
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'chem-master-window-packaging-text'}" />
<Control HorizontalExpand="True"/>
<Label Text="{Loc 'chem-master-window-buffer-label'}" />
<Label Name="BufferCurrentVolume" StyleClasses="LabelSecondaryColor" />
</BoxContainer>

<!-- Wrap the packaging info-->
<PanelContainer>
<PanelContainer VerticalExpand="True" HorizontalExpand="True" MinSize="0 300">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#1B1B1E" />
</PanelContainer.PanelOverride>

<!-- Packaging Info -->
<BoxContainer Orientation="Vertical" Margin="4" HorizontalExpand="True" VerticalExpand="True" SeparationOverride="5">
<!-- Label for output -->
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'chem-master-current-text-label'}" />
<Control HorizontalExpand="True" MinSize="50 0"/>
<LineEdit Name="LabelLineEdit" SetWidth="455"/>
</BoxContainer>

<!-- Pills Type Buttons -->
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'chem-master-window-pill-type-label'}"/>
<Control HorizontalExpand="True" MinSize="50 0"/>
<GridContainer Name="Grid" Columns="10">
<!-- Pills type buttons are generated in the code -->
</GridContainer>
</BoxContainer>

<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'chem-master-window-pills-label'}" />
<Control HorizontalExpand="True" MinSize="50 0" />
<Label Text="{Loc 'chem-master-window-pills-number-label'}" Margin="5 0 0 0" StyleClasses="LabelSecondaryColor" />
<SpinBox MinSize="100 0" Name="PillNumber" Access="Public" Value="0" />
<Label Text="{Loc 'chem-master-window-dose-label'}" Margin="5 0 0 0" StyleClasses="LabelSecondaryColor" />
<SpinBox MinSize="100 0" Name="PillDosage" Access="Public" Value="1" />
<Button MinSize="80 0" Name="CreatePillButton" Access="Public" Text="{Loc 'chem-master-window-create-button'}" />
</BoxContainer>

<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'chem-master-window-bottles-label'}" />
<Control HorizontalExpand="True" MinSize="50 0" />
<Label Text="{Loc 'chem-master-window-dose-label'}" Margin="5 0 0 0" StyleClasses="LabelSecondaryColor" />
<SpinBox MinSize="100 0" Name="BottleDosage" Access="Public" Value="0" />
<Button MinSize="80 0" Name="CreateBottleButton" Access="Public" Text="{Loc 'chem-master-window-create-button'}" />
</BoxContainer>
<BoxContainer>
<ScrollContainer HorizontalExpand="True" MinSize="0 20">
<!-- Initially empty, when server sends state data this will have container contents and fill volume.-->
<BoxContainer Name="ContainerInfoContainer" Orientation="Vertical" Margin="4" HorizontalExpand="True">
<Label Text="{Loc 'chem-master-window-no-container-loaded-text'}" />
</BoxContainer>
</ScrollContainer>
</BoxContainer>
</PanelContainer>
<RichTextLabel Name="AmountLabel" Text="{Loc 'chem-master-window-transferring-default-label'}" Margin="0 0 7 0" />
<LineEdit MinSize="140 0" Name="AmountLineEdit" Access="Public" PlaceHolder="{Loc 'chem-master-window-amount-placeholder'}" />
<GridContainer
Name="AmountButtons"
VerticalExpand="True"
HorizontalExpand="True"
Margin="2 2 2 2"
Columns="5" />
</BoxContainer>
</TabContainer>
</BoxContainer>
</controls:FancyWindow>
Loading
Loading