2018-07-25 07:36:19 +00:00
|
|
|
extends MarginContainer
|
|
|
|
|
2018-08-05 12:47:18 +00:00
|
|
|
signal character_creation_finished
|
2018-07-25 07:36:19 +00:00
|
|
|
|
2018-08-05 12:47:18 +00:00
|
|
|
#func _ready():
|
|
|
|
# $Home.show()
|
|
|
|
# $Settings.hide()
|
2018-07-25 07:36:19 +00:00
|
|
|
|
|
|
|
func _on_Home_setting_pressed():
|
|
|
|
$Home.hide()
|
|
|
|
$Settings.show()
|
|
|
|
$Help.hide()
|
|
|
|
|
|
|
|
func _on_Settings_return_pressed():
|
|
|
|
$Home.show()
|
|
|
|
$Settings.hide()
|
|
|
|
$Help.show()
|
|
|
|
|
|
|
|
func _on_Home_play_pressed():
|
|
|
|
if not get_tree().paused:
|
|
|
|
pause()
|
|
|
|
else:
|
|
|
|
play()
|
|
|
|
|
|
|
|
func _input(event):
|
2018-07-30 07:08:39 +00:00
|
|
|
|
2018-07-28 18:34:08 +00:00
|
|
|
if event.is_action_pressed("ui_test"):
|
|
|
|
print( "Event: ui_test" )
|
|
|
|
|
|
|
|
if event.is_action_pressed("ui_quit"):
|
|
|
|
get_tree().quit()
|
|
|
|
|
|
|
|
if event.is_action_pressed("ui_reload"):
|
|
|
|
if not $Settings.visible:
|
|
|
|
get_tree().reload_current_scene()
|
|
|
|
|
|
|
|
if event.is_action_pressed("ui_pause") and not event.is_echo():
|
|
|
|
if not $Settings.visible:
|
|
|
|
if not get_tree().paused:
|
|
|
|
pause()
|
|
|
|
else:
|
|
|
|
play()
|
2018-07-25 07:36:19 +00:00
|
|
|
# ----------------------------------
|
|
|
|
# Capturing/Freeing the cursor
|
2018-07-30 12:56:17 +00:00
|
|
|
if Input.is_action_just_pressed("ui_free_cursor"):
|
2018-07-30 10:32:44 +00:00
|
|
|
if Input.get_mouse_mode() == Input.MOUSE_MODE_VISIBLE:
|
|
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
|
|
|
else:
|
|
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
2018-07-25 07:36:19 +00:00
|
|
|
# ----------------------------------
|
2018-07-31 08:26:45 +00:00
|
|
|
if Input.is_action_just_pressed("ui_hide_all"):
|
|
|
|
self.visible = not self.visible
|
|
|
|
if Input.is_action_just_pressed("ui_hide_hud"):
|
|
|
|
$HUD.visible = not $HUD.visible
|
|
|
|
|
2018-07-30 07:08:39 +00:00
|
|
|
|
|
|
|
# Si on est en mode "deplacement", on desative le focus sur l'interface
|
|
|
|
# afin de ne pas naviguer dedans en même temps que l'on agit en jeu.
|
|
|
|
if Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
|
|
|
|
recursive_release_focus( self )
|
|
|
|
|
|
|
|
func recursive_release_focus( control ):
|
|
|
|
if control is Control:
|
|
|
|
if len(control.get_children()) > 0:
|
|
|
|
for child in control.get_children():
|
|
|
|
recursive_release_focus( child )
|
|
|
|
control.release_focus()
|
|
|
|
|
2018-07-25 07:36:19 +00:00
|
|
|
func pause():
|
|
|
|
get_tree().paused = true
|
|
|
|
show_menu()
|
|
|
|
func play():
|
|
|
|
get_tree().paused = false
|
|
|
|
hide_menu()
|
2018-07-28 18:34:08 +00:00
|
|
|
|
2018-07-25 07:36:19 +00:00
|
|
|
func show_menu():
|
|
|
|
$Home.show()
|
|
|
|
$Settings.hide()
|
|
|
|
$HUD.modulate.a = 0.5
|
|
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
|
|
|
func hide_menu():
|
|
|
|
$Settings.hide()
|
|
|
|
$Home.hide()
|
|
|
|
$Help.show()
|
|
|
|
$HUD.modulate.a = 1.0
|
2018-07-28 08:28:50 +00:00
|
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
|
|
|
|
|
|
|
func _on_Settings_font_changed( value ):
|
|
|
|
$HUD.get_theme().default_font.size = value
|
2018-08-05 12:47:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_login_menu_login_button_pressed():
|
|
|
|
$login_menu.hide()
|
2018-08-05 18:25:15 +00:00
|
|
|
$character_selection_menu.show()
|
2018-08-05 12:47:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_character_creation_menu_valid_button_pressed():
|
|
|
|
$character_creation_menu.hide()
|
2018-08-05 19:36:20 +00:00
|
|
|
$HUD.show()
|
2018-08-05 12:47:18 +00:00
|
|
|
pause()
|
2018-08-05 19:36:20 +00:00
|
|
|
|
2018-08-05 18:25:15 +00:00
|
|
|
emit_signal( "character_creation_finished" )
|
|
|
|
|
|
|
|
func _on_character_selection_menu_character_selected(slot):
|
|
|
|
print( "selected character slot "+str( slot )+"." )
|
|
|
|
$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()
|