|
|
|
using Game;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.SceneManagement;
|
|
|
|
using UnityEngine.UIElements;
|
|
|
|
|
|
|
|
public class MenuUI : MonoBehaviour {
|
|
|
|
|
|
|
|
private VisualElement root;
|
|
|
|
|
|
|
|
private VisualElement mainMenu, playMenu, settingsMenu;
|
|
|
|
|
|
|
|
private void OnEnable() {
|
|
|
|
root = GetComponent<UIDocument>().rootVisualElement;
|
|
|
|
|
|
|
|
mainMenu = root.Q("main_menu");
|
|
|
|
playMenu = root.Q("play_menu");
|
|
|
|
settingsMenu = root.Q("settings_menu");
|
|
|
|
|
|
|
|
mainMenu.Q("btn_play").RegisterCallback<ClickEvent>(PlayPressed);
|
|
|
|
mainMenu.Q("btn_settings").RegisterCallback<ClickEvent>(SettingsPressed);
|
|
|
|
|
|
|
|
playMenu.Q("btn_find").RegisterCallback<ClickEvent>(FindPressed);
|
|
|
|
playMenu.Q("btn_host").RegisterCallback<ClickEvent>(HostPressed);
|
|
|
|
playMenu.Q("btn_join").RegisterCallback<ClickEvent>(JoinPressed);
|
|
|
|
playMenu.Q("btn_bot").RegisterCallback<ClickEvent>(BotPressed);
|
|
|
|
playMenu.Q("btn_bots").RegisterCallback<ClickEvent>(BotsPressed);
|
|
|
|
|
|
|
|
// PlayPressed(null);
|
|
|
|
// BotPressed(null);
|
|
|
|
}
|
|
|
|
|
|
|
|
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) {
|
|
|
|
Settings.Type = Type.Hybrid;
|
|
|
|
Settings.AIDifficulty = Difficulty.VeryHard;
|
|
|
|
|
|
|
|
SceneManager.LoadScene("Game");
|
|
|
|
}
|
|
|
|
|
|
|
|
private void BotsPressed(ClickEvent evt) {
|
|
|
|
Settings.Type = Type.AI;
|
|
|
|
Settings.AIDifficulty = Difficulty.VeryHard;
|
|
|
|
|
|
|
|
SceneManager.LoadScene("Game");
|
|
|
|
}
|
|
|
|
}
|