test-client-godot/login_scene/login_scene.gd

30 lines
931 B
GDScript3
Raw Normal View History

extends Node
signal character_creation_finished
func _ready():
$login_menu.show()
self.connect( "character_creation_finished", global, "_on_login_scene_character_creation_finished" )
func _on_login_menu_login_button_pressed():
$login_menu.hide()
$character_selection_menu.show()
func _on_character_selection_menu_return_button_pressed():
$login_menu.show()
$character_selection_menu.hide()
func _on_character_selection_menu_character_selected(slot):
var config_file = ConfigFile.new()
var err = config_file.load( "user://player.cfg" )
if err:
print("Error code when loading player config file: ", err)
global.character_slot = slot
global.character_name = config_file.get_value( str(slot), "name", "player")
global.character_color = config_file.get_value( str(slot), "color", Color(1.0, 63.0, 63.0, 1.0) )
emit_signal( "character_creation_finished" )