Esempio n. 1
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s = CCDirector.SharedDirector.WinSize;
            var layer1 = new CCLayerRGBA();

            var sister1 = new CCSprite("Images/grossinis_sister1.png");
            var sister2 = new CCSprite("Images/grossinis_sister2.png");
            var label = new CCLabelBMFont("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);

            layer1.RunAction(
                new CCRepeatForever(
                    CCSequence.FromActions(
                        new CCFadeTo(4, 0),
                        new CCFadeTo(4, 255),
                        new CCDelayTime(1))
                    )
                );

            sister1.RunAction(
                new CCRepeatForever(
                    CCSequence.FromActions(
                        new CCFadeTo(2, 0),
                        new CCFadeTo(2, 255),
                        new CCFadeTo(2, 0),
                        new CCFadeTo(2, 255),
                        new CCDelayTime(1))
                    )
                );
    
    
            // Enable cascading in scene
            SetEnableRecursiveCascading(this, true);
        }
        public override void OnEnter()
        {
            base.OnEnter();
            CCSize winSize = CCDirector.SharedDirector.WinSize;
            float x = winSize.Width / 2;
            float y = 0 + (winSize.Height / 2);
            var rgba = new CCLayerRGBA();
            rgba.CascadeColorEnabled = true;
            rgba.CascadeOpacityEnabled = true;
            AddChild(rgba);

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

            var blocks_scaled_with_insets = new CCScale9Sprite();
            blocks_scaled_with_insets.InitWithSpriteFrameName("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.");
        }