Beispiel #1
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 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);
        }
        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 ();
        }
Beispiel #5
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);
        }