本文整理汇总了C#中Cocos2D.CCTouch类的典型用法代码示例。如果您正苦于以下问题:C# CCTouch类的具体用法?C# CCTouch怎么用?C# CCTouch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CCTouch类属于Cocos2D命名空间,在下文中一共展示了CCTouch类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
示例2: TouchEnded
public override void TouchEnded(CCTouch touch)
{
CCPoint touchLocation = touch.Location;
CCPoint nodePosition = ConvertToNodeSpace(touchLocation);
m_test.MouseUp();
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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();
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例14: TouchEnded
public override void TouchEnded(CCTouch touch)
{
numberOfTouchesE++;
}
示例15: TouchCancelled
public override void TouchCancelled(CCTouch touch)
{
numberOfTouchesC++;
}