From cd07aabcda1198484eb67116df53952b7c314217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=A8=E8=90=BD=E5=9F=BA=E5=9B=B4=E8=99=BE?= <3161880837@qq.com> Date: Sat, 6 Sep 2025 10:06:39 +0800 Subject: [PATCH] =?UTF-8?q?feat(Debug):=20=E6=B7=BB=E5=8A=A0FeedIsTypeTopi?= =?UTF-8?q?c=E8=B0=83=E8=AF=95=E7=BB=84=E4=BB=B6=E5=B9=B6=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E8=9B=8B=E7=B3=95=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加用于调试的FeedIsTypeTopic场景和脚本,支持按主题筛选Feed 更新蛋糕资源的主题和字段配置 --- components/Debug/FeedIsTypeTopic.tscn | 8 ++++++++ components/Feeds/Cake.tscn | 6 +++--- scripts/Debug/FeedIsTopic.gd | 29 +++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 components/Debug/FeedIsTypeTopic.tscn create mode 100644 scripts/Debug/FeedIsTopic.gd diff --git a/components/Debug/FeedIsTypeTopic.tscn b/components/Debug/FeedIsTypeTopic.tscn new file mode 100644 index 0000000..2be2795 --- /dev/null +++ b/components/Debug/FeedIsTypeTopic.tscn @@ -0,0 +1,8 @@ +[gd_scene load_steps=2 format=3 uid="uid://5fbadcha65g4"] + +[ext_resource type="Script" path="res://scripts/Debug/FeedIsTopic.gd" id="1_2hikw"] + +[node name="Debug" type="HBoxContainer"] +theme_override_constants/separation = 0 +script = ExtResource("1_2hikw") +targetTopics = Array[int]([6]) diff --git a/components/Feeds/Cake.tscn b/components/Feeds/Cake.tscn index be76db2..5a13719 100644 --- a/components/Feeds/Cake.tscn +++ b/components/Feeds/Cake.tscn @@ -7,9 +7,9 @@ avatarTexture = ExtResource("2_ijk6h") displayName = "生日蛋糕" quality = 2 -topic = 4 -fields = Array[int]([4, 1]) -fieldValues = Array[float]([0.03, 0.04]) +topic = 6 +fields = Array[int]([16]) +fieldValues = Array[float]([1.0]) costs = Array[int]([0, 1]) costCounts = Array[int]([300, 200]) diff --git a/scripts/Debug/FeedIsTopic.gd b/scripts/Debug/FeedIsTopic.gd new file mode 100644 index 0000000..9bae975 --- /dev/null +++ b/scripts/Debug/FeedIsTopic.gd @@ -0,0 +1,29 @@ +@tool +extends HBoxContainer + +@export var targetTopics: Array[FeedName.Topic] = [] +@export var clickToRefresh: bool = false + +var lastState: bool = false + +func _ready(): + rebuild() +func _physics_process(_delta): + if clickToRefresh != lastState: + lastState = clickToRefresh + rebuild() + +func rebuild(): + for i in get_children(): + i.queue_free() + var files = DirTool.listdir("res://components/Feeds/") + for file in files: + var passed: bool = false + var feed = load(file).instantiate() as Feed + for targetTopic in targetTopics: + var haveThis = feed.topic == targetTopic + passed = haveThis + if passed: + break + if passed: + add_child(feed)