Exemple #1
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = CCDirector.SharedDirector.WinSize;

            CCLabelTTF label = new CCLabelTTF(title(), "arial", 18);
            AddChild(label, 1);
            label.Position = new CCPoint(s.Width / 2, s.Height - 50);

            string strSubtitle = subtitle();
            if (strSubtitle != null)
            {
                CCLabelTTF l = new CCLabelTTF(strSubtitle, "arial", 22);
                AddChild(l, 1);
                l.Position = new CCPoint(s.Width / 2, s.Height - 80);
            }

            CCMenuItemImage item1 = new CCMenuItemImage(s_pPathB1, s_pPathB2, backCallback);
            CCMenuItemImage item2 = new CCMenuItemImage(s_pPathR1, s_pPathR2, restartCallback);
            CCMenuItemImage item3 = new CCMenuItemImage(s_pPathF1, s_pPathF2, nextCallback);

            CCMenu menu = new CCMenu(item1, item2, item3);

            menu.Position = new CCPoint(0, 0);
            item1.Position = new CCPoint(s.Width / 2 - 100, 30);
            item2.Position = new CCPoint(s.Width / 2, 30);
            item3.Position = new CCPoint(s.Width / 2 + 100, 30);

            AddChild(menu, 1);

            CCLayerColor background = new CCLayerColor(new CCColor4B(255,0,0,255));
            AddChild(background, -10);
        }
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = CCDirector.SharedDirector.WinSize;

            CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFramesWithFile("zwoptex/grossini.plist");
            CCSpriteFrameCache.SharedSpriteFrameCache.AddSpriteFramesWithFile("zwoptex/grossini-generic.plist");

            CCLayerColor layer1 = new CCLayerColor(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 = new CCSprite(CCSpriteFrameCache.SharedSpriteFrameCache.SpriteFrameByName("grossini_dance_01.png"));
            sprite1.Position = (new CCPoint(s.Width / 2 - 80, s.Height / 2));
            AddChild(sprite1);

            sprite1.FlipX = false;
            sprite1.FlipY = false;

            CCLayerColor layer2 = new CCLayerColor(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 = new CCSprite(CCSpriteFrameCache.SharedSpriteFrameCache.SpriteFrameByName("grossini_dance_generic_01.png"));
            sprite2.Position = (new CCPoint(s.Width / 2 + 80, s.Height / 2));
            AddChild(sprite2);

            sprite2.FlipX = false;
            sprite2.FlipY = false;

            Schedule(startIn05Secs, 1.0f);

            counter = 0;
        }
Exemple #3
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = CCDirector.SharedDirector.WinSize;
            CCLayerColor layer1 = new CCLayerColor(new CCColor4B(255, 255, 0, 80), 100, 300);
            layer1.Position = (new CCPoint(s.Width / 3, s.Height / 2));
            layer1.IgnoreAnchorPointForPosition = false;
            AddChild(layer1, 1);

            CCLayerColor layer2 = new CCLayerColor(new CCColor4B(0, 0, 255, 255), 100, 300);
            layer2.Position = (new CCPoint((s.Width / 3) * 2, s.Height / 2));
            layer2.IgnoreAnchorPointForPosition = false;
            AddChild(layer2, 1);

            CCActionInterval actionTint = new CCTintBy (2, -255, -127, 0);
            CCActionInterval actionTintBack = (CCActionInterval)actionTint.Reverse();
            CCActionInterval seq1 = (CCActionInterval)CCSequence.FromActions(actionTint, actionTintBack);
            layer1.RunAction(seq1);

            CCActionInterval actionFade = new CCFadeOut  (2.0f);
            CCActionInterval actionFadeBack = (CCActionInterval)actionFade.Reverse();
            CCActionInterval seq2 = (CCActionInterval)CCSequence.FromActions(actionFade, actionFadeBack);
            layer2.RunAction(seq2);
        }
        public override bool Init()
        {
            if (base.Init())
            {
                CCSize s = CCDirector.SharedDirector.WinSize;

                CCLayerColor background = new CCLayerColor(new CCColor4B(255, 0, 255, 255));
                AddChild(background);

                CCLayerColor sprite_a = new CCLayerColor(new CCColor4B(255, 0, 0, 255), 700, 700);
                sprite_a.AnchorPoint = new CCPoint(0.5f, 0.5f);
                sprite_a.IgnoreAnchorPointForPosition = true;
                sprite_a.Position = new CCPoint(0.0f, s.Height / 2);
                AddChild(sprite_a);

                sprite_a.RunAction(new CCRepeatForever ((CCActionInterval)CCSequence.FromActions(
                                                                       new CCMoveTo (1.0f, new CCPoint(1024.0f, 384.0f)),
                                                                       new CCMoveTo (1.0f, new CCPoint(0.0f, 384.0f)))));

                CCLayerColor sprite_b = new CCLayerColor(new CCColor4B(0, 0, 255, 255), 400, 400);
                sprite_b.AnchorPoint = new CCPoint(0.5f, 0.5f);
                sprite_b.IgnoreAnchorPointForPosition = true;
                sprite_b.Position = new CCPoint(s.Width / 2, s.Height / 2);
                AddChild(sprite_b);

                CCMenuItemLabel label = CCMenuItemLabel.Create(new CCLabelTTF("Flip Me", "Helvetica", 24), callBack);
                CCMenu menu = new CCMenu(label);
                menu.Position = new CCPoint(s.Width - 200.0f, 50.0f);
                AddChild(menu);

                return true;
            }

            return false;
        }
Exemple #5
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCActionInterval effect = (CCSequence.FromActions(new CCDelayTime (2.0f), new CCShaky3D(16, false, new CCGridSize(5, 5), 5.0f)));

            // cleanup
            CCNode bg = GetChildByTag(EffectAdvanceScene.kTagBackground);
            RemoveChild(bg, true);

            // background
            CCLayerColor layer = new CCLayerColor(new CCColor4B(255, 0, 0, 255));
            AddChild(layer, -10);
            CCSprite sprite = new CCSprite("Images/grossini");
            sprite.Position = new CCPoint(50, 80);
            layer.AddChild(sprite, 10);

            // foreground
            CCLayerColor layer2 = new CCLayerColor(new CCColor4B(0, 255, 0, 255));
            CCSprite fog = new CCSprite("Images/Fog");

            var bf = new CCBlendFunc {Source = OGLES.GL_SRC_ALPHA, Destination = OGLES.GL_ONE_MINUS_SRC_ALPHA};
            fog.BlendFunc = bf;
            layer2.AddChild(fog, 1);
            AddChild(layer2, 1);

            layer2.RunAction(new CCRepeatForever (effect));
        }
Exemple #6
0
        public override bool Init()
        {
            if (base.Init())
            {
                // ask director the the window size
                CCSize size = CCDirector.SharedDirector.WinSize;

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

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

                CCMenuItemSprite sprite = new CCMenuItemSprite(question2, question, this, selectAnswer);
                CCLayerColor layer = new CCLayerColor(new CCColor4B(0, 0, 255, 255), 100, 100);

                CCLayerColor layer2 = new CCLayerColor(new CCColor4B(255, 0, 0, 255), 100, 100);
                CCMenuItemSprite sprite2 = new CCMenuItemSprite(layer, layer2, this, selectAnswer);
                CCMenu menu = new CCMenu(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;
        }
        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;
        }
        public static CCLayerColor node()
        {
            CCLayerColor pRet = new CCLayerColor();
            if (pRet.init())
            {
                return pRet;
            }

            return null;
        }
Exemple #9
0
        public void showFont(string pFont)
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            var blockSize = new CCSize(s.Width / 3, 200);
            float fontSize = 26;

            RemoveChildByTag(kTagLabel1, true);
            RemoveChildByTag(kTagLabel2, true);
            RemoveChildByTag(kTagLabel3, true);
            RemoveChildByTag(kTagLabel4, true);

            CCLabelTTF top = new CCLabelTTF(pFont, pFont, 24);
            CCLabelTTF left = new CCLabelTTF("alignment left", pFont, fontSize,
                                                blockSize, CCTextAlignment.CCTextAlignmentLeft,
                                                FontTestScene.verticalAlignment[FontTestScene.vAlignIdx]);
            CCLabelTTF center = new CCLabelTTF("alignment center", pFont, fontSize,
                                                  blockSize, CCTextAlignment.CCTextAlignmentCenter,
                                                  FontTestScene.verticalAlignment[FontTestScene.vAlignIdx]);
            CCLabelTTF right = new CCLabelTTF("alignment right", pFont, fontSize,
                                                 blockSize, CCTextAlignment.CCTextAlignmentRight,
                                                 FontTestScene.verticalAlignment[FontTestScene.vAlignIdx]);

            CCLayerColor leftColor = new CCLayerColor(new CCColor4B(100, 100, 100, 255), blockSize.Width, blockSize.Height);
            CCLayerColor centerColor = new CCLayerColor(new CCColor4B(200, 100, 100, 255), blockSize.Width, blockSize.Height);
            CCLayerColor rightColor = new CCLayerColor(new CCColor4B(100, 100, 200, 255), blockSize.Width, blockSize.Height);

            leftColor.IgnoreAnchorPointForPosition = false;
            centerColor.IgnoreAnchorPointForPosition = false;
            rightColor.IgnoreAnchorPointForPosition = false;

            top.AnchorPoint = new CCPoint(0.5f, 1);
            left.AnchorPoint = new CCPoint(0, 0.5f);
            leftColor.AnchorPoint = new CCPoint(0, 0.5f);
            center.AnchorPoint = new CCPoint(0, 0.5f);
            centerColor.AnchorPoint = new CCPoint(0, 0.5f);
            right.AnchorPoint = new CCPoint(0, 0.5f);
            rightColor.AnchorPoint = new CCPoint(0, 0.5f);

            top.Position = new CCPoint(s.Width / 2, s.Height - 20);
            left.Position = new CCPoint(0, s.Height / 2);
            leftColor.Position = left.Position;
            center.Position = new CCPoint(blockSize.Width, s.Height / 2);
            centerColor.Position = center.Position;
            right.Position = new CCPoint(blockSize.Width * 2, s.Height / 2);
            rightColor.Position = right.Position;

            AddChild(leftColor, -1);
            AddChild(left, 0, kTagLabel1);
            AddChild(rightColor, -1);
            AddChild(right, 0, kTagLabel2);
            AddChild(centerColor, -1);
            AddChild(center, 0, kTagLabel3);
            AddChild(top, 0, kTagLabel4);
        }
        public LabelGlyphDesigner()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            CCLayerColor layer = new CCLayerColor(new CCColor4B(128, 128, 128, 255));
            AddChild(layer, -10);

            // CCLabelBMFont
            CCLabelBMFont label1 = new CCLabelBMFont("Testing Glyph Designer", "fonts/futura-48.fnt");
            AddChild(label1);
            label1.Position = new CCPoint(s.Width / 2, s.Height / 2);
        }
Exemple #11
0
        public override void OnEnter()
        {
            base.OnEnter();

            this.TouchEnabled = true;

            CCSize s = CCDirector.SharedDirector.WinSize;
            CCLayerColor layer = new CCLayerColor(new CCColor4B(0xFF, 0x00, 0x00, 0x80), 200, 200);

            layer.IgnoreAnchorPointForPosition = false;
            layer.Position = (new CCPoint(s.Width / 2, s.Height / 2));
            AddChild(layer, 1, kTagLayer);
        }
        public RenderTextureIssue937()
        {
            /*
            *     1    2
            * A: A1   A2
            *
            * B: B1   B2
            *
            *  A1: premulti sprite
            *  A2: premulti render
            *
            *  B1: non-premulti sprite
            *  B2: non-premulti render
            */
            CCLayerColor background = new CCLayerColor(new CCColor4B(200, 200, 200, 255));
            AddChild(background);

            CCSprite spr_premulti = new CCSprite("Images/fire");
            spr_premulti.Position = new CCPoint(16, 48);

            CCSprite spr_nonpremulti = new CCSprite("Images/fire");
            spr_nonpremulti.Position = new CCPoint(16, 16);

            /* A2 & B2 setup */
            CCRenderTexture rend = new CCRenderTexture(32, 64);

            // It's possible to modify the RenderTexture blending function by
            //CCBlendFunc bf = new CCBlendFunc (OGLES.GL_ONE, OGLES.GL_ONE_MINUS_SRC_ALPHA);
            //rend.Sprite.BlendFunc = bf;

            rend.Begin();
            // A2
            spr_premulti.Visit();
            // B2
            spr_nonpremulti.Visit();
            rend.End();

            CCSize s = CCDirector.SharedDirector.WinSize;

            /* A1: setup */
            spr_premulti.Position = new CCPoint(s.Width / 2 - 16, s.Height / 2 + 16);
            /* B1: setup */
            spr_nonpremulti.Position = new CCPoint(s.Width / 2 - 16, s.Height / 2 - 16);

            rend.Position = new CCPoint(s.Width / 2 + 16, s.Height / 2);

            AddChild(spr_nonpremulti);
            AddChild(spr_premulti);
            AddChild(rend);
        }
        public LayerTestBlend()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;
            CCLayerColor layer1 = new CCLayerColor(new CCColor4B(255, 255, 255, 80));

            CCSprite sister1 = new CCSprite(s_pPathSister1);
            CCSprite sister2 = new CCSprite(s_pPathSister2);

            AddChild(sister1);
            AddChild(sister2);
            AddChild(layer1, 100, kTagLayer);

            sister1.Position = new CCPoint(160, s.Height / 2);
            sister2.Position = new CCPoint(320, s.Height / 2);

            Schedule(newBlend, 1.0f);
        }
        public LabelTTFA8Test()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            CCLayerColor layer = new CCLayerColor(new CCColor4B(128, 128, 128, 255));
            AddChild(layer, -10);

            // CCLabelBMFont
            CCLabelTTF label1 = new CCLabelTTF("Testing A8 Format", "Marker Felt", 38);
            AddChild(label1);
            label1.Color = CCTypes.CCRed;
            label1.Position = new CCPoint(s.Width / 2, s.Height / 2);

            CCFadeOut fadeOut = new CCFadeOut  (2);
            CCFadeIn fadeIn = new CCFadeIn  (2);
            CCFiniteTimeAction seq = CCSequence.FromActions(fadeOut, fadeIn);
            CCRepeatForever forever = new CCRepeatForever ((CCActionInterval) seq);
            label1.RunAction(forever);
        }
        public override void OnEnter()
        {
            base.OnEnter();

            CCLayerColor l = new CCLayerColor(m_tColor);
            m_pInScene.Visible = false;

            AddChild(l, 2, kSceneFade);
            CCNode f = GetChildByTag(kSceneFade);

            var a = (CCActionInterval) CCSequence.FromActions
                                           (
                                               new CCFadeIn (m_fDuration / 2),
                                               new CCCallFunc((HideOutShowIn)),
                                               new CCFadeOut  (m_fDuration / 2),
                                               new CCCallFunc((Finish))
                                           );

            f.RunAction(a);
        }
        public MainLayer()
        {
            base.TouchEnabled = true;

            CCSprite sprite = new CCSprite(ClickAndMoveTest.s_pPathGrossini);

            CCLayer layer = new CCLayerColor(new CCColor4B(255, 255, 0, 255));
            AddChild(layer, -1);

            AddChild(sprite, 0, ClickAndMoveTest.kTagSprite);
            sprite.Position = new CCPoint(20, 150);

            sprite.RunAction(new CCJumpTo (4, new CCPoint(300, 48), 100, 4));

            layer.RunAction(new CCRepeatForever (
                                                                (CCActionInterval)(CCSequence.FromActions(
                                                                                    new CCFadeIn  (1),
                                                                                    new CCFadeOut  (1)))
                                                                ));
        }
        public override void OnEnter()
        {
            base.OnEnter();

            float x, y;

            CCSize size = CCDirector.SharedDirector.WinSize;
            x = size.Width;
            y = size.Height;

            CCNode blue = new CCLayerColor(new CCColor4B(0, 0, 255, 255));
            CCNode red = new CCLayerColor(new CCColor4B(255, 0, 0, 255));
            CCNode green = new CCLayerColor(new CCColor4B(0, 255, 0, 255));
            CCNode white = new CCLayerColor(new CCColor4B(255, 255, 255, 255));

            blue.Scale = (0.5f);
            blue.Position = (new CCPoint(-x / 4, -y / 4));
            blue.AddChild(SpriteLayer.node());

            red.Scale = (0.5f);
            red.Position = (new CCPoint(x / 4, -y / 4));

            green.Scale = (0.5f);
            green.Position = (new CCPoint(-x / 4, y / 4));
            green.AddChild(TestLayer.node());

            white.Scale = (0.5f);
            white.Position = (new CCPoint(x / 4, y / 4));

            AddChild(blue, -1);
            AddChild(white);
            AddChild(green);
            AddChild(red);

            CCAction rot = new CCRotateBy (8, 720);

            blue.RunAction(rot);
            red.RunAction((CCAction)(rot.Copy()));
            green.RunAction((CCAction)(rot.Copy()));
            white.RunAction((CCAction)(rot.Copy()));
        }
Exemple #18
0
        public Atlas3()
        {
            m_time = 0;

            CCLayerColor col = new CCLayerColor(new CCColor4B(128, 128, 128, 255));
            AddChild(col, -10);

            CCLabelBMFont label1 = CCLabelBMFont.Create("Test", "fonts/bitmapFontTest2.fnt");

            // testing anchors
            label1.AnchorPoint = new CCPoint(0, 0);
            AddChild(label1, 0, (int)TagSprite.kTagBitmapAtlas1);
            CCActionInterval fade = new CCFadeOut  (1.0f);
            CCFiniteTimeAction fade_in = fade.Reverse();
            CCFiniteTimeAction seq = CCSequence.FromActions(fade, fade_in);
            CCAction repeat = new CCRepeatForever ((CCActionInterval)seq);
            label1.RunAction(repeat);

            // VERY IMPORTANT
            // color and opacity work OK because bitmapFontAltas2 loads a BMP image (not a PNG image)
            // If you want to use both opacity and color, it is recommended to use NON premultiplied images like BMP images
            // Of course, you can also tell XCode not to compress PNG images, but I think it doesn't work as expected
            CCLabelBMFont label2 = CCLabelBMFont.Create("Test", "fonts/bitmapFontTest2.fnt");
            // testing anchors
            label2.AnchorPoint = new CCPoint(0.5f, 0.5f);
            label2.Color = ccRED;
            AddChild(label2, 0, (int)TagSprite.kTagBitmapAtlas2);
            label2.RunAction((CCAction)(repeat.Copy()));

            CCLabelBMFont label3 = CCLabelBMFont.Create("Test", "fonts/bitmapFontTest2.fnt");
            // testing anchors
            label3.AnchorPoint = new CCPoint(1, 1);
            AddChild(label3, 0, (int)TagSprite.kTagBitmapAtlas3);

            CCSize s = CCDirector.SharedDirector.WinSize;
            label1.Position = new CCPoint();
            label2.Position = new CCPoint(s.Width / 2, s.Height / 2);
            label3.Position = new CCPoint(s.Width, s.Height);

            base.Schedule(step);//:@selector(step:)];
        }
Exemple #19
0
        public override void onEnter()
        {
            base.onEnter();

            CCLayerColor l = CCLayerColor.layerWithColor(m_tColor);

            m_pInScene.Visible = false;

            AddChild(l, 2, kSceneFade);
            Node f = GetChildByTag(kSceneFade);

            CCActionInterval a = (CCActionInterval)CCSequence.actions
                                 (
                CCFadeIn.actionWithDuration(m_fDuration / 2),
                CCCallFunc.actionWithTarget(this, (base.hideOutShowIn)),
                CCFadeOut.actionWithDuration(m_fDuration / 2),
                CCCallFunc.actionWithTarget(this, (base.finish))
                                 );

            f.RunAction(a);
        }
Exemple #20
0
        public override bool Init()
        {
            // always call "super" init
            // Apple recommends to re-assign "self" with the "super" return value
            if (base.Init())
            {
                TouchEnabled = true;
                // ask director the the window size
                CCSize size = CCDirector.SharedDirector.WinSize;
                CCLayerColor layer;
                for (int i = 0; i < 5; i++)
                {
                    layer = new CCLayerColor(new CCColor4B((byte)(i*20), (byte)(i*20), (byte)(i*20),255));
                    layer.ContentSize = new CCSize(i * 100, i * 100);
                    layer.Position = new CCPoint(size.Width / 2, size.Height / 2);
                    layer.AnchorPoint = new CCPoint(0.5f, 0.5f);
                    layer.IgnoreAnchorPointForPosition = true;
                    AddChild(layer, -1 - i);

                }

                // create and initialize a Label
                CCLabelTTF label = new CCLabelTTF("Hello World", "Marker Felt", 64);
                CCMenuItem item1 = CCMenuItemFont.Create("restart", restart);

                CCMenu menu = new CCMenu(item1);
                menu.AlignItemsVertically();
                menu.Position = new CCPoint(size.Width / 2, 100);
                AddChild(menu);

                // position the label on the center of the screen
                label.Position = new CCPoint(size.Width / 2, size.Height / 2);

                // add the label as a child to this Layer
                AddChild(label);
                return true;
            }
            return false;
        }
        public override void OnEnter()
        {
            base.OnEnter();

            this.TouchEnabled = true;

            CCSize s = CCDirector.SharedDirector.WinSize;
            CCLayerColor layer = new CCLayerColor(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 = new CCHide();
            CCScaleTo scaleTo1 = new CCScaleTo(0.0f, 0.0f);
            CCShow show = new CCShow();
            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);
        }
        public IntroLayer()
        {
            //// create and initialize a Label
            //var label = new CCLabelTTF("Hello Cocos2D-XNA", "MarkerFelt", 22);

            //// position the label on the center of the screen
            //label.Position = CCDirector.SharedDirector.WinSize.Center;

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

            //// setup our color for the background
            //Color = new CCColor3B(Microsoft.Xna.Framework.Color.Blue);
            //Opacity = 255;

            CCLayerColor layer = new CCLayerColor();
            layer.initWithColorWidthHeight(new ccColor4B(0xff, 0xff, 0, 0xff), 100, 100);
            this.addChild(layer);

            CCParticleSun sun = new CCParticleSun();
            this.addChild(sun);
        }
Exemple #23
0
        public LabelTTFTest()
        {
            var blockSize = new CCSize(200, 160);
            CCSize s = CCDirector.SharedDirector.WinSize;

            CCLayerColor colorLayer = new CCLayerColor(new CCColor4B(100, 100, 100, 255), blockSize.Width, blockSize.Height);
            colorLayer.AnchorPoint = new CCPoint(0, 0);
            colorLayer.Position = new CCPoint((s.Width - blockSize.Width) / 2, (s.Height - blockSize.Height) / 2);

            AddChild(colorLayer);

            CCMenuItemFont.FontSize = 30;
            CCMenu menu = new CCMenu(
                new CCMenuItemFont("Left", setAlignmentLeft),
                new CCMenuItemFont("Center", setAlignmentCenter),
                new CCMenuItemFont("Right", setAlignmentRight)
                );
            menu.AlignItemsVerticallyWithPadding(4);
            menu.Position = new CCPoint(50, s.Height / 2 - 20);
            AddChild(menu);

            menu = new CCMenu(
                new CCMenuItemFont("Top", setAlignmentTop),
                new CCMenuItemFont("Middle", setAlignmentMiddle),
                new CCMenuItemFont("Bottom", setAlignmentBottom)
                );
            menu.AlignItemsVerticallyWithPadding(4);
            menu.Position = new CCPoint(s.Width - 50, s.Height / 2 - 20);
            AddChild(menu);

            m_plabel = null;
            m_eHorizAlign = CCTextAlignment.CCTextAlignmentLeft;
            m_eVertAlign = CCVerticalTextAlignment.CCVerticalTextAlignmentTop;

            updateAlignment();
        }
        /// <summary>
        /// creates a CCLayer with color, width and height in Points
        /// </summary>
        public static CCLayerColor layerWithColorWidthHeight(ccColor4B color, float width, float height)
        {
            CCLayerColor pLayer = new CCLayerColor();
            if (pLayer.initWithColorWidthHeight(color, width, height))
            {
                return pLayer;
            }

            return null;
        }
Exemple #25
0
 /// <summary>
 /// creates a CCLayer with color. Width and height are the window size. 
 /// </summary>
 public static CCLayerColor Create(CCColor4B color)
 {
     var pLayer = new CCLayerColor();
     pLayer.InitWithColor(color);
     return pLayer;
 }
Exemple #26
0
 /// <summary>
 /// creates a CCLayer with color, width and height in Points
 /// </summary>
 public static CCLayerColor Create(CCColor4B color, float width, float height)
 {
     var pLayer = new CCLayerColor();
     pLayer.InitWithColorWidthHeight(color, width, height);
     return pLayer;
 }
Exemple #27
0
 public static new CCLayerColor Create()
 {
     var pRet = new CCLayerColor();
     pRet.Init();
     return pRet;
 }
Exemple #28
0
        public TMXIsoTest2()
        {
            CCLayerColor color = new CCLayerColor(new CCColor4B(64, 64, 64, 255));
            AddChild(color, -1);

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

            CCSize s = map.ContentSize;

            // move map to the center of the screen
            CCSize ms = map.MapSize;
            CCSize ts = map.TileSize;
            map.RunAction(new CCMoveTo (1.0f, new CCPoint(-ms.Width * ts.Width / 2, -ms.Height * ts.Height / 2)));
        }
Exemple #29
0
        public TMXIsoTest1()
        {
            CCLayerColor color = new CCLayerColor(new CCColor4B(64, 64, 64, 255));
            AddChild(color, -1);

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

            CCSize s = map.ContentSize;

            map.AnchorPoint = (new CCPoint(0.5f, 0.5f));
        }
Exemple #30
0
        public TMXHexTest()
        {
            CCLayerColor color = new CCLayerColor(new CCColor4B(64, 64, 64, 255));
            AddChild(color, -1);

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

            CCSize s = map.ContentSize;
        }
        /// <summary>
        /// creates a CCLayer with color. Width and height are the window size. 
        /// </summary>
        public static CCLayerColor layerWithColor(ccColor4B color)
        {
            CCLayerColor pLayer = new CCLayerColor();
            if (pLayer.initWithColor(color))
            {
                return pLayer;
            }

            return null;
        }