public static void RouteTouchUp(CCNode root, Touch touch) { CCPoint touchLocation = touch.CCTouch.Location; if (root.ChildrenCount > 0) { for (int i = root.ChildrenCount - 1; i >= 0; i--) { RouteTouchUp(root.Children[i], touch); //递归 if (touch.Handled == true) return; ITouch itouch = root.Children[i] as ITouch; if (itouch != null) { CCNode node = root.Children[i] as CCNode; if (node.Parent.Visible == true && node.Visible == true) { CCPoint local = node.ConvertToNodeSpace(touchLocation); CCRect r = new CCRect( node.PositionX - node.ContentSize.Width * node.AnchorPoint.X, node.PositionY - node.ContentSize.Height * node.AnchorPoint.Y, node.ContentSize.Width, node.ContentSize.Height ); r.Origin = CCPoint.Zero; if (r.ContainsPoint(local)) itouch.OnTouchDown(touch); } } } } }
public void OnTouchMove(Touch e) { if (this.TouchMove != null) this.TouchMove(this, e); }
public void OnTouchUp(Touch e) { if (this.TouchUp != null) this.TouchUp(this, e); }
public void OnTouchDown(Touch e) { if (this.TouchDown != null) this.TouchDown(this, e); }