2024-07-09 22:33:38 +02:00
|
|
|
extends Control
|
|
|
|
|
2024-07-20 11:20:18 +02:00
|
|
|
@onready var tool_slots = %ToolSlots
|
|
|
|
@onready var game_menu_ui = %GameMenuUI
|
|
|
|
@onready var world = %World
|
|
|
|
|
2024-07-09 22:33:38 +02:00
|
|
|
|
|
|
|
func _on_message_timer_timeout():
|
|
|
|
%MessagesContainer.visible = false
|
|
|
|
|
|
|
|
|
|
|
|
func _on_player_trigger_message(message):
|
|
|
|
%MessagesContainer/MessageTextEdit.text = message
|
|
|
|
%MessagesContainer/MessageTimer.start(1)
|
|
|
|
%MessagesContainer.visible = true
|
|
|
|
|
2024-07-20 11:20:18 +02:00
|
|
|
|
|
|
|
func _unhandled_key_input(event:InputEvent):
|
|
|
|
var key_event:InputEventKey = event as InputEventKey
|
|
|
|
|
|
|
|
if key_event and key_event.pressed and key_event.get_keycode_with_modifiers() == KEY_ESCAPE:
|
|
|
|
if %GameMenuUI.visible:
|
|
|
|
%GameMenuUI.hide()
|
|
|
|
else:
|
|
|
|
%GameMenuUI.show()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_game_menu_ui_visibility_changed():
|
|
|
|
# Function gets triggered when scene is still in construction. In that
|
|
|
|
# case just return.
|
|
|
|
if tool_slots == null:
|
|
|
|
return
|
|
|
|
|
|
|
|
if %GameMenuUI.visible:
|
|
|
|
tool_slots.hide()
|
|
|
|
%World.process_mode = Node.PROCESS_MODE_DISABLED
|
|
|
|
else:
|
|
|
|
tool_slots.show()
|
|
|
|
%World.process_mode = Node.PROCESS_MODE_INHERIT
|
|
|
|
|