ui stule update
This commit is contained in:
1 parent
e2b4f7a1c1
commit
2b2c70d0ac
5 files changed
+21
-18
No files matched your search
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
"sources": [
|
"sources": [
|
||||||
"src/*.cs"
|
"src/*.cs"
|
||||||
],
|
],
|
||||||
"depends": [ "core>=1", "interface>=1" ],
|
"depends": [ "visual_novel_core>=1", "interface>=1" ],
|
||||||
"ui": [
|
"ui": [
|
||||||
{
|
{
|
||||||
"id": "cooking_workbench",
|
"id": "cooking_workbench",
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ custom_minimum_size = Vector2(100, 30)
|
|||||||
|
|
||||||
[node name="TxtName" type="Label" parent="HBox"]
|
[node name="TxtName" type="Label" parent="HBox"]
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
theme_override_colors/font_color = Color(1, 1, 0, 1)
|
theme_override_colors/font_color = Color(0.941176, 0.756863, 0.411765, 1)
|
||||||
theme_override_font_sizes/font_size = 12
|
theme_override_font_sizes/font_size = 12
|
||||||
|
|
||||||
[node name="TxtTime" type="Label" parent="HBox"]
|
[node name="TxtTime" type="Label" parent="HBox"]
|
||||||
custom_minimum_size = Vector2(40, 30)
|
custom_minimum_size = Vector2(40, 30)
|
||||||
theme_override_colors/font_color = Color(1, 0, 0, 1)
|
theme_override_colors/font_color = Color(0.909804, 0.662745, 0.670588, 1)
|
||||||
theme_override_font_sizes/font_size = 12
|
theme_override_font_sizes/font_size = 12
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using Cthangover.Core.Items;
|
using Cthangover.Core.Items;
|
||||||
using Cthangover.Core.Settings;
|
using Cthangover.Core.Settings;
|
||||||
using Cthangover.Core.UI;
|
using Cthangover.Core.UI;
|
||||||
|
using Cthangover.Core.UI.Theming;
|
||||||
using Cthangover.Core.Utils;
|
using Cthangover.Core.Utils;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
@@ -15,8 +16,8 @@ namespace Mods.Cooking.Workbench
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class RecipeIconItemBehaviour : Widget
|
public class RecipeIconItemBehaviour : Widget
|
||||||
{
|
{
|
||||||
private static readonly Color NormalColor = Colors.White;
|
private static readonly Color NormalColor = UiTokens.InkBright;
|
||||||
private static readonly Color NotItemsColor = Colors.Gray;
|
private static readonly Color NotItemsColor = UiTokens.Muted;
|
||||||
|
|
||||||
private TextureRect img;
|
private TextureRect img;
|
||||||
private Label txt;
|
private Label txt;
|
||||||
@@ -53,8 +54,8 @@ namespace Mods.Cooking.Workbench
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Evaluates whether the player's inventory contains enough of the
|
/// Evaluates whether the player's inventory contains enough of the
|
||||||
/// required ingredient. Tints the icon and count text to
|
/// required ingredient. Tints the icon and count text to
|
||||||
/// <c>NormalColor</c> (white) when satisfied or <c>NotItemsColor</c>
|
/// <c>NormalColor</c> (bright ink) when satisfied or <c>NotItemsColor</c>
|
||||||
/// (grey) when insufficient. Called by the parent
|
/// (muted) when insufficient. Called by the parent
|
||||||
/// <see cref="RecipeItemBehaviour"/> during state refresh.
|
/// <see cref="RecipeItemBehaviour"/> during state refresh.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns><c>true</c> if inventory meets or exceeds the required count.</returns>
|
/// <returns><c>true</c> if inventory meets or exceeds the required count.</returns>
|
||||||
@@ -62,7 +63,7 @@ namespace Mods.Cooking.Workbench
|
|||||||
{
|
{
|
||||||
var result = GameData.Instance.Runtime.Inventory.CheckCount(ingredient.Item) >= ingredient.Count;
|
var result = GameData.Instance.Runtime.Inventory.CheckCount(ingredient.Item) >= ingredient.Count;
|
||||||
txt.AddThemeColorOverride("font_color", result ? NormalColor : NotItemsColor);
|
txt.AddThemeColorOverride("font_color", result ? NormalColor : NotItemsColor);
|
||||||
img.Modulate = result ? Colors.White : NotItemsColor;
|
img.Modulate = result ? UiTokens.White : NotItemsColor;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Cthangover.Core.Items;
|
|||||||
using Cthangover.Core.Scenes;
|
using Cthangover.Core.Scenes;
|
||||||
using Cthangover.Core.Settings;
|
using Cthangover.Core.Settings;
|
||||||
using Cthangover.Core.UI;
|
using Cthangover.Core.UI;
|
||||||
|
using Cthangover.Core.UI.Theming;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
namespace Mods.Cooking.Workbench
|
namespace Mods.Cooking.Workbench
|
||||||
@@ -25,9 +26,9 @@ namespace Mods.Cooking.Workbench
|
|||||||
private Label txtTime;
|
private Label txtTime;
|
||||||
private HBoxContainer recipeContentHbox;
|
private HBoxContainer recipeContentHbox;
|
||||||
|
|
||||||
private static readonly Color normalColor = new(1f, 1f, 1f, 1f);
|
private static readonly Color normalColor = UiTokens.White;
|
||||||
private static readonly Color selectedColor = new(0.8f, 0.8f, 0.8f, 1f);
|
private static readonly Color selectedColor = UiTokens.Alpha(UiTokens.White, 0.8f);
|
||||||
private static readonly Color disableColor = new(0.5f, 0.5f, 0.5f, 1f);
|
private static readonly Color disableColor = UiTokens.Muted;
|
||||||
|
|
||||||
private IRecipe recipe;
|
private IRecipe recipe;
|
||||||
private Node panel;
|
private Node panel;
|
||||||
@@ -79,8 +80,8 @@ namespace Mods.Cooking.Workbench
|
|||||||
/// Refreshes the visual availability state of this recipe.
|
/// Refreshes the visual availability state of this recipe.
|
||||||
/// Iterates all child <see cref="RecipeIconItemBehaviour"/> widgets,
|
/// Iterates all child <see cref="RecipeIconItemBehaviour"/> widgets,
|
||||||
/// calling <c>CheckAndUpdate</c> on each. If any ingredient is missing,
|
/// calling <c>CheckAndUpdate</c> on each. If any ingredient is missing,
|
||||||
/// tints the name and time labels with <c>disableColor</c> (greyed out);
|
/// tints the name and time labels with <c>disableColor</c> (muted);
|
||||||
/// otherwise restores the default yellow/red colour scheme.
|
/// otherwise restores the accent (gold) and danger (red) colour scheme.
|
||||||
/// Call after inventory changes or cooking operations.
|
/// Call after inventory changes or cooking operations.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void UpdateState()
|
public void UpdateState()
|
||||||
@@ -98,8 +99,8 @@ namespace Mods.Cooking.Workbench
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
txtName.AddThemeColorOverride("font_color", Colors.Yellow);
|
txtName.AddThemeColorOverride("font_color", UiTokens.AccentBright);
|
||||||
txtTime.AddThemeColorOverride("font_color", Colors.Red);
|
txtTime.AddThemeColorOverride("font_color", UiTokens.DangerText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +144,7 @@ namespace Mods.Cooking.Workbench
|
|||||||
{
|
{
|
||||||
var plus = new Label();
|
var plus = new Label();
|
||||||
plus.Text = "+";
|
plus.Text = "+";
|
||||||
plus.AddThemeFontSizeOverride("font_size", 12);
|
plus.AddThemeFontSizeOverride("font_size", UiTokens.FontBodySmall);
|
||||||
plus.VerticalAlignment = VerticalAlignment.Center;
|
plus.VerticalAlignment = VerticalAlignment.Center;
|
||||||
recipeContentHbox.AddChild(plus);
|
recipeContentHbox.AddChild(plus);
|
||||||
items.Add(plus);
|
items.Add(plus);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Cthangover.Core.Items;
|
|||||||
using Cthangover.Core.Scenes;
|
using Cthangover.Core.Scenes;
|
||||||
using Cthangover.Core.Settings;
|
using Cthangover.Core.Settings;
|
||||||
using Cthangover.Core.UI;
|
using Cthangover.Core.UI;
|
||||||
|
using Cthangover.Core.UI.Theming;
|
||||||
using Cthangover.Core.UI.Tool;
|
using Cthangover.Core.UI.Tool;
|
||||||
using Cthangover.Core.UI.Inventory;
|
using Cthangover.Core.UI.Inventory;
|
||||||
using Godot;
|
using Godot;
|
||||||
@@ -38,7 +39,7 @@ namespace Mods.Cooking.Workbench
|
|||||||
|
|
||||||
var leftTitle = GetNode<Label>("HBox/LeftPanel/LeftTitle");
|
var leftTitle = GetNode<Label>("HBox/LeftPanel/LeftTitle");
|
||||||
leftTitle.Text = TranslationServer.Translate("ui/cook/title");
|
leftTitle.Text = TranslationServer.Translate("ui/cook/title");
|
||||||
leftTitle.AddThemeFontSizeOverride("font_size", 16);
|
leftTitle.AddThemeFontSizeOverride("font_size", UiTokens.FontLead);
|
||||||
|
|
||||||
content = GetNode<VBoxContainer>("HBox/LeftPanel/Scroll/Content");
|
content = GetNode<VBoxContainer>("HBox/LeftPanel/Scroll/Content");
|
||||||
|
|
||||||
@@ -109,7 +110,7 @@ namespace Mods.Cooking.Workbench
|
|||||||
public void ClickRecipe(IRecipe recipe, RecipeItemBehaviour recipeItemBehaviour)
|
public void ClickRecipe(IRecipe recipe, RecipeItemBehaviour recipeItemBehaviour)
|
||||||
{
|
{
|
||||||
if (txtDescription != null)
|
if (txtDescription != null)
|
||||||
txtDescription.Text = "[b][color=yellow]" + TranslationServer.Translate(recipe.Name) + "[/color][/b]\n\n" +
|
txtDescription.Text = "[b][color=#" + UiTokens.AccentBright.ToHtml(false) + "]" + TranslationServer.Translate(recipe.Name) + "[/color][/b]\n\n" +
|
||||||
TranslationServer.Translate(recipe.Description);
|
TranslationServer.Translate(recipe.Description);
|
||||||
|
|
||||||
outputContainer.List = recipe.Output.Select(o => (IItemContainer)new ItemContainer
|
outputContainer.List = recipe.Output.Select(o => (IItemContainer)new ItemContainer
|
||||||
|
|||||||
Reference in new issue
Block a user