Exemple #1
0
    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();
        }
    }
Exemple #2
0
    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.MenuPage) {
            pageToCreate = new MenuPage();
        }else if(pageType == BPageType.InGamePage) {
            pageToCreate = new InGamePage();
        }

        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(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.InGamePage) {
            pageToCreate = new BInGamePage ();
        } else if (pageType == BPageType.MainMenu){
            //reset score
            _score = 0;
            pageToCreate = new BMainMenu();
        } else if (pageType == BPageType.ScorePage){
            pageToCreate = new BScorePage ();
        } else if (pageType == BPageType.Instructions){
            pageToCreate = new BInstructions ();
        }

        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 ();
        }
    }