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)