This repository has been archived on 2022-01-09. You can view files and clone it, but cannot push or open issues/pull-requests.
2021-06-02 23:32:07 +02:00
|
|
|
extends Node
|
|
|
|
|
2021-06-03 19:03:43 +02:00
|
|
|
enum GameFocus {IN_MENU, PLAYING, TYPING, AFK}
|
2021-06-02 23:32:07 +02:00
|
|
|
|
2021-06-03 19:03:43 +02:00
|
|
|
var mode = GameFocus.IN_MENU
|
2021-06-02 23:32:07 +02:00
|
|
|
|
|
|
|
func _input(event) -> void:
|
|
|
|
if Input.is_action_just_pressed("ui_cancel"):
|
2021-06-03 19:03:43 +02:00
|
|
|
if mode == GameFocus.PLAYING:
|
2021-06-02 23:32:07 +02:00
|
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
|
|
|
$CanvasLayer/GUI.show()
|
|
|
|
$Level/Player.input_active = false
|
2021-06-03 19:03:43 +02:00
|
|
|
mode = GameFocus.IN_MENU
|
|
|
|
elif mode == GameFocus.IN_MENU:
|
2021-06-02 23:32:07 +02:00
|
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
|
|
|
$CanvasLayer/GUI.hide()
|
|
|
|
$Level/Player.input_active = true
|
2021-06-03 19:03:43 +02:00
|
|
|
mode = GameFocus.PLAYING
|