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);
        }
Example #2
0
 public CCLens3DState (CCLens3D action, CCNodeGrid target) : base (action, target)
 {
     Position = action.Position;
     Radius = action.Radius;
     LensScale = action.LensScale;
     Concave = action.Concave;
 }
        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 ();
        }
Example #4
0
 public CCLens3DState(CCLens3D action, CCNodeGrid target) : base(action, target)
 {
     Position  = action.Position;
     Radius    = action.Radius;
     LensScale = action.LensScale;
     Concave   = action.Concave;
 }
Example #5
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));

        }
		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);

		}
        public CCGridActionState(CCGridAction action, CCNodeGrid target) : base(action, target)
        {
            GridSize = action.GridSize;

            // If target is not a CCNodeGrid we will want to emmit a message and
            // return or there can be possible NRE's later on.
            var gridNodeTarget = Target as CCNodeGrid;

            if (gridNodeTarget == null)
            {
                Debug.Assert(false, "Grid Actions only target CCNodeGrids.");
                CCLog.Log("Grid Actions only target CCNodeGrids.");
                return;
            }

            CCGridBase targetGrid = target.Grid;

            if (targetGrid != null && targetGrid.ReuseGrid > 0)
            {
                Grid = targetGrid;

                if (targetGrid.Active && targetGrid.GridSize.X == GridSize.X && targetGrid.GridSize.Y == GridSize.Y)
                {
                    targetGrid.Reuse();
                }
                else
                {
                    Debug.Assert(false);
                }
            }
            else
            {
                if (targetGrid != null && targetGrid.Active)
                {
                    targetGrid.Active = false;
                }

                CCGridBase newgrid = Grid;
                if (target != null)
                {
                    target.Grid        = newgrid;
                    target.Grid.Active = true;
                }
            }
        }
Example #8
0
        public CCGridActionState (CCGridAction action, CCNodeGrid target) : base (action, target)
		{
			GridSize = action.GridSize;

            // If target is not a CCNodeGrid we will want to emmit a message and 
            // return or there can be possible NRE's later on.
            var gridNodeTarget = Target as CCNodeGrid;
            if (gridNodeTarget == null)
            {
                Debug.Assert(false, "Grid Actions only target CCNodeGrids.");
                CCLog.Log("Grid Actions only target CCNodeGrids.");
                return;
            }

            CCGridBase targetGrid = target.Grid;

			if (targetGrid != null && targetGrid.ReuseGrid > 0)
			{
				Grid = targetGrid;

				if (targetGrid.Active && targetGrid.GridSize.X == GridSize.X && targetGrid.GridSize.Y == GridSize.Y)
				{
					targetGrid.Reuse ();
				}
				else
				{
					Debug.Assert (false);
				}
			}
			else
			{
				if (targetGrid != null && targetGrid.Active)
				{
					targetGrid.Active = false;
				}

				CCGridBase newgrid = Grid;
                if (target != null)
                {
                    target.Grid = newgrid;
                    target.Grid.Active = true;
                }
			}
		}
Example #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);
        }
Example #10
0
 public CCFadeOutUpTilesState (CCFadeOutUpTiles action, CCNodeGrid target) : base (action, target)
 {
 }
Example #11
0
 public CCJumpTiles3DState (CCJumpTiles3D action, CCNodeGrid target) : base (action, target)
 {
     NumberOfJumps = action.NumberOfJumps;
 }
 public CCTiledGrid3DActionState (CCTiledGrid3DAction action, CCNodeGrid target) : base (action, target)
 {
 }
Example #13
0
 public CCWavesState(CCWaves action, CCNodeGrid target) : base(action, target)
 {
     Vertical   = action.Vertical;
     Horizontal = action.Horizontal;
 }
Example #14
0
 public CCGridActionState (CCGridAction action, CCNodeGrid target) : this (action, (CCNode)target)
 {
 }
Example #15
0
 public CCWavesTiles3DState(CCWavesTiles3D action, CCNodeGrid target) : base(action, target)
 {
     Waves = action.Waves;
 }
Example #16
0
 public CCFlipX3DState(CCFlipX3D action, CCNodeGrid target) : base(action, target)
 {
 }
Example #17
0
 public CCJumpTiles3DState(CCJumpTiles3D action, CCNodeGrid target) : base(action, target)
 {
     NumberOfJumps = action.NumberOfJumps;
 }
Example #18
0
 public CCFlipY3DState (CCFlipY3D action, CCNodeGrid target) 
     : base (action, target)
 {
 }
Example #19
0
 public CCTwirlState (CCTwirl action, CCNodeGrid target) : base (action, target)
 {
     Twirls = action.Twirls;
     PositionInPixels = action.Position;
 }
Example #20
0
 public CCLiquidState(CCLiquid action, CCNodeGrid target) : base(action, target)
 {
     Waves = action.Waves;
 }
Example #21
0
 public CCWaves3DState (CCWaves3D action, CCNodeGrid target) : base (action, target)
 {
 }
Example #22
0
 public CCWavesState (CCWaves action, CCNodeGrid target) : base (action, target)
 {
     Vertical = action.Vertical;
     Horizontal = action.Horizontal;
 }
Example #23
0
 public CCRipple3DState(CCRipple3D action, CCNodeGrid target) : base(action, target)
 {
     Position = action.Position;
     Radius   = action.Radius;
     Waves    = action.Waves;
 }
Example #24
0
 public CCFadeOutBLTilesState(CCFadeOutBLTiles action, CCNodeGrid target) : base(action, target)
 {
 }
Example #25
0
 public CCRipple3DState (CCRipple3D action, CCNodeGrid target) : base (action, target)
 {
     Position = action.Position;
     Radius = action.Radius;
     Waves = action.Waves;
 }
Example #26
0
 public CCWaves3DState(CCWaves3D action, CCNodeGrid target) : base(action, target)
 {
 }
Example #27
0
 public CCTwirlState(CCTwirl action, CCNodeGrid target) : base(action, target)
 {
     Twirls           = action.Twirls;
     PositionInPixels = action.Position;
 }
 public CCTiledGrid3DActionState(CCTiledGrid3DAction action, CCNodeGrid target) : base(action, target)
 {
 }
Example #29
0
 public CCPageTurn3DState(CCPageTurn3D action, CCNodeGrid target) : base(action, target)
 {
 }
Example #30
0
 public CCGridActionState(CCGridAction action, CCNodeGrid target) : this(action, (CCNode)target)
 {
 }
Example #31
0
 public CCWavesTiles3DState (CCWavesTiles3D action, CCNodeGrid target) : base (action, target)
 {
     Waves = action.Waves;
 }