• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# CocosSharp.CCEventListenerTouchAllAtOnce类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Init

        /// <summary>
        /// Init the specified sceneLayer.
        /// </summary>
        /// <param name="sceneLayer">The scene layer.</param>
        public void Init(CCLayer sceneLayer)
        {
            m_touchListener = new CCEventListenerTouchAllAtOnce();
            m_touchListener.OnTouchesBegan = OnTouchesBegan;
            m_touchListener.OnTouchesCancelled = OnTouchesCancelled;
            m_touchListener.OnTouchesEnded = OnTouchesEnded;
            m_touchListener.OnTouchesMoved = OnTouchesMoved;

            sceneLayer.AddEventListener(m_touchListener);
        }
开发者ID:Lopt,项目名称:ascendancy,代码行数:14,代码来源:TouchHandler.cs


示例17: AddedToScene

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


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


示例18: GameStartLayer

        public GameStartLayer () : base ()
        {
            var touchListener = new CCEventListenerTouchAllAtOnce ();
            touchListener.OnTouchesEnded = (touches, ccevent) => Window.DefaultDirector.ReplaceScene (GameLayer.GameScene (Window));

            AddEventListener (touchListener, this);

            Color = CCColor3B.Black;
            Opacity = 255;
        }
开发者ID:460189852,项目名称:cocos-sharp-samples,代码行数:10,代码来源:GameStartLayer.cs


示例19: AddedToScene

 protected override void AddedToScene()
 {
     base.AddedToScene();
     // Use the bounds to layout the positioning of our drawable assets
     CCRect bounds = VisibleBoundsWorldspace;
     // Register for touch events
     var touchListener = new CCEventListenerTouchAllAtOnce();
     touchListener.OnTouchesEnded = OnTouchesEnded;
     AddEventListener(touchListener, this);
 }
开发者ID:MTVaught,项目名称:VS-Xamarin-Examples,代码行数:10,代码来源:GameLayer.cs


示例20: AddedToScene

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

			//Init Game Elements
			_player1Score = 0;
			_player2Score = 0;


			//get screen size
			_screenSize = Window.WindowSizeInPixels; //CCDirector::sharedDirector()->getWinSize();

			//1. add court image
			GameSprite court = new GameSprite("court"); // CCSprite::create("court.png");
			court.SetPosition(new CCPoint(_screenSize.Width * 0.5f, _screenSize.Height * 0.5f)); //->setPosition(ccp());

			AddChild(court);

			//2. add players
			_player1 = new GameSprite("mallet"); //GameSprite::gameSpriteWithFile("mallet.png");
			_player1.SetPosition(new CCPoint(_screenSize.Width * 0.5f, _player1.RotationX * 2f));

			AddChild(_player1, 0, kPlayer1Tag);

			_player2 = new GameSprite("mallet");
			_player2.SetPosition(new CCPoint(_screenSize.Width * 0.5f, _screenSize.Height - _player1.RotationX * 2));
			AddChild(_player2, 0, kPlayer2Tag);

			_players = new GameSprite[] { _player1, _player2 };// CCArray::create(_player1, _player2, NULL);

			//3. add puck
			_ball = new GameSprite("puck");
			_ball.SetPosition(new CCPoint(_screenSize.Width * 0.5f, _screenSize.Height * 0.5f - 2f * _ball.RotationX));
			AddChild(_ball);

			//4. add score display
			_player1ScoreLabel = new CCLabelTtf("0", "MarkerFelt", 22);
			_player1ScoreLabel.Position = new CCPoint(_screenSize.Width - 60f, _screenSize.Height * 0.5f - 80f);
			_player1ScoreLabel.Rotation = 90;
			AddChild(_player1ScoreLabel);

			_player2ScoreLabel = new CCLabelTtf("0", "MarkerFelt", 22);
			_player2ScoreLabel.Position = new CCPoint(_screenSize.Width - 60f, _screenSize.Height * 0.5f + 80f);
			_player2ScoreLabel.Rotation = 90;
			AddChild(_player2ScoreLabel);

			//listen for touches
			CCEventListenerTouchAllAtOnce tListener = new CCEventListenerTouchAllAtOnce();
			tListener.OnTouchesBegan = TouchesBegan;
			tListener.OnTouchesEnded = TouchesEnded;
			tListener.OnTouchesMoved = TouchesMoved;
			AddEventListener(tListener, this);

			Schedule(Update);
		}
开发者ID:460189852,项目名称:cocos-sharp-samples,代码行数:55,代码来源:IntroLayer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CocosSharp.CCLabel类代码示例发布时间:2022-05-24
下一篇:
C# CocosSharp.CCEvent类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap