1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 06:51:54 +08:00
Files
Dog-Lynx-And-HCN/scripts/Tools/Managers/ComponentManager.gd
T
fallingshrimp 492373a48e feat: 添加角色选择系统及相关功能
新增角色卡片组件和角色选择逻辑
实现角色卡片动画效果和交互功能
添加初始角色数据配置
修改启动面板以支持角色选择
更新主题样式和UI布局
2026-05-04 19:52:04 +08:00

80 lines
4.0 KiB
GDScript

@tool
extends Node
class_name ComponentManager
static var abstracts = {}
static var bullets = {}
static var characterCards = {}
static var characters = {}
static var weapons = {}
static var summons = {}
static var effects = {}
static var feeds = []
static var obstacles = {}
static var panels = {}
static var uiComponents = {}
static var themes = {}
static var fieldTextures = {}
static var itemTextures = {}
static func init():
for i in DirTool.listdir("res://components/Abstracts"):
abstracts[DirTool.getBasenameWithoutExtension(i)] = load(i)
for i in DirTool.listdir("res://components/Bullets"):
bullets[DirTool.getBasenameWithoutExtension(i)] = load(i)
for i in DirTool.listdir("res://components/CharacterCards"):
characterCards[DirTool.getBasenameWithoutExtension(i)] = load(i)
for i in DirTool.listdir("res://components/Characters"):
characters[DirTool.getBasenameWithoutExtension(i)] = load(i)
for i in DirTool.listdir("res://components/Weapons"):
weapons[DirTool.getBasenameWithoutExtension(i)] = load(i)
for i in DirTool.listdir("res://components/Summons"):
summons[DirTool.getBasenameWithoutExtension(i)] = load(i)
for i in DirTool.listdir("res://components/Effects"):
effects[DirTool.getBasenameWithoutExtension(i)] = load(i)
for i in DirTool.listdir("res://components/Feeds"):
feeds.append(load(i))
for i in DirTool.listdir("res://components/Obstacles"):
obstacles[DirTool.getBasenameWithoutExtension(i)] = load(i)
for i in DirTool.listdir("res://components/Scenes/FullscreenPanels"):
panels[DirTool.getBasenameWithoutExtension(i)] = load(i)
for i in DirTool.listdir("res://components/UI"):
uiComponents[DirTool.getBasenameWithoutExtension(i)] = load(i)
for i in DirTool.listdir("res://themes"):
themes[DirTool.getBasenameWithoutExtension(i)] = load(i)
for i in DirTool.listdir("res://resources/fieldIcons"):
fieldTextures[DirTool.getBasenameWithoutExtension(i)] = load(i)
for i in DirTool.listdir("res://resources/items"):
itemTextures[DirTool.getBasenameWithoutExtension(i)] = load(i)
static func getAbstract(t: String) -> PackedScene:
return MathTool.priority(abstracts.get(t, false), load("res://components/Abstracts/%s.tscn" % t))
static func getBullet(t: String) -> PackedScene:
return MathTool.priority(bullets.get(t, false), load("res://components/Bullets/%s.tscn" % t))
static func getCharacterCard(t: String) -> PackedScene:
return MathTool.priority(characterCards.get(t, false), load("res://components/CharacterCards/%s.tscn" % t))
static func getCharacter(t: String) -> PackedScene:
return MathTool.priority(characters.get(t, false), load("res://components/Characters/%s.tscn" % t))
static func getWeapon(t: String) -> PackedScene:
return MathTool.priority(weapons.get(t, false), load("res://components/Weapons/%s.tscn" % t))
static func getSummon(t: String) -> PackedScene:
return MathTool.priority(summons.get(t, false), load("res://components/Summons/%s.tscn" % t))
static func getEffect(t: String) -> PackedScene:
return MathTool.priority(effects.get(t, false), load("res://components/Effects/%s.tscn" % t))
static func getFeed(i: int) -> PackedScene:
if i >= 0 and i < feeds.size():
return feeds[i]
return null
static func getObstacle(t: String) -> PackedScene:
return MathTool.priority(obstacles.get(t, false), load("res://components/Obstacles/%s.tscn" % t))
static func getPanel(t: String) -> PackedScene:
return MathTool.priority(panels.get(t, false), load("res://components/Scenes/FullscreenPanels/%s.tscn" % t))
static func getUIComponent(t: String) -> PackedScene:
return MathTool.priority(uiComponents.get(t, false), load("res://components/UI/%s.tscn" % t))
static func getTheme(t: String) -> Theme:
return MathTool.priority(themes.get(t, false), load("res://themes/%s.tres" % t))
static func getFieldTexture(t: String) -> Texture2D:
return MathTool.priority(fieldTextures.get(t, false), load("res://resources/fieldIcons/%s.svg" % t))
static func getItemTexture(t: String) -> Texture2D:
return MathTool.priority(itemTextures.get(t, false), load("res://resources/items/%s.svg" % t))