workbench ui clean up (#399)

* workbench ui clean fix

* stack localization
This commit is contained in:
Ed
2024-08-07 09:32:27 +03:00
committed by GitHub
parent 78e140b4ae
commit d4001598d4
14 changed files with 73 additions and 28 deletions

View File

@@ -1,6 +1,4 @@
using Content.Shared._CP14.Workbench;
using Content.Shared._CP14.Workbench.Prototypes;
using Content.Shared.Stacks;
using Content.Shared.Stacks;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
@@ -26,7 +24,7 @@ public sealed partial class CP14WorkbenchRecipeControl : Control
public CP14WorkbenchRecipeControl(EntityPrototype prototype, int count) : this()
{
var entityName = Loc.GetString(prototype.Name);
var entityName = prototype.Name;
Name.Text = count <= 1 ? entityName : $"{entityName} x{count}";
View.Texture = _sprite.GetPrototypeIcon(prototype).Default;
}
@@ -34,7 +32,7 @@ public sealed partial class CP14WorkbenchRecipeControl : Control
public CP14WorkbenchRecipeControl(StackPrototype prototype, int count) : this()
{
var entityName = Loc.GetString(prototype.Name);
Name.Text = count <= 1 ? entityName : $"{entityName} x{count}";
Name.Text = $"{entityName} x{count}";
var icon = prototype.Icon;
if (icon is null)

View File

@@ -1,7 +1,7 @@
<DefaultWindow xmlns="https://spacestation14.io"
xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Title="Workbench"
Title="{Loc 'cp14-workbench-ui-title'}"
MinSize="700 600">
<BoxContainer Orientation="Vertical">
<!-- Main -->
@@ -41,7 +41,7 @@
<controls:HLine Color="#404040" Thickness="2" Margin="0 5"/>
<!-- Required title -->
<Label Text="Required"/>
<Label Text="{Loc 'cp14-workbench-recipe-list'}"/>
<!-- Craft requirements content -->
<!-- Added by code -->
@@ -50,7 +50,7 @@
<controls:HLine Color="#404040" Thickness="2" Margin="0 5"/>
<!-- Craft button -->
<Button Name="CraftButton" Text="Craft"/>
<Button Name="CraftButton" Text="{Loc 'cp14-workbench-craft'}"/>
</BoxContainer>
</PanelContainer>
</BoxContainer>

View File

@@ -40,11 +40,23 @@ public sealed partial class CP14WorkbenchWindow : DefaultWindow
{
CraftsContainer.RemoveAllChildren();
List<CP14WorkbenchUiRecipesEntry> uncraftableList = new();
foreach (var entry in recipesState.Recipes)
{
if (entry.Craftable)
{
var control = new CP14WorkbenchRequirementControl(entry);
control.OnSelect += RecipeSelect;
CraftsContainer.AddChild(control);
}
else
uncraftableList.Add(entry);
}
foreach (var entry in uncraftableList)
{
var control = new CP14WorkbenchRequirementControl(entry);
control.OnSelect += RecipeSelect;
CraftsContainer.AddChild(control);
}
@@ -73,8 +85,8 @@ public sealed partial class CP14WorkbenchWindow : DefaultWindow
var result = _prototype.Index(recipe.Result);
ItemView.Texture = _sprite.GetPrototypeIcon(recipe.Result).Default;
ItemName.Text = Loc.GetString(result.Name);
ItemDescription.Text = Loc.GetString(result.Description);
ItemName.Text = result.Name;
ItemDescription.Text = result.Description;
ItemRequirements.RemoveAllChildren();
foreach (var (entProtoId, count) in recipe.Entities)
@@ -82,9 +94,9 @@ public sealed partial class CP14WorkbenchWindow : DefaultWindow
ItemRequirements.AddChild(new CP14WorkbenchRecipeControl(_prototype.Index(entProtoId), count));
}
foreach (var (entProtoId, count) in recipe.Stacks)
foreach (var (stackProtoId, count) in recipe.Stacks)
{
ItemRequirements.AddChild(new CP14WorkbenchRecipeControl(_prototype.Index(entProtoId), count));
ItemRequirements.AddChild(new CP14WorkbenchRecipeControl(_prototype.Index(stackProtoId), count));
}
CraftButton.Disabled = !entry.Craftable;

View File

@@ -0,0 +1,4 @@
cp14-stack-copper-coin = copper coins
cp14-stack-silver-coin = silver coins
cp14-stack-gold-coin = gold coins
cp14-stack-platinum-coin = platinum coins

View File

@@ -0,0 +1,8 @@
cp14-stack-dirt-block = dirt blocks
cp14-stack-stone-block = stone blocks
cp14-stack-wood-planks = wooden planks
cp14-stack-nails = nails
cp14-stack-copper-bars = copper bars
cp14-stack-iron-bars = iron bars
cp14-stack-gold-bars = gold bars

View File

@@ -1,5 +1,6 @@
cp14-verb-categories-craft = Select recipe:
cp14-workbench-ui-title = Item creation
cp14-workbench-craft = Craft
cp14-workbench-recipe-list = Recipe:
cp14-workbench-no-resource = There aren't enough ingredients!

View File

@@ -0,0 +1,4 @@
cp14-stack-copper-coin = медные монеты
cp14-stack-silver-coin = серебрянные монеты
cp14-stack-gold-coin = золотые монеты
cp14-stack-platinum-coin = платиновые монеты

View File

@@ -0,0 +1,8 @@
cp14-stack-dirt-block = блоки земли
cp14-stack-stone-block = каменные блоки
cp14-stack-wood-planks = деревянные доски
cp14-stack-nails = гвозди
cp14-stack-copper-bars = медные слитки
cp14-stack-iron-bars = железные слитки
cp14-stack-gold-bars = золотые слитки

View File

@@ -1,5 +1,6 @@
cp14-verb-categories-craft = Выберите крафт:
cp14-workbench-ui-title = Создание предметов
cp14-workbench-craft = Создать
cp14-workbench-recipe-list = Рецепт:
cp14-workbench-no-resource = Не хватает ингредиентов!

View File

@@ -13,7 +13,7 @@
- type: entity
id: CP14MeltingMoldBlank
parent: CP14MeltingMoldBase
name: black melting mold
name: blank melting mold
description: An empty mold for casting metal. You can cut any shape you need in it on the pattern cutting table.
components:
- type: Sprite

View File

@@ -74,6 +74,7 @@
recipes:
- CP14Bucket
- CP14BaseBarrel
- CP14WoodenBeerMug
- type: entity
id: CP14WorkbenchMeltingMolds

View File

@@ -13,4 +13,12 @@
stacks:
CP14WoodenPlanks: 5
CP14Nail: 2
result: CP14BaseBarrel
result: CP14BaseBarrel
- type: CP14Recipe
id: CP14WoodenBeerMug
craftTime: 3
stacks:
CP14WoodenPlanks: 2
CP14Nail: 1
result: CP14WoodenBeerMug

View File

@@ -1,6 +1,6 @@
- type: stack
id: CP14CopperCoin
name: copper crown
name: cp14-stack-copper-coin
spawn: CP14CopperCoin1
icon:
sprite: /Textures/_CP14/Objects/Economy/cp_coin.rsi
@@ -9,7 +9,7 @@
- type: stack
id: CP14SilverCoin
name: silver sovereign
name: cp14-stack-silver-coin
spawn: CP14SilverCoin1
icon:
sprite: /Textures/_CP14/Objects/Economy/sp_coin.rsi
@@ -18,7 +18,7 @@
- type: stack
id: CP14GoldCoin
name: gold galifar
name: cp14-stack-gold-coin
spawn: CP14GoldCoin1
icon:
sprite: /Textures/_CP14/Objects/Economy/gp_coin.rsi
@@ -27,7 +27,7 @@
- type: stack
id: CP14PlatinumCoin
name: platinum dragon
name: cp14-stack-platinum-coin
spawn: CP14PlatinumCoin1
icon:
sprite: /Textures/_CP14/Objects/Economy/pp_coin.rsi

View File

@@ -1,48 +1,48 @@
- type: stack
id: CP14Dirt
name: dirt block
name: cp14-stack-dirt-block
spawn: CP14DirtBlock1
icon: { sprite: _CP14/Objects/Materials/dirt_block.rsi, state: dirt_2 }
maxCount: 10
- type: stack
id: CP14Stone
name: stone block
name: cp14-stack-stone-block
spawn: CP14StoneBlock1
icon: { sprite: _CP14/Objects/Materials/stone_block.rsi, state: stone_2 }
maxCount: 10
- type: stack
id: CP14WoodenPlanks
name: wooden planks
name: cp14-stack-wood-planks
spawn: CP14WoodenPlanks1
icon: { sprite: _CP14/Objects/Materials/wood.rsi, state: planks_2 }
maxCount: 10
- type: stack
id: CP14Nail
name: nails
name: cp14-stack-nails
spawn: CP14Nail1
icon: { sprite: _CP14/Objects/Materials/nails.rsi, state: nail_2 }
maxCount: 10
- type: stack
id: CP14CopperBar
name: copper bars
name: cp14-stack-copper-bars
spawn: CP14CopperBar1
icon: { sprite: _CP14/Objects/Materials/copper_bar.rsi, state: bar_2 }
maxCount: 10
- type: stack
id: CP14IronBar
name: iron bars
name: cp14-stack-iron-bars
spawn: CP14IronBar1
icon: { sprite: _CP14/Objects/Materials/iron_bar.rsi, state: bar_2 }
maxCount: 10
- type: stack
id: CP14GoldBar
name: gold bars
name: cp14-stack-gold-bars
spawn: CP14GoldBar1
icon: { sprite: _CP14/Objects/Materials/gold_bar.rsi, state: bar_2 }
maxCount: 10