2021-06-02 23:32:07 +02:00
|
|
|
extends Node
|
|
|
|
|
2021-06-03 22:34:36 +02:00
|
|
|
enum GameFocus {MENU, GAME, CHAT, AWAY}
|
2021-06-02 23:32:07 +02:00
|
|
|
|
2021-06-03 22:34:36 +02:00
|
|
|
@onready var gui = $GUI
|
2021-06-04 00:38:30 +02:00
|
|
|
@onready var hud = $HUD
|
2021-06-03 22:34:36 +02:00
|
|
|
@onready var player = $Level/Player
|
2021-06-04 00:38:30 +02:00
|
|
|
@onready var chat = hud.get_node("Chat")
|
2021-06-03 22:34:36 +02:00
|
|
|
|
|
|
|
var focus = GameFocus.MENU
|
2021-06-02 23:32:07 +02:00
|
|
|
|
|
|
|
func _input(event) -> void:
|
|
|
|
if Input.is_action_just_pressed("ui_cancel"):
|
2021-06-03 22:34:36 +02:00
|
|
|
if focus == GameFocus.GAME:
|
2021-06-02 23:32:07 +02:00
|
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
2021-06-03 22:34:36 +02:00
|
|
|
gui.show()
|
|
|
|
player.input_active = false
|
|
|
|
focus = GameFocus.MENU
|
|
|
|
elif focus == GameFocus.MENU:
|
2021-06-02 23:32:07 +02:00
|
|
|
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
2021-06-03 22:34:36 +02:00
|
|
|
gui.hide()
|
|
|
|
player.input_active = true
|
|
|
|
focus = GameFocus.GAME
|