fix lathe syncing and tweak ui (#17489)

This commit is contained in:
Nemanja
2023-06-20 02:39:35 -04:00
committed by GitHub
parent 763f6048f2
commit a01f26d3a6
12 changed files with 64 additions and 83 deletions

View File

@@ -29,16 +29,15 @@ namespace Content.Client.Lathe.UI
_menu.OnQueueButtonPressed += _ =>
{
_queueMenu.OpenCenteredLeft();
if (_queueMenu.IsOpen)
_queueMenu.Close();
else
_queueMenu.OpenCenteredLeft();
};
_menu.OnServerListButtonPressed += _ =>
{
SendMessage(new ConsoleServerSelectionMessage());
};
_menu.OnServerSyncButtonPressed += _ =>
{
SendMessage(new ConsoleServerSyncMessage());
};
_menu.RecipeQueueAction += (recipe, amount) =>
{
SendMessage(new LatheQueueRecipeMessage(recipe, amount));
@@ -56,7 +55,7 @@ namespace Content.Client.Lathe.UI
case LatheUpdateState msg:
if (_menu != null)
_menu.Recipes = msg.Recipes;
_menu?.PopulateRecipes(Owner.Owner);
_menu?.PopulateRecipes(Lathe);
_menu?.PopulateMaterials(Lathe);
_queueMenu?.PopulateList(msg.Queue);
_queueMenu?.SetInfo(msg.CurrentlyProducing);

View File

@@ -1,85 +1,84 @@
<DefaultWindow
xmlns="https://spacestation14.io"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
Title="{Loc 'lathe-menu-title'}"
MinSize="300 450"
SetSize="300 450">
<BoxContainer
Orientation="Vertical"
VerticalExpand="True"
HorizontalExpand="True"
SeparationOverride="5">
<BoxContainer
Orientation="Horizontal"
Align="End"
HorizontalExpand="True"
VerticalExpand="True"
SizeFlagsStretchRatio="1">
HorizontalExpand="True">
<Button
Name="QueueButton"
Text="{Loc 'lathe-menu-queue'}"
TextAlign="Center"
Mode="Press"
SizeFlagsStretchRatio="1">
StyleClasses="OpenRight">
</Button>
<Button
Name="ServerListButton"
Text="{Loc 'lathe-menu-server-list'}"
TextAlign="Center"
Mode="Press"
SizeFlagsStretchRatio="1">
</Button>
<Button
Name="ServerSyncButton"
Text="{Loc 'lathe-menu-sync'}"
TextAlign="Center"
Mode="Press"
SizeFlagsStretchRatio="1">
StyleClasses="OpenLeft">
</Button>
</BoxContainer>
<BoxContainer
Orientation="Horizontal"
HorizontalExpand="True"
VerticalExpand="True"
SizeFlagsStretchRatio="1">
<BoxContainer Orientation="Horizontal"
HorizontalExpand="True">
<LineEdit
Name="SearchBar"
PlaceHolder="{Loc 'lathe-menu-search-designs'}"
HorizontalExpand="True"
SizeFlagsStretchRatio="1">
HorizontalExpand="True">
</LineEdit>
<Button
Name="FilterButton"
Text="{Loc 'lathe-menu-search-filter'}"
TextAlign="Center"
SizeFlagsStretchRatio="1"
Disabled="True">
Margin="5 0 0 0"
Disabled="True"
StyleClasses="ButtonSquare">
</Button>
</BoxContainer>
<ScrollContainer MinHeight="225">
<BoxContainer
Name="RecipeList"
Orientation="Vertical"
SizeFlagsStretchRatio="8"
HorizontalExpand="True"
VerticalExpand="True">
</BoxContainer>
</ScrollContainer>
<BoxContainer
Orientation="Horizontal"
HorizontalExpand="True"
VerticalExpand="True"
SizeFlagsStretchRatio="1">
<BoxContainer Orientation="Vertical"
MinHeight="225"
VerticalExpand="True"
HorizontalExpand="True"
SizeFlagsStretchRatio="4">
<PanelContainer VerticalExpand="True">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#1B1B1E" />
</PanelContainer.PanelOverride>
<ScrollContainer VerticalExpand="True" HScrollEnabled="False">
<BoxContainer
Name="RecipeList"
Orientation="Vertical"
HorizontalExpand="True"
VerticalExpand="True"
RectClipContent="True">
</BoxContainer>
</ScrollContainer>
</PanelContainer>
</BoxContainer>
<BoxContainer Orientation="Horizontal"
HorizontalExpand="True">
<Label Margin="8 0 8 0" Text="{Loc 'lathe-menu-amount'}"/>
<LineEdit
Name="AmountLineEdit"
PlaceHolder="0"
Text="1"
HorizontalExpand="True" />
HorizontalExpand="True"/>
</BoxContainer>
<BoxContainer Orientation="Vertical" VerticalExpand="True" HorizontalExpand="True">
<ItemList
Name="Materials"
VerticalExpand="True">
</ItemList>
</BoxContainer>
<ItemList
Name="Materials"
VerticalExpand="True"
SizeFlagsStretchRatio="3">
</ItemList>
</BoxContainer>
</DefaultWindow>

View File

@@ -1,5 +1,6 @@
using System.Linq;
using System.Text;
using Content.Client.Stylesheets;
using Content.Shared.Lathe;
using Content.Shared.Materials;
using Content.Shared.Research.Prototypes;
@@ -22,7 +23,6 @@ public sealed partial class LatheMenu : DefaultWindow
public event Action<BaseButton.ButtonEventArgs>? OnQueueButtonPressed;
public event Action<BaseButton.ButtonEventArgs>? OnServerListButtonPressed;
public event Action<BaseButton.ButtonEventArgs>? OnServerSyncButtonPressed;
public event Action<string, int>? RecipeQueueAction;
public List<string> Recipes = new();
@@ -49,15 +49,13 @@ public sealed partial class LatheMenu : DefaultWindow
QueueButton.OnPressed += a => OnQueueButtonPressed?.Invoke(a);
ServerListButton.OnPressed += a => OnServerListButtonPressed?.Invoke(a);
//refresh the bui state
ServerSyncButton.OnPressed += a => OnServerSyncButtonPressed?.Invoke(a);
if (_entityManager.TryGetComponent<LatheComponent>(owner.Lathe, out var latheComponent))
{
if (!latheComponent.DynamicRecipes.Any())
{
ServerListButton.Visible = false;
ServerSyncButton.Visible = false;
QueueButton.RemoveStyleClass(StyleBase.ButtonOpenRight);
//QueueButton.AddStyleClass(StyleBase.ButtonSquare);
}
}
}

View File

@@ -2,11 +2,13 @@
<Button
Name="Button"
HorizontalExpand="True"
TooltipDelay="0.5">
TooltipDelay="0.5"
Margin="0"
StyleClasses="ButtonSquare">
<BoxContainer Orientation="Horizontal">
<TextureRect
Name="RecipeTexture"
Margin="0,0,4,0"
Margin="0 0 4 0"
MinSize="32 32"
Stretch="KeepAspectCentered" />
<Label Name="RecipeName" HorizontalExpand="True" />