test-client-godot/login_scene/login_scene.gd

47 lines
1.3 KiB
GDScript3
Raw Normal View History

extends Node
signal character_creation_finished
func _ready():
print("login_scene_ready")
$login_menu.show()
self.connect( "character_creation_finished", self.get_parent(), "_on_login_scene_character_creation_finished" )
func _on_login_menu_login_button_pressed():
$login_menu.hide()
$character_selection_menu.show()
func _on_character_creation_menu_valid_button_pressed():
emit_signal( "character_creation_finished" )
func _on_character_selection_menu_character_selected( slot ):
2018-08-08 08:46:16 +00:00
global.character_slot = 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)
if config_file.has_section( str(slot) ):
global.character_name = config_file.get_value(str(global.character_slot), "name" )
global.character_color = config_file.get_value(str(global.character_slot), "color" )
emit_signal( "character_creation_finished" )
else:
$character_selection_menu.hide()
$character_creation_menu.show()
func _on_character_creation_menu_return_button_pressed():
$character_creation_menu.hide()
$character_selection_menu.show()
func _on_character_selection_menu_return_button_pressed():
$login_menu.show()
$character_selection_menu.hide()