fix: Pause Menu now halts the app state and restores it, and ensures savegame
This commit is contained in:
parent
d58225f21b
commit
b57aa76e23
|
|
@ -111,7 +111,7 @@ var last_mode := DisplayServer.WINDOW_MODE_WINDOWED
|
||||||
func _unhandled_input(event: InputEvent) -> void:
|
func _unhandled_input(event: InputEvent) -> void:
|
||||||
#if event.is_action_type(): print_debug("Unhandled Input", event)
|
#if event.is_action_type(): print_debug("Unhandled Input", event)
|
||||||
|
|
||||||
if event.is_action_pressed("ui_pause"):
|
if event.is_action_pressed("ui_pause") and state == AppState.PLAY:
|
||||||
state = AppState.PAUSE
|
state = AppState.PAUSE
|
||||||
get_viewport().set_input_as_handled()
|
get_viewport().set_input_as_handled()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,8 @@ func _on_help_pressed():
|
||||||
|
|
||||||
var last_mouse_mode: Input.MouseMode
|
var last_mouse_mode: Input.MouseMode
|
||||||
func appear():
|
func appear():
|
||||||
|
State.save_game.save_to_file(get_tree().root.get_texture())
|
||||||
|
|
||||||
get_tree().paused = true
|
get_tree().paused = true
|
||||||
show()
|
show()
|
||||||
last_mouse_mode = Input.mouse_mode
|
last_mouse_mode = Input.mouse_mode
|
||||||
|
|
@ -29,6 +31,7 @@ func appear():
|
||||||
|
|
||||||
|
|
||||||
func disappear():
|
func disappear():
|
||||||
|
Main.state = Main.AppState.PLAY
|
||||||
hide()
|
hide()
|
||||||
Input.mouse_mode = last_mouse_mode
|
Input.mouse_mode = last_mouse_mode
|
||||||
get_tree().paused = false
|
get_tree().paused = false
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue