예제 #1
0
        public MenuLayer3()
        {
            CCMenuItemFont.FontName = "arial";
            CCMenuItemFont.FontSize = 28;

            CCLabelBMFont   label = new CCLabelBMFont("Enable AtlasItem", "fonts/bitmapFontTest3.fnt");
            CCMenuItemLabel item1 = new CCMenuItemLabel(label, this.menuCallback2);
            CCMenuItemFont  item2 = new CCMenuItemFont("--- Go Back ---", this.menuCallback);

            CCSprite spriteNormal   = new CCSprite(s_MenuItem, new CCRect(0, 23 * 2, 115, 23));
            CCSprite spriteSelected = new CCSprite(s_MenuItem, new CCRect(0, 23 * 1, 115, 23));
            CCSprite spriteDisabled = new CCSprite(s_MenuItem, new CCRect(0, 23 * 0, 115, 23));


            CCMenuItemSprite item3 = new CCMenuItemSprite(spriteNormal, spriteSelected, spriteDisabled, this.menuCallback3);

            m_disabledItem         = item3;
            m_disabledItem.Enabled = false;

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

            menu.Position = new CCPoint(0, 0);

            CCSize s = CCDirector.SharedDirector.WinSize;

            item1.Position = new CCPoint(s.Width / 2 - 150, s.Height / 2);
            item2.Position = new CCPoint(s.Width / 2 - 200, s.Height / 2);
            item3.Position = new CCPoint(s.Width / 2, s.Height / 2 - 100);
            CCJumpBy jump = new CCJumpBy(3, new CCPoint(400, 0), 50, 4);

            item2.RunAction(new CCRepeatForever(
                                (CCActionInterval)(new CCSequence(jump, jump.Reverse()))
                                )
                            );
            CCActionInterval spin1 = new CCRotateBy(3, 360);
            CCActionInterval spin2 = (CCActionInterval)(spin1.Copy());
            CCActionInterval spin3 = (CCActionInterval)(spin1.Copy());

            item1.RunAction(new CCRepeatForever(spin1));
            item2.RunAction(new CCRepeatForever(spin2));
            item3.RunAction(new CCRepeatForever(spin3));

            AddChild(menu);
        }
        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()));
        }
예제 #3
0
        public Layer3()
        {
            CCMenuItemFont.DefaultFontName = "Marker Felt";
            CCMenuItemFont.DefaultFontSize = 28;

            CCLabelBMFont label = new CCLabelBMFont("Enable AtlasItem", "bitmapFontTest3.fnt");
            CCMenuItemLabel item1 = new CCMenuItemLabel(label, this, new MonoMac.ObjCRuntime.Selector("menuCallback2:"));
            CCMenuItemFont item2 = new CCMenuItemFont("--- Go Back ---", this, new MonoMac.ObjCRuntime.Selector("menuCallback:"));

            CCSprite spriteNormal = new CCSprite ("menuitemsprite.png", new RectangleF (0, 23 * 2, 115, 23));
            CCSprite spriteSelected = new CCSprite ("menuitemsprite.png", new RectangleF (0, 23 * 1, 115, 23));
            CCSprite spriteDisabled = new CCSprite ("menuitemsprite.png", new RectangleF (0, 23 * 0, 115, 23));

            CCMenuItemSprite item3 = new CCMenuItemSprite (spriteNormal, spriteSelected, spriteDisabled, this, new MonoMac.ObjCRuntime.Selector("menuCallback3:"));
            disabledItem = item3;
            disabledItem.Enabled = false;

            NSArray arrayOfItems = NSArray.FromObjects(item1, item2, item3);
            CCMenu menu = new CCMenu(arrayOfItems);

            CGSize s = CCDirector.SharedDirector().WinSize ();

            item1.Position = new CCPoint(s.Width/2 - 150, s.Height/2);
            item2.Position = new CCPoint(s.Width/2 - 200, s.Height/2);
            item3.Position = new CCPoint(s.Width/2, s.Height/2 - 100);

            var jump = new CCJumpBy(3, new CCPoint(400,0), 50, 4);
            item2.RunAction (new CCRepeatForever ((CCActionInterval)CCSequence.Actions (jump, jump.Reverse ())));
            var spin1 = new CCRotateBy (3, 360);
            var spin2 = (CCRotateBy)spin1.Copy ();
            var spin3 = (CCRotateBy)spin1.Copy ();

            item1.RunAction (new CCRepeatForever (spin1));
            item2.RunAction (new CCRepeatForever (spin2));
            item3.RunAction (new CCRepeatForever (spin3));

            this.AddChild (menu);
            menu.Position = new CCPoint(0, 0);
        }
예제 #4
0
        public override void OnEnter()
        {
            base.OnEnter();

            centerSprites(2);

            var jump1 = new CCJumpBy(2, CCPoint.Zero, 100, 3);
            var jump2 = (CCJumpBy)jump1.Copy();
            var rot1  = new CCRotateBy(1, 360);
            var rot2  = (CCRotateBy)rot1.Copy();

            var t1 = new CCTargetedAction(m_kathia, jump2);
            var t2 = new CCTargetedAction(m_kathia, rot2);


            var seq    = CCSequence.FromActions(jump1, t1, rot1, t2);
            var always = new CCRepeatForever(seq);

            m_tamara.RunAction(always);
        }
예제 #5
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCSize s = CCDirector.SharedDirector.WinSize;

            CCSprite sp1 = new CCSprite(TestResource.s_pPathSister1);
            CCSprite sp2 = new CCSprite(TestResource.s_pPathSister2);
            CCSprite sp3 = new CCSprite(TestResource.s_pPathSister1);
            CCSprite sp4 = new CCSprite(TestResource.s_pPathSister2);

            sp1.Position = (new CCPoint(100, s.Height / 2));
            sp2.Position = (new CCPoint(380, s.Height / 2));
            AddChild(sp1);
            AddChild(sp2);

            sp3.Scale = (0.25f);
            sp4.Scale = (0.25f);

            sp1.AddChild(sp3);
            sp2.AddChild(sp4);

            CCActionInterval a1 = new CCRotateBy(2, 360);
            CCActionInterval a2 = new CCScaleBy(2, 2);

            CCAction action1 = new CCRepeatForever((CCActionInterval) new CCSequence(a1, a2, a2.Reverse())
                                                   );
            CCAction action2 = new CCRepeatForever((CCActionInterval)
                                                   (new CCSequence(
                                                        (CCActionInterval)(a1.Copy()),
                                                        (CCActionInterval)(a2.Copy()),
                                                        a2.Reverse()))
                                                   );

            sp2.AnchorPoint = (new CCPoint(0, 0));

            sp1.RunAction(action1);
            sp2.RunAction(action2);
        }
예제 #6
0
        public override void OnEnter()
        {
            base.OnEnter();

            float x, y;

            CCSize size = CCDirector.SharedDirector.WinSize;

            x = size.Width;
            y = size.Height;

            CCSprite sprite        = new CCSprite(s_pPathGrossini);
            CCSprite spriteSister1 = new CCSprite(s_pPathSister1);
            CCSprite spriteSister2 = new CCSprite(s_pPathSister2);

            sprite.Scale        = (1.5f);
            spriteSister1.Scale = (1.5f);
            spriteSister2.Scale = (1.5f);

            sprite.Position        = (new CCPoint(x / 2, y / 2));
            spriteSister1.Position = (new CCPoint(40, y / 2));
            spriteSister2.Position = (new CCPoint(x - 40, y / 2));

            CCAction rot = new CCRotateBy(16, -3600);

            AddChild(sprite);
            AddChild(spriteSister1);
            AddChild(spriteSister2);

            sprite.RunAction(rot);

            CCActionInterval jump1 = new CCJumpBy(4, new CCPoint(-400, 0), 100, 4);
            CCActionInterval jump2 = (CCActionInterval)jump1.Reverse();

            CCActionInterval rot1 = new CCRotateBy(4, 360 * 2);
            CCActionInterval rot2 = (CCActionInterval)rot1.Reverse();

            spriteSister1.RunAction(new CCRepeat(new CCSequence(jump2, jump1), 5));
            spriteSister2.RunAction(new CCRepeat(new CCSequence((CCFiniteTimeAction)(jump1.Copy()), (CCFiniteTimeAction)(jump2.Copy())), 5));

            spriteSister1.RunAction(new CCRepeat(new CCSequence(rot1, rot2), 5));
            spriteSister2.RunAction(new CCRepeat(new CCSequence((CCFiniteTimeAction)(rot2.Copy()), (CCFiniteTimeAction)(rot1.Copy())), 5));
        }