Exemplo n.º 1
0
        public override void Play(MovieCallback callback)
        {
            if (callback == null)
            {
                Play();
                return;
            }
            if (_startFrame == _endFrame)
            {
                GotoFrame(_startFrame);
                callback(this);
                return;
            }
            Stop();

            GotoFrame(_startFrame);
            MovieImpAction     action         = new MovieImpAction(this, _startFrame, _endFrame);
            CCActionFiniteTime callbackAction = new CCCallBlock(delegate {
                callback(this);
            });
            CCActionInterval seq = CCSequence.Actions(action, callbackAction) as CCActionInterval;

            if (_loop)
            {
                _action = new CCRepeatForever(seq);
            }
            else
            {
                _action = seq;
            }
            _view.runAction(_action);
        }
        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;
        }
Exemplo n.º 3
0
        public void initWithAction(CCActionFiniteTime one, CCActionFiniteTime two)
        {
            NSUtils.Assert(one != null && two != null, "Sequence: arguments must be non-nil");
            NSUtils.Assert(one != _one && one != _two, "Spawn: reinit using same parameters is not supported");
            NSUtils.Assert(two != _two && two != _one, "Spawn: reinit using same parameters is not supported");

            float d1 = one.duration;
            float d2 = two.duration;

            base.initWithDuration(Mathf.Max(d1, d2));
            _one = one;
            _two = two;

            if (FloatUtils.Big(d1, d2))
            {
                _two = CCSequence.Actions(two, new CCDelayTime(d1 - d2));
            }
            else if (d1 < d2)
            {
                _one = CCSequence.Actions(one, new CCDelayTime(d2 - d1));
            }
        }