示例#1
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));
        }
        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);
        }