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

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            var layer1 = new CCLayerColor(new CCColor4B(0xFF, 0xFF, 0x00, 0x80));

            layer1.IgnoreAnchorPointForPosition = false;
            layer1.Position          = (new CCPoint(s.Width / 2, s.Height / 2));
            layer1.ChildClippingMode = CCClipMode.Bounds;
            AddChild(layer1, 1);

            s = layer1.ContentSize;

            m_pInnerLayer = new CCLayerColor(new CCColor4B(0xFF, 0x00, 0x00, 0x80));
            m_pInnerLayer.IgnoreAnchorPointForPosition = false;
            m_pInnerLayer.Position          = (new CCPoint(s.Width / 2, s.Height / 2));
            m_pInnerLayer.ChildClippingMode = CCClipMode.Bounds;

            layer1.AddChild(m_pInnerLayer, 1);

            //
            // Add two labels using BM label class
            // CCLabelBMFont
            CCLabelBMFont label1 = new CCLabelBMFont("LABEL1", "fonts/konqa32.fnt");

            label1.Position = new CCPoint(m_pInnerLayer.ContentSize.Width, m_pInnerLayer.ContentSize.Height * 0.75f);
            m_pInnerLayer.AddChild(label1);

            CCLabelBMFont label2 = new CCLabelBMFont("LABEL2", "fonts/konqa32.fnt");

            label2.Position = new CCPoint(0, m_pInnerLayer.ContentSize.Height * 0.25f);
            m_pInnerLayer.AddChild(label2);


            CCScaleTo scaleTo2 = new CCScaleTo(runTime * 0.25f, 3.0f);
            CCScaleTo scaleTo3 = new CCScaleTo(runTime * 0.25f, 1.0f);

            m_pInnerLayer.RepeatForever(scaleTo2, scaleTo3);


            CCFiniteTimeAction seq = new CCRepeatForever(
                new CCSequence(scaleTo2, scaleTo3)
                );

            m_pInnerLayer.RunAction(seq);

            CCSize size = Layer.VisibleBoundsWorldspace.Size;

            var move1 = new CCMoveTo(2, new CCPoint(size.Width / 2, size.Height));
            var move2 = new CCMoveTo(2, new CCPoint(size.Width, size.Height / 2));
            var move3 = new CCMoveTo(2, new CCPoint(size.Width / 2, 0));
            var move4 = new CCMoveTo(2, new CCPoint(0, size.Height / 2));

            layer1.RunAction(new CCRepeatForever(new CCSequence(move1, move2, move3, move4)));
        }
Beispiel #2
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s      = Layer.VisibleBoundsWorldspace.Size;
            var layer1 = new CCLayer();


            var sister1 = new CCSprite("Images/grossinis_sister1.png");
            var sister2 = new CCSprite("Images/grossinis_sister2.png");
            var label   = new CCLabel("Test", "fonts/bitmapFontTest.fnt");

            // by default a CCLabelBMFont has IsColorModifiedByOpacity on by default if the
            // texture atlas is PreMultipliedAlpha.  Label as used by Cocos2d-x by default has
            // this set to false.  Maybe this is a bug in Cocos2d-x?
            label.IsColorModifiedByOpacity = false;

            layer1.AddChild(sister1);
            layer1.AddChild(sister2);
            layer1.AddChild(label);
            this.AddChild(layer1, 0, kTagLayer);

            sister1.Position = new CCPoint(s.Width * 1 / 3, s.Height / 2);
            sister2.Position = new CCPoint(s.Width * 2 / 3, s.Height / 2);
            label.Position   = new CCPoint(s.Width / 2, s.Height / 2);

            // Define our delay time
            var delay = new CCDelayTime(1);

            layer1.RepeatForever(
                new CCFadeTo(4, 0),
                new CCFadeTo(4, 255),
                delay
                );

            // We only have to define them once.
            var fadeTo11 = new CCFadeTo(2, 0);
            var fadeTo12 = new CCFadeTo(2, 255);

            sister1.RepeatForever(
                fadeTo11,
                fadeTo12,
                fadeTo11,
                fadeTo12,
                delay
                );


            // Enable cascading in scene
            SetEnableRecursiveCascading(this, true);
        }
Beispiel #3
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s      = Layer.VisibleBoundsWorldspace.Size;
            var layer1 = new CCLayer();

            var sister1 = new CCSprite("Images/grossinis_sister1.png");
            var sister2 = new CCSprite("Images/grossinis_sister2.png");
            var label   = new CCLabel("Test", "fonts/bitmapFontTest.fnt");

            layer1.AddChild(sister1);
            layer1.AddChild(sister2);
            layer1.AddChild(label);
            this.AddChild(layer1, 0, kTagLayer);

            sister1.Position = new CCPoint(s.Width * 1 / 3, s.Height / 2);
            sister2.Position = new CCPoint(s.Width * 2 / 3, s.Height / 2);
            label.Position   = new CCPoint(s.Width / 2, s.Height / 2);

            // Define our delay time
            var delay = new CCDelayTime(1);

            layer1.RepeatForever(
                new CCTintTo(6, 255, 0, 255),
                new CCTintTo(6, 255, 255, 255),
                delay
                );

            sister1.RepeatForever(
                new CCTintTo(2, 255, 255, 0),
                new CCTintTo(2, 255, 255, 255),
                new CCTintTo(2, 0, 255, 255),
                new CCTintTo(2, 255, 255, 255),
                new CCTintTo(2, 255, 0, 255),
                new CCTintTo(2, 255, 255, 255),
                delay
                );

            // Enable cascading in scene
            SetEnableRecursiveCascading(this, true);
        }
Beispiel #4
0
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = Layer.VisibleBoundsWorldspace.Size;
            float  x       = winSize.Width / 2;
            float  y       = 0 + (winSize.Height / 2);
            var    rgba    = new CCLayer();

            rgba.IsColorCascaded   = true;
            rgba.IsOpacityCascaded = true;
            AddChild(rgba);

            var blocksScaledWithInsets = CCScale9Sprite.SpriteWithFrameName("blocks9r.png");

            blocksScaledWithInsets.Position = new CCPoint(x, y);

            rgba.AddChild(blocksScaledWithInsets);
            var actions = new CCSequence(new CCFadeIn(1),
                                         new CCTintTo(1, 0, 255, 0),
                                         new CCTintTo(1, 255, 255, 255),
                                         new CCFadeOut(1));

            rgba.RepeatForever(actions);
        }