void Awake() { levelButton = Resources.Load("Button") as GameObject; int cellsPerPage = nomPerCol * nomPerRow; int tmpNomLevels = Application.levelCount - 1 - Application.loadedLevel; while (tmpNomLevels > 0) { tmpNomLevels -= cellsPerPage; m_nomPages++; } m_pages = new GameObject[m_nomPages]; int offset = 0; for (int i = 0; i < m_nomPages; i++) { m_pages[i] = spawnButtons(offset); if (i != 0) { m_pages[i].SetActive(false); } offset += cellsPerPage; } m_buttonToggle = gameObject.GetComponent <ButtonToggle>(); m_orgButtons = m_buttonToggle.buttons; changePage(m_pages[0]); }
void Awake() { levelButton = Resources.Load("Button") as GameObject; int cellsPerPage = nomPerCol * nomPerRow; int tmpNomLevels = Application.levelCount-1-Application.loadedLevel; while(tmpNomLevels > 0) { tmpNomLevels-=cellsPerPage; m_nomPages++; } m_pages = new GameObject[m_nomPages]; int offset = 0; for(int i=0 ;i<m_nomPages; i++) { m_pages[i] = spawnButtons(offset); if(i!=0) { m_pages[i].SetActive(false); } offset += cellsPerPage; } m_buttonToggle = gameObject.GetComponent<ButtonToggle>(); m_orgButtons = m_buttonToggle.buttons; if(m_pages.Length>0){ changePage(m_pages[0]); } }
void Awake() { int cellsPerPage = nomPerCol * nomPerRow; int tmpNomLevels = Gameplay.SceneCount - 1 - Gameplay.CurrentSceneIndex; while (tmpNomLevels > 0) { tmpNomLevels -= cellsPerPage; m_nomPages++; } m_pages = new GameObject[m_nomPages]; int offset = 0; for (int i = 0; i < m_nomPages; i++) { m_pages[i] = spawnButtons(offset); if (i != 0) { m_pages[i].SetActive(false); } offset += cellsPerPage; } m_buttonToggle = gameObject.GetComponent <ButtonToggle>(); m_orgButtons = m_buttonToggle.buttons; changePage(m_pages[0]); }
void Awake() { int cellsPerPage = nomPerCol * nomPerRow; GameObject[] levels = Resources.LoadAll <GameObject>("Maps/Game"); nombreTotalDeNiveau = levels.Length; int tmpNomLevels = nombreTotalDeNiveau; while (tmpNomLevels > 0) { tmpNomLevels -= cellsPerPage; m_nomPages++; } m_pages = new GameObject[m_nomPages]; int offset = 0; for (int i = 0; i < m_nomPages; i++) { m_pages[i] = spawnButtons(offset); if (i != 0) { m_pages[i].SetActive(false); } offset += cellsPerPage; } m_buttonToggle = gameObject.GetComponent <ButtonToggle>(); m_orgButtons = m_buttonToggle.buttons; changePage(m_pages[0]); }
void Awake() { tooManyGameObject = GameObject.FindGameObjectsWithTag("PersistantVars"); constantsGameObject = GameObject.Find("Constants"); if(tooManyGameObject.Length>1) {Destroy(tooManyGameObject[1]);} //Text texttemp = gameObject.GetComponentInChildren<Text>(); //texttemp.text = Application.levelCount + ""; //levelButton = Resources.Load("Button") as GameObject; int cellsPerPage = 1;//nomPerCol * nomPerRow; print(Application.levelCount); int tmpNomLevels = Application.levelCount-2-Application.loadedLevel; while (tmpNomLevels > 0) { tmpNomLevels-=cellsPerPage; m_nomPages++; } m_pages = new GameObject[m_nomPages]; int offset = 0; for(int i=0 ;i<m_nomPages; i++) { m_pages[i] = spawnButtons(offset); if(i!=0) { m_pages[i].SetActive(false); } offset += cellsPerPage; } m_buttonToggle = gameObject.GetComponent<ButtonToggle>(); m_orgButtons = m_buttonToggle.buttons; changePage(m_pages[0]); }