Пример #1
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);
        }
Пример #2
0
        private Button resumeButton;    // Button is just a custom class. Its just a layer with one menu button.

        public override bool init()
        {
            #region Default Code
            if (!base.init())
            {
                return(false);
            }

            this.m_bIsTouchEnabled = true;
            size = CCDirector.sharedDirector().getWinSize();

            this.AddCloseButton();
            this.AddLabel();
            this.AddSpriteBackground();
            #endregion

            // create new Layer. Add a Button to it.
            pauseLayer            = CCLayerColor.layerWithColorWidthHeight(new ccColor4B(100, 0, 0, 150), 800, 480);
            resumeButton          = new Button("Tap to Resume", this, this.resumeButtonClicked);
            resumeButton.position = new CCPoint(400, 240);
            pauseLayer.addChild(resumeButton);

            this.isTouchEnabled = true;
            return(true);
        }
Пример #3
0
        public override bool init()
        {
            if (base.init())
            {
                // ask director the the window size
                CCSize size = CCDirector.sharedDirector().getWinSize();

                QuestionContainerSprite question  = new QuestionContainerSprite();
                QuestionContainerSprite question2 = new QuestionContainerSprite();
                question.init();
                question2.init();

                //		[question setContentSize:CGSizeMake(50,50)];
                //		[question2 setContentSize:CGSizeMake(50,50)];

                CCMenuItemSprite sprite = CCMenuItemSprite.itemFromNormalSprite(question2, question, this, selectAnswer);
                CCLayerColor     layer  = CCLayerColor.layerWithColorWidthHeight(new ccColor4B(0, 0, 255, 255), 100, 100);


                CCLayerColor     layer2  = CCLayerColor.layerWithColorWidthHeight(new ccColor4B(255, 0, 0, 255), 100, 100);
                CCMenuItemSprite sprite2 = CCMenuItemSprite.itemFromNormalSprite(layer, layer2, this, selectAnswer);
                CCMenu           menu    = CCMenu.menuWithItems(sprite, sprite2, null);
                menu.alignItemsVerticallyWithPadding(100);
                menu.position = new CCPoint(size.width / 2, size.height / 2);

                // add the label as a child to this Layer
                addChild(menu);

                return(true);
            }
            return(false);
        }
Пример #4
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);
        }
Пример #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), 200, 200);

            layer.isRelativeAnchorPoint = true;
            layer.position = (new CCPoint(s.width / 2, s.height / 2));
            addChild(layer, 1, kTagLayer);
        }
Пример #6
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);
        }
Пример #7
0
        public override void onEnter()
        {
            base.onEnter();

            CCSize s = CCDirector.sharedDirector().getWinSize();

            CCSpriteFrameCache.sharedSpriteFrameCache().addSpriteFramesWithFile("zwoptex/grossini");
            CCSpriteFrameCache.sharedSpriteFrameCache().addSpriteFramesWithFile("zwoptex/grossini-generic");

            CCLayerColor layer1 = CCLayerColor.layerWithColorWidthHeight(new ccColor4B(255, 0, 0, 255), 85, 121);

            layer1.position = (new CCPoint(s.width / 2 - 80 - (85.0f * 0.5f), s.height / 2 - (121.0f * 0.5f)));
            addChild(layer1);

            sprite1          = CCSprite.spriteWithSpriteFrame(CCSpriteFrameCache.sharedSpriteFrameCache().spriteFrameByName("grossini_dance_01.png"));
            sprite1.position = (new CCPoint(s.width / 2 - 80, s.height / 2));
            addChild(sprite1);

            sprite1.IsFlipX = (false);
            sprite1.IsFlipY = (false);

            CCLayerColor layer2 = CCLayerColor.layerWithColorWidthHeight(new ccColor4B(255, 0, 0, 255), 85, 121);

            layer2.position = (new CCPoint(s.width / 2 + 80 - (85.0f * 0.5f), s.height / 2 - (121.0f * 0.5f)));
            addChild(layer2);

            sprite2          = CCSprite.spriteWithSpriteFrame(CCSpriteFrameCache.sharedSpriteFrameCache().spriteFrameByName("grossini_dance_generic_01.png"));
            sprite2.position = (new CCPoint(s.width / 2 + 80, s.height / 2));
            addChild(sprite2);

            sprite2.IsFlipX = (false);
            sprite2.IsFlipY = (false);

            schedule((startIn05Secs), 1.0f);

            counter = 0;
        }