2021-05-08 20:38:16 +02:00
|
|
|
extends Spatial
|
|
|
|
|
|
2021-05-09 17:10:40 +02:00
|
|
|
func _process(_delta):
|
|
|
|
|
# Event key "escape" and "godot event" ui_end
|
|
|
|
|
if Input.is_action_just_pressed("ui_end"):
|
2021-05-09 22:03:42 +02:00
|
|
|
_confirm_before_quit()
|
2021-05-08 20:38:16 +02:00
|
|
|
|
|
|
|
|
func _notification(what):
|
2021-05-09 17:10:40 +02:00
|
|
|
# Notification for android back action
|
2021-05-08 20:38:16 +02:00
|
|
|
if what == MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST:
|
2021-05-09 22:03:42 +02:00
|
|
|
_confirm_before_quit()
|
|
|
|
|
|
|
|
|
|
func _confirm_before_quit():
|
|
|
|
|
var confirm = ConfirmationDialog.new()
|
|
|
|
|
confirm.set_title("Quit ?")
|
|
|
|
|
confirm.set_text("Voulez vous vraiment quitté ?")
|
|
|
|
|
add_child(confirm)
|
|
|
|
|
confirm.connect("confirmed", self, "_quit_to_menu")
|
|
|
|
|
confirm.popup()
|
2021-05-09 17:10:40 +02:00
|
|
|
|
|
|
|
|
# Back to main scene
|
|
|
|
|
func _quit_to_menu():
|
|
|
|
|
Global.goto_scene("res://scenes/main.tscn")
|