extends Control const ABILITY_BUTTON = preload("res://scene/ability_button.tscn") const ATTRIBUTE = preload("res://scene/attribute.tscn") const SELECTED = preload("res://res/ui/ui_005_basic_message/selected.tres") const BASIC_MES_SKIN_CARD = preload("res://scene/basic_mes_skin_card.tscn") const START_CONFIG_MES = preload("res://scene/start_config_mes.tscn") var data:Dictionary ##当前是在游戏外编辑还是在游戏内编辑 @export var is_in_game:bool=false @onready var button_group:Array[Button]=[$VBoxContainer/TextureRect/HBoxContainer/Button, $VBoxContainer/TextureRect/HBoxContainer/Button2, $VBoxContainer/TextureRect/HBoxContainer/Button3, $VBoxContainer/TextureRect/HBoxContainer/Button4, $VBoxContainer/TextureRect/HBoxContainer/Button5, $VBoxContainer/TextureRect/HBoxContainer/Button6] @onready var now_selected_button:Button=$VBoxContainer/TextureRect/HBoxContainer/Button #面板关闭信号 signal close var now_selected_mes:StartConfigMes func init_from_data(): for i in %special_container.get_children(): i.queue_free() for i in %ability_container.get_children(): i.queue_free() %character.texture=Global.get_texture(CharacterTool.get_skin_now_use_data(data)["character"]) var basic_data=data["basic_mes"] match int(basic_data["type"]): 0: %category.text="历史" 1: %category.text="奇幻" 2: %category.text="现实" 3: %category.text="末世" %place.text=basic_data["place"] #缺少性别 %race.text=basic_data["race"] %birthday.text=basic_data["birthday"] %introduction.text=basic_data["introduction"] var basic_attribute:Dictionary=data["basic_attribute"] var fight_attribute:Dictionary={} if data.has("fight_attribute"): fight_attribute=data["fight_attribute"] for i in %basic_attribute.get_children(): i.queue_free() for i in %fight_attribute.get_children(): i.queue_free() for i in basic_attribute.keys(): var new_attribute=ATTRIBUTE.instantiate() new_attribute.data={ "name":CharacterTool.get_name_by_attribute_key(i), "value":basic_attribute[i] } %basic_attribute.add_child(new_attribute) for i in fight_attribute.keys(): var new_attribute=ATTRIBUTE.instantiate() new_attribute.data={ "name":CharacterTool.get_name_by_attribute_key(i), "value":basic_attribute[i] } %fight_attribute.add_child(new_attribute) pass if data.has("special"): var special_data=data["special"] for i in special_data: var new_button=ABILITY_BUTTON.instantiate() new_button.show_mes=i["introduction"] new_button.text=i["name"] %special_container.add_child(new_button) if data.has("ability"): var ability_data=data["ability"] for i in ability_data: var new_button=ABILITY_BUTTON.instantiate() new_button.show_mes=i["introduction"] new_button.text=i["name"] %ability_container.add_child(new_button) %character_name.text=data["name"] var star_arr=%star_container.get_children() var star_num:int=data["star"] for i in star_arr.size(): if i void: if is_in_game: $VBoxContainer/TextureRect/HBoxContainer/Button6.hide() else: $VBoxContainer/TextureRect/HBoxContainer/Button6.show() pass data=Global.get_character_data("test_character_01") init_from_data() connect_button() func _on_back_button_pressed() -> void: self.hide() close.emit() pass # Replace with function body.