public void Setup(Player player, PlayersMenu playersMenu, bool allowRemoval) { this.player = player; this.playersMenu = playersMenu; playerText.text = player.name; enabledToggle.isOn = player.enabled; removeButton.interactable = allowRemoval || !player.enabled; enabledToggle.interactable = allowRemoval || !player.enabled; this.playersMenu.SetDoneButtonAvailability(); setUpDone = true; }
public void SetupFor(Section section) { Debug.Log("Setting up General UI for the section '" + section + "'"); if (section == null) { Debug.LogError("The General UI can not be set up for a null section.", gameObject); } if (sectionTitleLocalizer == null) { sectionTitleLocalizer = sectionTitle.GetComponent <Localizer>(); } if (sectionTitleLocalizer == null) { Debug.LogWarning("The localizer in the section title was not found.", sectionTitle); } topBar.SetActive(section.topBar); backButton.SetActive(section.backButton); sectionTitle.SetActive(section.sectionTitle); gameTitle.SetActive(section.appTitle); configButton.SetActive(section.configButton); playersButton.SetActive(section.playersButton); helpButton.SetActive(section.helpButton); if (section.sectionTitle) { sectionTitleLocalizer.Localize(section.nameId); } if (playersMenuController == null) { playersMenuController = playersMenu.GetComponent <PlayersMenu>(); } if (localizationFilesSelectorMenuController == null) { localizationFilesSelectorMenuController = localizationFilesSelectorMenu.GetComponent <LocalizationFilesSelectorMenu>(); } if (errorsMenuController == null) { errorsMenuController = errorsMenu.GetComponent <ErrorsMenu>(); } }
public MenuController() { Console.CursorVisible = false; this.mainMenu = new MainMenu(); this.playersMenu = new PlayersMenu(); this.diceMenu = new DiceMenu(); this.replayMenu = new ReplayMenu(); this.mainMenu.Exit += this.OnExit; this.mainMenu.DisplayPlayersMenu += this.OnDisplayPlayersMenu; this.playersMenu.PlayersSelected += this.OnPlayersSelected; this.diceMenu.DiceSelected += this.OnDiceSelected; this.replayMenu.Exit += this.OnExit; this.replayMenu.DisplayMainMenu += this.OnDisplayMainMenu; this.replayMenu.Replay += this.OnReplay; }
// Start is called before the first frame update void Start() { mainMenuText = JsonUtility.FromJson <MainMenuText>(TextAssetLoader.GetCorrectTextAsset(textDirection).text); var panel = GameObject.Find("Canvas").transform; firstMenu = new FirstMenu(panel.Find("First Menu")); playersMenu = new PlayersMenu(panel.Find("Players Menu")); credistMenu = new CredistMenu(panel.Find("Credits Menu")); colorMenu = new ColorMenu(panel.Find("Color Menu")); clickManager = GameObject.Find("Click Manager").GetComponent <AudioSource>(); playersMenu.howManyPlayerText.text = mainMenuText.numberOfPlayerText; for (int i = 0; i < playersMenu.playersButtons.Length; i++) { playersMenu.playersButtons[i].GetComponentInChildren <Text>().text = $"{i + 2}"; } firstMenu.playButton.onClick.AddListener(() => ButtonFunction(ShowPlayerMenu)); firstMenu.infoButton.onClick.AddListener(() => ButtonFunction(ShowCreditMenu)); for (int i = 0; i < playersMenu.playersButtons.Length; i++) { int x = i + 2; playersMenu.playersButtons[i].onClick.AddListener(() => ButtonFunction(() => ShowColorMenu(x))); } firstMenu.configButton.onClick.AddListener(() => ButtonFunction(() => SceneManager.LoadScene("Configuration"))); firstMenu.howButton.onClick.AddListener(() => ButtonFunction(() => SceneManager.LoadScene("Help"))); playersMenu.returnButton.onClick.AddListener(() => ButtonFunction(ShowFirstMenu)); credistMenu.returnButton.onClick.AddListener(() => ButtonFunction(ShowFirstMenu)); credistMenu.malenyButton.onClick.AddListener(() => Application.OpenURL("https://www.linkedin.com/in/elena-hernández/")); credistMenu.pacoButton.onClick.AddListener(() => Application.OpenURL("https://www.linkedin.com/in/francisco-rovira/")); for (int i = 0; i < colorMenu.colorButton.Length; i++) { int x = i; colorMenu.colorButton[i].onClick.AddListener(() => ButtonFunction(() => SetColor(x))); } colorMenu.returnButton.onClick.AddListener(() => ButtonFunction(ReturnColorMenu)); credistMenu.madeText.text = mainMenuText.creditsBody; credistMenu.andText.text = mainMenuText.creditsSecondBody; musicManager = FindObjectOfType <MusicManager>(); musicManager.PlayNewClip(musicManager.menuMusic); }