2018-08-07 08:18:26 +00:00
|
|
|
extends Node
|
|
|
|
|
|
|
|
signal character_creation_finished
|
|
|
|
|
|
|
|
|
|
|
|
func _ready():
|
2018-08-08 13:48:37 +00:00
|
|
|
$login_menu.show()
|
2018-08-09 07:36:14 +00:00
|
|
|
self.connect( "character_creation_finished", global, "_on_login_scene_character_creation_finished" )
|
2018-08-08 13:48:37 +00:00
|
|
|
|
2018-10-11 14:11:06 +00:00
|
|
|
global.get_node( "audio_stream_player" ).stream = load( "res://assets/musics/pre-mix_menu_pantin_remake.ogg" )
|
2018-09-30 14:22:07 +00:00
|
|
|
global.get_node( "audio_stream_player" ).play()
|
|
|
|
|
2018-10-09 15:27:21 +00:00
|
|
|
$login_menu.show()
|
|
|
|
$register_menu.hide()
|
|
|
|
$license_menu.hide()
|
2019-11-20 20:20:14 +00:00
|
|
|
|
2018-08-07 08:18:26 +00:00
|
|
|
func _on_login_menu_login_button_pressed():
|
2019-12-02 22:34:04 +00:00
|
|
|
print("[login_scene] Launch game")
|
2018-08-07 08:18:26 +00:00
|
|
|
$login_menu.hide()
|
|
|
|
$character_selection_menu.show()
|
|
|
|
|
2018-08-09 14:09:55 +00:00
|
|
|
func _on_character_selection_menu_return_button_pressed():
|
|
|
|
$login_menu.show()
|
|
|
|
$character_selection_menu.hide()
|
2018-08-07 08:18:26 +00:00
|
|
|
|
2018-08-23 14:03:36 +00:00
|
|
|
func _on_character_selection_menu_character_selected( slot ):
|
2018-08-08 12:31:51 +00:00
|
|
|
var config_file = ConfigFile.new()
|
|
|
|
var err = config_file.load( "user://player.cfg" )
|
|
|
|
if err:
|
2019-11-20 20:20:14 +00:00
|
|
|
print("Error code when loading player config file player.cfg: ", err)
|
|
|
|
|
2018-08-23 14:03:36 +00:00
|
|
|
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 )
|
2018-08-23 14:03:36 +00:00
|
|
|
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 )
|
2018-08-27 08:22:15 +00:00
|
|
|
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 ) )
|
2018-08-23 14:03:36 +00:00
|
|
|
character.update()
|
2019-11-20 20:20:14 +00:00
|
|
|
|
2018-08-09 14:09:55 +00:00
|
|
|
emit_signal( "character_creation_finished" )
|
2018-10-09 13:20:55 +00:00
|
|
|
|
|
|
|
|
2018-10-11 13:32:12 +00:00
|
|
|
func _on_quit_button_pressed():
|
2019-12-10 20:40:32 +00:00
|
|
|
print("[login_scene:_on_quit_button_pressed] Stop application")
|
|
|
|
net_low_level.disconnect_server()
|
2018-10-11 13:32:12 +00:00
|
|
|
self.get_tree().quit()
|
|
|
|
|
|
|
|
|
2018-10-09 13:20:55 +00:00
|
|
|
func _on_sound_button_toggled(button_pressed):
|
|
|
|
if button_pressed:
|
|
|
|
global.get_node( "audio_stream_player" ).stop()
|
|
|
|
else:
|
|
|
|
global.get_node( "audio_stream_player" ).play()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_login_menu_register_button_pressed():
|
|
|
|
$login_menu.hide()
|
|
|
|
$register_menu.show()
|
2018-10-09 15:27:21 +00:00
|
|
|
$license_menu.hide()
|
2018-10-09 13:20:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_register_menu_cancel_button_pressed():
|
|
|
|
$login_menu.show()
|
|
|
|
$register_menu.hide()
|
2018-10-09 15:27:21 +00:00
|
|
|
$license_menu.hide()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_register_menu_license_button_pressed():
|
|
|
|
$login_menu.hide()
|
|
|
|
$register_menu.hide()
|
|
|
|
$license_menu.show()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_license_menu_return_button_pressed():
|
|
|
|
$login_menu.hide()
|
|
|
|
$register_menu.show()
|
|
|
|
$license_menu.hide()
|
2018-10-11 13:32:12 +00:00
|
|
|
|
2019-11-20 20:20:14 +00:00
|
|
|
|
|
|
|
func _on_register_menu_register_account_created():
|
|
|
|
$login_menu.show()
|
|
|
|
$register_menu.hide()
|
|
|
|
$license_menu.hide()
|