Link back button to quit code main menu
This commit is contained in:
+1
-23
@@ -18,15 +18,9 @@ func _ready():
|
||||
_load_meshes()
|
||||
|
||||
func _process(_delta):
|
||||
_check_quit_scene()
|
||||
_check_dissolve_mesh()
|
||||
_check_change_angle_camera()
|
||||
|
||||
func _check_quit_scene():
|
||||
# Event key "escape" and "godot event" ui_end
|
||||
if Input.is_action_just_pressed("ui_end"):
|
||||
_confirm_before_quit()
|
||||
|
||||
func _check_dissolve_mesh():
|
||||
# Event dissolve in object searched by gamer
|
||||
for key in meshes:
|
||||
@@ -109,29 +103,13 @@ func _gyroscope_changed_up(gyroscope):
|
||||
(gyroscope.abs().x - gyroscope_value_old.abs().x) > GYROSCOPE_MAX_DIFF and \
|
||||
gyroscope.x < gyroscope_value_old.x
|
||||
|
||||
func _notification(what):
|
||||
# Notification for android back action
|
||||
if what == MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST:
|
||||
_confirm_before_quit()
|
||||
|
||||
func _confirm_before_quit():
|
||||
$Dialog/ConfirmEscape.popup()
|
||||
|
||||
# Back to main scene
|
||||
func _quit_to_menu():
|
||||
Global.goto_scene("res://scenes/main.tscn")
|
||||
|
||||
func _start_dissolve(key):
|
||||
if meshes[key].lock() == false:
|
||||
meshes[key].set_lock(true)
|
||||
|
||||
func _on_ConfirmEscape_confirmed():
|
||||
_quit_to_menu()
|
||||
|
||||
## PRIVATE
|
||||
func _load_translations():
|
||||
$Dialog/ConfirmEscape.set_title(tr("SCENE_WARCRAFT_DIALOG_QUIT_TITLE"))
|
||||
$Dialog/ConfirmEscape.set_text(tr("SCENE_WARCRAFT_DIALOG_QUIT_QUESTION"))
|
||||
pass
|
||||
|
||||
func _load_meshes():
|
||||
var scene_detail = null
|
||||
|
||||
Reference in New Issue
Block a user