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


C# cocos2d.CCTouch类代码示例

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


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

示例1: ccTouchBegan

 // CCLayer
 public override bool ccTouchBegan(CCTouch pTouch, CCEvent pEvent)
 {
     Debug.WriteLine("++++++++++++++++++++++++++++++++++++++++++++");
     m_beginPos = pTouch.locationInView(pTouch.view());
     m_beginPos = CCDirector.sharedDirector().convertToGL(m_beginPos);
     return true;
 }
开发者ID:ChowZenki,项目名称:cocos2d-x-for-xna,代码行数:8,代码来源:TextInputTest.cs

示例2: ccTouchEnded

        public override void ccTouchEnded(CCTouch pTouch, CCEvent pEvent)
        {
            if (m_pTrackNode != null)
            {
                return;
            }

            CCPoint endPos = pTouch.locationInView(pTouch.view());
            endPos = CCDirector.sharedDirector().convertToGL(endPos);

            float delta = 5.0f;
            if (Math.Abs(endPos.x - m_beginPos.x) > delta
                || Math.Abs(endPos.y - m_beginPos.y) > delta)
            {
                // not click
                m_beginPos.x = m_beginPos.y = -1;
                return;
            }

            // decide the trackNode is clicked.
            CCRect rect;
            CCPoint point = convertTouchToNodeSpaceAR(pTouch);
            Debug.WriteLine("KeyboardNotificationLayer:clickedAt(%f,%f)", point.x, point.y);

            rect = TextInputTestScene.getRect(m_pTrackNode);
            Debug.WriteLine("KeyboardNotificationLayer:TrackNode at(origin:%f,%f, size:%f,%f)",
                rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);

            this.onClickTrackNode(CCRect.CCRectContainsPoint(rect, point));
            Debug.WriteLine("----------------------------------");
        }
开发者ID:ChowZenki,项目名称:cocos2d-x-for-xna,代码行数:31,代码来源:TextInputTest.cs

示例3: ExcuteScriptTouchHandler

 public void ExcuteScriptTouchHandler(int eventType, CCTouch pTouch)
 {
     if (m_pEventTypeFuncMap != null && CCScriptEngineManager.SharedScriptEngineManager.ScriptEngine != null)
     {
         CCScriptEngineManager.SharedScriptEngineManager.ScriptEngine.ExecuteTouchEvent((m_pEventTypeFuncMap)[eventType],
                                                                                          pTouch);
     }
 }
开发者ID:homocury,项目名称:cocos2d-xna,代码行数:8,代码来源:CCTouchDelegate.cs

示例4: excuteScriptTouchHandler

 public void excuteScriptTouchHandler(int eventType, CCTouch pTouch)
 {
     if (m_pEventTypeFuncMap != null && CCScriptEngineManager.sharedScriptEngineManager().ScriptEngine != null)
     {
         CCScriptEngineManager.sharedScriptEngineManager().ScriptEngine.executeTouchEvent((m_pEventTypeFuncMap)[eventType].ToString(),
                                                                                                  pTouch);
     }
 }
开发者ID:liwq-net,项目名称:cocos2d-for-xna-windows,代码行数:8,代码来源:CCTouchDelegate.cs

示例5: ccTouchBegan

        public virtual bool ccTouchBegan(CCTouch touch, CCEvent eventer)
        {
            if (m_state != PaddleState.kPaddleStateUngrabbed) return false;
            if (!containsTouchLocation(touch)) return false;

            m_state = PaddleState.kPaddleStateGrabbed;
            return true;
        }
开发者ID:Openxlive,项目名称:cocos2d-x-for-xna,代码行数:8,代码来源:Paddle.cs

示例6: updateSize

 public void updateSize(CCTouch touch)
 {
     CCPoint touchLocation = touch.locationInView(touch.view());
     touchLocation = CCDirector.sharedDirector().convertToGL(touchLocation);
     CCSize s = CCDirector.sharedDirector().getWinSize();
     CCSize newSize = new CCSize(Math.Abs(touchLocation.x - s.width / 2) * 2, Math.Abs(touchLocation.y - s.height / 2) * 2);
     CCLayerColor l = (CCLayerColor)getChildByTag(kTagLayer);
     l.contentSize = newSize;
 }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:9,代码来源:LayerTest1.cs

示例7: ccTouchEnded

        public virtual void ccTouchEnded(CCTouch touch, CCEvent eventer)
        {
            CCPoint touchPoint = touch.locationInView(touch.view());
            CCPoint convertedLocation = CCDirector.sharedDirector().convertToGL(touchPoint);

            //执行运动
            CCActionInterval move = CCMoveTo.actionWithDuration(3, convertedLocation);
            CCActionInterval move_ease_inout = CCEaseInOut.actionWithAction(move);//ease缓冲
            base.runAction(move_ease_inout);
        }
开发者ID:GhostSoar,项目名称:LearningCocos2d_xForXNA,代码行数:10,代码来源:TouchableSprite.cs

示例8: TouchBegan

        public override bool TouchBegan(CCTouch touch, CCEvent e)
        {
            CCPoint touchLocation = touch.Location;

            CCPoint nodePosition = ConvertToNodeSpace(touchLocation);
            //    NSLog(@"pos: %f,%f -> %f,%f", touchLocation.x, touchLocation.y, nodePosition.x, nodePosition.y);

            m_test.MouseDown(new Vector2(nodePosition.X, nodePosition.Y));

            return true;
        }
开发者ID:homocury,项目名称:cocos2d-xna,代码行数:11,代码来源:Box2DView.cs

示例9: ccTouchEnded

 public void ccTouchEnded(CCTouch pTouch, CCEvent pEvent)
 {
     CCPoint point = pTouch.locationInView(0);
     CCPoint newPoint = CCDirector.sharedDirector().convertToGL(point);
     CCPoint rePoint = GetGroundPosition(newPoint);
     if ((int)rePoint.x < Map.Height &&
         (int)rePoint.y < Map.Width &&
         (role.Col != (int)rePoint.y || role.Row != (int)rePoint.x))
     {
         map.ChangeToWall((int)rePoint.x, (int)rePoint.y);
     }
     role.GetPathNodeList();
 }
开发者ID:hj458377603,项目名称:TowerDefence,代码行数:13,代码来源:GameScene.cs

示例10: ccTouchMoved

        public override void ccTouchMoved(CCTouch touch, CCEvent parmevent)
        {
            CCPoint touchLocation = touch.locationInView(touch.view());
            CCPoint prevLocation = touch.previousLocationInView(touch.view());

            touchLocation = CCDirector.sharedDirector().convertToGL(touchLocation);
            prevLocation = CCDirector.sharedDirector().convertToGL(prevLocation);

            CCPoint diff = new CCPoint(touchLocation.x - prevLocation.x, touchLocation.y - prevLocation.y);

            CCNode node = getChildByTag(1);
            CCPoint currentPos = node.position;
            node.position = new CCPoint(currentPos.x + diff.x, currentPos.y + diff.y);
        }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:14,代码来源:TileDemo.cs

示例11: TouchMoved

        public override void TouchMoved(CCTouch touch, CCEvent event_)
        {
            CCPoint touchLocation = touch.LocationInView;
            CCPoint prevLocation = touch.PreviousLocationInView;

            touchLocation = CCDirector.SharedDirector.ConvertToGl(touchLocation);
            prevLocation = CCDirector.SharedDirector.ConvertToGl(prevLocation);

            CCPoint diff = touchLocation - prevLocation;

            CCNode node = GetChildByTag(kTagTileMap); // (int) KTag.kTagNode);
            CCPoint currentPos = node.Position;
            node.Position = currentPos + diff;
        }
开发者ID:HarkDev,项目名称:cocos2d-xna,代码行数:14,代码来源:Parallax2.cs

示例12: ccTouchMoved

        public virtual void ccTouchMoved(CCTouch touch, CCEvent eventer)
        {
            // If it weren't for the TouchDispatcher, you would need to keep a reference
            // to the touch from touchBegan and check that the current touch is the same
            // as that one.
            // Actually, it would be even more complicated since in the Cocos dispatcher
            // you get CCSets instead of 1 UITouch, so you'd need to loop through the set
            // in each touchXXX method.

            Debug.Assert(m_state == PaddleState.kPaddleStateGrabbed, "Paddle - Unexpected state!");

            CCPoint touchPoint = touch.locationInView(touch.view());
            touchPoint = CCDirector.sharedDirector().convertToGL(touchPoint);

            base.position = new CCPoint(touchPoint.x, base.position.y);
        }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:16,代码来源:Paddle.cs

示例13: ccTouchMoved

 public virtual void ccTouchMoved(CCTouch touch, CCEvent event_)
 {
 }
开发者ID:liwq-net,项目名称:liwq718,代码行数:3,代码来源:CCLayer.cs

示例14: ccTouchCancelled

 public virtual void ccTouchCancelled(CCTouch touch, CCEvent event_)
 {
 }
开发者ID:liwq-net,项目名称:liwq718,代码行数:3,代码来源:CCLayer.cs

示例15: ccTouchBegan

 public virtual bool ccTouchBegan(CCTouch touch, CCEvent event_)
 {
     // Debug.Assert(false, "Layer#ccTouchBegan override me");
     return true;
 }
开发者ID:liwq-net,项目名称:liwq718,代码行数:5,代码来源:CCLayer.cs


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