Skip to content

Commit

Permalink
Use phone back button rather than quit
Browse files Browse the repository at this point in the history
  • Loading branch information
IMP1 committed Jan 9, 2023
1 parent 470f4e4 commit 34e51d1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ _global_script_class_icons={

config/name="Spy Game Chooser"
run/main_scene="res://scenes/Main.tscn"
config/quit_on_go_back=false

[display]

Expand Down
4 changes: 4 additions & 0 deletions scenes/Finish.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ func _reset() -> void:
var transition: int = Scene.Transition.FLY + Scene.Transition.RIGHT + Scene.Transition.FADE
var scene: Scene = load("res://scenes/Setup.tscn").instance()
_main_scene.change_scene(scene, transition, transition)

func _notification(what):
if what == MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST:
_reset()
4 changes: 4 additions & 0 deletions scenes/GameInfo.gd
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ func _back() -> void:
var transition: int = Scene.Transition.FLY + Scene.Transition.UP + Scene.Transition.FADE
var scene: Scene = SETUP.instance()
_main_scene.change_scene(scene, transition, transition)

func _notification(what):
if what == MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST:
_back()
10 changes: 10 additions & 0 deletions scenes/PlayerAssignments.gd
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,13 @@ func _wipe_midpoint() -> void:

func _wipe_finish() -> void:
_wipe.visible = false

func _back() -> void:
# TODO: Some other transition
var transition: int = Scene.Transition.FLY + Scene.Transition.RIGHT + Scene.Transition.FADE
var scene: Scene = load("res://scenes/Setup.tscn").instance()
_main_scene.change_scene(scene, transition, transition)

func _notification(what):
if what == MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST:
_back()
4 changes: 4 additions & 0 deletions scenes/Setup.gd
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ func _show_game_info() -> void:
var scene: Scene = GAME_INFO.instance()
scene.games = _possible_games
_main_scene.change_scene(scene, transition, transition)

func _notification(what):
if what == MainLoop.NOTIFICATION_WM_GO_BACK_REQUEST:
get_tree().quit(0)

0 comments on commit 34e51d1

Please sign in to comment.