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


C# CCEvent类代码示例

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


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

示例1: TouchMoved

        public override void TouchMoved(CCTouch touch, CCEvent e)
        {
            CCPoint touchLocation = touch.Location;
            CCPoint nodePosition = ConvertToNodeSpace(touchLocation);

            m_test.MouseMove(new Vector2(nodePosition.X, nodePosition.Y));
        }
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:7,代码来源:Box2DView.cs

示例2: TouchesEnded

        public override void TouchesEnded(List<CCTouch> touches, CCEvent event_)
        {
            //base.ccTouchesEnded(touches, event_);
            object it = touches.First();
            CCTouch touch = (CCTouch)(it);

            CCPoint location = touch.LocationInView;
            CCPoint convertedLocation = CCDirector.SharedDirector.ConvertToGl(location);

            CCNode s = GetChildByTag(ClickAndMoveTest.kTagSprite);
            s.StopAllActions();
            s.RunAction(new CCMoveTo (1, new CCPoint(convertedLocation.X, convertedLocation.Y)));
            float o = convertedLocation.X - s.Position.X;
            float a = convertedLocation.Y - s.Position.Y;
            float at = (float)(Math.Atan(o / a) * 57.29577951f);

            if (a < 0)
            {
                if (o < 0)
                    at = 180 + Math.Abs(at);
                else
                    at = 180 - Math.Abs(at);
            }

            s.RunAction(new CCRotateTo (1, at));
        }
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:26,代码来源:ClickAndMoveTest.cs

示例3: TouchEnded

        public override void TouchEnded(CCTouch touch, CCEvent e)
        {
            CCPoint touchLocation = touch.Location;
            CCPoint nodePosition = ConvertToNodeSpace(touchLocation);

            m_test.MouseUp();
        }
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:7,代码来源:Box2DView.cs

示例4: 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

示例5: ccTouchesMoved

        public override void ccTouchesMoved(List<CCTouch> pTouches, CCEvent pEvent)
        {
            foreach (var it in pTouches)
            {
                CCTouch touch = it;

                CCPoint touchLocation = touch.locationInView(touch.view());
                touchLocation = CCDirector.sharedDirector().convertToGL(touchLocation);
                float nMoveY = touchLocation.y - m_tBeginPos.y;

                CCPoint curPos = m_pItmeMenu.position;
                CCPoint nextPos = new CCPoint(curPos.x, curPos.y + nMoveY);
                CCSize winSize = CCDirector.sharedDirector().getWinSize();
                if (nextPos.y < 0.0f)
                {
                    m_pItmeMenu.position = new CCPoint(0, 0);
                    return;
                }

                if (nextPos.y > ((BugsTestScene.MAX_COUNT + 1) * BugsTestScene.LINE_SPACE - winSize.height))
                {
                    m_pItmeMenu.position = new CCPoint(0, ((BugsTestScene.MAX_COUNT + 1) * BugsTestScene.LINE_SPACE - winSize.height));
                    return;
                }

                m_pItmeMenu.position = nextPos;
                m_tBeginPos = touchLocation;
                BugsTestScene.s_tCurPos = nextPos;
            }
        }
开发者ID:hiceka,项目名称:cocos2d-x-for-xna,代码行数:30,代码来源:BugsTestMainLayer.cs

示例6: ccTouchesBegan

        public override void ccTouchesBegan(List<CCTouch> pTouches, CCEvent pEvent)
        {
            CCTouch touch = pTouches.FirstOrDefault();

            m_tBeginPos = touch.locationInView(touch.view());
            m_tBeginPos = CCDirector.sharedDirector().convertToGL(m_tBeginPos);
        }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:7,代码来源:controller.cs

示例7: TouchesCancelled

 public virtual void TouchesCancelled(List<CCTouch> touches, CCEvent pEvent)
 {
     if (m_bDispatchEvents)
     {
         Touches(touches, pEvent, (int) CCTouchType.CCTOUCHCANCELLED);
     }
 }
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:7,代码来源:CCTouchDispatcher.cs

示例8: TouchesEnded

        public override void TouchesEnded(List<CCTouch> touches, CCEvent event_)
        {
            base.TouchesEnded(touches, event_);
            CCNode node = GetChildByTag((int)kTags.kTagSpriteBatchNode);

            var children = node.Children;
            CCSprite sprite;
            if (m_usingTexture1)                          //--> win32 : Let's it make just simple sentence
            {
                foreach (var item in children)
                {
                    sprite = (CCSprite)item;
                    if (sprite == null)
                        break;

                    sprite.Texture = m_texture2;
                }

                m_usingTexture1 = false;
            }
            else
            {
                foreach (var item in children)
                {
                    sprite = (CCSprite)item;
                    if (sprite == null)
                        break;

                    sprite.Texture = m_texture1;
                }

                m_usingTexture1 = true;
            }
        }
开发者ID:homocury,项目名称:cocos2d-xna,代码行数:34,代码来源:SpriteNewTexture.cs

示例9: TouchesBegan

 public virtual void TouchesBegan(List<CCTouch> touches, CCEvent pEvent)
 {
     if (m_bDispatchEvents)
     {
         Touches(touches, pEvent, (int) CCTouchType.CCTOUCHBEGAN);
     }
 }
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:7,代码来源:CCTouchDispatcher.cs

示例10: TouchesEnded

 public virtual void TouchesEnded(List<CCTouch> touches, CCEvent pEvent)
 {
     if (m_bDispatchEvents)
     {
         Touches(touches, pEvent, (int) CCTouchType.CCTOUCHENDED);
     }
 }
开发者ID:CartBlanche,项目名称:cocos2d-xna,代码行数:7,代码来源:CCTouchDispatcher.cs

示例11: ccTouchesEnded

        public override void ccTouchesEnded(List<CCTouch> touches, CCEvent events)
        {
#if CC_ENABLE_CACHE_TEXTTURE_DATA

	CCSetIterator it;
	CCTouch* touch;

	for( it = touches->begin(); it != touches->end(); it++) 
	{
		touch = (CCTouch*)(*it);

		if(!touch)
			break;

		CCPoint location = touch->locationInView(touch->view());

		location = CCDirector::sharedDirector()->convertToGL(location);

		m_brush->setPosition(location);
		m_brush->setRotation( rand()%360 );
	}

	m_target->begin();
	m_brush->visit();
	m_target->end(true);
#endif
        }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:27,代码来源:RenderTextureTest.cs

示例12: ccTouchesMoved

        public override void ccTouchesMoved(List<CCTouch> pTouches, CCEvent pEvent)
        {
            CCTouch touch = pTouches.FirstOrDefault();

            CCPoint touchLocation = touch.locationInView(touch.view());
            touchLocation = CCDirector.sharedDirector().convertToGL(touchLocation);
            float nMoveY = touchLocation.y - m_tBeginPos.y;

            CCPoint curPos = m_pItemMenu.position;
            CCPoint nextPos = new CCPoint(curPos.x, curPos.y + nMoveY);
            CCSize winSize = CCDirector.sharedDirector().getWinSize();
            if (nextPos.y < 0.0f)
            {
                m_pItemMenu.position = new CCPoint(0, 0);
                return;
            }

            if (nextPos.y > (((int)TestCases.TESTS_COUNT + 1) * LINE_SPACE - winSize.height))
            {
                m_pItemMenu.position = (new CCPoint(0, (((int)TestCases.TESTS_COUNT + 1) * LINE_SPACE - winSize.height)));
                return;
            }

            m_pItemMenu.position = nextPos;
            m_tBeginPos = touchLocation;
            s_tCurPos = nextPos;
        }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:27,代码来源:controller.cs

示例13: 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

示例14: ccTouchesEnded

        public override void ccTouchesEnded(List<CCTouch> touches, CCEvent event_)
        {
            //base.ccTouchesEnded(touches, event_);
            object it = touches.First();
            CCTouch touch = (CCTouch)(it);

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

            CCNode s = getChildByTag(ClickAndMoveTest.kTagSprite);
            s.stopAllActions();
            s.runAction(CCMoveTo.actionWithDuration(1, new CCPoint(convertedLocation.x, convertedLocation.y)));
            float o = convertedLocation.x - s.position.x;
            float a = convertedLocation.y - s.position.y;
            float at = (float)(Math.Atan(o / a) * 57.29577951f);

            if (a < 0)
            {
                if (o < 0)
                    at = 180 + Math.Abs(at);
                else
                    at = 180 - Math.Abs(at);
            }

            s.runAction(CCRotateTo.actionWithDuration(1, at));
        }
开发者ID:Ratel13,项目名称:cocos2d-x-for-xna,代码行数:26,代码来源:ClickAndMoveTest.cs

示例15: 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


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