using Global; using UnityEngine.UIElements; namespace Menu { public class MainMenuUI { private VisualElement mainMenu, playMenu, settingsMenu; public VisualElement Root { get; set; } public void Show() { Root.style.display = DisplayStyle.Flex; } private void Hide() { Root.style.display = DisplayStyle.None; } public void ResetAndShow() { mainMenu = Root.Q("main_menu"); playMenu = Root.Q("play_menu"); settingsMenu = Root.Q("settings_menu"); mainMenu.Q("btn_play").RegisterCallback(PlayPressed); mainMenu.Q("btn_settings").RegisterCallback(SettingsPressed); playMenu.Q("btn_find").RegisterCallback(FindPressed); playMenu.Q("btn_host").RegisterCallback(HostPressed); playMenu.Q("btn_join").RegisterCallback(JoinPressed); playMenu.Q("btn_bot").RegisterCallback(BotPressed); playMenu.Q("btn_bots").RegisterCallback(BotsPressed); mainMenu.style.display = DisplayStyle.Flex; playMenu.style.display = DisplayStyle.None; settingsMenu.style.display = DisplayStyle.None; Show(); } private void PlayPressed(ClickEvent evt) { mainMenu.style.display = DisplayStyle.None; playMenu.style.display = DisplayStyle.Flex; } private void SettingsPressed(ClickEvent evt) { mainMenu.style.display = DisplayStyle.None; settingsMenu.style.display = DisplayStyle.Flex; } private void FindPressed(ClickEvent evt) { } private void HostPressed(ClickEvent evt) { } private void JoinPressed(ClickEvent evt) { } private void BotPressed(ClickEvent evt) { RoomSettings.Type = Type.Hybrid; GoToRoom(); } private void BotsPressed(ClickEvent evt) { RoomSettings.Type = Type.AI; GoToRoom(); } private void GoToRoom() { Hide(); MainUI.Instance.roomUI.Show(); } } }