1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-27 22:41:56 +08:00

refactor: 重构资源路径和组件结构

- 将attackstar.svg从UI目录移动到resources/common目录
- 将VerticalColorBar.tscn从UI/Variants目录移动到根components目录
- 将LaserSummoner.tscn从Bullets/Common目录移动到Bullets根目录
- 移除调试日志打印语句
- 优化ItemStore.gd的getTexture方法默认值处理
- 更新相关场景和脚本中的资源引用路径
- 添加FeedFilter调试工具组件
- 优化ComponentManager初始化逻辑
This commit is contained in:
2025-09-21 13:56:50 +08:00
parent d54c050be9
commit 4e3425eda9
16 changed files with 124 additions and 31 deletions
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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"]
+11
View File
@@ -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
+1 -1
View File
@@ -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"]
+1 -1
View File
@@ -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"]
+9 -1
View File
@@ -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")
+1 -1
View File
@@ -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")

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

@@ -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]
-1
View File
@@ -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):
+70
View File
@@ -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
+4 -3
View File
@@ -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
+2 -1
View File
@@ -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"))
+20 -17
View File
@@ -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]