コード例 #1
0
        public override void onEnter()
        {
            base.onEnter();

            CCActionInterval effect = (CCActionInterval)(CCSequence.actions(CCDelayTime.actionWithDuration(2.0f), CCShaky3D.actionWithRange(16, false, new ccGridSize(5, 5), 5.0f)));

            // cleanup
            CCNode bg = getChildByTag(EffectAdvanceScene.kTagBackground);

            removeChild(bg, true);

            // background
            CCLayerColor layer = CCLayerColor.layerWithColor(new ccColor4B(255, 0, 0, 255));

            addChild(layer, -10);
            CCSprite sprite = CCSprite.spriteWithFile("Images/grossini");

            sprite.position = new CCPoint(50, 80);
            layer.addChild(sprite, 10);

            // foreground
            CCLayerColor layer2 = CCLayerColor.layerWithColor(new ccColor4B(0, 255, 0, 255));
            CCSprite     fog    = CCSprite.spriteWithFile("Images/Fog");

            ccBlendFunc bf = new ccBlendFunc {
                src = 0x0302, dst = 0x0303
            };

            fog.BlendFunc = bf;
            layer2.addChild(fog, 1);
            addChild(layer2, 1);

            layer2.runAction(CCRepeatForever.actionWithAction(effect));
        }
コード例 #2
0
        public override bool init()
        {
            if (base.init())
            {
                CCSize s = CCDirector.sharedDirector().getWinSize();

                CCLayerColor background = CCLayerColor.layerWithColor(new ccColor4B(255, 0, 255, 255));
                addChild(background);

                CCLayerColor sprite_a = CCLayerColor.layerWithColorWidthHeight(new ccColor4B(255, 0, 0, 255), 700, 700);
                sprite_a.anchorPoint           = new CCPoint(0.5f, 0.5f);
                sprite_a.isRelativeAnchorPoint = true;
                sprite_a.position = new CCPoint(0.0f, s.height / 2);
                addChild(sprite_a);

                sprite_a.runAction(CCRepeatForever.actionWithAction((CCActionInterval)CCSequence.actions(
                                                                        CCMoveTo.actionWithDuration(1.0f, new CCPoint(1024.0f, 384.0f)),
                                                                        CCMoveTo.actionWithDuration(1.0f, new CCPoint(0.0f, 384.0f)))));

                CCLayerColor sprite_b = CCLayerColor.layerWithColorWidthHeight(new ccColor4B(0, 0, 255, 255), 400, 400);
                sprite_b.anchorPoint           = new CCPoint(0.5f, 0.5f);
                sprite_b.isRelativeAnchorPoint = true;
                sprite_b.position = new CCPoint(s.width / 2, s.height / 2);
                addChild(sprite_b);

                CCMenuItemLabel label = CCMenuItemLabel.itemWithLabel(CCLabelTTF.labelWithString("Flip Me", "Helvetica", 24), this, callBack);
                CCMenu          menu  = CCMenu.menuWithItems(label);
                menu.position = new CCPoint(s.width - 200.0f, 50.0f);
                addChild(menu);

                return(true);
            }

            return(false);
        }
コード例 #3
0
        public override void onEnter()
        {
            base.onEnter();

            CCSize       s      = CCDirector.sharedDirector().getWinSize();
            CCLayerColor layer1 = CCLayerColor.layerWithColorWidthHeight(new ccColor4B(255, 255, 0, 80), 100, 300);

            layer1.position = (new CCPoint(s.width / 3, s.height / 2));
            layer1.isRelativeAnchorPoint = true;
            addChild(layer1, 1);

            CCLayerColor layer2 = CCLayerColor.layerWithColorWidthHeight(new ccColor4B(0, 0, 255, 255), 100, 300);

            layer2.position = (new CCPoint((s.width / 3) * 2, s.height / 2));
            layer2.isRelativeAnchorPoint = true;
            addChild(layer2, 1);

            CCActionInterval actionTint     = CCTintBy.actionWithDuration(2, -255, -127, 0);
            CCActionInterval actionTintBack = (CCActionInterval)actionTint.reverse();
            CCActionInterval seq1           = (CCActionInterval)CCSequence.actions(actionTint, actionTintBack);

            layer1.runAction(seq1);

            CCActionInterval actionFade     = CCFadeOut.actionWithDuration(2.0f);
            CCActionInterval actionFadeBack = (CCActionInterval)actionFade.reverse();
            CCActionInterval seq2           = (CCActionInterval)CCSequence.actions(actionFade, actionFadeBack);

            layer2.runAction(seq2);
        }
コード例 #4
0
        public override void onEnter()
        {
            // todo: CCLayerColor hasn't been implemented

            base.onEnter();

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

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

            CCLayerColor box = CCLayerColor.layerWithColor(new ccColor4B(255, 255, 0, 255));

            box.anchorPoint = new CCPoint(0, 0);
            box.position    = new CCPoint(190, 110);
            box.contentSize = boxSize;

            CCLayerColor uL = CCLayerColor.layerWithColor(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);

            CCLayerColor uR = CCLayerColor.layerWithColor(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);

            CCActionInterval actionTo      = CCSkewTo.actionWithDuration(2, 0.0f, 2.0f);
            CCActionInterval rotateTo      = CCRotateTo.actionWithDuration(2, 61.0f);
            CCActionInterval actionScaleTo = CCScaleTo.actionWithDuration(2, -0.44f, 0.47f);

            CCActionInterval actionScaleToBack = CCScaleTo.actionWithDuration(2, 1.0f, 1.0f);
            CCActionInterval rotateToBack      = CCRotateTo.actionWithDuration(2, 0);
            CCActionInterval actionToBack      = CCSkewTo.actionWithDuration(2, 0, 0);

            box.runAction(CCSequence.actions(actionTo, actionToBack));
            box.runAction(CCSequence.actions(rotateTo, rotateToBack));
            box.runAction(CCSequence.actions(actionScaleTo, actionScaleToBack));
        }
コード例 #5
0
        public override void onEnter()
        {
            base.onEnter();

            this.isTouchEnabled = true;

            CCSize       s     = CCDirector.sharedDirector().getWinSize();
            CCLayerColor layer = CCLayerColor.layerWithColorWidthHeight(new ccColor4B(0xFF, 0x00, 0x00, 0x80), s.width * 0.75f, s.height * 0.75f);

            layer.isRelativeAnchorPoint = true;
            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.labelWithString("LABEL1", "fonts/fnt/konqa32");

            layer.addChild(label1);
            label1.position = new CCPoint(layer.contentSize.width / 2, layer.contentSize.height * 0.75f);
            CCLabelBMFont label2 = CCLabelBMFont.labelWithString("LABEL2", "fonts/fnt/konqa32");

            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.action();
            CCScaleTo   scaleTo1 = CCScaleTo.actionWithDuration(0.0f, 0.0f);
            CCShow      show     = CCShow.action();
            CCDelayTime delay    = CCDelayTime.actionWithDuration(waitTime);
            CCScaleTo   scaleTo2 = CCScaleTo.actionWithDuration(runTime * 0.25f, 1.2f);
            CCScaleTo   scaleTo3 = CCScaleTo.actionWithDuration(runTime * 0.25f, 0.95f);
            CCScaleTo   scaleTo4 = CCScaleTo.actionWithDuration(runTime * 0.25f, 1.1f);
            CCScaleTo   scaleTo5 = CCScaleTo.actionWithDuration(runTime * 0.25f, 1.0f);

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

            layer.runAction(seq);
        }