]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
uichange Chemmaster (#14237)
authorDEATHB4DEFEAT <77995199+DEATHB4DEFEAT@users.noreply.github.com>
Wed, 5 Apr 2023 22:55:14 +0000 (15:55 -0700)
committerGitHub <noreply@github.com>
Wed, 5 Apr 2023 22:55:14 +0000 (16:55 -0600)
Content.Client/Chemistry/UI/ChemMasterWindow.xaml
Content.Client/Chemistry/UI/ChemMasterWindow.xaml.cs
Content.Server/Chemistry/EntitySystems/ChemMasterSystem.cs
Content.Shared/Chemistry/SharedChemMaster.cs

index af15fe4684af9485fcd3e30b1c3037b3e85a571f..b1f4f5917f419a392cc1e2b4afc31d12452835d3 100644 (file)
@@ -1,88 +1,81 @@
-<DefaultWindow xmlns="https://spacestation14.io"
-            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-            xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
-            MinSize="620 670"
-            Title="{Loc 'chem-master-bound-user-interface-title'}">
-    <TabContainer Name="Tabs" Margin="0 0 2 0">
-        <BoxContainer Orientation="Vertical"
-                      HorizontalExpand="True"
-                      Margin="5 5 5 5"
-                      SeparationOverride="10">
+<controls:FancyWindow xmlns="https://spacestation14.io"
+                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"
+                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 Name="InputEjectButton"
-                        Access="Public"
-                        Text="{Loc 'chem-master-window-eject-button'}" />
+                <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>
-                <!-- Initially empty, when server sends state data this will have container contents and fill volume.-->
-                <BoxContainer Name="InputContainerInfo"
-                              Orientation="Vertical"
-                              Margin="4 4 4 4"
-                              HorizontalExpand="True">
-                    <Label Text="{Loc 'chem-master-window-no-container-loaded-text'}" />
-                </BoxContainer>
+
+                <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>
+
             <!-- Padding -->
             <Control MinSize="0 10" />
+
             <!-- Buffer -->
             <BoxContainer Orientation="Horizontal">
                 <Label Text="{Loc 'chem-master-window-buffer-text'}" />
                 <Control HorizontalExpand="True" />
-                <Button Name="BufferTransferButton"
-                        Access="Public"
-                        Text="{Loc 'chem-master-window-transfer-button'}" ToggleMode="True"
-                        StyleClasses="OpenRight" />
-                <Button Name="BufferDiscardButton"
-                        Access="Public"
-                        Text="{Loc 'chem-master-window-discard-button'}" ToggleMode="True"
-                        StyleClasses="OpenLeft" />
+                <Button MinSize="80 0" Name="BufferTransferButton" Access="Public" Text="{Loc 'chem-master-window-transfer-button'}" ToggleMode="True" StyleClasses="OpenRight" />
+                <Button MinSize="80 0" Name="BufferDiscardButton" Access="Public" Text="{Loc 'chem-master-window-discard-button'}" ToggleMode="True" StyleClasses="OpenLeft" />
             </BoxContainer>
+
             <!-- Buffer info -->
             <PanelContainer VerticalExpand="True" MinSize="0 200">
                 <PanelContainer.PanelOverride>
                     <gfx:StyleBoxFlat BackgroundColor="#1B1B1E" />
                 </PanelContainer.PanelOverride>
-                <!-- Buffer reagent list -->
-                <BoxContainer Name="BufferInfo"
-                              Orientation="Vertical"
-                              Margin="4 4 4 4"
-                              HorizontalExpand="True">
-                    <Label Text="{Loc 'chem-master-window-buffer-empty-text'}" />
-                </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'}" />
+                    </BoxContainer>
+                </ScrollContainer>
             </PanelContainer>
         </BoxContainer>
-        <BoxContainer Orientation="Vertical"
-                      HorizontalExpand="True"
-                      Margin="5 5 5 5"
-                      SeparationOverride="10">
+
+        <BoxContainer Orientation="Vertical" HorizontalExpand="True" Margin="5" SeparationOverride="10">
             <!-- Output container info -->
             <BoxContainer Orientation="Horizontal">
                 <Label Text="{Loc 'chem-master-window-container-label'}" />
                 <Control HorizontalExpand="True" />
-                <Button Name="OutputEjectButton"
-                        Access="Public"
-                        Text="{Loc 'chem-master-window-eject-button'}" />
+                <Button MinSize="80 0" Name="OutputEjectButton" Access="Public" Text="{Loc 'chem-master-window-eject-button'}" />
             </BoxContainer>
+
             <PanelContainer VerticalExpand="True" MinSize="0 200">
                 <PanelContainer.PanelOverride>
                     <gfx:StyleBoxFlat BackgroundColor="#1B1B1E" />
                 </PanelContainer.PanelOverride>
-                <!-- Initially empty, when server sends state data this will have container contents and fill volume.-->
-                <BoxContainer Name="OutputContainerInfo"
-                              Orientation="Vertical"
-                              Margin="4 4 4 4"
-                              HorizontalExpand="True">
-                    <Label Text="{Loc 'chem-master-window-no-container-loaded-text'}" />
-                </BoxContainer>
+
+                <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" />
+
             <!-- Packaging -->
             <BoxContainer Orientation="Horizontal">
                 <Label Text="{Loc 'chem-master-window-packaging-text'}" />
                 <Label Text="{Loc 'chem-master-window-buffer-label'}" />
                 <Label Name="BufferCurrentVolume" StyleClasses="LabelSecondaryColor" />
             </BoxContainer>
+
             <!-- Wrap the packaging info-->
             <PanelContainer>
                 <PanelContainer.PanelOverride>
                     <gfx:StyleBoxFlat BackgroundColor="#1B1B1E" />
                 </PanelContainer.PanelOverride>
+
                 <!-- Packaging Info -->
-                <BoxContainer Orientation="Vertical"
-                              Margin="4 4 4 4"
-                              HorizontalExpand="True"
-                              VerticalExpand="True"
-                              SeparationOverride="5">
+                <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'}"/>
                             <!-- 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 Name="PillNumber"
-                                 Access="Public"
-                                 Value="0" />
-                        <Label Text="{Loc 'chem-master-window-dose-label'}"
-                               Margin="5 0 0 0"
-                               StyleClasses="LabelSecondaryColor" />
-                        <SpinBox Name="PillDosage"
-                                 Access="Public"
-                                 Value="1" />
-                        <Button Name="CreatePillButton"
-                                Access="Public"
-                                Text="{Loc 'chem-master-window-create-button'}" />
+                        <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 Name="BottleDosage"
-                                    Access="Public"
-                                    Value="0" />
-                        <Button Name="CreateBottleButton"
-                                Access="Public"
-                                Text="{Loc 'chem-master-window-create-button'}" />
+                        <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>
             </PanelContainer>
         </BoxContainer>
     </TabContainer>
-</DefaultWindow>
+</controls:FancyWindow>
index 477288e5c8afe60f8234ca7b5147265581b115f9..5f372067373cd1dc86614ec4dcf1df97b4743a47 100644 (file)
@@ -1,5 +1,6 @@
 using System.Linq;
 using Content.Client.Stylesheets;
+using Content.Client.UserInterface.Controls;
 using Content.Shared.Chemistry;
 using Content.Shared.Chemistry.Reagent;
 using Robust.Client.AutoGenerated;
@@ -18,7 +19,7 @@ namespace Content.Client.Chemistry.UI
     /// Client-side UI used to control a <see cref="SharedChemMasterComponent"/>
     /// </summary>
     [GenerateTypedNameReferences]
-    public sealed partial class ChemMasterWindow : DefaultWindow
+    public sealed partial class ChemMasterWindow : FancyWindow
     {
         [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
         public event Action<BaseButton.ButtonEventArgs, ReagentButton>? OnReagentButtonPressed;
@@ -210,6 +211,8 @@ namespace Content.Client.Chemistry.UI
                             MakeReagentButton("5", ChemMasterReagentAmount.U5, reagent.ReagentId, true, StyleBase.ButtonOpenBoth),
                             MakeReagentButton("10", ChemMasterReagentAmount.U10, reagent.ReagentId, true, StyleBase.ButtonOpenBoth),
                             MakeReagentButton("25", ChemMasterReagentAmount.U25, reagent.ReagentId, true, StyleBase.ButtonOpenBoth),
+                            MakeReagentButton("50", ChemMasterReagentAmount.U50, reagent.ReagentId, true, StyleBase.ButtonOpenBoth),
+                            MakeReagentButton("100", ChemMasterReagentAmount.U100, reagent.ReagentId, true, StyleBase.ButtonOpenBoth),
                             MakeReagentButton(Loc.GetString("chem-master-window-buffer-all-amount"), ChemMasterReagentAmount.All, reagent.ReagentId, true, StyleBase.ButtonOpenLeft),
                         }
                     });
@@ -254,10 +257,9 @@ namespace Content.Client.Chemistry.UI
                         // Try to get the prototype for the given reagent. This gives us its name.
                         _prototypeManager.TryIndex(lineItem.Id, out ReagentPrototype? proto);
                         var name = proto?.LocalizedName
-                                   ?? Loc.GetString("chem-master-window-unknown-reagent-text");
+                                    ?? Loc.GetString("chem-master-window-unknown-reagent-text");
 
                         return (name, lineItem.Id, lineItem.Quantity);
-
                     })
                     .OrderBy(r => r.Item1);
 
@@ -292,6 +294,10 @@ namespace Content.Client.Chemistry.UI
                             "10", ChemMasterReagentAmount.U10, id, false, StyleBase.ButtonOpenBoth));
                         cs.Add(MakeReagentButton(
                             "25", ChemMasterReagentAmount.U25, id, false, StyleBase.ButtonOpenBoth));
+                        cs.Add(MakeReagentButton(
+                            "50", ChemMasterReagentAmount.U50, id, false, StyleBase.ButtonOpenBoth));
+                        cs.Add(MakeReagentButton(
+                            "100", ChemMasterReagentAmount.U100, id, false, StyleBase.ButtonOpenBoth));
                         cs.Add(MakeReagentButton(
                             Loc.GetString("chem-master-window-buffer-all-amount"),
                             ChemMasterReagentAmount.All, id, false, StyleBase.ButtonOpenLeft));
@@ -329,6 +335,5 @@ namespace Content.Client.Chemistry.UI
             Id = id;
             IsBuffer = isBuffer;
         }
-
     }
 }
index 9f66c7be4762d6a48085c5496fb34eaa64e07d05..535efd6070efbcb1b29191f997ffe51df75d7b3a 100644 (file)
@@ -2,7 +2,6 @@ using System.Diagnostics.CodeAnalysis;
 using System.Linq;
 using Content.Server.Chemistry.Components;
 using Content.Server.Labels;
-using Content.Server.Labels.Components;
 using Content.Server.Popups;
 using Content.Server.Storage.Components;
 using Content.Server.Storage.EntitySystems;
@@ -16,9 +15,6 @@ using JetBrains.Annotations;
 using Robust.Server.GameObjects;
 using Robust.Shared.Audio;
 using Robust.Shared.Containers;
-using Robust.Shared.Player;
-using Robust.Shared.Utility;
-
 
 namespace Content.Server.Chemistry.EntitySystems
 {
index a97ad05f7638b37a45aed739e19f3bb984946717..0e20e91a515751aea18d5492373ecba783e610b6 100644 (file)
@@ -95,6 +95,8 @@ namespace Content.Shared.Chemistry
         U5 = 5,
         U10 = 10,
         U25 = 25,
+        U50 = 50,
+        U100 = 100,
         All,
     }