From 925738afc2f0d034a4b21f2427bc6046eb62c671 Mon Sep 17 00:00:00 2001 From: Ed <96445749+TheShuEd@users.noreply.github.com> Date: Wed, 15 Jan 2025 00:34:08 +0300 Subject: [PATCH] Workbench update (#760) * fix workbench icons * workbench search * fix 1 * UI finalize * fix material localization * restore shard sprite * Update sewing_table.yml --- .../CP14WorkbenchBoundUserInterface.cs | 11 ++- .../Workbench/CP14WorkbenchRecipeControl.xaml | 22 +++-- .../CP14WorkbenchRecipeControl.xaml.cs | 5 +- .../CP14WorkbenchRequirementControl.xaml | 12 ++- .../CP14WorkbenchRequirementControl.xaml.cs | 2 +- .../_CP14/Workbench/CP14WorkbenchWindow.xaml | 93 ++++++++++-------- .../Workbench/CP14WorkbenchWindow.xaml.cs | 38 +++++-- .../_CP14/Workbench/CP14WorkbenchSystem.UI.cs | 6 +- .../_CP14/Workbench/CP14WorkbenchSystem.cs | 5 +- .../_CP14/Workbench/CP14WorkbenchUI.cs | 1 - .../Workbench/SharedCP14WorkbenchSystem.cs | 2 +- .../en-US/_CP14/materials/materials.ftl | 6 +- .../ru-RU/_CP14/materials/materials.ftl | 6 +- .../Actions/Spells/Water/T1_ice_shards.yml | 2 +- .../Prototypes/_CP14/Materials/simple.yml | 24 ++--- .../_CP14/Recipes/Workbench/sewing_table.yml | 4 +- .../Effects/Magic/ice_shard.rsi/meta.json | 14 +++ .../Effects/Magic/ice_shard.rsi/shard.png | Bin 0 -> 245 bytes 18 files changed, 168 insertions(+), 85 deletions(-) create mode 100644 Resources/Textures/_CP14/Effects/Magic/ice_shard.rsi/meta.json create mode 100644 Resources/Textures/_CP14/Effects/Magic/ice_shard.rsi/shard.png diff --git a/Content.Client/_CP14/Workbench/CP14WorkbenchBoundUserInterface.cs b/Content.Client/_CP14/Workbench/CP14WorkbenchBoundUserInterface.cs index 03ca3bedfd..810aa36901 100644 --- a/Content.Client/_CP14/Workbench/CP14WorkbenchBoundUserInterface.cs +++ b/Content.Client/_CP14/Workbench/CP14WorkbenchBoundUserInterface.cs @@ -12,6 +12,9 @@ public sealed class CP14WorkbenchBoundUserInterface : BoundUserInterface { private CP14WorkbenchWindow? _window; + [ViewVariables] + private string _search = string.Empty; + public CP14WorkbenchBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) { } @@ -23,6 +26,12 @@ public sealed class CP14WorkbenchBoundUserInterface : BoundUserInterface _window = this.CreateWindow(); _window.OnCraft += entry => SendMessage(new CP14WorkbenchUiCraftMessage(entry.ProtoId)); + + _window.OnTextUpdated += search => + { + _search = search.Trim().ToLowerInvariant(); + _window.UpdateFilter(_search); + }; } protected override void UpdateState(BoundUserInterfaceState state) @@ -32,7 +41,7 @@ public sealed class CP14WorkbenchBoundUserInterface : BoundUserInterface switch (state) { case CP14WorkbenchUiRecipesState recipesState: - _window?.UpdateRecipes(recipesState); + _window?.UpdateRecipes(recipesState, _search); break; } } diff --git a/Content.Client/_CP14/Workbench/CP14WorkbenchRecipeControl.xaml b/Content.Client/_CP14/Workbench/CP14WorkbenchRecipeControl.xaml index fab7715ae6..fb6998a909 100644 --- a/Content.Client/_CP14/Workbench/CP14WorkbenchRecipeControl.xaml +++ b/Content.Client/_CP14/Workbench/CP14WorkbenchRecipeControl.xaml @@ -1,10 +1,20 @@  - - diff --git a/Content.Client/_CP14/Workbench/CP14WorkbenchRecipeControl.xaml.cs b/Content.Client/_CP14/Workbench/CP14WorkbenchRecipeControl.xaml.cs index 747dbff6fe..5fbe8b477d 100644 --- a/Content.Client/_CP14/Workbench/CP14WorkbenchRecipeControl.xaml.cs +++ b/Content.Client/_CP14/Workbench/CP14WorkbenchRecipeControl.xaml.cs @@ -31,7 +31,9 @@ public sealed partial class CP14WorkbenchRecipeControl : Control { var entityName = prototype.Name; Name.Text = count <= 1 ? entityName : $"{entityName} x{count}"; - View.Texture = _sprite.GetPrototypeIcon(prototype).Default; + + View.Visible = false; + EntityView.SetPrototype(prototype); } public CP14WorkbenchRecipeControl(StackPrototype prototype, int count) : this() @@ -43,6 +45,7 @@ public sealed partial class CP14WorkbenchRecipeControl : Control if (icon is null) return; + EntityView.Visible = false; View.Texture = _sprite.Frame0(icon); } } diff --git a/Content.Client/_CP14/Workbench/CP14WorkbenchRequirementControl.xaml b/Content.Client/_CP14/Workbench/CP14WorkbenchRequirementControl.xaml index 3efee3eace..049b95455b 100644 --- a/Content.Client/_CP14/Workbench/CP14WorkbenchRequirementControl.xaml +++ b/Content.Client/_CP14/Workbench/CP14WorkbenchRequirementControl.xaml @@ -1,11 +1,13 @@  diff --git a/Content.Client/_CP14/Workbench/CP14WorkbenchRequirementControl.xaml.cs b/Content.Client/_CP14/Workbench/CP14WorkbenchRequirementControl.xaml.cs index 4563643a3f..7686375fbf 100644 --- a/Content.Client/_CP14/Workbench/CP14WorkbenchRequirementControl.xaml.cs +++ b/Content.Client/_CP14/Workbench/CP14WorkbenchRequirementControl.xaml.cs @@ -59,6 +59,6 @@ public sealed partial class CP14WorkbenchRequirementControl : Control private void UpdateView() { - View.Texture = _sprite.GetPrototypeIcon(_recipePrototype.Result).Default; + View.SetPrototype(_recipePrototype.Result); } } diff --git a/Content.Client/_CP14/Workbench/CP14WorkbenchWindow.xaml b/Content.Client/_CP14/Workbench/CP14WorkbenchWindow.xaml index 86daf28101..d1f45eb2e2 100644 --- a/Content.Client/_CP14/Workbench/CP14WorkbenchWindow.xaml +++ b/Content.Client/_CP14/Workbench/CP14WorkbenchWindow.xaml @@ -2,59 +2,68 @@ xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client" xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" Title="{Loc 'cp14-workbench-ui-title'}" - MinSize="700 600"> - + SetSize="700 500" + MinSize="700 300"> + - + + + + - + + - - - - - - - + + + + + + + - - - - - - + + + + + MaxSize="64 64" + HorizontalAlignment="Left" /> - - - - - - - - -