Пример #1
0
        public static CCScaleTo actionWithDuration(float duration, float sx, float sy)
        {
            CCScaleTo cCScaleTo = new CCScaleTo();

            cCScaleTo.initWithDuration(duration, sx, sy);
            return(cCScaleTo);
        }
Пример #2
0
        public override void onEnter()
        {
            base.onEnter();
            CCSize s = CCDirector.sharedDirector().getWinSize();

            m_pInScene.scale        = 0.5f;
            m_pInScene.position     = new CCPoint(s.width, 0);
            m_pInScene.anchorPoint  = new CCPoint(0.5f, 0.5f);
            m_pOutScene.anchorPoint = new CCPoint(0.5f, 0.5f);

            CCActionInterval jump     = CCJumpBy.actionWithDuration(m_fDuration / 4, new CCPoint(-s.width, 0), s.width / 4, 2);
            CCActionInterval scaleIn  = CCScaleTo.actionWithDuration(m_fDuration / 4, 1.0f);
            CCActionInterval scaleOut = CCScaleTo.actionWithDuration(m_fDuration / 4, 0.5f);

            CCActionInterval jumpZoomOut = (CCActionInterval)(CCSequence.actions(scaleOut, jump));
            CCActionInterval jumpZoomIn  = (CCActionInterval)(CCSequence.actions(jump, scaleIn));

            CCActionInterval delay = CCDelayTime.actionWithDuration(m_fDuration / 2);

            m_pOutScene.runAction(jumpZoomOut);
            m_pInScene.runAction
            (
                CCSequence.actions
                (
                    delay,
                    jumpZoomIn,
                    CCCallFunc.actionWithTarget(this, base.finish)
                )
            );
        }
Пример #3
0
        public override void onEnter()
        {
            base.onEnter();
            CCSize winSize = CCDirector.sharedDirector().getWinSize();

            this.m_pInScene.scale        = 0.5f;
            this.m_pInScene.position     = new CCPoint(winSize.width, 0f);
            this.m_pInScene.anchorPoint  = new CCPoint(0.5f, 0.5f);
            this.m_pOutScene.anchorPoint = new CCPoint(0.5f, 0.5f);
            CCActionInterval cCActionInterval  = CCJumpBy.actionWithDuration(this.m_fDuration / 4f, new CCPoint(-winSize.width, 0f), winSize.width / 4f, 2);
            CCActionInterval cCActionInterval1 = CCScaleTo.actionWithDuration(this.m_fDuration / 4f, 1f);
            CCActionInterval cCActionInterval2 = CCScaleTo.actionWithDuration(this.m_fDuration / 4f, 0.5f);

            CCFiniteTimeAction[] cCFiniteTimeActionArray = new CCFiniteTimeAction[] { cCActionInterval2, cCActionInterval };
            CCActionInterval     cCActionInterval3       = (CCActionInterval)CCSequence.actions(cCFiniteTimeActionArray);

            CCFiniteTimeAction[] cCFiniteTimeActionArray1 = new CCFiniteTimeAction[] { cCActionInterval, cCActionInterval1 };
            CCActionInterval     cCActionInterval4        = (CCActionInterval)CCSequence.actions(cCFiniteTimeActionArray1);
            CCActionInterval     cCActionInterval5        = CCDelayTime.actionWithDuration(this.m_fDuration / 2f);

            this.m_pOutScene.runAction(cCActionInterval3);
            CCScene mPInScene = this.m_pInScene;

            CCFiniteTimeAction[] cCFiniteTimeActionArray2 = new CCFiniteTimeAction[] { cCActionInterval5, cCActionInterval4, CCCallFunc.actionWithTarget(this, new SEL_CallFunc(this.finish)) };
            mPInScene.runAction(CCSequence.actions(cCFiniteTimeActionArray2));
        }
Пример #4
0
        /// <summary>
        /// creates the action with and X factor and a Y factor
        /// </summary>
        /// <param name="duration"></param>
        /// <param name="sx"></param>
        /// <param name="sy"></param>
        /// <returns></returns>
        public static CCScaleTo actionWithDuration(float duration, float sx, float sy)
        {
            CCScaleTo pScaleTo = new CCScaleTo();
            pScaleTo.initWithDuration(duration, sx, sy);
            //pScaleTo->autorelease();

            return pScaleTo;
        }
Пример #5
0
        /// <summary>
        /// creates the action with and X factor and a Y factor
        /// </summary>
        /// <param name="duration"></param>
        /// <param name="sx"></param>
        /// <param name="sy"></param>
        /// <returns></returns>
        public static CCScaleTo actionWithDuration(float duration, float sx, float sy)
        {
            CCScaleTo pScaleTo = new CCScaleTo();

            pScaleTo.initWithDuration(duration, sx, sy);
            //pScaleTo->autorelease();

            return(pScaleTo);
        }
Пример #6
0
 public override void unselected()
 {
     if (this.m_bIsEnabled)
     {
         base.unselected();
         base.stopActionByTag(-1061138430);
         CCAction cCAction = CCScaleTo.actionWithDuration(0.1f, this.m_fOriginalScale);
         cCAction.tag = -1061138430;
         base.runAction(cCAction);
     }
 }
Пример #7
0
        public override void onEnter()
        {
            base.onEnter();

            CCActionInterval inA, outA;

            m_pInScene.Visible = false;

            float inDeltaZ, inAngleZ;
            float outDeltaZ, outAngleZ;

            if (m_eOrientation == tOrientation.kOrientationUpOver)
            {
                inDeltaZ  = 90;
                inAngleZ  = 270;
                outDeltaZ = 90;
                outAngleZ = 0;
            }
            else
            {
                inDeltaZ  = -90;
                inAngleZ  = 90;
                outDeltaZ = -90;
                outAngleZ = 0;
            }

            inA = (CCActionInterval)CCSequence.actions
                  (
                CCDelayTime.actionWithDuration(m_fDuration / 2),
                CCSpawn.actions
                (
                    new CCOrbitCamera(m_fDuration / 2, 1, 0, inAngleZ, inDeltaZ, 90, 0),
                    CCScaleTo.actionWithDuration(m_fDuration / 2, 1),
                    CCShow.action()
                ),
                CCCallFunc.actionWithTarget(this, base.finish)
                  );

            outA = (CCActionInterval)CCSequence.actions
                   (
                CCSpawn.actions
                (
                    new CCOrbitCamera(m_fDuration / 2, 1, 0, outAngleZ, outDeltaZ, 90, 0),
                    CCScaleTo.actionWithDuration(m_fDuration / 2, 0.5f)
                ),
                CCHide.action(),
                CCDelayTime.actionWithDuration(m_fDuration / 2)
                   );

            m_pInScene.Scale = 0.5f;
            m_pInScene.RunAction(inA);
            m_pOutScene.RunAction(outA);
        }
Пример #8
0
 public override void unselected()
 {
     // subclass to change the default action
     if (m_bIsEnabled)
     {
         base.unselected();
         this.stopActionByTag(unchecked ((int)kZoomActionTag));
         CCAction zoomAction = CCScaleTo.actionWithDuration(0.1f, m_fOriginalScale);
         zoomAction.tag = unchecked ((int)kZoomActionTag);
         this.runAction(zoomAction);
     }
 }
Пример #9
0
        public virtual bool onTextFieldInsertText(CCTextFieldTTF pSender, string text, int nLen)
        {
            // if insert enter, treat as default to detach with ime
            if ("\n" == text)
            {
                return(false);
            }

            // if the textfield's char count more than m_nCharLimit, doesn't insert text anymore.
            if (pSender.CharCount >= m_nCharLimit)
            {
                return(true);
            }

            // create a insert text sprite and do some action
            CCLabelTTF label = CCLabelTTF.labelWithString(text, TextInputTestScene.FONT_NAME, TextInputTestScene.FONT_SIZE);

            this.addChild(label);
            ccColor3B color = new ccColor3B {
                r = 226, g = 121, b = 7
            };

            label.Color = color;

            // move the sprite from top to position
            CCPoint endPos = pSender.position;

            if (pSender.CharCount > 0)
            {
                endPos.x += pSender.contentSize.width / 2;
            }
            CCSize  inputTextSize = label.contentSize;
            CCPoint beginPos      = new CCPoint(endPos.x, CCDirector.sharedDirector().getWinSize().height - inputTextSize.height * 2);

            float duration = 0.5f;

            label.position = beginPos;
            label.scale    = 8;

            CCAction seq = CCSequence.actions(
                CCSpawn.actions(
                    CCMoveTo.actionWithDuration(duration, endPos),
                    CCScaleTo.actionWithDuration(duration, 1),
                    CCFadeOut.actionWithDuration(duration)),
                CCCallFuncN.actionWithTarget(this, callbackRemoveNodeWhenDidAction));

            label.runAction(seq);
            return(false);
        }
Пример #10
0
        public override void onEnter()
        {
            base.onEnter();
            this.m_pInScene.scale        = 0.001f;
            this.m_pOutScene.scale       = 1f;
            this.m_pInScene.anchorPoint  = new CCPoint(0.6666667f, 0.5f);
            this.m_pOutScene.anchorPoint = new CCPoint(0.333333343f, 0.5f);
            CCActionInterval cCActionInterval  = CCScaleTo.actionWithDuration(this.m_fDuration, 0.01f);
            CCActionInterval cCActionInterval1 = CCScaleTo.actionWithDuration(this.m_fDuration, 1f);

            this.m_pInScene.runAction(this.easeActionWithAction(cCActionInterval1));
            CCScene mPOutScene = this.m_pOutScene;

            CCFiniteTimeAction[] cCFiniteTimeActionArray = new CCFiniteTimeAction[] { this.easeActionWithAction(cCActionInterval), CCCallFunc.actionWithTarget(this, new SEL_CallFunc(this.finish)) };
            mPOutScene.runAction(CCSequence.actions(cCFiniteTimeActionArray));
        }
Пример #11
0
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCScaleTo cCScaleTo = null;

            if (pZone == null || pZone.m_pCopyObject == null)
            {
                cCScaleTo = new CCScaleTo();
                pZone     = new CCZone(cCScaleTo);
            }
            else
            {
                cCScaleTo = (CCScaleTo)pZone.m_pCopyObject;
            }
            base.copyWithZone(pZone);
            cCScaleTo.initWithDuration(this.m_fDuration, this.m_fEndScaleX, this.m_fEndScaleY);
            return(cCScaleTo);
        }
Пример #12
0
 public override void selected()
 {
     if (this.Enabled)
     {
         base.selected();
         CCAction actionByTag = base.getActionByTag(-1061138430);
         if (actionByTag == null)
         {
             this.m_fOriginalScale = this.scale;
         }
         else
         {
             base.stopAction(actionByTag);
         }
         CCAction cCAction = CCScaleTo.actionWithDuration(0.1f, this.m_fOriginalScale * 1.2f);
         cCAction.tag = -1061138430;
         base.runAction(cCAction);
     }
 }
Пример #13
0
        public override void OnEnter()
        {
            base.OnEnter();

            this.TouchEnabled = true;

            CCSize s = CCDirector.SharedDirector.WinSize;
            CCLayerColor layer = CCLayerColor.Create(new CCColor4B(0xFF, 0x00, 0x00, 0x80), s.Width * 0.75f, s.Height * 0.75f);

            layer.IgnoreAnchorPointForPosition = false;
            layer.Position = (new CCPoint(s.Width / 2, s.Height / 2));
            AddChild(layer, 1, kTagLayer);
            //
            // Add two labels using BM label class
            // CCLabelBMFont
            CCLabelBMFont label1 = CCLabelBMFont.Create("LABEL1", "fonts/konqa32.fnt");
            layer.AddChild(label1);
            label1.Position = new CCPoint(layer.ContentSize.Width / 2, layer.ContentSize.Height * 0.75f);
            CCLabelBMFont label2 = CCLabelBMFont.Create("LABEL2", "fonts/konqa32.fnt");
            layer.AddChild(label2);
            label2.Position = new CCPoint(layer.ContentSize.Width / 2, layer.ContentSize.Height * 0.25f);
            //
            // Do the sequence of actions in the bug report
            float waitTime = 3f;
            float runTime = 12f;
            layer.Visible = false;
            CCHide hide = CCHide.Create();
            CCScaleTo scaleTo1 = new CCScaleTo(0.0f, 0.0f);
            CCShow show = CCShow.Create();
            CCDelayTime delay = new CCDelayTime (waitTime);
            CCScaleTo scaleTo2 = new CCScaleTo(runTime * 0.25f, 1.2f);
            CCScaleTo scaleTo3 = new CCScaleTo(runTime * 0.25f, 0.95f);
            CCScaleTo scaleTo4 = new CCScaleTo(runTime * 0.25f, 1.1f);
            CCScaleTo scaleTo5 = new CCScaleTo(runTime * 0.25f, 1.0f);

            CCFiniteTimeAction seq = CCSequence.FromActions(hide, scaleTo1, show, delay, scaleTo2, scaleTo3, scaleTo4, scaleTo5);

            layer.RunAction(seq);
        }
Пример #14
0
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCZone pNewZone = null;
            CCScaleTo pCopy = null;
            if (pZone != null && pZone.m_pCopyObject != null)
            {
                //in case of being called at sub class
                pCopy = (CCScaleTo)(pZone.m_pCopyObject);
            }
            else
            {
                pCopy = new CCScaleTo();
                pZone = pNewZone = new CCZone(pCopy);
            }

            base.copyWithZone(pZone);

            pCopy.initWithDuration(m_fDuration, m_fEndScaleX, m_fEndScaleY);

            //CC_SAFE_DELETE(pNewZone);
            return pCopy;
        }
Пример #15
0
        public override void selected()
        {
            // subclass to change the default action
            if (this.Enabled)
            {
                base.selected();

                CCAction action = getActionByTag(unchecked ((int)kZoomActionTag));
                if (action != null)
                {
                    this.stopAction(action);
                }
                else
                {
                    m_fOriginalScale = this.scale;
                }

                CCAction zoomAction = CCScaleTo.actionWithDuration(0.1f, m_fOriginalScale * 1.2f);
                zoomAction.tag = unchecked ((int)kZoomActionTag);
                this.runAction(zoomAction);
            }
        }
Пример #16
0
        public override CCObject copyWithZone(CCZone pZone)
        {
            CCZone    pNewZone = null;
            CCScaleTo pCopy    = null;

            if (pZone != null && pZone.m_pCopyObject != null)
            {
                //in case of being called at sub class
                pCopy = (CCScaleTo)(pZone.m_pCopyObject);
            }
            else
            {
                pCopy = new CCScaleTo();
                pZone = pNewZone = new CCZone(pCopy);
            }

            base.copyWithZone(pZone);

            pCopy.initWithDuration(m_fDuration, m_fEndScaleX, m_fEndScaleY);

            //CC_SAFE_DELETE(pNewZone);
            return(pCopy);
        }
Пример #17
0
        public override void OnEnter()
        {
            base.OnEnter();

            m_pInScene.Scale = 0.001f;
            m_pOutScene.Scale = (1.0f);

            m_pInScene.AnchorPoint = new CCPoint(2 / 3.0f, 0.5f);
            m_pOutScene.AnchorPoint = new CCPoint(1 / 3.0f, 0.5f);

            CCActionInterval scaleOut = new CCScaleTo(m_fDuration, 0.01f);
            CCActionInterval scaleIn = new CCScaleTo(m_fDuration, 1.0f);

            m_pInScene.RunAction(EaseAction(scaleIn));
            m_pOutScene.RunAction
                (
                    CCSequence.FromActions
                        (
                            EaseAction(scaleOut),
                            new CCCallFunc((Finish))
                        )
                );
        }
Пример #18
0
        public override void onEnter()
        {
            base.onEnter();

            m_pInScene.scale  = 0.001f;
            m_pOutScene.scale = (1.0f);

            m_pInScene.anchorPoint  = new CCPoint(2 / 3.0f, 0.5f);
            m_pOutScene.anchorPoint = new CCPoint(1 / 3.0f, 0.5f);

            CCActionInterval scaleOut = CCScaleTo.actionWithDuration(m_fDuration, 0.01f);
            CCActionInterval scaleIn  = CCScaleTo.actionWithDuration(m_fDuration, 1.0f);

            m_pInScene.runAction(this.easeActionWithAction(scaleIn));
            m_pOutScene.runAction
            (
                CCSequence.actions
                (
                    this.easeActionWithAction(scaleOut),
                    CCCallFunc.actionWithTarget(this, (base.finish))
                )
            );
        }
Пример #19
0
        public TMXReadWriteTest()
        {
            m_gid = 0;

            CCTMXTiledMap map = CCTMXTiledMap.Create("TileMaps/orthogonal-test2");
            AddChild(map, 0, kTagTileMap);

            CCTMXLayer layer = map.LayerNamed("Layer 0");
            layer.Texture.SetAntiAliasTexParameters();

            map.Scale = (1);

            CCSprite tile0 = layer.TileAt(new CCPoint(1, 63));
            CCSprite tile1 = layer.TileAt(new CCPoint(2, 63));
            CCSprite tile2 = layer.TileAt(new CCPoint(3, 62)); //new CCPoint(1,62));
            CCSprite tile3 = layer.TileAt(new CCPoint(2, 62));
            tile0.AnchorPoint = (new CCPoint(0.5f, 0.5f));
            tile1.AnchorPoint = (new CCPoint(0.5f, 0.5f));
            tile2.AnchorPoint = (new CCPoint(0.5f, 0.5f));
            tile3.AnchorPoint = (new CCPoint(0.5f, 0.5f));

            CCMoveBy move = new CCMoveBy (0.5f, new CCPoint(0, 160));
            CCRotateBy rotate = new CCRotateBy (2, 360);
            CCScaleBy scale = new CCScaleBy(2, 5);
            CCFadeOut opacity = new CCFadeOut  (2);
            CCFadeIn fadein = new CCFadeIn  (2);
            CCScaleTo scaleback = new CCScaleTo(1, 1);
            CCCallFuncN finish = new CCCallFuncN(removeSprite);
            CCSequence seq0 = CCSequence.FromActions(move, rotate, scale, opacity, fadein, scaleback, finish);
            var seq1 = (CCActionInterval) (seq0.Copy());
            var seq2 = (CCActionInterval) (seq0.Copy());
            var seq3 = (CCActionInterval) (seq0.Copy());

            tile0.RunAction(seq0);
            tile1.RunAction(seq1);
            tile2.RunAction(seq2);
            tile3.RunAction(seq3);

            m_gid = layer.TileGIDAt(new CCPoint(0, 63));
            ////----UXLOG("Tile GID at:(0,63) is: %d", m_gid);

            Schedule(updateCol, 2.0f);
            Schedule(repaintWithGID, 2.0f);
            Schedule(removeTiles, 1.0f);

            ////----UXLOG("++++atlas quantity: %d", layer.textureAtlas().getTotalQuads());
            ////----UXLOG("++++children: %d", layer.getChildren().count() );

            m_gid2 = 0;
        }
Пример #20
0
        protected override void Step(float dt)
        {
            base.Step (dt);

            if (gameSuspended)
                return;

            var batchnode = GetChildByTag((int)Tags.SpriteManager) as CCSpriteBatchNode;
            var bird = batchnode.GetChildByTag((int)Tags.Bird) as CCSprite;
            var particles = GetChildByTag((int)Tags.Particles) as CCParticleSystem;

            bird_pos.X += bird_vel.X * dt;

            if(bird_vel.X < -30.0f && birdLookingRight) {
                birdLookingRight = false;
                bird.ScaleX = -1.0f;
            } else if (bird_vel.X > 30.0f && !birdLookingRight) {
                birdLookingRight = true;
                bird.ScaleX = 1.0f;
            }

            var bird_size = bird.ContentSize;
            float max_x = 320-bird_size.Width/2;
            float min_x = 0+bird_size.Width/2;

            if(bird_pos.X>max_x) bird_pos.X = max_x;
            if(bird_pos.X<min_x) bird_pos.X = min_x;

            bird_vel.Y += bird_acc.Y * dt;
            bird_pos.Y += bird_vel.Y * dt;

            var bonus = batchnode.GetChildByTag((int)Tags.BomusStart + currentBonusType);
            if(bonus.Visible) {
                var bonus_pos = bonus.Position;
                float range = 20.0f;
                if(bird_pos.X > bonus_pos.X - range &&
                   bird_pos.X < bonus_pos.Y + range &&
                   bird_pos.Y > bonus_pos.Y - range &&
                   bird_pos.Y < bonus_pos.Y + range ) {
                    switch(currentBonusType) {
                    case (int)Bonus.Bonus5:   score += 5000;   break;
                    case (int)Bonus.Bonus10:  score += 10000;  break;
                    case (int)Bonus.Bonus50:  score += 50000;  break;
                    case (int)Bonus.Bonus100: score += 100000; break;
                    }
                    var scorelabel = GetChildByTag((int)Tags.ScoreLabel) as CCLabelBMFont;
                    scorelabel.SetString(score.ToString());

                    var a1 = new CCScaleTo(.2f,1.5f,.08f);
                    var a2 = new CCScaleTo(.2f,1f,1f);
                    var a3 = CCSequence.Create(a1,a2,a1,a2,a1,a2);
                    scorelabel.RunAction(a3);
                    ResetBonus ();
                }
            }

            int t;

            if(bird_vel.Y < 0) {

                t = (int)Tags.PlatformsStart;
                for(t = (int)Tags.PlatformsStart; t < (int)Tags.PlatformsStart + numPlatforms; t++) {
                    var platform = batchnode.GetChildByTag(t) as CCSprite;

                    var platform_size = platform.ContentSize;
                    var platform_pos = platform.Position;

                    max_x = platform_pos.X - platform_size.Width/2 - 10;
                    min_x = platform_pos.X + platform_size.Width/2 + 10;
                    float min_y = platform_pos.Y + (platform_size.Height+bird_size.Height)/2 - platformTopPadding;

                    if(bird_pos.X > max_x &&
                       bird_pos.X < min_x &&
                       bird_pos.Y > platform_pos.Y &&
                       bird_pos.Y < min_y) {
                        Jump();
                    }
                }

                if(bird_pos.Y < -bird_size.Height/2) {
                    ShowHighScores();
                }

            } else if(bird_pos.Y > 240) {

                float delta = bird_pos.Y - 240;
                bird_pos.Y = 240;

                currentPlatformY -= delta;

                for(t = (int)Tags.CloudsStart; t < (int)Tags.CloudsStart + numClouds; t++) {
                    var cloud = batchnode.GetChildByTag(t) as CCSprite;
                    var pos = cloud.Position;
                    pos.Y -= delta * cloud.ScaleY * 0.8f;
                    if(pos.Y < -cloud.ContentSize.Height/2) {
                        currentCloudTag = t;
                        ResetCloud();

                    } else {
                        cloud.Position = pos;
                    }
                }

                for(t = (int)Tags.PlatformsStart; t < (int)Tags.PlatformsStart + numPlatforms; t++) {
                    var platform = batchnode.GetChildByTag(t) as CCSprite;
                    var pos = platform.Position;
                    pos = new CCPoint(pos.X,pos.Y-delta);
                    if(pos.Y < -platform.ContentSize.Height/2) {
                        currentPlatformTag = t;
                        ResetPlatform ();
                    } else {
                        platform.Position = pos;
                    }
                }

                if(bonus.Visible) {
                    var pos = bonus.Position;
                    pos.Y -= delta;
                    if(pos.Y < -bonus.ContentSize.Height/2) {
                        ResetBonus ();
                        //[self resetBonus];
                    } else {
                        bonus.Position = pos;
                    }
                }

                score += (int)delta;

                var scoreLabel = GetChildByTag((int)Tags.ScoreLabel) as CCLabelBMFont;
                scoreLabel.SetString(score.ToString());
            }

            bird.Position = bird_pos;

            if (particles !=null) {
                var particle_pos = new CCPoint(bird_pos.X,bird_pos.Y-17);
                particles.Position = particle_pos;
            }
        }
Пример #21
0
        public override void OnEnter()
        {
            base.OnEnter();

            centerSprites(3);

            var actionTo = new CCScaleTo(2, 0.5f);
            var actionBy = new CCScaleBy(2, 1, 10);
            var actionBy2 = new CCScaleBy(2, 5f, 1.0f);
            var actionByBack = actionBy.Reverse();

            m_grossini.RunAction(actionTo);
            m_tamara.RunAction(CCSequence.FromActions(actionBy, actionBy.Reverse()));
            m_kathia.RunAction(CCSequence.FromActions(actionBy2, actionBy2.Reverse()));
        }
Пример #22
0
 public override void Unselected()
 {
     // subclass to change the default action
     if (m_bIsEnabled)
     {
         base.Unselected();
         StopActionByTag(unchecked((int) kZoomActionTag));
         CCAction zoomAction = new CCScaleTo(0.1f, m_fOriginalScale);
         zoomAction.Tag = unchecked((int) kZoomActionTag);
         RunAction(zoomAction);
     }
 }
Пример #23
0
        public override void Selected()
        {
            // subclass to change the default action
            if (m_bIsEnabled)
            {
                base.Selected();

                CCAction action = GetActionByTag(unchecked((int) kZoomActionTag));
                if (action != null)
                {
                    StopAction(action);
                }
                else
                {
                    m_fOriginalScale = Scale;
                }

                CCAction zoomAction = new CCScaleTo(0.1f, m_fOriginalScale * 1.2f);
                zoomAction.Tag = unchecked((int) kZoomActionTag);
                RunAction(zoomAction);
            }
        }
Пример #24
0
        public override void OnEnter()
        {
            base.OnEnter();

            m_tamara.RemoveFromParentAndCleanup(true);
            m_grossini.RemoveFromParentAndCleanup(true);
            m_kathia.RemoveFromParentAndCleanup(true);

            // Get window size so that we can center the box layer
            var winSize = CCDirector.SharedDirector.WinSize;

            var boxSize = new CCSize(100.0f, 100.0f);

            var box = new CCLayerColor(new CCColor4B(255, 255, 0, 255));
            box.AnchorPoint = new CCPoint(0, 0);
            box.Position = new CCPoint(winSize.Center.X - (boxSize.Width / 2), winSize.Center.Y - (boxSize.Height / 2));
            box.ContentSize = boxSize;

            var uL = new CCLayerColor(new CCColor4B(255, 0, 0, 255));
            box.AddChild(uL);
            uL.ContentSize = new CCSize(markrside, markrside);
            uL.Position = new CCPoint(0.0f, boxSize.Height - markrside);
            uL.AnchorPoint = new CCPoint(0, 0);

            var uR = new CCLayerColor(new CCColor4B(0, 0, 255, 255));
            box.AddChild(uR);
            uR.ContentSize = new CCSize(markrside, markrside);
            uR.Position = new CCPoint(boxSize.Width - markrside, boxSize.Height - markrside);
            uR.AnchorPoint = new CCPoint(0, 0);
            AddChild(box);

            var actionTo = new CCSkewTo (2, 0.0f, 2.0f);
            var rotateTo = new CCRotateTo (2, 61.0f);
            var actionScaleTo = new CCScaleTo(2, -0.44f, 0.47f);

            var actionScaleToBack = new CCScaleTo(2, 1.0f, 1.0f);
            var rotateToBack = new CCRotateTo (2, 0);
            var actionToBack = new CCSkewTo (2, 0, 0);

            box.RunAction(CCSequence.FromActions(actionTo, actionToBack));
            box.RunAction(CCSequence.FromActions(rotateTo, rotateToBack));
            box.RunAction(CCSequence.FromActions(actionScaleTo, actionScaleToBack));
        }
Пример #25
0
        public override void onEnter()
        {
            float single;
            float single1;
            float single2;
            float single3;

            base.onEnter();
            this.m_pInScene.visible = false;
            if (this.m_eOrientation != tOrientation.kOrientationLeftOver)
            {
                single  = -90f;
                single1 = 90f;
                single2 = -90f;
                single3 = 0f;
            }
            else
            {
                single  = 90f;
                single1 = 270f;
                single2 = 90f;
                single3 = 0f;
            }
            CCFiniteTimeAction[] cCFiniteTimeActionArray  = new CCFiniteTimeAction[] { CCDelayTime.actionWithDuration(this.m_fDuration / 2f), null, null };
            CCFiniteTimeAction[] cCFiniteTimeActionArray1 = new CCFiniteTimeAction[] { CCOrbitCamera.actionWithDuration(this.m_fDuration / 2f, 1f, 0f, single1, single, 90f, 0f), CCScaleTo.actionWithDuration(this.m_fDuration / 2f, 1f), CCShow.action() };
            cCFiniteTimeActionArray[1] = CCSpawn.actions(cCFiniteTimeActionArray1);
            cCFiniteTimeActionArray[2] = CCCallFunc.actionWithTarget(this, new SEL_CallFunc(this.finish));
            CCActionInterval cCActionInterval = (CCActionInterval)CCSequence.actions(cCFiniteTimeActionArray);

            CCFiniteTimeAction[] cCFiniteTimeActionArray2 = new CCFiniteTimeAction[3];
            CCFiniteTimeAction[] cCFiniteTimeActionArray3 = new CCFiniteTimeAction[] { CCOrbitCamera.actionWithDuration(this.m_fDuration / 2f, 1f, 0f, single3, single2, 90f, 0f), CCScaleTo.actionWithDuration(this.m_fDuration / 2f, 0.5f) };
            cCFiniteTimeActionArray2[0] = CCSpawn.actions(cCFiniteTimeActionArray3);
            cCFiniteTimeActionArray2[1] = CCHide.action();
            cCFiniteTimeActionArray2[2] = CCDelayTime.actionWithDuration(this.m_fDuration / 2f);
            CCActionInterval cCActionInterval1 = (CCActionInterval)CCSequence.actions(cCFiniteTimeActionArray2);

            this.m_pInScene.scale = 0.5f;
            this.m_pInScene.runAction(cCActionInterval);
            this.m_pOutScene.runAction(cCActionInterval1);
        }