当前位置: 首页>>代码示例>>C#>>正文


C# CocosSharp.CCEventListenerTouchAllAtOnce类代码示例

本文整理汇总了C#中CocosSharp.CCEventListenerTouchAllAtOnce的典型用法代码示例。如果您正苦于以下问题:C# CCEventListenerTouchAllAtOnce类的具体用法?C# CCEventListenerTouchAllAtOnce怎么用?C# CCEventListenerTouchAllAtOnce使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CCEventListenerTouchAllAtOnce类属于CocosSharp命名空间,在下文中一共展示了CCEventListenerTouchAllAtOnce类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LabelFNTOldNew

        public LabelFNTOldNew()
        {
            // CCLabel Bitmap Font
            label1 = new CCLabel("Bitmap Font Label Test", "fonts/arial-unicode-26.fnt");
            label1.Scale = 2;
            label1.Color = CCColor3B.White;

            AddChild(label1);

            label2 = new CCLabelBMFont("Bitmap Font Label Test", "fonts/arial-unicode-26.fnt");
            label2.Scale = 2;
            label2.Color = CCColor3B.Red;

            AddChild(label2);

            drawNode = new CCDrawNode();
            AddChild(drawNode);

            var touchListener = new CCEventListenerTouchAllAtOnce();
            touchListener.OnTouchesEnded = (touches, touchEvent) =>
            {
                var location = touches[0].Location;

                if (label1.BoundingBoxTransformedToWorld.ContainsPoint(location))
                    CCLog.Log("Hit");
            };
            AddEventListener(touchListener);

        }
开发者ID:KevinHeyer,项目名称:CocosSharp,代码行数:29,代码来源:LabelFNTOldNew.cs

示例2: GameLayer

        //^Each character needed it's own CCSprite to go with a weapon, only one instance of a CCSprite shows in game


        public GameLayer() : base("level_" + CCRandom.GetRandomInt(3, numLevels) + ".tmx"/*"level_5.tmx"*/) // get a random level and load it on initialization
        {
            character.map = this;
            //touch listener - calles tileHandler to handle tile touches
            touchListener = new CCEventListenerTouchAllAtOnce();
            touchListener.OnTouchesEnded = handleEndTouches;
            AddEventListener(touchListener);

            loopTiles(null);
            //Schedule the main game loop
            enemiesList = placeEnemiesRandomly();
            foreach (character enemy in enemiesList)
                this.AddChild(enemy);

            //Add labels to the upper left hand corner
            //Might be better to have a bar with width based on a percentage of health/maxhealth
            userInfo = new CCLabel
                ("Health: " + user.health + "/" + user.maxHealth + "    Attack : " + user.weapon.attack,"arial",12);
            userInfo.Position = new CCPoint(70, VisibleBoundsWorldspace.UpperRight.Y + 5);
            userInfo.IsAntialiased = true;
            this.AddChild(userInfo);

            //run main game loop - frames happen every 1 second
            Schedule(RunGameLogic,(float)0.5);
        }
开发者ID:jacobmcrandall,项目名称:POOPCrawler,代码行数:28,代码来源:GameLayer.cs

示例3: GameScene

		public GameScene(CCWindow mainWindow) : base(mainWindow)
		{
			mainLayer = new CCLayer ();
			AddChild (mainLayer);

			paddleSprite = new CCSprite ("paddle");
			paddleSprite.PositionX = 100;
			paddleSprite.PositionY = 100;
			mainLayer.AddChild (paddleSprite);

			ballSprite = new CCSprite ("ball");
			ballSprite.PositionX = 320;
			ballSprite.PositionY = 600;
			mainLayer.AddChild (ballSprite);

			scoreLabel = new CCLabel ("Score: 0", "arial", 22);
			scoreLabel.PositionX = mainLayer.VisibleBoundsWorldspace.MinX + 20;
			scoreLabel.PositionY = mainLayer.VisibleBoundsWorldspace.MaxY - 20;
			scoreLabel.AnchorPoint = CCPoint.AnchorUpperLeft;

			mainLayer.AddChild (scoreLabel);

			Schedule (RunGameLogic);

			touchListener = new CCEventListenerTouchAllAtOnce ();
			touchListener.OnTouchesMoved = HandleTouchesMoved;
			AddEventListener (touchListener, this);
		}
开发者ID:Rajneesh360Logica,项目名称:monotouch-samples,代码行数:28,代码来源:GameScene.cs

示例4: GameOverLayer

		public GameOverLayer (int score)
		{

			var touchListener = new CCEventListenerTouchAllAtOnce();
			touchListener.OnTouchesEnded = (touches, ccevent) => CCDirector.SharedDirector.ReplaceScene (GameLayer.Scene);

			EventDispatcher.AddEventListener(touchListener, this);

			string scoreMessage = String.Format ("Game Over. You collected {0} bananas!", score);
       
            var scoreLabel = new CCLabelTtf (scoreMessage, "MarkerFelt", 22) {
				Position = new CCPoint( CCDirector.SharedDirector.WinSize.Center.X,  CCDirector.SharedDirector.WinSize.Center.Y + 50),
                Color = new CCColor3B (CCColor4B.Yellow),
				HorizontalAlignment = CCTextAlignment.Center,
				VerticalAlignment = CCVerticalTextAlignment.Center,
				Dimensions = ContentSize
			};

			AddChild (scoreLabel);

            var playAgainLabel = new CCLabelTtf ("Tap to Play Again", "MarkerFelt", 22) {
				Position = CCDirector.SharedDirector.WinSize.Center,
                Color = new CCColor3B (CCColor4B.Green),
				HorizontalAlignment = CCTextAlignment.Center,
				VerticalAlignment = CCVerticalTextAlignment.Center,
				Dimensions = ContentSize
			};

			AddChild (playAgainLabel);

            Color = new CCColor3B (CCColor4B.Black);
			Opacity = 255;

		}
开发者ID:h7ing,项目名称:CocosSharp,代码行数:34,代码来源:GameOverLayer.cs

示例5: LabelSFOldNew

        public LabelSFOldNew()
        {
            // CCLabel SpriteFont
            label1 = new CCLabel("SpriteFont Label Test", "arial", 48, CCLabelFormat.SpriteFont);

            AddChild(label1);

            label2 = new CCLabelTtf("SpriteFont Label Test", "arial", 48);
            label2.Color = CCColor3B.Red;
            label2.AnchorPoint = CCPoint.AnchorMiddle;

            AddChild(label2);

            drawNode = new CCDrawNode();
            AddChild(drawNode);

            var touchListener = new CCEventListenerTouchAllAtOnce();
            touchListener.OnTouchesEnded = (touches, touchEvent) =>
            {
                var location = touches[0].Location;

                if (label1.BoundingBoxTransformedToWorld.ContainsPoint(location))
                    CCLog.Log("Hit");
            };
            AddEventListener(touchListener);

        }
开发者ID:KevinHeyer,项目名称:CocosSharp,代码行数:27,代码来源:LabelSFOldNew.cs

示例6: AddedToScene

        protected override void AddedToScene()
        {
            base.AddedToScene();

            // Use the bounds to layout the positioning of our drawable assets
            var bounds = VisibleBoundsWorldspace;

            ContentManager content = Application.Game.Content;
            content.RootDirectory = Application.ContentRootDirectory;

            SpriteFont font = content.Load<SpriteFont>("fonts/Segoe_UI_10_Regular");
            FontManager.DefaultFont = Engine.Instance.Renderer.CreateFont(font);

            root = new BasicUI((int)bounds.Size.Width, (int)bounds.Size.Height);
            debug = new DebugViewModel(root);
            root.DataContext = new BasicUIViewModel();

            SoundManager.Instance.LoadSounds(content, "sounds");
            ImageManager.Instance.LoadImages(content);
            FontManager.Instance.LoadFonts(content, "fonts");

            Schedule(UpdateUI);

            // Register for touch events
            var touchListener = new CCEventListenerTouchAllAtOnce();
            touchListener.OnTouchesEnded = OnTouchesEnded;
            AddEventListener(touchListener, this);
        }
开发者ID:Mike-EEE,项目名称:UI_Examples,代码行数:28,代码来源:IntroLayer.cs

示例7: GameLayer

        public GameLayer()
        {
            var touchListener = new CCEventListenerTouchAllAtOnce ();
            touchListener.OnTouchesEnded = OnTouchesEnded;

            AddEventListener (touchListener, this);
            Color = new CCColor3B (CCColor4B.White);
            Opacity = 255;

            visibleBananas = new List<CCSprite> ();
            hitBananas = new List<CCSprite> ();

            // batch node for physics balls
            ballsBatch = new CCSpriteBatchNode ("balls", 100);
            ballTexture = ballsBatch.Texture;
            AddChild (ballsBatch, 1, 1);

            AddGrass ();
            AddSun ();
            AddMonkey ();

            StartScheduling();

            CCSimpleAudioEngine.SharedEngine.PlayBackgroundMusic ("Sounds/backgroundMusic", true);
        }
开发者ID:jonathanzuniga,项目名称:GoneBananas,代码行数:25,代码来源:GameLayer.cs

示例8: AddedToScene

        protected override void AddedToScene()
        {
            base.AddedToScene();

            var tilemap = new CCTileMap("tilemaps/iso-test-zorder.tmx");
            AddChild(tilemap);

            // Uncomment this to test loading from a stream reader with Release > 1.3.1.0
            //
            // Note: the application.ContentSearchPaths.Add("tilemaps"); in AppDelegate.cs module
            //
            // Without a TileMapFileName there is no way to determine the relative offset of the backing 
            // graphic asset so this will have to set in the tile map definition or use a search path added 
            // to the application ContentSearchPaths ex.. application.ContentSearchPaths.Add("images");

//            using (var streamReader = new StreamReader(CCFileUtils.GetFileStream("tilemaps/iso-test-zorder.tmx")))
//            {
//                var tileMap = new CCTileMap(streamReader);
//                AddChild(tileMap);
//            }

            // Use the bounds to layout the positioning of our drawable assets
            var bounds = VisibleBoundsWorldspace;

            // position the label on the center of the screen
            label.Position = bounds.Center;

            // Register for touch events
            var touchListener = new CCEventListenerTouchAllAtOnce();
            touchListener.OnTouchesEnded = OnTouchesEnded;
            AddEventListener(touchListener, this);
        }
开发者ID:460189852,项目名称:cocos-sharp-samples,代码行数:32,代码来源:IntroLayer.cs

示例9: StartScene

        public StartScene(CCWindow mainWindow)
            : base(mainWindow)
        {
            mainLayer = new CCLayer ();
            AddChild (mainLayer);

            PlayButton = new CCSprite ("logo");

            NameLabel = new CCLabel ("Map Knight - Alpha", "arial", 22);
            CreatorLabel = new CCLabel ("Created by tipfom and Exo", "arial", 22);
            VersionLabel = new CCLabel ("Version unspecified", "arial", 22);
            InfoLabel = new CCLabel ("Click to play", "arial", 22);

            PlayButton.ScaleX = mainWindow.WindowSizeInPixels.Width / PlayButton.ContentSize.Width;
            PlayButton.ScaleY = mainWindow.WindowSizeInPixels.Height / PlayButton.ContentSize.Height;
            PlayButton.Position = new CCPoint (PlayButton.ScaledContentSize.Width / 2, PlayButton.ScaledContentSize.Height / 2);

            NameLabel.Position = new CCPoint (mainWindow.WindowSizeInPixels.Width / 4 * 3, mainWindow.WindowSizeInPixels.Height / 2 - NameLabel.ContentSize.Height);
            CreatorLabel.Position = new CCPoint (mainWindow.WindowSizeInPixels.Width / 4 * 3, NameLabel.PositionY - CreatorLabel.ContentSize.Height - 30);
            VersionLabel.Position = new CCPoint (mainWindow.WindowSizeInPixels.Width / 4 * 3, CreatorLabel.PositionY - VersionLabel.ContentSize.Height - 30);
            InfoLabel.Position = new CCPoint (mainWindow.WindowSizeInPixels.Width / 4 * 3, VersionLabel.PositionY - InfoLabel.ContentSize.Height - 30);

            mainLayer.AddChild (PlayButton);
            mainLayer.AddChild (NameLabel);
            mainLayer.AddChild (CreatorLabel);
            mainLayer.AddChild (VersionLabel);
            mainLayer.AddChild (InfoLabel);

            touchListener = new CCEventListenerTouchAllAtOnce ();
            touchListener.OnTouchesEnded = HandleTouchesEnded;
            AddEventListener (touchListener, this);
        }
开发者ID:Nuckal777,项目名称:mapKnight,代码行数:32,代码来源:StartScene.cs

示例10: RubeBasicLayer

        public RubeBasicLayer(string jsonfile)
        {
            AnchorPoint = new CCPoint(0, 0);

            HasWheel = true;

            JSON_FILE = jsonfile;

            TouchPanel.EnabledGestures = GestureType.Pinch | GestureType.PinchComplete;

            var touchListener = new CCEventListenerTouchAllAtOnce();
            touchListener.OnTouchesBegan = OnTouchesBegan;
            touchListener.OnTouchesMoved = OnTouchesMoved;
            touchListener.OnTouchesEnded = OnTouchesEnded;
            touchListener.OnTouchesCancelled = OnTouchesCancelled;
            AddEventListener(touchListener, this);

            var mouseListener = new CCEventListenerMouse();
            mouseListener.OnMouseScroll = OnMouseScroll;
            AddEventListener(mouseListener, this);

            // set the starting scale and offset values from the subclass
            Position = InitialWorldOffset();
            Scale = InitialWorldScale();

            // load the world from RUBE .json file (this will also call afterLoadProcessing)
            LoadWorld();
        }
开发者ID:netonjm,项目名称:RubeLoader,代码行数:28,代码来源:RubeBasicLayer.cs

示例11: GameLayer

		public GameLayer ()
        {
            var touchListener = new CCEventListenerTouchAllAtOnce();
            touchListener.OnTouchesEnded = OnTouchesEnded;

            EventDispatcher.AddEventListener(touchListener, this);
            Color = new CCColor3B (CCColor4B.White);
			Opacity = 255;

			visibleBananas = new List<CCSprite> ();
			hitBananas = new List<CCSprite> ();
	
			monkey = new CCSprite ("Monkey");
			monkey.Position = CCDirector.SharedDirector.WinSize.Center;
			AddChild (monkey);

			Schedule ((t) => {
				visibleBananas.Add (AddBanana ());
				dt += t;
				if(ShouldEndGame ()){
					var gameOverScene = GameOverLayer.SceneWithScore(hitBananas.Count);
					CCTransitionFadeDown transitionToGameOver = new CCTransitionFadeDown(1.0f, gameOverScene);
					CCDirector.SharedDirector.ReplaceScene (transitionToGameOver);
				}
			}, 1.0f);

			Schedule ((t) => {
				CheckCollision ();
			});
		}
开发者ID:KerwinMa,项目名称:CocosSharp,代码行数:30,代码来源:GameLayer.cs

示例12: AddedToScene

        protected override void AddedToScene()
        {
            base.AddedToScene();

            // Use the bounds to layout the positioning of our drawable assets
            var bounds = VisibleBoundsWorldspace;

            // position the label on the center of the screen
            label.Position = bounds.LowerLeft;

            //Ubicar las 6 sillas al inicio
            //TODO hallar el centro de la pantalla
            CCSize tamaño = Scene.Window.WindowSizeInPixels;
            CCPoint centro = tamaño.Center;
            double cx = centro.X;
            double cy = centro.Y;
            double radio = 200;

            for (int i = 0; i < sillas.Count; i++)
            {
                double xpos = cx + radio * Math.Sin(2 * Math.PI / 6 * i);
                double ypos = cy + radio * Math.Cos(2 * Math.PI / 6 * i);
                CCPoint position = new CCPoint((float)xpos, (float)ypos);
                sillas[i].Position = position;
                sillas[i].Rotation = (float)(180 + 360 / 6 * i);
            }

            // Register for touch events
            var touchListener = new CCEventListenerTouchAllAtOnce();
            touchListener.OnTouchesEnded = OnTouchesEnded;
            AddEventListener(touchListener, this);
        }
开发者ID:sanslash332,项目名称:codename-the-great-and-powerful-phone-party,代码行数:32,代码来源:IntroLayer.cs

示例13: CCEventListenerTouchAllAtOnce

		internal CCEventListenerTouchAllAtOnce (CCEventListenerTouchAllAtOnce eventListener) 
			: this()
		{
			OnTouchesBegan = eventListener.OnTouchesBegan;
			OnTouchesMoved = eventListener.OnTouchesMoved;
			OnTouchesEnded = eventListener.OnTouchesEnded;
			OnTouchesCancelled = eventListener.OnTouchesCancelled;
		}
开发者ID:KerwinMa,项目名称:CocosSharp,代码行数:8,代码来源:CCEventListenerTouchAllAtOnce.cs

示例14: TouchScreenInput

        public TouchScreenInput(CCLayer owner)
        {
            this.owner = owner;

            touchListener = new CCEventListenerTouchAllAtOnce ();
            touchListener.OnTouchesMoved = HandleTouchesMoved;
            touchListener.OnTouchesBegan = HandleTouchesBegan;
            owner.AddEventListener (touchListener);
        }
开发者ID:coroner4817,项目名称:CoinTime,代码行数:9,代码来源:TouchScreenInput.cs

示例15: TouchScreenInput

        public TouchScreenInput(CCLayer Owner,PhysicsEntity controledEntity)
        {
            this.owner = Owner;
            mControledEntity = controledEntity;

            touchListener = new CCEventListenerTouchAllAtOnce ();
            touchListener.OnTouchesMoved = HandleTouchesMoved;
            touchListener.OnTouchesEnded = OnTouchesEnded;
            owner.AddEventListener (touchListener);
        }
开发者ID:coroner4817,项目名称:MyBouncingGame,代码行数:10,代码来源:TouchScreenInput.cs


注:本文中的CocosSharp.CCEventListenerTouchAllAtOnce类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。