39 lines
781 B
GDScript
39 lines
781 B
GDScript
extends Control
|
|
|
|
class_name GameUI
|
|
|
|
signal command(command)
|
|
|
|
enum ServerMenuItem {
|
|
ServerInfo
|
|
}
|
|
|
|
enum PopupName {
|
|
SpaceMap,
|
|
EnergyUsage
|
|
}
|
|
|
|
func _ready() -> void:
|
|
# Add options to menu buttons
|
|
var serverMenu = $Menu/Margins/Grid/Server.get_popup()
|
|
serverMenu.connect("id_pressed", self, "_server_option_chosen")
|
|
serverMenu.add_item("Server info", ServerMenuItem.ServerInfo)
|
|
|
|
func _server_option_chosen(id) -> void:
|
|
match id:
|
|
ServerMenuItem.ServerInfo:
|
|
$ServerInfoPopup.popup_centered()
|
|
|
|
func open_popup(map_name) -> void:
|
|
match map_name:
|
|
PopupName.SpaceMap:
|
|
$MapPopup.popup_centered_ratio()
|
|
PopupName.EnergyUsage:
|
|
pass
|
|
|
|
func close_popup(map_name) -> void:
|
|
match map_name:
|
|
PopupName.SpaceMap:
|
|
$MapPopup.visible = false
|
|
PopupName.EnergyUsage:
|
|
pass
|