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.
		
		
		
		
		
			
		
			
				
	
	
		
			43 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			GDScript
		
	
			
		
		
	
	
			43 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			GDScript
		
	
| extends Cfg
 | |
| class_name CoreCfg
 | |
| 
 | |
| @export var name: String
 | |
| @export var type: Enum.ECoreType = Enum.ECoreType.Active
 | |
| 
 | |
| var icon: Texture2D
 | |
| var skill_cfg_dict: Dictionary = {}
 | |
| 
 | |
| 
 | |
| func get_icon() -> Texture2D:
 | |
| 	if not icon:
 | |
| 		var res_name: String = get_res_name()
 | |
| 		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_dict:
 | |
| 		return skill_cfg_dict[index]
 | |
| 	var res_name: String = get_res_name()
 | |
| 	var path_index: String = "res://config/skill_core/%s_%d.tres" % [res_name, index]
 | |
| 	if ResourceLoader.exists(path_index):
 | |
| 		skill_cfg_dict[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_dict[index] = load(path_default) as SkillCfg
 | |
| 	if index in skill_cfg_dict:
 | |
| 		return skill_cfg_dict[index]
 | |
| 	print("无效的技能配置: %s_%d" % [res_name, index])
 | |
| 	return null
 | |
| 
 | |
| func get_mp_cost() -> int:
 | |
| 	var skill_cfg: SkillCfg = get_skill_cfg(0) # todo
 | |
| 	if skill_cfg:
 | |
| 		return skill_cfg.mp_cost
 | |
| 	return 0
 |