예제 #1
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCNode target = GetChildByTag(EffectAdvanceScene.kTagBackground);

            // To reuse a grid the grid size and the grid type must be the same.
            // in this case:
            //     Lens3D is Grid3D and it's size is (15,10)
            //     Waves3D is Grid3D and it's size is (15,10)

            CCSize size = CCDirector.SharedDirector.WinSize;
            CCActionInterval lens = new CCLens3D(0.0f, new CCGridSize(15, 10), new CCPoint(size.Width / 2, size.Height / 2), 240);
            CCActionInterval waves = new CCWaves3D(10, new CCGridSize(15, 10), 18, 15);


            CCFiniteTimeAction reuse = new CCReuseGrid(1);
            CCActionInterval delay = new CCDelayTime (8);

            CCActionInterval orbit = new CCOrbitCamera(5, 1, 2, 0, 180, 0, -90);
            CCFiniteTimeAction orbit_back = orbit.Reverse();

            target.RunAction(new CCRepeatForever ((new CCSequence(orbit, orbit_back))));
            target.RunAction(new CCSequence(lens, delay, reuse, waves));
        }
예제 #2
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCNode target = GetChildByTag(EffectAdvanceScene.kTagBackground);

            // To reuse a grid the grid size and the grid type must be the same.
            // in this case:
            //     ShakyTiles is TiledGrid3D and it's size is (15,10)
            //     Shuffletiles is TiledGrid3D and it's size is (15,10)
            //	   TurnOfftiles is TiledGrid3D and it's size is (15,10)
            CCActionInterval shaky = new CCShakyTiles3D(5, new CCGridSize(15, 10), 4, false);
            CCActionInterval shuffle = new CCShuffleTiles(new CCGridSize(15, 10), 3, 0);
            CCActionInterval turnoff = new CCTurnOffTiles(3, new CCGridSize(15, 10), 0);
            CCFiniteTimeAction turnon = turnoff.Reverse();

            // reuse 2 times:
            //   1 for shuffle
            //   2 for turn off
            //   turnon tiles will use a new grid
            CCFiniteTimeAction reuse = new CCReuseGrid(2);

            CCActionInterval delay = new CCDelayTime (1);

            //	id orbit = [OrbitCamera::actionWithDuration:5 radius:1 deltaRadius:2 angleZ:0 deltaAngleZ:180 angleX:0 deltaAngleX:-90];
            //	id orbit_back = [orbit reverse];
            //
            //	[target runAction: [RepeatForever::actionWithAction: [Sequence actions: orbit, orbit_back, nil]]];
            target.RunAction((new CCSequence(shaky, delay, reuse, shuffle, (CCFiniteTimeAction) delay.Copy(), turnoff, turnon)));
        }
예제 #3
0
        public static CCActionInterval actionWithDuration(float t)
        {
            CCFlipX3D flipx = new CCFlipX3D(t);
            CCFiniteTimeAction flipx_back = flipx.Reverse();
            CCDelayTime delay = new CCDelayTime (2);

            return (CCSequence.FromActions(flipx, delay, flipx_back));
        }
예제 #4
0
        public new static CCActionInterval actionWithDuration(float t)
        {
            CCTurnOffTiles fadeout = new CCTurnOffTiles(t, new CCGridSize(48, 32), 25);
            CCFiniteTimeAction back = fadeout.Reverse();
            CCDelayTime delay = new CCDelayTime (0.5f);

            return (CCActionInterval)(new CCSequence(fadeout, delay, back));
        }
예제 #5
0
        public static CCActionInterval actionWithDuration(float t)
        {
            CCFadeOutDownTiles fadeout = new CCFadeOutDownTiles(t, new CCGridSize(16, 12));
            CCFiniteTimeAction back = fadeout.Reverse();
            CCDelayTime delay = new CCDelayTime (0.5f);

            return (CCActionInterval)(new CCSequence(fadeout, delay, back));
        }
예제 #6
0
        public new static CCActionInterval actionWithDuration(float t)
        {
            CCShuffleTiles shuffle = new CCShuffleTiles(new CCGridSize(16, 12), t, 25);
            CCFiniteTimeAction shuffle_back = shuffle.Reverse();
            CCDelayTime delay = new CCDelayTime (2);

            return (CCActionInterval)(new CCSequence(shuffle, delay, shuffle_back));
        }
        public void disableMenuCallback(object pSender)
        {
            m_pMenu1.Enabled = false;
            CCDelayTime wait = new CCDelayTime (5);
            CCCallFunc enable = new CCCallFunc(enableMenuCallback);

            CCFiniteTimeAction seq = CCSequence.FromActions(wait, enable);
            m_pMenu1.RunAction(seq);
        }
예제 #8
0
        public override void OnEnter()
        {
            base.OnEnter();

            this.TouchEnabled = true;

            CCSize s = CCDirector.SharedDirector.WinSize;
            CCLayerColor layer = new CCLayerColor(new CCColor4B(0xFF, 0x00, 0x00, 0x80), s.Width * 0.75f, s.Height * 0.75f);

            layer.IgnoreAnchorPointForPosition = false;
            layer.Position = (new CCPoint(s.Width / 2, s.Height / 2));
            AddChild(layer, 1, kTagLayer);
            //
            // Add two labels using BM label class
            // CCLabelBMFont
            CCLabelBMFont label1 = new CCLabelBMFont("LABEL1", "fonts/konqa32.fnt");
            layer.AddChild(label1);
            label1.Position = new CCPoint(layer.ContentSize.Width / 2, layer.ContentSize.Height * 0.75f);
            CCLabelBMFont label2 = new CCLabelBMFont("LABEL2", "fonts/konqa32.fnt");
            layer.AddChild(label2);
            label2.Position = new CCPoint(layer.ContentSize.Width / 2, layer.ContentSize.Height * 0.25f);
            //
            // Do the sequence of actions in the bug report
            float waitTime = 3f;
            float runTime = 12f;
            layer.Visible = false;
            CCHide hide = new CCHide();
            CCScaleTo scaleTo1 = new CCScaleTo(0.0f, 0.0f);
            CCShow show = new CCShow();
            CCDelayTime delay = new CCDelayTime (waitTime);
            CCScaleTo scaleTo2 = new CCScaleTo(runTime * 0.25f, 1.2f);
            CCScaleTo scaleTo3 = new CCScaleTo(runTime * 0.25f, 0.95f);
            CCScaleTo scaleTo4 = new CCScaleTo(runTime * 0.25f, 1.1f);
            CCScaleTo scaleTo5 = new CCScaleTo(runTime * 0.25f, 1.0f);

            CCFiniteTimeAction seq = new CCSequence(hide, scaleTo1, show, delay, scaleTo2, scaleTo3, scaleTo4, scaleTo5);

            layer.RunAction(seq);


        }
예제 #9
0
        public override void OnEnter()
        {
            base.OnEnter();

            var size = CCDirector.SharedDirector.WinSize;

            var move = new CCMoveBy (3, new CCPoint(size.Width - 130, 0));
            var move_back = (CCActionInterval) move.Reverse();

            var move_ease_in = new CCEaseIn((CCActionInterval) move.Copy(), 2.5f);
            var move_ease_in_back = move_ease_in.Reverse();

            var move_ease_out = new CCEaseOut((CCActionInterval) move.Copy(), 2.5f);
            var move_ease_out_back = move_ease_out.Reverse();

            var delay = new CCDelayTime (0.25f);

            var seq1 = new CCSequence(move, delay, move_back, (CCFiniteTimeAction) delay.Copy());
            var seq2 = new CCSequence(move_ease_in, (CCFiniteTimeAction) delay.Copy(), move_ease_in_back, (CCFiniteTimeAction) delay.Copy());
            var seq3 = new CCSequence(move_ease_out, (CCFiniteTimeAction) delay.Copy(), move_ease_out_back,
                                                (CCFiniteTimeAction) delay.Copy());

            var a2 = m_grossini.RunAction(new CCRepeatForever ((CCActionInterval)seq1));
            a2.Tag = 1;

            var a1 = m_tamara.RunAction(new CCRepeatForever ((CCActionInterval)seq2));
            a1.Tag = 1;

            var a = m_kathia.RunAction(new CCRepeatForever ((CCActionInterval)seq3));
            a.Tag = 1;

            Schedule(testStopAction, 6.25f);
        }
예제 #10
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s = CCDirector.SharedDirector.WinSize;

            var move = new CCMoveBy (3, new CCPoint(s.Width - 130, 0));
            var move_back = move.Reverse();

            var move_ease = new CCEaseBackInOut((CCActionInterval) (move.Copy()));
            var move_ease_back = move_ease.Reverse() as CCActionInterval;

            var delay = new CCDelayTime (0.25f);

            var seq1 = new CCSequence(move, delay, move_back, (CCFiniteTimeAction) delay.Copy());
            var seq2 = new CCSequence(move_ease, (CCFiniteTimeAction) delay.Copy(), move_ease_back, (CCFiniteTimeAction) delay.Copy());

            positionForTwo();

            m_grossini.RunAction(new CCRepeatForever (seq1));
            m_tamara.RunAction(new CCRepeatForever (seq2));
        }
예제 #11
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s = CCDirector.SharedDirector.WinSize;

            var move = new CCMoveBy (3, new CCPoint(s.Width - 130, 0));
            var move_back = move.Reverse();

            var move_ease_in = new CCEaseBounceIn((CCActionInterval) (move.Copy()));
            var move_ease_in_back = move_ease_in.Reverse();

            var move_ease_out = new CCEaseBounceOut((CCActionInterval) (move.Copy()));
            var move_ease_out_back = move_ease_out.Reverse();

            var delay = new CCDelayTime (0.25f);

            var seq1 = new CCSequence(move, delay, move_back, (CCFiniteTimeAction) delay.Copy());
            var seq2 = new CCSequence(move_ease_in, (CCFiniteTimeAction) delay.Copy(), move_ease_in_back, (CCFiniteTimeAction) delay.Copy());
            var seq3 = new CCSequence(move_ease_out, (CCFiniteTimeAction) delay.Copy(), move_ease_out_back,
                                                (CCFiniteTimeAction) delay.Copy());

            m_grossini.RunAction(new CCRepeatForever (seq1));
            m_tamara.RunAction(new CCRepeatForever (seq2));
            m_kathia.RunAction(new CCRepeatForever (seq3));
        }
예제 #12
0
        public override void OnEnter()
        {
            base.OnEnter();

            var s = CCDirector.SharedDirector.WinSize;

            var move = new CCMoveBy (3, new CCPoint(s.Width - 130, 0));

            var move_ease_inout1 = new CCEaseElasticInOut((CCActionInterval) (move.Copy()), 0.3f);
            var move_ease_inout_back1 = move_ease_inout1.Reverse();

            var move_ease_inout2 = new CCEaseElasticInOut((CCActionInterval) (move.Copy()), 0.45f);
            var move_ease_inout_back2 = move_ease_inout2.Reverse();

            var move_ease_inout3 = new CCEaseElasticInOut((CCActionInterval) (move.Copy()), 0.6f);
            var move_ease_inout_back3 = move_ease_inout3.Reverse();

            var delay = new CCDelayTime (0.25f);

            var seq1 = new CCSequence(move_ease_inout1, delay, move_ease_inout_back1, (CCFiniteTimeAction) delay.Copy());
            var seq2 = new CCSequence(move_ease_inout2, (CCFiniteTimeAction) delay.Copy(), move_ease_inout_back2,
                                                (CCFiniteTimeAction) delay.Copy());
            var seq3 = new CCSequence(move_ease_inout3, (CCFiniteTimeAction) delay.Copy(), move_ease_inout_back3,
                                                (CCFiniteTimeAction) delay.Copy());

            m_tamara.RunAction(new CCRepeatForever (seq1));
            m_kathia.RunAction(new CCRepeatForever (seq2));
            m_grossini.RunAction(new CCRepeatForever (seq3));
        }
예제 #13
0
 public override void Update(float dt)
 {
     elapsed += dt;
     if (elapsed > 1f)
     {
         elapsed = 0f;
         // CCLabelBMFont
         if (label1 != null)
         {
             RemoveChild(label1);
         }
         CCNode node = new CCNode();
         CCSize s = CCDirector.SharedDirector.WinSize;
         float x = s.Width * CCMacros.CCRandomBetween0And1();
         float y = s.Height * CCMacros.CCRandomBetween0And1();
         label1 = new CCLabelBMFont(string.Format("{0:N2},{1:N2} @ Mem Leak Ctor", x, y), "fonts/konqa32.fnt", 255f, CCTextAlignment.Right, CCPoint.Zero);
         node.AddChild(label1);
         label1.Position = new CCPoint(x, y);
         AddChild(node);
         label1 = node;
         // Start - test case for memory leak mentioned at https://cocos2dxna.codeplex.com/discussions/544032
         node.Scale = 2f;
         //--> This action causes the leak
         CCScaleTo acScale = new CCScaleTo(0.1f, 1);
         CCDelayTime acShow = new CCDelayTime(0.1f);
         CCSplitRows acFadeOut = new CCSplitRows(0.1f, 20);
         CCRemoveSelf acRemove = new CCRemoveSelf(true);
         CCSequence seq = new CCSequence(acScale, acShow, acFadeOut, acRemove);
         node.RunAction(seq);
     }
 }
예제 #14
0
        public SpriteOffsetAnchorFlip()
        {
            CCSize s = CCDirector.SharedDirector.WinSize;

            for (int i = 0; i < 3; i++)
            {
                CCSpriteFrameCache cache = CCSpriteFrameCache.SharedSpriteFrameCache;
                cache.AddSpriteFramesWithFile("animations/grossini.plist");
                cache.AddSpriteFramesWithFile("animations/grossini_gray.plist", "animations/grossini_gray");

                //
                // Animation using Sprite batch
                //
                CCSprite sprite = new CCSprite("grossini_dance_01.png");
                sprite.Position = (new CCPoint(s.Width / 4 * (i + 1), s.Height / 2));

                CCSprite point = new CCSprite("Images/r1");
                point.Scale = 0.25f;
                point.Position = sprite.Position;
                AddChild(point, 1);

                switch (i)
                {
                    case 0:
                        sprite.AnchorPoint = new CCPoint(0, 0);
                        break;
                    case 1:
                        sprite.AnchorPoint = (new CCPoint(0.5f, 0.5f));
                        break;
                    case 2:
                        sprite.AnchorPoint = new CCPoint(1, 1);
                        break;
                }

                point.Position = sprite.Position;

                var animFrames = new List<CCSpriteFrame>();
                string tmp = "";
                for (int j = 0; j < 14; j++)
                {
                    string temp = "";
                    if (j +1< 10)
                    {
                        temp = "0" + (j + 1);
                    }
                    else
                    {
                        temp = (j + 1).ToString();
                    }
                    tmp = string.Format("grossini_dance_{0}.png", temp);
                    CCSpriteFrame frame = cache.SpriteFrameByName(tmp);
                    animFrames.Add(frame);
                }

                CCAnimation animation = new CCAnimation(animFrames, 0.3f);
                sprite.RunAction(new CCRepeatForever (new CCAnimate (animation)));

                animFrames = null;

                CCFlipY flip = new CCFlipY(true);
                CCFlipY flip_back = new CCFlipY(false);
                CCDelayTime delay = new CCDelayTime (1);
                CCFiniteTimeAction seq = new CCSequence((CCFiniteTimeAction)delay, (CCFiniteTimeAction)flip, (CCFiniteTimeAction)delay.Copy(null), flip_back);
                sprite.RunAction(new CCRepeatForever ((CCActionInterval)seq));

                AddChild(sprite, 0);
            }
        }