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

C# Cocos2D.CCTouch类代码示例

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

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



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

示例1: TouchMoved

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

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


示例2: TouchEnded

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

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


示例3: TouchBegan

        public override bool TouchBegan(CCTouch t)
        {
            this.RemoveAllChildrenWithCleanup(true);
            var watch = System.Diagnostics.Stopwatch.StartNew();

            this.Schedule(dt =>
            {
                //string svg = "M32,7.174C18.311,7.174,7.174,18.311,7.174,32c0,13.689,11.137,24.826,24.826,24.826c13.689,0,24.826-11.137,24.826-24.826C56.826,18.311,45.689,7.174,32,7.174z M43.075,26.318c0.011,0.246,0.017,0.494,0.017,0.742c0,7.551-5.747,16.257-16.259,16.257c-3.227,0-6.231-0.945-8.759-2.567c0.447,0.053,0.902,0.08,1.363,0.08c2.678,0,5.141-0.914,7.097-2.446c-2.5-0.046-4.611-1.698-5.338-3.969c0.348,0.068,0.707,0.103,1.074,0.103c0.521,0,1.027-0.07,1.506-0.2c-2.614-0.525-4.583-2.834-4.583-5.602c0-0.024,0-0.049,0.001-0.072c0.77,0.427,1.651,0.685,2.587,0.714c-1.532-1.023-2.541-2.773-2.541-4.755c0-1.048,0.281-2.03,0.773-2.874c2.817,3.458,7.029,5.732,11.777,5.972c-0.098-0.419-0.147-0.854-0.147-1.303c0-3.155,2.558-5.714,5.714-5.714c1.643,0,3.128,0.694,4.17,1.804c1.303-0.256,2.525-0.73,3.63-1.387c-0.428,1.335-1.333,2.454-2.514,3.162c1.157-0.138,2.259-0.444,3.282-0.899C45.161,24.508,44.191,25.515,43.075,26.318z";
                var sprite = liwq.UIGraphic.Begin(300, 300).
                    AddRectangle(0, 0, 300, 300, liwq.Colors.SkyBlue, liwq.Colors.SkyBlue).
                    //AddEllipse(10, 10, 50, 50, liwq.Colors.Turquoise, liwq.Colors.Turquoise, 4).
                    //AddLine(10, 10, 60, 60, liwq.Colors.Lime, 4).
                    //AddPaths(200, 200, 200, 200, new string[1] { svg }, 0, 0, 64, 64, liwq.Colors.DarkOrange, liwq.Colors.White, 2).
                    //AddSvg(200, 200, 200, 200, liwq.Factory.ReadString("Content/svg/dribbble.svg")).
                    AddSvg(50, 50, 200, 200, liwq.Factory.ReadString(this.svgs[svgIndex++])).
                    AddText(60, 30, System.IO.Path.GetFileNameWithoutExtension(this.svgs[svgIndex]), liwq.Colors.DarkRed, liwq.Colors.DarkRed, MatterHackers.Agg.Font.LiberationSansFont.Instance, 16).
                    EndSprite();
                sprite.Position = CCDirector.SharedDirector.WinSize.Center;
                this.AddChild(sprite);
            }, 0.2f);

            watch.Stop();
            System.Console.WriteLine(watch.Elapsed);
            return true;
        }
开发者ID:liwq-net,项目名称:UIFactory,代码行数:25,代码来源:GameScene.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],
                                                                                          pTouch);
     }
 }
开发者ID:Zambiorix,项目名称:cocos2d-xna,代码行数:8,代码来源:CCTouchDelegate.cs


示例5: TouchBegan

        public virtual bool TouchBegan(CCTouch touch)
        {
            if (m_state != PaddleState.kPaddleStateUngrabbed) return false;
            if (!containsTouchLocation(touch)) return false;

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


示例6: TouchBegan

        public override bool TouchBegan(CCTouch touch)
        {
            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:Karunp,项目名称:cocos2d-xna,代码行数:11,代码来源:Box2DView.cs


示例7: TouchMoved

        public override void TouchMoved(CCTouch touch)
        {
            var touchLocation = touch.Location;
            var prevLocation = touch.PreviousLocation;

            CCPoint diff = touchLocation - prevLocation;

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


示例8: 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:CartBlanche,项目名称:cocos2d-xna,代码行数:14,代码来源:Parallax2.cs


示例9: TouchMoved

        public override void TouchMoved(CCTouch touch)
        {
            // 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!");

            var touchPoint = touch.Location;

            base.Position = new CCPoint(touchPoint.X, base.Position.Y);
        }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:15,代码来源:Paddle.cs


示例10: TouchMoved

        public override void TouchMoved(CCTouch touch)
        {
            Debug.Assert(m_eState == CCMenuState.TrackingTouch, "[Menu TouchMoved] -- invalid state");
            CCMenuItem currentItem = ItemForTouch(touch);
            if (currentItem != m_pSelectedItem)
            {
                if (m_pSelectedItem != null)
                {
                    m_pSelectedItem.Unselected();
                }

                m_pSelectedItem = currentItem;

                if (m_pSelectedItem != null)
                {
                    m_pSelectedItem.Selected();
                }
            }
        }
开发者ID:netonjm,项目名称:cocos2d-xna,代码行数:19,代码来源:CCMenu.cs


示例11: ItemForTouch

        protected virtual CCMenuItem ItemForTouch(CCTouch touch)
        {
            CCPoint touchLocation = touch.Location;

            if (m_pChildren != null && m_pChildren.count > 0)
            {
                for (int i = m_pChildren.count-1; i >= 0; i--)
                {
                    var pChild = m_pChildren.Elements[i] as CCMenuItem;
                    if (pChild != null && pChild.Visible && pChild.Enabled)
                    {
                        CCPoint local = pChild.ConvertToNodeSpace(touchLocation);
                        CCRect r = pChild.Rectangle;
                        r.Origin = CCPoint.Zero;

                        if (r.ContainsPoint(local))
                        {
                            return pChild;
                        }
                    }
                }
            }

            return null;
        }
开发者ID:netonjm,项目名称:cocos2d-xna,代码行数:25,代码来源:CCMenu.cs


示例12: TouchBegan

        public override bool TouchBegan(CCTouch touch)
        {
            if (m_eState != CCMenuState.Waiting || !m_bVisible || !m_bEnabled)
            {
                return false;
            }

            for (CCNode c = m_pParent; c != null; c = c.Parent)
            {
                if (c.Visible == false)
                {
                    return false;
                }
            }

            m_pSelectedItem = ItemForTouch(touch);
            if (m_pSelectedItem != null)
            {
                m_eState = CCMenuState.TrackingTouch;
                m_pSelectedItem.Selected();
                return true;
            }
            return false;
        }
开发者ID:netonjm,项目名称:cocos2d-xna,代码行数:24,代码来源:CCMenu.cs


示例13: TouchCancelled

 public override void TouchCancelled(CCTouch touch)
 {
     Debug.Assert(m_eState == CCMenuState.TrackingTouch, "[Menu ccTouchCancelled] -- invalid state");
     if (m_pSelectedItem != null)
     {
         m_pSelectedItem.Unselected();
     }
     m_eState = CCMenuState.Waiting;
 }
开发者ID:netonjm,项目名称:cocos2d-xna,代码行数:9,代码来源:CCMenu.cs


示例14: TouchEnded

 public override void TouchEnded(CCTouch touch)
 {
     numberOfTouchesE++;
 }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:4,代码来源:TouchesPerformTest1.cs


示例15: TouchCancelled

 public override void TouchCancelled(CCTouch touch)
 {
     numberOfTouchesC++;
 }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:4,代码来源:TouchesPerformTest1.cs


示例16: TouchBegan

 public override bool TouchBegan(CCTouch touch)
 {
     numberOfTouchesB++;
     return true;
 }
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:5,代码来源:TouchesPerformTest1.cs


示例17: TouchMoved

 public override void TouchMoved(CCTouch pTouch)
 {
     //nothing
 }
开发者ID:liwq-net,项目名称:UIFactory,代码行数:4,代码来源:CCTextFieldTTF.cs


示例18: TouchCancelled

 public override void TouchCancelled(CCTouch touch)
 {
 }
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:3,代码来源:TileMapTest.cs


示例19: TouchCancelled

 public override void TouchCancelled(CCTouch pTouch)
 {
     //nothing
 }
开发者ID:liwq-net,项目名称:UIFactory,代码行数:4,代码来源:CCTextFieldTTF.cs


示例20: TouchBegan

 public override bool TouchBegan(CCTouch touch)
 {
     return true;
 }
开发者ID:rtabbara,项目名称:cocos2d-xna,代码行数:4,代码来源:TileMapTest.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# CocosSharp.CCApplication类代码示例发布时间:2022-05-24
下一篇:
C# Cocos2D.CCTexture2D类代码示例发布时间: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