Exemplo n.º 1
0
        async void StressIt(float dt)
        {
            if (this.NumberOfRunningActions > 0)
            {
                return;
            }

            var targetNode = new CCNodeGrid();

            AddChild(targetNode);

            //lbl = new CCSprite("images/bat2.png");
            label1          = CreateLabel(string.Format("Score: {0:n0} - Level: {1}", 123456, count), 30, CCColor3B.Yellow, CCColor3B.Blue);
            label1.Position = this.ContentSize.Center;
            targetNode.AddChild(label1);
            count++;

            await targetNode.RunActionAsync(fadeOut);

            // Make sure we unset our grid that was attached.
            targetNode.Grid = null;

            label1.RemoveFromParent();
            label1 = null;

            targetNode.RemoveFromParent();

//            GC.Collect ();
//            GC.WaitForPendingFinalizers ();
//            GC.Collect ();
        }
Exemplo n.º 2
0
        public TextLayer() : base()
        {
            Color   = new CCColor3B(32, 128, 32);
            Opacity = 255;

            BaseNode = new CCNodeGrid();
            var effect = CurrentAction;

            BaseNode.RunAction(effect);
            AddChild(BaseNode, 0, EffectTestScene.kTagBackground);

            var bg = new CCSprite(TestResource.s_back3);

            BaseNode.AddChild(bg, 0);

            var Kathia = new CCSprite(TestResource.s_pPathSister2);

            BaseNode.AddChild(Kathia, 1, EffectTestScene.kTagKathia);

            var sc      = new CCScaleBy(2, 5);
            var sc_back = sc.Reverse();

            Kathia.RunAction(new CCRepeatForever(sc, sc_back));


            var Tamara = new CCSprite(TestResource.s_pPathSister1);

            BaseNode.AddChild(Tamara, 1, EffectTestScene.kTagTamara);

            var sc2      = new CCScaleBy(2, 5);
            var sc2_back = sc2.Reverse();

            Tamara.RunAction(new CCRepeatForever(sc2, sc2_back));
        }
Exemplo n.º 3
0
        public GameLayer()
            : base(CCColor4B.Blue, CCColor4B.AliceBlue)
        {
            // Set the layer gradient direction
            this.Vector = new CCPoint(0.5f, 0.5f);

            // Create and add sprites
            // We will later be applying a wave action to these sprites
            // These type of actions can only be applied to CCNodeGrid instances
            // Therefore, wrap our sprites in a CCNodeGrid parent
            monkeySprite1 = new CCNodeGrid();
            monkeySprite1.AddChild(new CCSprite("monkey"));
            AddChild(monkeySprite1);

            monkeySprite2 = new CCNodeGrid();
            monkeySprite2.AddChild(new CCSprite("monkey"));
            AddChild(monkeySprite2);

            // Define actions
            var moveUp   = new CCMoveBy(1.0f, new CCPoint(0.0f, 50.0f));
            var moveDown = moveUp.Reverse();

            // A CCSequence action runs the list of actions in ... sequence!
            CCSequence moveSeq = new CCSequence(new CCEaseBackInOut(moveUp), new CCEaseBackInOut(moveDown));

            repeatedAction = new CCRepeatForever(moveSeq);

            // A CCSpawn action runs the list of actions concurrently
            dreamAction = new CCSpawn(new CCFadeIn(5.0f), new CCWaves(5.0f, new CCGridSize(10, 20), 4, 4));

            // Schedule for method to be called every 0.1s
            Schedule(UpdateLayerGradient, 0.1f);
        }
Exemplo n.º 4
0
 public CCReuseGridState (CCReuseGrid action, CCNodeGrid target)
     : base (action, target)
 {   
     CCGridBase grid = target.Grid;
     if (grid != null && grid.Active)
     {
         grid.ReuseGrid += action.Times;
     }
 }
Exemplo n.º 5
0
 public CCStopGridState (CCStopGrid action, CCNodeGrid target)
     : base (action, target)
 {   
     CCGridBase pGrid = target.Grid;
     if (pGrid != null && pGrid.Active)
     {
         pGrid.Active = false;
     }
 }
Exemplo n.º 6
0
        public CCStopGridState(CCStopGrid action, CCNodeGrid target)
            : base(action, target)
        {
            CCGridBase pGrid = target.Grid;

            if (pGrid != null && pGrid.Active)
            {
                pGrid.Active = false;
            }
        }
Exemplo n.º 7
0
        public CCReuseGridState(CCReuseGrid action, CCNodeGrid target)
            : base(action, target)
        {
            CCGridBase grid = target.Grid;

            if (grid != null && grid.Active)
            {
                grid.ReuseGrid += action.Times;
            }
        }
Exemplo n.º 8
0
        public override void OnEnter()
        {
            CCRect visibleBounds = Layer.VisibleBoundsWorldspace;

            base.OnEnter();

            bgNode             = new CCNodeGrid();
            bgNode.AnchorPoint = CCPoint.AnchorMiddle;
            contentLayer.AddChild(bgNode);
            //bgNode.Position = visibleBounds.Center;

            var bg = new CCSprite("Images/background3");

            //bg.AnchorPoint = CCPoint.AnchorMiddle;
            bg.Position = visibleBounds.Center;

            //bgNode.ContentSize = bg.ContentSize;

            bgNode.AddChild(bg);


            Target1             = new CCNodeGrid();
            Target1.AnchorPoint = CCPoint.AnchorMiddle;

            grossini = new CCSprite("Images/grossinis_sister2");
            Target1.AddChild(grossini);
            bgNode.AddChild(Target1);

            Target1.Position = bg.BoundingBox.Center + new CCPoint(-100.0f, 0.0f);
            //grossini.Position =

            var sc      = new CCScaleBy(2, 5);
            var sc_back = sc.Reverse();

            Target1.RepeatForever(sc, sc_back);

            Target2             = new CCNodeGrid();
            Target2.AnchorPoint = CCPoint.AnchorMiddle;

            tamara = new CCSprite("Images/grossinis_sister1");

            Target2.AddChild(tamara);
            bgNode.AddChild(Target2);

            Target2.Position = bg.BoundingBox.Center + new CCPoint(100.0f, 0.0f);

            var sc2      = new CCScaleBy(2, 5);
            var sc2_back = sc2.Reverse();

            tamara.RepeatForever(sc2, sc2_back);
        }
Exemplo n.º 9
0
        public override void OnEnter()
        {
            base.OnEnter();

            var effect = new CCSequence(new CCDelayTime(2.0f), new CCShaky3D(5.0f, new CCGridSize(5, 5), 16, false));

            // cleanup
            contentLayer.RemoveChild(bgNode, true);

            // background
            var layer = new CCDrawNode();

            layer.Color   = CCColor3B.Red;
            layer.Opacity = 255;

            layer.DrawRect(VisibleBoundsWorldspace);

            AddChild(layer, -10);

            var sprite = new CCSprite("Images/grossini");

            sprite.Position = new CCPoint(50, 80);
            layer.AddChild(sprite, 10);

            // foreground
            var layer2BaseGrid = new CCNodeGrid();
            var layer2         = new CCDrawNode();

            layer2.Color   = CCColor3B.Green;
            layer2.Opacity = 255;

            layer2.DrawRect(VisibleBoundsWorldspace);

            var fog = new CCSprite("Images/Fog");

            var bf = new CCBlendFunc {
                Source = CCOGLES.GL_SRC_ALPHA, Destination = CCOGLES.GL_ONE_MINUS_SRC_ALPHA
            };

            fog.BlendFunc = bf;
            layer2.AddChild(fog, 1);
            AddChild(layer2BaseGrid, 1);
            layer2BaseGrid.AddChild(layer2);

            layer2BaseGrid.RepeatForever(effect);
        }
Exemplo n.º 10
0
        public CCTurnOffTilesState (CCTurnOffTiles action, CCNodeGrid target) : base (action, target)
        {
            int i;

            if (action.Seed != CCShuffleTiles.NoSeedSpecified)
            {
                CCRandom.Next (action.Seed);
            }

            CCGridSize gridSize = action.GridSize;
            TilesCount = gridSize.X * gridSize.Y;
            TilesOrder = new int[TilesCount];

            for (i = 0; i < TilesCount; ++i)
            {
                TilesOrder [i] = i;
            }

            Shuffle (TilesOrder, TilesCount);
        }
Exemplo n.º 11
0
        public CCTurnOffTilesState(CCTurnOffTiles action, CCNodeGrid target) : base(action, target)
        {
            int i;

            if (action.Seed != CCShuffleTiles.NoSeedSpecified)
            {
                CCRandom.Next(action.Seed);
            }

            CCGridSize gridSize = action.GridSize;

            TilesCount = gridSize.X * gridSize.Y;
            TilesOrder = new int[TilesCount];

            for (i = 0; i < TilesCount; ++i)
            {
                TilesOrder [i] = i;
            }

            Shuffle(TilesOrder, TilesCount);
        }
Exemplo n.º 12
0
        public CCShuffleTilesState(CCShuffleTiles action, CCNodeGrid target) : base(action, target)
        {
            CCGridSize gridSize = action.GridSize;

            TilesCount = gridSize.X * gridSize.Y;
            int[] shuffledTilesOrder = new int[TilesCount];
            int   i, j, f = 0;

            for (i = 0; i < TilesCount; i++)
            {
                shuffledTilesOrder [i] = i;
            }

            if (action.Seed != CCShuffleTiles.NoSeedSpecified)
            {
                CCRandom.Next(action.Seed);
            }


            Shuffle(ref shuffledTilesOrder, TilesCount);
            TilesOrder = shuffledTilesOrder;

            Tiles = new CCTile[TilesCount];

            for (i = 0; i < gridSize.X; ++i)
            {
                for (j = 0; j < gridSize.Y; ++j)
                {
                    Tiles [f] = new CCTile {
                        Position      = new CCPoint(i, j),
                        StartPosition = new CCPoint(i, j),
                        Delta         = GetDelta(i, j)
                    };

                    f++;
                }
            }
        }
Exemplo n.º 13
0
 public CCSplitRowsState(CCSplitRows action, CCNodeGrid target) : base(action, target)
 {
     VisibleSize = Target.VisibleBoundsWorldspace.Size;
     width       = VisibleSize.Width;
 }
Exemplo n.º 14
0
 public CCShaky3DState (CCShaky3D action, CCNodeGrid target) : base (action, target)
 {
     Shake = action.Shake;
     Range = action.Range;
 }
Exemplo n.º 15
0
 public CCSplitColsState (CCSplitCols action, CCNodeGrid target) : base (action, target)
 {
     VisibleSize = Target.VisibleBoundsWorldspace.Size;
     height = VisibleSize.Height;
 }
Exemplo n.º 16
0
 public CCShatteredTiles3DState(CCShatteredTiles3D action, CCNodeGrid target) : base(action, target)
 {
     Range    = action.Range;
     ShatterZ = action.ShatterZ;
 }
Exemplo n.º 17
0
 public CCSplitColsState(CCSplitCols action, CCNodeGrid target) : base(action, target)
 {
     VisibleSize = Target.VisibleBoundsWorldspace.Size;
     height      = VisibleSize.Height;
 }
Exemplo n.º 18
0
 public CCSplitRowsState (CCSplitRows action, CCNodeGrid target) : base (action, target)
 {
     VisibleSize = Target.VisibleBoundsWorldspace.Size;
     width = VisibleSize.Width;
 }
Exemplo n.º 19
0
 public CCShatteredTiles3DState (CCShatteredTiles3D action, CCNodeGrid target) : base (action, target)
 {
     Range = action.Range;
     ShatterZ = action.ShatterZ;
 }
Exemplo n.º 20
0
 public CCShaky3DState(CCShaky3D action, CCNodeGrid target) : base(action, target)
 {
     Shake = action.Shake;
     Range = action.Range;
 }