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

            var s = CCDirector.SharedDirector.WinSize;

            // rotate and jump
            var jump1 = new CCJumpBy(4, new CCPoint(-s.Width + 80, 0), 100, 4);
            var jump2 = jump1.Reverse();
            var rot1  = new CCRotateBy(4, 360 * 2);
            var rot2  = rot1.Reverse();

            var seq3_1 = CCSequence.FromActions(jump2, jump1);
            var seq3_2 = CCSequence.FromActions(rot1, rot2);
            var spawn  = CCSpawn.FromActions(seq3_1, seq3_2);
            var action = new CCSpeed(new CCRepeatForever(spawn), 1.0f);

            action.Tag = EaseTest.kTagAction1;

            var action2 = (CCAction)(action.Copy());
            var action3 = (CCAction)(action.Copy());

            action2.Tag = EaseTest.kTagAction1;
            action3.Tag = EaseTest.kTagAction1;

            m_grossini.RunAction(action2);
            m_tamara.RunAction(action3);
            m_kathia.RunAction(action);

            Schedule(altertime, 1.0f);
        }
示例#2
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCRect visibleBounds = VisibleBoundsWorldspace;

            CCCamera contentCamera = contentLayer.Camera;

            contentCamera.Projection             = CCCameraProjection.Projection3D;
            contentCamera.PerspectiveAspectRatio = 1.0f;

            CCPoint3 cameraCenter = contentCamera.CenterInWorldspace;
            CCPoint3 cameraTarget = contentCamera.TargetInWorldspace;

            float targeCenterLength = (cameraTarget - cameraCenter).Length;


            contentCamera.NearAndFarPerspectiveClipping = new CCPoint(0.15f, 100.0f);

            contentCamera.PerspectiveFieldOfView = (float)Math.Atan(visibleBounds.Size.Height / (2.0f * targeCenterLength));

            var lens      = new CCLens3D(10, new CCGridSize(64, 48), new CCPoint(100, 180), 80);
            var move      = new CCJumpBy(5, new CCPoint(600, 0), 100, 5);
            var move_back = move.Reverse();

            CCLens3DState lensState = bgNode.RunAction(lens) as CCLens3DState;

            var target = new Lens3DTarget(lensState);

            // Please make sure the target has been added to its parent.
            AddChild(target);

            target.AddActions(false, move, move_back);
        }
示例#3
0
        public override void OnEnter()
        {
            base.OnEnter();

            alignSpritesLeft(1);

            var jump   = new CCJumpBy(2, new CCPoint(300, 0), 50, 4);
            var action = CCSequence.FromActions(jump, jump.Reverse());

            m_grossini.RunAction(action);
        }
示例#4
0
        public override void OnEnter()
        {
            base.OnEnter();

            centerSprites(3);

            var actionTo     = new CCJumpTo(2, new CCPoint(300, 300), 50, 4);
            var actionBy     = new CCJumpBy(2, new CCPoint(300, 0), 50, 4);
            var actionUp     = new CCJumpBy(2, new CCPoint(0, 0), 80, 4);
            var actionByBack = actionBy.Reverse();

            m_tamara.RunAction(actionTo);
            m_grossini.RunAction(CCSequence.FromActions(actionBy, actionByBack));
            m_kathia.RunAction(new CCRepeatForever(actionUp));
        }
示例#5
0
        protected override void AddedToScene()
        {
            base.AddedToScene();

            var label = new CCLabelBMFont("Enable AtlasItem", "fonts/bitmapFontTest3.fnt");
            var item1 = new CCMenuItemLabelBMFont(label, this.menuCallback2);

            CCMenuItemFont.FontSize = 28;
            CCMenuItemFont.FontName = "arial";

            var item2 = new CCMenuItemFont("--- Go Back ---", this.menuCallback);

            // We do not have an HD version of the menuitemsprite so internally CocosSharp tries to convert our
            // rectangle coordinates passed to work with HD images so the coordinates are off.  We will just
            // modify this here to make sure we have the correct sizes when they are passed.
            var spriteNormal   = new CCSprite(s_MenuItem, new CCRect(0, 23 * 2, 115, 23));
            var spriteSelected = new CCSprite(s_MenuItem, new CCRect(0, 23 * 1, 115, 23));
            var spriteDisabled = new CCSprite(s_MenuItem, new CCRect(0, 23 * 0, 115, 23));


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

            m_disabledItem         = item3;
            m_disabledItem.Enabled = false;

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

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

            var s = Layer.VisibleBoundsWorldspace.Size;

            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.RepeatForever(jump, jump.Reverse());

            var spin1 = new CCRotateBy(3, 360);

            item1.RepeatForever(spin1);
            item2.RepeatForever(spin1);
            item3.RepeatForever(spin1);

            AddChild(menu);
        }
示例#6
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);
        }
示例#7
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCRect visibleBounds = VisibleBoundsWorldspace;

            var lens      = new CCLens3D(10, new CCGridSize(64, 48), new CCPoint(100, 180), 80);
            var move      = new CCJumpBy(5, new CCPoint(600, 0), 100, 5);
            var move_back = move.Reverse();

            CCLens3DState lensState = bgNode.RunAction(lens) as CCLens3DState;

            var target = new Lens3DTarget(lensState);

            // Please make sure the target has been added to its parent.
            AddChild(target);

            target.AddActions(false, move, move_back);
        }
示例#8
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCRect visibleBounds = VisibleBoundsWorldspace;

            var radius = 150;
            var lens   = new CCLens3D(10, new CCGridSize(64, 48), new CCPoint(100, visibleBounds.Center.Y - radius / 2), radius);
            var jumpBy = new CCJumpBy(5, new CCPoint(600, 0), 100, 5);

            CCLens3DState lensState = bgNode.RunAction(lens) as CCLens3DState;

            var target = new Lens3DTarget(lensState);

            // Please make sure the target has been added to its parent.
            AddChild(target);

            target.AddActions(false, jumpBy, jumpBy.Reverse());
        }
示例#9
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));
        }
示例#10
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);
        }
示例#11
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCLens3D   lens      = new CCLens3D(10, new CCGridSize(32, 24), new CCPoint(100, 180), 150);
            CCJumpBy   move      = new CCJumpBy(5, new CCPoint(380, 0), 100, 4);
            var        move_back = (CCActionInterval)move.Reverse();
            CCSequence seq       = new CCSequence(move, move_back);

            /* In cocos2d-iphone, the type of action's target is 'id', so it supports using the instance of 'CCLens3D' as its target.
             *  While in cocos2d-x, the target of action only supports CCNode or its subclass,
             *  so we make an encapsulation for CCLens3D to achieve that.
             */

            CCDirector director = CCDirector.SharedDirector;
            CCNode     target   = Lens3DTarget.Create(lens);

            // Please make sure the target been added to its parent.
            AddChild(target);

            director.ActionManager.AddAction(seq, target, false);
            RunAction(lens);
        }
示例#12
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s = Layer.VisibleBoundsWorldspace.Size;

            // rotate and jump
            var jump1 = new CCJumpBy(4, new CCPoint(-s.Width + 80, 0), 100, 4);
            var jump2 = jump1.Reverse();
            var rot1  = new CCRotateBy(4, 360 * 2);
            var rot2  = rot1.Reverse();

            var seq3_1 = new CCSequence(jump2, jump1);
            var seq3_2 = new CCSequence(rot1, rot2);
            var spawn  = new CCSpawn(seq3_1, seq3_2);

            speedAction1 = new CCSpeed(new CCRepeatForever(spawn), 1.0f);
            speedAction2 = new CCSpeed(new CCRepeatForever(spawn), 2.0f);
            speedAction3 = new CCSpeed(new CCRepeatForever(spawn), 0.5f);

            m_grossini.RunAction(speedAction1);
            m_tamara.RunAction(speedAction2);
            m_kathia.RunAction(speedAction3);
        }
示例#13
0
        public IntervalLayer()
        {
            m_time0 = m_time1 = m_time2 = m_time3 = m_time4 = 0.0f;

            CCSize s = Layer.VisibleBoundsWorldspace.Size;

            // sun
            var sun = new CCParticleSun(new CCPoint(s.Width / 2, s.Height / 2));

            sun.Texture  = CCTextureCache.SharedTextureCache.AddImage("Images/fire");
            sun.Position = (new CCPoint(s.Width - 32, s.Height - 32));

            sun.TotalParticles = 130;
            sun.Life           = (0.6f);
            AddChild(sun);

            // timers
            m_label0 = new CCLabel("0", "fonts/bitmapFontTest4.fnt");
            m_label1 = new CCLabel("0", "fonts/bitmapFontTest4.fnt");
            m_label2 = new CCLabel("0", "fonts/bitmapFontTest4.fnt");
            m_label3 = new CCLabel("0", "fonts/bitmapFontTest4.fnt");
            m_label4 = new CCLabel("0", "fonts/bitmapFontTest4.fnt");

            Schedule();

            Schedule(step1);
            Schedule(step2, 0);
            Schedule(step3, 1.0f);
            Schedule(step4, 2.0f);

            m_label0.Position = new CCPoint(s.Width * 1 / 6, s.Height / 2);
            m_label1.Position = new CCPoint(s.Width * 2 / 6, s.Height / 2);
            m_label2.Position = new CCPoint(s.Width * 3 / 6, s.Height / 2);
            m_label3.Position = new CCPoint(s.Width * 4 / 6, s.Height / 2);
            m_label4.Position = new CCPoint(s.Width * 5 / 6, s.Height / 2);

            AddChild(m_label0);
            AddChild(m_label1);
            AddChild(m_label2);
            AddChild(m_label3);
            AddChild(m_label4);

            // Sprite
            CCSprite sprite = new CCSprite(s_pPathGrossini);

            sprite.Position = new CCPoint(40, 50);

            CCJumpBy jump = new CCJumpBy(3, new CCPoint(s.Width - 80, 0), 50, 4);

            AddChild(sprite);
            sprite.RunAction(new CCRepeatForever(
                                 (CCFiniteTimeAction)(new CCSequence(jump, jump.Reverse())))
                             );

            // pause button
            CCMenuItem item1 = new CCMenuItemFont("Pause", onPause);
            CCMenu     menu  = new CCMenu(item1);

            menu.Position = new CCPoint(s.Width / 2, s.Height - 50);

            AddChild(menu);
        }