test-client-godot/login_scene/login_scene.gd

38 lines
1.4 KiB
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" )
2018-09-30 14:22:07 +00:00
global.get_node( "audio_stream_player" ).stream = load( "res://assets/test/musiques/pre-mix_khanat_main_theme_2018-07-23.ogg" )
global.get_node( "audio_stream_player" ).play()
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)
character.slot = slot
2018-08-29 08:13:37 +00:00
character.pseudo = config_file.get_value( str(slot), "name", "player" )
character.gender = config_file.get_value( str(slot), "gender", 1 )
character.color = config_file.get_value( str(slot), "color", Color(1.0, 0.25, 0.25, 1.0) )
character.size = config_file.get_value( str(slot), "size", 1.0 )
character.ears_size = config_file.get_value( str(slot), "ears_size", 0.0 )
2018-08-29 08:13:37 +00:00
character.eyes_color = config_file.get_value( str(slot), "eyes_color", Color( 0.0, 1.0, 0.0, 1.0 ) )
character.update()
emit_signal( "character_creation_finished" )