You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
GDScript
37 lines
1.2 KiB
GDScript
extends Resource
|
|
class_name CoreCfg
|
|
|
|
@export var name: String
|
|
@export var type: Enum.ECoreType
|
|
|
|
var icon: Texture2D
|
|
var skill_cfg: Dictionary = {}
|
|
|
|
|
|
func get_icon()->Texture2D:
|
|
if not icon:
|
|
var res_name: String = Util.get_resource_name(self)
|
|
var path: String = "res://resource/ui/icon/core/%s.png" % res_name
|
|
if ResourceLoader.exists(path):
|
|
icon = load(path) as Texture2D
|
|
else:
|
|
icon = load("res://resource/ui/icon/core/default.png") as Texture2D
|
|
return icon
|
|
|
|
|
|
func get_skill_cfg(index: int)->SkillCfg:
|
|
if index in skill_cfg:
|
|
return skill_cfg[index]
|
|
var res_name: String = Util.get_resource_name(self)
|
|
var path_index: String = "res://config/skill_core/%s_%d.tres" % [res_name, index]
|
|
if ResourceLoader.exists(path_index):
|
|
skill_cfg[index] = load(path_index) as SkillCfg
|
|
else:
|
|
var path_default: String = "res://config/skill_core/%s.tres" % res_name
|
|
if ResourceLoader.exists(path_default):
|
|
skill_cfg[index] = load(path_default) as SkillCfg
|
|
if index in skill_cfg:
|
|
return skill_cfg[index]
|
|
print("无效的技能配置: %s_%d" % [res_name, index])
|
|
return null
|