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

            var origin = VisibleBoundsWorldspace.Origin;
            var size   = VisibleBoundsWorldspace.Size;

            var sprite1 = new TouchableSprite(30);
            var texture = CCTextureCache.SharedTextureCache.AddImage("Images/CyanSquare.png");

            sprite1.Texture  = texture;
            sprite1.Position = origin + size.Center + new CCPoint(-80, 80);
            AddChild(sprite1, 10);

            var sprite2 = new TouchableSprite(20);

            texture          = CCTextureCache.SharedTextureCache.AddImage("Images/MagentaSquare.png");
            sprite2.Texture  = texture;
            sprite2.Position = origin + size.Center;
            AddChild(sprite2, 20);

            var sprite3 = new TouchableSprite(10);

            texture             = CCTextureCache.SharedTextureCache.AddImage("Images/YellowSquare.png");
            sprite3.Texture     = texture;
            sprite3.Position    = CCPoint.Zero; //new CCPoint (-120, 120) ;
            sprite3.AnchorPoint = CCPoint.AnchorMiddle;
            sprite2.AddChild(sprite3, 1);
        }
		public override void OnEnter()
		{
			base.OnEnter ();

			var origin = Layer.VisibleBoundsWorldspace.Origin;
			var size = Layer.VisibleBoundsWorldspace.Size;

			var sprite1 = new TouchableSprite (30);
			var texture = CCTextureCache.SharedTextureCache.AddImage("Images/CyanSquare.png");
			sprite1.Texture = texture;
			sprite1.Position = origin + new CCPoint (size.Width / 2, size.Height / 2) + new CCPoint (-80, 80);
			AddChild(sprite1, 10);

			var sprite2 = new TouchableSprite (20);
			texture = CCTextureCache.SharedTextureCache.AddImage("Images/MagentaSquare.png");
			sprite2.Texture = texture;
			sprite2.Position = origin + new CCPoint (size.Width / 2, size.Height / 2);
			AddChild(sprite2, 20);

			var sprite3 = new TouchableSprite (10);
			texture = CCTextureCache.SharedTextureCache.AddImage("Images/YellowSquare.png");
			sprite3.Texture = texture;
            sprite3.Position = origin + new CCPoint (size.Width / 2, size.Height / 2) + new CCPoint (-120, 120) ;
			sprite2.AddChild(sprite3, 1);

		}
		public override void OnEnter ()
		{
			base.OnEnter ();

            CCRect visibleBounds = VisibleBoundsWorldspace;
			var origin = Layer.VisibleBoundsWorldspace.Origin;
			var size = Layer.VisibleBoundsWorldspace.Size;

			var sprite1 = new TouchableSprite ();
			var texture = CCTextureCache.SharedTextureCache.AddImage("Images/CyanSquare.png");
			sprite1.Texture = texture;
			sprite1.Position = origin + new CCPoint (size.Width / 2, size.Height / 2) + new CCPoint (-80, 80);
			AddChild(sprite1, -10);

			var sprite2 = new TouchableSprite ();
			texture = CCTextureCache.SharedTextureCache.AddImage("Images/MagentaSquare.png");
			sprite2.Texture = texture;
			sprite2.Position = origin + new CCPoint (size.Width / 2, size.Height / 2);
			AddChild(sprite2, -20);

			var sprite3 = new TouchableSprite ();
			texture = CCTextureCache.SharedTextureCache.AddImage("Images/YellowSquare.png");
			sprite3.Texture = texture;
			sprite3.Position = CCPoint.Zero;
			sprite2.AddChild(sprite3, -1);

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

			var popup = new CCMenuItemFont("Popup", (sender) =>
				{

                    this.PauseListeners(true);

					var colorLayer = new CCLayerColor(new CCColor4B(0, 0, 255, 100));
					AddChild(colorLayer, 99999);

					var closeItem = new CCMenuItemFont("close", (closeSender) =>
						{
							colorLayer.RemoveFromParent();
                            this.ResumeListeners(true);
				});

                    closeItem.Position = visibleBounds.Center;

					var closeMenu = new CCMenu(closeItem);
					closeMenu.AnchorPoint = CCPoint.AnchorLowerLeft;
					closeMenu.Position = CCPoint.Zero;

					colorLayer.AddChild(closeMenu);
			});

			popup.AnchorPoint = CCPoint.AnchorMiddleRight;
            popup.Position = new CCPoint(visibleBounds.Origin.X + visibleBounds.Size.Width,
                visibleBounds.Origin.Y + visibleBounds.Size.Height / 2);

			var menu = new CCMenu(popup);
			menu.AnchorPoint = CCPoint.AnchorLowerLeft;
			menu.Position = CCPoint.Zero;

			AddChild(menu);

		}
		public override void OnEnter()
		{
			base.OnEnter ();

			var origin = VisibleBoundsWorldspace.Origin;
			var size = VisibleBoundsWorldspace.Size;

			var sprite1 = new TouchableSprite (30);
			var texture = CCTextureCache.SharedTextureCache.AddImage("Images/CyanSquare.png");
			sprite1.Texture = texture;
            sprite1.Position = origin + size.Center + new CCPoint (-80, 80);
			AddChild(sprite1, 10);

			var sprite2 = new TouchableSprite (20);
			texture = CCTextureCache.SharedTextureCache.AddImage("Images/MagentaSquare.png");
			sprite2.Texture = texture;
            sprite2.Position = origin + size.Center;
			AddChild(sprite2, 20);

			var sprite3 = new TouchableSprite (10);
			texture = CCTextureCache.SharedTextureCache.AddImage("Images/YellowSquare.png");
			sprite3.Texture = texture;
            sprite3.Position = CCPoint.Zero; //new CCPoint (-120, 120) ;
            sprite3.AnchorPoint = CCPoint.AnchorMiddle;
			sprite2.AddChild(sprite3, 1);

		}
Exemple #5
0
        public override void OnEnter()
        {
            base.OnEnter();

            CCRect visibleBounds = VisibleBoundsWorldspace;
            var    origin        = Layer.VisibleBoundsWorldspace.Origin;
            var    size          = Layer.VisibleBoundsWorldspace.Size;

            var sprite1 = new TouchableSprite();
            var texture = CCTextureCache.SharedTextureCache.AddImage("Images/CyanSquare.png");

            sprite1.Texture  = texture;
            sprite1.Position = origin + new CCPoint(size.Width / 2, size.Height / 2) + new CCPoint(-80, 80);
            AddChild(sprite1, -10);

            var sprite2 = new TouchableSprite();

            texture          = CCTextureCache.SharedTextureCache.AddImage("Images/MagentaSquare.png");
            sprite2.Texture  = texture;
            sprite2.Position = origin + new CCPoint(size.Width / 2, size.Height / 2);
            AddChild(sprite2, -20);

            var sprite3 = new TouchableSprite();

            texture          = CCTextureCache.SharedTextureCache.AddImage("Images/YellowSquare.png");
            sprite3.Texture  = texture;
            sprite3.Position = CCPoint.Zero;
            sprite2.AddChild(sprite3, -1);

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

            var popup = new CCMenuItemFont("Popup", (sender) =>
            {
                this.PauseListeners(true);

                var colorLayer = new CCLayerColor(new CCColor4B(0, 0, 255, 100));
                AddChild(colorLayer, 99999);

                var closeItem = new CCMenuItemFont("close", (closeSender) =>
                {
                    colorLayer.RemoveFromParent();
                    this.ResumeListeners(true);
                });

                closeItem.Position = visibleBounds.Center;

                var closeMenu         = new CCMenu(closeItem);
                closeMenu.AnchorPoint = CCPoint.AnchorLowerLeft;
                closeMenu.Position    = CCPoint.Zero;

                colorLayer.AddChild(closeMenu);
            });

            popup.AnchorPoint = CCPoint.AnchorMiddleRight;
            popup.Position    = new CCPoint(visibleBounds.Origin.X + visibleBounds.Size.Width,
                                            visibleBounds.Origin.Y + visibleBounds.Size.Height / 2);

            var menu = new CCMenu(popup);

            menu.AnchorPoint = CCPoint.AnchorLowerLeft;
            menu.Position    = CCPoint.Zero;

            AddChild(menu);
        }