public void GoToPage(BPageType pageType) { if (_currentPageType == pageType) { return; //we're already on the same page, so don't bother doing anything } BPage pageToCreate = null; if (pageType == BPageType.TitlePage) { pageToCreate = new BTitlePage(); } else if (pageType == BPageType.InGamePage) { pageToCreate = new BInGamePage(); } else if (pageType == BPageType.ScorePage) { pageToCreate = new BScorePage(); } if (pageToCreate != null) //destroy the old page and create a new one { _currentPageType = pageType; if (_currentPage != null) { _stage.RemoveChild(_currentPage); } _currentPage = pageToCreate; _stage.AddChild(_currentPage); _currentPage.Start(); } }
public void GoToPage(PageType pageType) { Page pageToCreate = null; if (pageType == PageType.MainMenuPage) { pageToCreate = new MainMenuPage(); } if (pageType == PageType.InGamePage) { pageToCreate = new InGamePage(); } if (pageToCreate != null) { _currentPageType = pageType; if (_currentPage != null) { _stage.RemoveChild(_currentPage); } _currentPage = pageToCreate; _stage.AddChild(_currentPage); _currentPage.Start(); } }
public void GoToMenu(PageType pageType) { if(currentPageType == pageType) return; // already on this menu // Get the stage stage_ = Futile.stage; // Remove the current page if it exists if(currentPage != null && stage_ != null){ stage_.RemoveChild(currentPage); } // Set new page and page type switch(pageType){ case PageType.TitlePage: currentPageType = PageType.TitlePage; currentPage = new TitlePage(); break; case PageType.LevelSelectPage: currentPageType = PageType.LevelSelectPage; currentPage = new LevelSelectPage(); break; case PageType.CreditsPage: currentPageType = PageType.CreditsPage; currentPage = new CreditsPage(); break; } // Add the page and init it stage_.AddChild(currentPage); currentPage.Start(); }
public void GoToPage(PageType pageType) { RXDebug.Log("Here i am changing the page"); if (_currentPageType == pageType) { return; } Page pageToCreate = null; if (pageType == PageType.MenuPage) { pageToCreate = new MenuPage(); } if (pageType == PageType.InGamePage) { pageToCreate = new InGamePage(); } if (pageToCreate != null) { _currentPageType = pageType; if (_currentPage != null) { _stage.RemoveChild(_currentPage); } _currentPage = pageToCreate; _stage.AddChild(_currentPage); _currentPage.Start(); } }
public void GoToMenu(PageType pageType) { if (currentPageType == pageType) { return; // already on this menu } // Get the stage stage_ = Futile.stage; // Remove the current page if it exists if (currentPage != null && stage_ != null) { stage_.RemoveChild(currentPage); } // Set new page and page type switch (pageType) { case PageType.TitlePage: currentPageType = PageType.TitlePage; currentPage = new TitlePage(); break; case PageType.LevelSelectPage: currentPageType = PageType.LevelSelectPage; currentPage = new LevelSelectPage(); break; case PageType.CreditsPage: currentPageType = PageType.CreditsPage; currentPage = new CreditsPage(); break; case PageType.HowToPlayPage: currentPageType = PageType.HowToPlayPage; currentPage = new HowToPlayPage(); break; } // Add the page and init it stage_.AddChild(currentPage); currentPage.Start(); }