TinyAdventure/game_ui.gd

41 lines
986 B
GDScript
Raw Normal View History

2024-07-09 22:33:38 +02:00
extends Control
@onready var tool_slots = %ToolSlots
@onready var game_menu_ui = %GameMenuUI
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-08-15 21:10:38 +02:00
print(message)
2024-07-09 22:33:38 +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()
2024-08-02 00:06:50 +02:00
%GameScene.process_mode = Node.PROCESS_MODE_DISABLED
else:
tool_slots.show()
2024-08-02 00:06:50 +02:00
%GameScene.process_mode = Node.PROCESS_MODE_INHERIT