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
This commit is contained in:
Spartak
2021-11-26 22:44:36 -08:00
committed by GitHub
parent 4359a083c5
commit b06becaf98
12 changed files with 204 additions and 80 deletions

View File

@@ -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);
}
/// <summary>
@@ -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));
}
}