You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.0 KiB
66 lines
2.0 KiB
using Game;
|
|
using Global;
|
|
using UnityEngine;
|
|
using UnityEngine.SceneManagement;
|
|
using UnityEngine.UIElements;
|
|
|
|
namespace Menu {
|
|
public class MenuUI : MonoBehaviour {
|
|
|
|
private VisualElement mainMenu, playMenu, settingsMenu;
|
|
|
|
private VisualElement root;
|
|
|
|
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);
|
|
}
|
|
|
|
private void PlayPressed(ClickEvent evt) {
|
|
mainMenu.style.display = DisplayStyle.None;
|
|
playMenu.style.display = DisplayStyle.Flex;
|
|
|
|
RoomSettings.SpawnRates[Spawnable.Modification] = SpawnRate.Many;
|
|
RoomSettings.SpawnRates[Spawnable.NewBallPermanent] = SpawnRate.Many;
|
|
RoomSettings.SpawnRates[Spawnable.NewBallTemporary] = SpawnRate.Few;
|
|
RoomSettings.SpawnRates[Spawnable.Wormhole] = SpawnRate.Many;
|
|
}
|
|
|
|
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;
|
|
RoomSettings.AIDifficulty = Difficulty.VeryHard;
|
|
|
|
SceneManager.LoadScene("Game");
|
|
}
|
|
|
|
private void BotsPressed(ClickEvent evt) {
|
|
RoomSettings.Type = Type.AI;
|
|
RoomSettings.AIDifficulty = Difficulty.VeryHard;
|
|
|
|
SceneManager.LoadScene("Game");
|
|
}
|
|
}
|
|
}
|
|
|