private void GotoPreviousMenuHelper(GameObject pMenu) { AudioManager.Play("Back"); pMenu.SetActive(true); currentMenu.SetActive(false); currentMenu = pMenu; currentButton = 0; nextButtons = pMenu.GetComponent <PlayerMenuInitialButtonScript>().initialButton.GetComponentInChildren <MenuPlayerButtonScript>().nextButtons; }
private void GotoNextButton(GameObject next) { int nextButton = next.GetComponentInChildren <PauseButtonScript>().buttonID; if (currentButton != nextButton) { AudioManager.Play("Menu_Move"); currentButton = nextButton; } nextButtons = next.GetComponentInChildren <PauseButtonScript>().nextButtons; }
//helper for gotomenu methods private void GotoMenuHelper(GameObject nextmenu) { if (nextmenu != newGameOrLoadMenu) //play different sound when joining game { AudioManager.Play("Select"); //put this here for now for rest of menus } nextmenu.SetActive(true); currentMenu.SetActive(false); currentMenu = nextmenu; currentButton = 0; nextButtons = nextmenu.GetComponent <PlayerMenuInitialButtonScript>().initialButton.GetComponentInChildren <MenuPlayerButtonScript>().nextButtons; //initialButton = nextmenu.GetComponent<PlayerMenuInitialButtonScript>().initialButton; }
/* * private void Awake() * { * //deactivate all menus besides titlescreen * * * if (playerNum == 1) * { * joinScreen.SetActive(false); * playerNumText.SetActive(true); * newGameOrLoadMenu.SetActive(true); * currentMenu = newGameOrLoadMenu; * Settings.NumOfPlayers = 1; * //nextButtons = initialButton.GetComponent<PlayerMenuInitialButtonScript>().initialButton.GetComponentInChildren<MenuPlayerButtonScript>().nextButtons; * } * else * { * joinScreen.SetActive(true); * playerNumText.SetActive(false); * newGameOrLoadMenu.SetActive(false); * currentMenu = joinScreen; * //nextButtons = initialButton.GetComponent<PlayerMenuInitialButtonScript>().initialButton.GetComponentInChildren<MenuPlayerButtonScript>().nextButtons; * } * nextButtons = initialMenu.GetComponent<PlayerMenuInitialButtonScript>().initialButton.GetComponentInChildren<MenuPlayerButtonScript>().nextButtons; * //nextButtons = initialButton.GetComponent<PlayerMenuInitialButtonScript>().initialButton.GetComponentInChildren<MenuPlayerButtonScript>().nextButtons; * createNameMenu.SetActive(false); * selectNameMenu.SetActive(false); * chooseClassMenu.SetActive(false); * playerReadyScreen.SetActive(false); * * * currentButton = 0; * * * } */ // Start is called before the first frame update void Start() { if (MenuScript.DeleteMenuIsActive) { joinScreen.SetActive(false); SelectCharText.SetActive(false); playerNumText.SetActive(false); createNameMenu.SetActive(false); chooseClassMenu.SetActive(false); playerReadyScreen.SetActive(false); newGameOrLoadMenu.SetActive(false); StartText.SetActive(false); selectNameMenu.SetActive(true); currentMenu = selectNameMenu; previousMenu = joinScreen; nextButtons = currentMenu.GetComponent <PlayerMenuInitialButtonScript>().initialButton.GetComponentInChildren <MenuPlayerButtonScript>().nextButtons; currentButton = 0; return; } //deactivate all menus besides titlescreen UnAssignAllInfo(); playerInputIndex = 1; UnAssignAllInputsExceptPlayer1(); GetComponent <Image>().enabled = false; StartText.SetActive(false); SelectCharText.SetActive(true); if (playerNum == 1) { joinScreen.SetActive(false); playerNumText.SetActive(true); newGameOrLoadMenu.SetActive(true); currentMenu = newGameOrLoadMenu; Settings.NumOfPlayers = 1; previousMenu = joinScreen; //nextButtons = initialButton.GetComponent<PlayerMenuInitialButtonScript>().initialButton.GetComponentInChildren<MenuPlayerButtonScript>().nextButtons; } else { joinScreen.SetActive(true); playerNumText.SetActive(false); newGameOrLoadMenu.SetActive(false); currentMenu = joinScreen; previousMenu = null; //nextButtons = initialButton.GetComponent<PlayerMenuInitialButtonScript>().initialButton.GetComponentInChildren<MenuPlayerButtonScript>().nextButtons; } nextButtons = currentMenu.GetComponent <PlayerMenuInitialButtonScript>().initialButton.GetComponentInChildren <MenuPlayerButtonScript>().nextButtons; //nextButtons = initialButton.GetComponent<PlayerMenuInitialButtonScript>().initialButton.GetComponentInChildren<MenuPlayerButtonScript>().nextButtons; //Debug.Log("Player2 nextup = " + nextButtons.upButton.name + // "\nPlayer2 nextdown = " + nextButtons.downButton.name + // "\nPlayer2 nextright = " + nextButtons.rightButton.name + // "\nPlayer2 nextleft = " + nextButtons.leftButton.name + "\n"); //Debug.Log("ButtonIDold = " + nextButtons.upButton.GetComponentInChildren<MenuPlayerButtonScript>().buttonID); createNameMenu.SetActive(false); selectNameMenu.SetActive(false); chooseClassMenu.SetActive(false); playerReadyScreen.SetActive(false); currentButton = 0; }
// Start is called before the first frame update void Start() { numOfPlayers = Settings.NumOfPlayers; nextButtons = firstButton.GetComponentInChildren <PauseButtonScript>().nextButtons; }