1
1
mirror of https://github.com/Rundll86/Dog-Lynx-And-HCN.git synced 2026-05-28 23:11:54 +08:00
Files
Dog-Lynx-And-HCN/scripts/Tools/Managers/ComponentManager.gd
T
fallingshrimp ace6d3bf53 feat(武器系统): 添加武器类型支持及相关组件
- 在FeedName.gd中新增WEAPON枚举类型及对应翻译和颜色配置
- 在Feed.gd中添加weapons数组和weaponsBox容器
- 新增WeaponShow.tscn武器展示组件
- 添加NuclearBomb.tscn核弹武器示例
- 修改ComponentManager.gd中主题文件加载路径
- 更新FeedCardBase.tscn和FeedName.tscn以支持武器显示
2025-09-21 16:35:49 +08:00

44 lines
1.9 KiB
GDScript

@tool
extends Node
class_name ComponentManager
static var bullets = {}
static var characters = {}
static var effects = {}
static var feeds = []
static var uiComponents = {}
static var themes = {}
static var itemTextures = {}
static func init():
for i in DirTool.listdir("res://components/Bullets"):
bullets[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/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/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/items"):
itemTextures[DirTool.getBasenameWithoutExtension(i)] = load(i)
static func getBullet(t: String) -> PackedScene:
return MathTool.priority(bullets.get(t, false), load("res://components/Bullets/%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 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 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 getItemTexture(t: String) -> Texture2D:
return MathTool.priority(itemTextures.get(t, false), load("res://resources/items/%s.svg" % t))