This repository has been archived on 2020-09-30. You can view files and clone it, but cannot push or open issues or pull requests.
odyssey-old/Scenes/UI.gd

40 lines
781 B
GDScript3
Raw Normal View History

2020-07-06 22:00:39 +00:00
extends Control
2020-07-20 09:15:39 +00:00
class_name GameUI
2020-07-06 22:00:39 +00:00
signal command(command)
2020-07-10 11:31:16 +00:00
enum ServerMenuItem {
2020-07-20 09:15:39 +00:00
ServerInfo
}
enum PopupName {
SpaceMap,
EnergyUsage
2020-07-10 11:31:16 +00:00
}
func _ready() -> void:
# Add options to menu buttons
var serverMenu = $Menu/Margins/Grid/Server.get_popup()
serverMenu.connect("id_pressed", self, "_server_option_chosen")
2020-07-20 09:15:39 +00:00
serverMenu.add_item("Server info", ServerMenuItem.ServerInfo)
2020-07-10 11:31:16 +00:00
func _server_option_chosen(id) -> void:
match id:
2020-07-20 09:15:39 +00:00
ServerMenuItem.ServerInfo:
2020-07-10 11:31:16 +00:00
$ServerInfoPopup.popup_centered()
2020-07-20 09:15:39 +00:00
func open_popup(map_name) -> void:
match map_name:
PopupName.SpaceMap:
$MapPopup.popup_centered_ratio()
PopupName.EnergyUsage:
pass
2020-07-20 09:15:39 +00:00
func close_popup(map_name) -> void:
match map_name:
PopupName.SpaceMap:
$MapPopup.visible = false
PopupName.EnergyUsage:
pass