diff --git a/components/Bullets/BigLaser.tscn b/components/Bullets/BigLaser.tscn index 8e84d1c..060a7d2 100644 --- a/components/Bullets/BigLaser.tscn +++ b/components/Bullets/BigLaser.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=3 uid="uid://ltqx7fyovhla"] -[ext_resource type="PackedScene" uid="uid://8gjjfju6p3fh" path="res://components/Bullets/Common/LaserSummoner.tscn" id="1_ukbip"] +[ext_resource type="PackedScene" uid="uid://8gjjfju6p3fh" path="res://components/Bullets/LaserSummoner.tscn" id="1_ukbip"] [node name="BigLaser" instance=ExtResource("1_ukbip")] needEnergy = 100.0 diff --git a/components/Bullets/ChickLaser.tscn b/components/Bullets/ChickLaser.tscn index 41eb7c8..b59dfac 100644 --- a/components/Bullets/ChickLaser.tscn +++ b/components/Bullets/ChickLaser.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=17 format=3 uid="uid://bvri0nv1jrigf"] -[ext_resource type="PackedScene" uid="uid://8gjjfju6p3fh" path="res://components/Bullets/Common/LaserSummoner.tscn" id="1_eb54j"] +[ext_resource type="PackedScene" uid="uid://8gjjfju6p3fh" path="res://components/Bullets/LaserSummoner.tscn" id="1_eb54j"] [ext_resource type="Script" path="res://scripts/Contents/Bullets/ChickLaser.gd" id="2_7g0f0"] [ext_resource type="Shader" path="res://shaders/BigLaser.gdshader" id="3_4y0mm"] [ext_resource type="Texture2D" uid="uid://cv8yl3ncek4ap" path="res://resources/bullets/laser-circle/blue-circle.svg" id="4_cws6l"] diff --git a/components/Bullets/Common/LaserSummoner.tscn b/components/Bullets/LaserSummoner.tscn similarity index 100% rename from components/Bullets/Common/LaserSummoner.tscn rename to components/Bullets/LaserSummoner.tscn diff --git a/components/Debug/FeedFilter.tscn b/components/Debug/FeedFilter.tscn new file mode 100644 index 0000000..3bfc329 --- /dev/null +++ b/components/Debug/FeedFilter.tscn @@ -0,0 +1,11 @@ +[gd_scene load_steps=2 format=3 uid="uid://feedfiltercombined"] + +[ext_resource type="Script" path="res://scripts/Debug/FeedFilter.gd" id="1_feedfilter"] + +[node name="FeedFilter" type="HBoxContainer"] +theme_override_constants/separation = 0 +script = ExtResource("1_feedfilter") +targetFields = Array[int]([]) +targetTopics = Array[int]([]) +composeMode = 0 +clickToRefresh = false \ No newline at end of file diff --git a/components/Effects/AttackStar.tscn b/components/Effects/AttackStar.tscn index 8b4e122..dac52b9 100644 --- a/components/Effects/AttackStar.tscn +++ b/components/Effects/AttackStar.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=9 format=3 uid="uid://bkwy3rwkihf4m"] [ext_resource type="PackedScene" uid="uid://bcvuuy2m0pke0" path="res://components/Abstracts/EffectBase.tscn" id="1_gbycc"] -[ext_resource type="Texture2D" uid="uid://chqmaeivt84b5" path="res://components/UI/attackstar.svg" id="2_2ws80"] +[ext_resource type="Texture2D" uid="uid://chqmaeivt84b5" path="res://resources/common/attackstar.svg" id="2_2ws80"] [ext_resource type="AudioStream" uid="uid://cn876dtp1ypqx" path="res://resources/sounds/effect/Collect.wav" id="2_nxkfo"] [sub_resource type="Curve" id="Curve_2biku"] diff --git a/components/Scenes/UI.tscn b/components/Scenes/UI.tscn index dd4baf9..c499d03 100644 --- a/components/Scenes/UI.tscn +++ b/components/Scenes/UI.tscn @@ -8,7 +8,7 @@ [ext_resource type="StyleBox" uid="uid://8pg3ry3y5wjv" path="res://styleboxes/centerRight.tres" id="5_3hym1"] [ext_resource type="PackedScene" uid="uid://beo6s1kudbbve" path="res://components/Scenes/FullscreenPanels/GameOver.tscn" id="6_10ay6"] [ext_resource type="Texture2D" uid="uid://k13cte17httt" path="res://resources/items/energy.svg" id="7_2om12"] -[ext_resource type="PackedScene" uid="uid://b07gqo6df0r5y" path="res://components/UI/Variants/VerticalColorBar.tscn" id="8_f4j2b"] +[ext_resource type="PackedScene" uid="uid://b07gqo6df0r5y" path="res://components/VerticalColorBar.tscn" id="8_f4j2b"] [ext_resource type="StyleBox" uid="uid://ddnjus87wwlm8" path="res://styleboxes/leftPanel.tres" id="11_67ghp"] [ext_resource type="PackedScene" uid="uid://cksonrrx38k36" path="res://components/Scenes/FullscreenPanels/Pause.tscn" id="12_jkm6o"] [ext_resource type="PackedScene" uid="uid://dekcqdhrjs07u" path="res://components/Scenes/FullscreenPanels/Weapon.tscn" id="13_bmc24"] diff --git a/components/Scenes/World.tscn b/components/Scenes/World.tscn index 73ff7af..31d36b9 100644 --- a/components/Scenes/World.tscn +++ b/components/Scenes/World.tscn @@ -1,10 +1,12 @@ -[gd_scene load_steps=10 format=3 uid="uid://dmxi1ikn6avig"] +[gd_scene load_steps=12 format=3 uid="uid://dmxi1ikn6avig"] [ext_resource type="Script" path="res://scripts/Tools/Managers/WorldManager.gd" id="1_lxsxj"] [ext_resource type="PackedScene" uid="uid://dfwg750a47ggx" path="res://components/Scenes/UI.tscn" id="2_04cdd"] +[ext_resource type="Script" path="res://scripts/Tools/Managers/ComponentManager.gd" id="2_fseiu"] [ext_resource type="PackedScene" uid="uid://bm7ymrri6pykb" path="res://components/Characters/Rooster.tscn" id="3_5ui6q"] [ext_resource type="Texture2D" uid="uid://c33c8mtm4x3e3" path="res://resources/maps/Galaxy.png" id="4_oy4jj"] [ext_resource type="Script" path="res://scripts/Tools/Managers/CameraManager.gd" id="5_mk7bv"] +[ext_resource type="Script" path="res://scripts/Tools/ItemStore.gd" id="7_b3hon"] [sub_resource type="Animation" id="Animation_ykpvi"] length = 0.001 @@ -72,6 +74,9 @@ y_sort_enabled = true script = ExtResource("1_lxsxj") metadata/_edit_vertical_guides_ = [-1.0, 57.0] +[node name="Node" type="Node" parent="."] +script = ExtResource("2_fseiu") + [node name="UI" parent="." instance=ExtResource("2_04cdd")] [node name="camera" type="Camera2D" parent="."] @@ -103,3 +108,6 @@ shape = SubResource("CircleShape2D_4hkht") polygon = PackedVector2Array(-2419, 1803, 2429, 1825, 2392, -366, 2867, -318, 2723, 2241, -2879, 2193, -2797, -2582, 2959, -2528, 2858, -347, 2420, -337, 2441, -1834, -2438, -1792) [node name="rooster" parent="." groups=["players"] instance=ExtResource("3_5ui6q")] + +[node name="Node2" type="Node" parent="."] +script = ExtResource("7_b3hon") diff --git a/components/UI/SkillIcon.tscn b/components/UI/SkillIcon.tscn index d350a45..67e8c78 100644 --- a/components/UI/SkillIcon.tscn +++ b/components/UI/SkillIcon.tscn @@ -3,7 +3,7 @@ [ext_resource type="Shader" path="res://shaders/CooldownProgress.gdshader" id="1_jaivk"] [ext_resource type="Script" path="res://scripts/Statemachine/SkillIcon.gd" id="1_l7say"] [ext_resource type="Texture2D" uid="uid://cp4ypuarjoshp" path="res://resources/skillIcons/purple-crystal.png" id="2_hh1bl"] -[ext_resource type="Texture2D" uid="uid://chqmaeivt84b5" path="res://components/UI/attackstar.svg" id="4_50rim"] +[ext_resource type="Texture2D" uid="uid://chqmaeivt84b5" path="res://resources/common/attackstar.svg" id="4_50rim"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_3fyf3"] shader = ExtResource("1_jaivk") diff --git a/components/UI/Variants/VerticalColorBar.tscn b/components/VerticalColorBar.tscn similarity index 100% rename from components/UI/Variants/VerticalColorBar.tscn rename to components/VerticalColorBar.tscn diff --git a/components/UI/attackstar.svg b/resources/common/attackstar.svg similarity index 100% rename from components/UI/attackstar.svg rename to resources/common/attackstar.svg diff --git a/components/UI/attackstar.svg.import b/resources/common/attackstar.svg.import similarity index 74% rename from components/UI/attackstar.svg.import rename to resources/common/attackstar.svg.import index 3946d02..51c84d0 100644 --- a/components/UI/attackstar.svg.import +++ b/resources/common/attackstar.svg.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://chqmaeivt84b5" -path="res://.godot/imported/attackstar.svg-b1221cbc7b9ccfacea37ada0859e9b08.ctex" +path="res://.godot/imported/attackstar.svg-183bfa7a1d8c538e44ef724c3e3caa0d.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://components/UI/attackstar.svg" -dest_files=["res://.godot/imported/attackstar.svg-b1221cbc7b9ccfacea37ada0859e9b08.ctex"] +source_file="res://resources/common/attackstar.svg" +dest_files=["res://.godot/imported/attackstar.svg-183bfa7a1d8c538e44ef724c3e3caa0d.ctex"] [params] diff --git a/scripts/Contents/Panels/MakeFeed.gd b/scripts/Contents/Panels/MakeFeed.gd index 66c1fbd..ca9fe0d 100644 --- a/scripts/Contents/Panels/MakeFeed.gd +++ b/scripts/Contents/Panels/MakeFeed.gd @@ -25,7 +25,6 @@ func _ready(): regenerateCards() ) for i in len(ComponentManager.feeds): - print("正在从 %s 加载饲料卡" % ComponentManager.feeds[i]) var feed = ComponentManager.getFeed(i).instantiate() as Feed feed.selected.connect( func(applied: bool): diff --git a/scripts/Debug/FeedFilter.gd b/scripts/Debug/FeedFilter.gd new file mode 100644 index 0000000..4f40463 --- /dev/null +++ b/scripts/Debug/FeedFilter.gd @@ -0,0 +1,70 @@ +@tool +extends HBoxContainer + +enum ComposeMode { + ALL, + ANY, +} + +@export var targetFields: Array[FieldStore.Entity] = [] +@export var targetTopics: Array[FeedName.Topic] = [] +@export var composeMode: ComposeMode = ComposeMode.ALL +@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 feed = load(file).instantiate() as Feed + + # 检查字段条件 + var fieldPassed: bool = true + if !targetFields.is_empty(): + fieldPassed = checkFieldCondition(feed) + + # 检查主题条件 + var topicPassed: bool = true + if !targetTopics.is_empty(): + topicPassed = checkTopicCondition(feed) + + # 如果两个条件都满足,则添加到容器中 + if fieldPassed and topicPassed: + add_child(feed) + +func checkFieldCondition(feed: Feed) -> bool: + var passed: bool = true + for targetField in targetFields: + var haveThis = false + for feedField in feed.fields: + if feedField == targetField: + haveThis = true + break + passed = haveThis + if composeMode == ComposeMode.ALL: + if not passed: + break + elif composeMode == ComposeMode.ANY: + if passed: + break + return passed + +func checkTopicCondition(feed: Feed) -> bool: + var passed: bool = false + for targetTopic in targetTopics: + var haveThis = feed.topic == targetTopic + passed = haveThis + if passed: + break + return passed \ No newline at end of file diff --git a/scripts/Tools/DirTool.gd b/scripts/Tools/DirTool.gd index 30b4168..6638ba2 100644 --- a/scripts/Tools/DirTool.gd +++ b/scripts/Tools/DirTool.gd @@ -10,9 +10,10 @@ static func listdir(path: String) -> Array[String]: var file_name = dir.get_next() while file_name != "": if file_name != "." and file_name != "..": - if file_name.get_extension() == "remap": - file_name = file_name.substr(0, len(file_name) - 6) - files.append(path + file_name) + if not file_name.get_extension() == "import": + if file_name.get_extension() == "remap": + file_name = file_name.substr(0, len(file_name) - 6) + files.append(path + file_name) file_name = dir.get_next() dir.list_dir_end() return files diff --git a/scripts/Tools/ItemStore.gd b/scripts/Tools/ItemStore.gd index 00be01f..1908b56 100644 --- a/scripts/Tools/ItemStore.gd +++ b/scripts/Tools/ItemStore.gd @@ -1,4 +1,5 @@ @tool +extends Node class_name ItemStore enum ItemType { @@ -23,4 +24,4 @@ static var idMap = { ItemType.SOUL: "soul", } static func getTexture(type: ItemType) -> Texture2D: - return ComponentManager.getItemTexture(idMap[type]) + return ComponentManager.getItemTexture(idMap.get(type, "baseball")) diff --git a/scripts/Tools/Managers/ComponentManager.gd b/scripts/Tools/Managers/ComponentManager.gd index 48c2301..d3672fc 100644 --- a/scripts/Tools/Managers/ComponentManager.gd +++ b/scripts/Tools/Managers/ComponentManager.gd @@ -1,3 +1,5 @@ +@tool +extends Node class_name ComponentManager static var bullets = {} @@ -8,6 +10,9 @@ static var uiComponents = {} static var themes = {} static var itemTextures = {} +func _ready(): + init() + static func init(): for i in DirTool.listdir("res://components/Bullets"): bullets[DirTool.getBasenameWithoutExtension(i)] = load(i) @@ -22,20 +27,18 @@ static func init(): for i in DirTool.listdir("res://themes"): themes[DirTool.getBasenameWithoutExtension(i)] = load(i) for i in DirTool.listdir("res://resources/items"): - itemTextures[DirTool.getBasenameWithoutExtension(i)] = load("res://resources/items/%s" % i) -static func getBullet(name: String): - return bullets[name] -static func getCharacter(name: String): - return characters[name] -static func getEffect(name: String): - return effects[name] -static func getFeed(index: int): - return feeds[index] -static func getUIComponent(name: String): - return uiComponents[name] -static func getTheme(name: String): - return themes[name] -static func getItemTexture(name: String): - return itemTextures[name] -static func readResource(path: String): - return load("res://resources/%s" % path) + itemTextures[DirTool.getBasenameWithoutExtension(i)] = load(i) +static func getBullet(t: String): + return bullets[t] +static func getCharacter(t: String): + return characters[t] +static func getEffect(t: String): + return effects[t] +static func getFeed(i: int): + return feeds[i] +static func getUIComponent(t: String): + return uiComponents[t] +static func getTheme(t: String): + return themes[t] +static func getItemTexture(t: String): + return itemTextures[t]