Add auto modes to reagent grinder (#26290)
* Add auto-mode to reagent grinder * Remove redundant stuff with DataField * Use margin instead of dummy control * Resolve grinder component
This commit is contained in:
@@ -3,10 +3,12 @@
|
||||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
|
||||
Title="{Loc grinder-menu-title}" MinSize="768 256">
|
||||
<BoxContainer Orientation="Horizontal">
|
||||
<BoxContainer Orientation="Vertical" VerticalAlignment="Top" Margin="8">
|
||||
<Button Name="GrindButton" Text="{Loc grinder-menu-grind-button}" TextAlign="Center" MinSize="64 48"/>
|
||||
<Control MinSize="0 16"/>
|
||||
<Button Name="JuiceButton" Text="{Loc grinder-menu-juice-button}" TextAlign="Center" MinSize="64 48"/>
|
||||
<BoxContainer Orientation="Vertical" VerticalAlignment="Top" Margin="8" MinWidth="100">
|
||||
<Label Text="{Loc grinder-menu-auto-label}" HorizontalAlignment="Center"/>
|
||||
<Button Name="AutoModeButton" Text="{Loc grinder-menu-auto-button}" TextAlign="Center" MinSize="64 48" Margin="0 0 0 16" />
|
||||
<Label Text="{Loc grinder-menu-manual-label}" HorizontalAlignment="Center"/>
|
||||
<Button Name="GrindButton" Text="{Loc grinder-menu-grind-button}" TextAlign="Center" MinSize="64 48" Margin="0 0 0 16" />
|
||||
<Button Name="JuiceButton" Text="{Loc grinder-menu-juice-button}" TextAlign="Center" MinSize="64 48" />
|
||||
</BoxContainer>
|
||||
|
||||
<ui:LabelledContentBox Name="ChamberContentBox" LabelText="{Loc grinder-menu-chamber-content-box-label}" ButtonText="{Loc grinder-menu-chamber-content-box-button}" VerticalExpand="True" HorizontalExpand="True" Margin="8" SizeFlagsStretchRatio="2"/>
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace Content.Client.Kitchen.UI
|
||||
_entityManager = entityManager;
|
||||
_prototypeManager = prototypeManager;
|
||||
_owner = owner;
|
||||
AutoModeButton.OnPressed += owner.ToggleAutoMode;
|
||||
GrindButton.OnPressed += owner.StartGrinding;
|
||||
JuiceButton.OnPressed += owner.StartJuicing;
|
||||
ChamberContentBox.EjectButton.OnPressed += owner.EjectAll;
|
||||
@@ -56,6 +57,19 @@ namespace Content.Client.Kitchen.UI
|
||||
GrindButton.Disabled = !state.CanGrind || !state.Powered;
|
||||
JuiceButton.Disabled = !state.CanJuice || !state.Powered;
|
||||
|
||||
switch (state.AutoMode)
|
||||
{
|
||||
case GrinderAutoMode.Grind:
|
||||
AutoModeButton.Text = Loc.GetString("grinder-menu-grind-button");
|
||||
break;
|
||||
case GrinderAutoMode.Juice:
|
||||
AutoModeButton.Text = Loc.GetString("grinder-menu-juice-button");
|
||||
break;
|
||||
default:
|
||||
AutoModeButton.Text = Loc.GetString("grinder-menu-auto-button-off");
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO move this to a component state and ensure the net ids.
|
||||
RefreshContentsDisplay(state.ReagentQuantities, _entityManager.GetEntityArray(state.ChamberContents), state.HasBeakerIn);
|
||||
}
|
||||
|
||||
@@ -52,6 +52,11 @@ namespace Content.Client.Kitchen.UI
|
||||
_menu?.HandleMessage(message);
|
||||
}
|
||||
|
||||
public void ToggleAutoMode(BaseButton.ButtonEventArgs args)
|
||||
{
|
||||
SendMessage(new ReagentGrinderToggleAutoModeMessage());
|
||||
}
|
||||
|
||||
public void StartGrinding(BaseButton.ButtonEventArgs? _ = null)
|
||||
{
|
||||
SendMessage(new ReagentGrinderStartMessage(GrinderProgram.Grind));
|
||||
|
||||
Reference in New Issue
Block a user