Exemplo n.º 1
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);

            CCLog.Log("S9CascadeOpacityAndColor ...");

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

            CCLog.Log("... created");

            blocks_scaled_with_insets.Position = new CCPoint(x, y);
            CCLog.Log("... setPosition");

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

            rgba.RunAction(repeat);
            CCLog.Log("AddChild");

            CCLog.Log("... S9CascadeOpacityAndColor done.");
        }
Exemplo n.º 2
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)));
        }