From b06becaf987d765f4dc3f92714f4a3185d40d2e8 Mon Sep 17 00:00:00 2001 From: Spartak Date: Fri, 26 Nov 2021 22:44:36 -0800 Subject: [PATCH] Adds pills type selection and pills canister (#5539) * Added pill type selection Ui textures missing for now * bugfixes * Pill type selection * ui changes * Added pills canister * Change requests --- .../UI/ChemMasterBoundUserInterface.cs | 24 +++--- .../Chemistry/UI/ChemMasterWindow.xaml | 11 ++- .../Chemistry/UI/ChemMasterWindow.xaml.cs | 63 ++++++++++++++-- .../Components/ChemMasterComponent.cs | 31 ++++++-- .../Components/SharedChemMasterComponent.cs | 42 ++++++----- .../components/chem-master-component.ftl | 1 + .../Entities/Objects/Specific/chemistry.yml | 21 ++++++ .../Specific/Chemistry/pills.rsi/meta.json | 69 +++++++++--------- .../pills_canister.rsi/inhand-left.png | Bin 0 -> 1729 bytes .../pills_canister.rsi/inhand-right.png | Bin 0 -> 1738 bytes .../Chemistry/pills_canister.rsi/meta.json | 22 ++++++ .../pill_canister.png | Bin 12 files changed, 204 insertions(+), 80 deletions(-) create mode 100644 Resources/Textures/Objects/Specific/Chemistry/pills_canister.rsi/inhand-left.png create mode 100644 Resources/Textures/Objects/Specific/Chemistry/pills_canister.rsi/inhand-right.png create mode 100644 Resources/Textures/Objects/Specific/Chemistry/pills_canister.rsi/meta.json rename Resources/Textures/Objects/Specific/Chemistry/{pills.rsi => pills_canister.rsi}/pill_canister.png (100%) diff --git a/Content.Client/Chemistry/UI/ChemMasterBoundUserInterface.cs b/Content.Client/Chemistry/UI/ChemMasterBoundUserInterface.cs index 8c3f96bb47..a499063ca7 100644 --- a/Content.Client/Chemistry/UI/ChemMasterBoundUserInterface.cs +++ b/Content.Client/Chemistry/UI/ChemMasterBoundUserInterface.cs @@ -38,13 +38,19 @@ namespace Content.Client.Chemistry.UI _window.OnClose += Close; //Setup static button actions. - _window.EjectButton.OnPressed += _ => PrepareData(UiAction.Eject, null, null, null); - _window.BufferTransferButton.OnPressed += _ => PrepareData(UiAction.Transfer, null, null, null); - _window.BufferDiscardButton.OnPressed += _ => PrepareData(UiAction.Discard, null, null, null); - _window.CreatePillButton.OnPressed += _ => PrepareData(UiAction.CreatePills, null, _window.PillAmount.Value, null); - _window.CreateBottleButton.OnPressed += _ => PrepareData(UiAction.CreateBottles, null, null, _window.BottleAmount.Value); + _window.EjectButton.OnPressed += _ => PrepareData(UiAction.Eject, null, null, null, null); + _window.BufferTransferButton.OnPressed += _ => PrepareData(UiAction.Transfer, null, null, null, null); + _window.BufferDiscardButton.OnPressed += _ => PrepareData(UiAction.Discard, null, null, null, null); + _window.CreatePillButton.OnPressed += _ => PrepareData(UiAction.CreatePills, null, null, _window.PillAmount.Value, null); + _window.CreateBottleButton.OnPressed += _ => PrepareData(UiAction.CreateBottles, null, null, null, _window.BottleAmount.Value); - _window.OnChemButtonPressed += (args, button) => PrepareData(UiAction.ChemButton, button, null, null); + for(uint i = 0; i < _window.PillTypeButtons.Length; i++) + { + uint type = i; + _window.PillTypeButtons[i].OnPressed += _ => PrepareData(UiAction.SetPillType, null, type + 1, null, null); + } + + _window.OnChemButtonPressed += (args, button) => PrepareData(UiAction.ChemButton, button, null, null, null); } /// @@ -63,15 +69,15 @@ namespace Content.Client.Chemistry.UI _window?.UpdateState(castState); //Update window state } - private void PrepareData(UiAction action, ChemButton? button, int? pillAmount, int? bottleAmount) + private void PrepareData(UiAction action, ChemButton? button, uint? pillType, int? pillAmount, int? bottleAmount) { if (button != null) { - SendMessage(new UiActionMessage(action, button.Amount, button.Id, button.isBuffer, null, null)); + SendMessage(new UiActionMessage(action, button.Amount, button.Id, button.IsBuffer, null, null, null)); } else { - SendMessage(new UiActionMessage(action, null, null, null, pillAmount, bottleAmount)); + SendMessage(new UiActionMessage(action, null, null, null, pillType, pillAmount, bottleAmount)); } } diff --git a/Content.Client/Chemistry/UI/ChemMasterWindow.xaml b/Content.Client/Chemistry/UI/ChemMasterWindow.xaml index 799cf16a98..3dac1a1d88 100644 --- a/Content.Client/Chemistry/UI/ChemMasterWindow.xaml +++ b/Content.Client/Chemistry/UI/ChemMasterWindow.xaml @@ -1,4 +1,4 @@ - + + +