public void GoToPage(PageType pageType)
    {
        if(_currentPageType == pageType) return; //we're already on the same page, so don't bother doing anything

        AbstractPage pageToCreate = null;

        switch (pageType) {
        case PageType.BitmaskPuzzleShapesGame:
            pageToCreate = new BitmaskPuzzleGame();
            break;
        }

        if(pageToCreate != null) //destroy the old page and create a new one
        {
            _currentPageType = pageType;

            if(_currentPage != null)
            {
                _currentPage.Destroy();
                Futile.stage.RemoveChild(_currentPage);
            }

            _currentPage = pageToCreate;
            Futile.stage.AddChild(_currentPage);
            _currentPage.Start();
        }
    }
Example #2
0
    public void GoToPage(PageType pageType)
    {
        if (_currentPageType == pageType)
        {
            return;                                      //we're already on the same page, so don't bother doing anything
        }
        AbstractPage pageToCreate = null;

        switch (pageType)
        {
        case PageType.BitmaskPuzzleShapesGame:
            pageToCreate = new BitmaskPuzzleGame();
            break;
        }

        if (pageToCreate != null)        //destroy the old page and create a new one
        {
            _currentPageType = pageType;

            if (_currentPage != null)
            {
                _currentPage.Destroy();
                Futile.stage.RemoveChild(_currentPage);
            }

            _currentPage = pageToCreate;
            Futile.stage.AddChild(_currentPage);
            _currentPage.Start();
        }
    }