chobit/shared/godot/ui/context_menu.gd

24 lines
642 B
GDScript

extends "res://addons/godot-ui/menu/popup_menu.gd"
## Right-click context menu for the companion avatar.
## Three items: Chat, Settings, Quit.
## Delegates all window/UI/theming to the godot-ui popup_menu component.
func _ready() -> void:
var items: Array[Dictionary] = [
{"label": "Chat", "action": "chat"},
{"label": "Settings", "action": "settings"},
{"label": "Quit", "action": "quit"},
]
setup(items)
item_pressed.connect(_on_item_pressed)
func _on_item_pressed(action: String) -> void:
match action:
"chat":
EventBus.chat_opened.emit()
"settings":
EventBus.settings_opened.emit()
"quit":
get_tree().quit()