58 lines
1.5 KiB
GDScript
58 lines
1.5 KiB
GDScript
extends Control
|
|
signal back
|
|
const CHARACTER_SELECT_CARD = preload("res://scene/character_select_card.tscn")
|
|
@onready var character_add_pos: VFlowContainer = $VBoxContainer/HBoxContainer/margin/HBoxContainer/ScrollContainer/character_add_pos
|
|
@onready var start: ToolButton = $VBoxContainer/HBoxContainer2/TextureRect/start
|
|
|
|
var now_select_node
|
|
var now_select_data:
|
|
set(val):
|
|
if now_select_node!=null:
|
|
now_select_node.is_selected=false
|
|
start.disable(val==null)
|
|
now_select_data=val
|
|
|
|
var data:Dictionary={
|
|
|
|
}
|
|
func _on_back_pressed() -> void:
|
|
back.emit()
|
|
pass # Replace with function body.
|
|
func fresh():
|
|
start.disable(true)
|
|
for i in character_add_pos.get_children():
|
|
i.queue_free()
|
|
for i in Global.system_game_data["unlock_character"]:
|
|
print(i)
|
|
var new_character=CHARACTER_SELECT_CARD.instantiate()
|
|
character_add_pos.add_child(new_character)
|
|
new_character.set_data(Database.get_character_data(i))
|
|
new_character.pressed.connect(pressed)
|
|
func _ready() -> void:
|
|
fresh()
|
|
|
|
func pressed(data,node,is_select):
|
|
|
|
if is_select:
|
|
print(data)
|
|
now_select_data=data
|
|
now_select_node=node
|
|
else:
|
|
now_select_data=null
|
|
now_select_node=null
|
|
|
|
|
|
pass
|
|
|
|
|
|
func _on_start_pressed() -> void:
|
|
print(now_select_data)
|
|
Global.now_game_data.character_data=now_select_data
|
|
|
|
SceneManager.change_scene_to("res://scene/game_flow.tscn")
|
|
|
|
var all_special:Array[CharacterTool.CharacterSpecial]=CharacterTool.get_all_special_type(Global.now_game_data.character_data,"start_game")
|
|
for i in all_special:
|
|
i.call_triger()
|
|
pass # Replace with function body.
|