public void selectPage(int page)
        {
            if (page < 0 || page >= layers_.Count)
            {
                CCDebug.Error(@"CCScrollLayer#selectPage: {0} - wrong page number, out of bounds. ", page);
                return;
            }

            this.position  = this.positionForPageWithNumber(page);
            prevScreen_    = currentScreen_;
            currentScreen_ = page;
        }
Exemplo n.º 2
0
        //
        // Draw the Scene
        //
        public void drawScene()
        {
            if (_displayError && _lastError != null)
            {
                return;
            }
            try{
                /* calculate "global" dt */
                calculateDeltaTime();

                /* tick before glClear: issue #533 */
                if (!_isPaused)
                {
                    _scheduler.update(_dt);
                }

                /* to avoid flickr, nextScene MUST be here: after tick and before draw.
                 * XXX: Which bug is this one. It seems that it can't be reproduced with v0.9 */
                if (_nextScene != null)
                {
                    setNextScene();
                }


                //			DateTime t3 = DateTime.Now;
                _globolRendererSortingOrder = _startGlbolRendererSortingOrder;
                if (_runningScene != null)
                {
                    _runningScene.visit();
                }
            }catch (Exception e) {
                CCDebug.Error(e.ToString());
                if (_displayError)
                {
                    _lastError = e;
                }
                else
                {
                    Application.Quit();
                }
            }
            showState();

//			_totalFrames++;
        }
        public void moveToPage(int page)
        {
            if (page < 0 || page >= layers_.Count)
            {
                CCDebug.Error("CCScrollLayer#moveToPage: {0} - wrong page number, out of bounds. ", page);
                return;
            }
            if (this.delegate_ != null)
            {
                this.delegate_.scrollLayerScrollingStarted(this, page);
            }
            isMoving_ = true;
            CCActionFiniteTime changePage = new CCMoveTo(scrollTime_, this.positionForPageWithNumber(page));

            changePage = CCSequence.Actions(changePage, new CCCallFunc(this, moveToPageEnded));
            this.runAction(changePage);
            prevScreen_    = currentScreen_;
            currentScreen_ = page;
        }