コード例 #1
0
ファイル: LayerTest1.cs プロジェクト: ztaksoftware/CocosSharp
        public override void OnEnter()
        {
            base.OnEnter();

            var s = Layer.VisibleBoundsWorldspace.Size;

            var layer1 = new CCLayerColor(new CCColor4B(192, 0, 0, 255));

            layer1.IsColorCascaded = false;

            layer1.Position = new CCPoint(0, s.Height / 2);

            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, 0);
            sister2.Position = new CCPoint(s.Width * 2 / 3, 0);
            label.Position   = new CCPoint(s.Width / 2, 0);

            // 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);
        }
コード例 #2
0
ファイル: LayerTest1.cs プロジェクト: ztaksoftware/CocosSharp
        public override void OnEnter()
        {
            base.OnEnter();

            var s = Layer.VisibleBoundsWorldspace.Size;

            var layer1 = new CCLayerColor(new CCColor4B(192, 0, 0, 255));

            layer1.IsColorCascaded = false;

            layer1.Position = new CCPoint(0, s.Height / 2);

            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, 0);
            sister2.Position = new CCPoint(s.Width * 2 / 3, 0);
            label.Position   = new CCPoint(s.Width / 2, 0);

            // 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);
        }
コード例 #3
0
ファイル: LayerTest1.cs プロジェクト: ztaksoftware/CocosSharp
        public override void OnEnter()
        {
            base.OnEnter();

            var s = Layer.VisibleBoundsWorldspace.Size;

            var layer1 = new CCLayerColor(new CCColor4B(192, 0, 0, 255));

            layer1.IsColorCascaded = false;

            layer1.Position = new CCPoint(0, s.Height / 2);

            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, 0);
            sister2.Position = new CCPoint(s.Width * 2 / 3, 0);
            label.Position   = new CCPoint(s.Width / 2, 0);

            // 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
                );
        }
コード例 #4
0
        public MainLayer()
        {
            var listener = new CCEventListenerTouchAllAtOnce();

            listener.OnTouchesEnded = onTouchesEnded;

            AddEventListener(listener);

            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.RepeatForever(new CCFadeIn(1), new CCFadeOut(1));
        }