This commit is contained in:
2025-06-16 07:59:50 +08:00
commit 7a6cd423fc
54 changed files with 4068 additions and 0 deletions

View File

@ -0,0 +1,33 @@
using Godot;
using System.Collections.Generic;
public partial class ResourceGrid : GridContainer
{
[Export]
public PackedScene ItemPanelScene;
public override void _Ready()
{
// 获取基础资源分类的所有物品
var items = ResourceCategoryManager.Instance.GetItemsByCategory("基础资源");
foreach (var item in items.Values)
{
var panel = (Panel)ItemPanelScene.Instantiate();
// 设置图标为白色底色
var icon = panel.GetNode<TextureRect>("HBoxContainer/Icon");
icon.Texture = null;
icon.Modulate = new Color(1, 1, 1, 1); // 白色
// 设置名称
var nameLabel = panel.GetNode<Label>("HBoxContainer/VBoxContainer/TopRow/NameLabel");
nameLabel.Text = item.Name;
// 其余内容可根据需要设置
// ...
AddChild(panel);
}
}
}