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; } }
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)); }
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("----------------------------------"); }
public override void TouchEnded(CCTouch touch, CCEvent e) { CCPoint touchLocation = touch.Location; CCPoint nodePosition = ConvertToNodeSpace(touchLocation); m_test.MouseUp(); }
public virtual void TouchesBegan(List<CCTouch> touches, CCEvent pEvent) { if (m_bDispatchEvents) { Touches(touches, pEvent, (int) CCTouchType.CCTOUCHBEGAN); } }
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)); }
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)); }
// 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; }
public virtual void TouchesCancelled(List<CCTouch> touches, CCEvent pEvent) { if (m_bDispatchEvents) { Touches(touches, pEvent, (int) CCTouchType.CCTOUCHCANCELLED); } }
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; } }
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 }
public virtual void TouchesEnded(List<CCTouch> touches, CCEvent pEvent) { if (m_bDispatchEvents) { Touches(touches, pEvent, (int) CCTouchType.CCTOUCHENDED); } }
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; }
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); }
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; }
private protected override void OnTouchesBeganUI(List <CCTouch> touches, CCEvent touchEvent) { base.OnTouchesBeganUI(touches, touchEvent); if (touches.Count > 0) { // turn darker when pressed Label.Color = CCColor3B.Gray; } }
private protected override void OnTouchesEndedUI(List <CCTouch> touches, CCEvent touchEvent) { base.OnTouchesEndedUI(touches, touchEvent); if (touches.Count > 0) { // turn back to original color when released Label.Color = CCColor3B.White; } }
public override void ccTouchesBegan(List <CCTouch> pTouches, CCEvent pEvent) { foreach (var it in pTouches) { CCTouch touch = it; m_tBeginPos = touch.locationInView(touch.view()); m_tBeginPos = CCDirector.sharedDirector().convertToGL(m_tBeginPos); } }
private protected override void OnTouchesEndedUI(List <CCTouch> touches, CCEvent touchEvent) { // reset the scale AddAction(new CCScaleTo(0.05f, 1f)); if (TouchIsOnIt(touches[0])) { MathChallengeNode.AnswerChosen(MathSprite.MathInfix); } }
public override void OnTouchesBegan(List <CCTouch> touches, CCEvent e) { base.OnTouchesBegan(touches, e); foreach (CCTouch touch in touches) { addGrossiniAtPosition(CCMouse.Instance.Position.ToCCPoint()); } }
public override void TouchesEnded(List<CCTouch> touches, CCEvent eventArgs) { foreach (CCTouch touch in touches) { CCPoint location = touch.LocationInView; location = CCDirector.SharedDirector.ConvertToGl(location); addNewSpriteWithCoords(location); } }
public override void TouchCancelled(CCTouch touch, CCEvent e) { Debug.Assert(m_eState == CCMenuState.TrackingTouch, "[Menu ccTouchCancelled] -- invalid state"); if (m_pSelectedItem != null) { m_pSelectedItem.Unselected(); } m_eState = CCMenuState.Waiting; }
private void OnTouchMoved(CCTouch touch, CCEvent arg2) { if (_selectedParticle != null && WithinGameArea(touch.Location)) { _selectedParticle.Particle.Position = new Vector(touch.Location.X, touch.Location.Y); _selectedParticle.GraphicalPoint = touch.Location; RedrawParticles(); } }
public void OnTouchesEnded(List <CCTouch> touches, CCEvent touchEvent) { JoyControl.OnTouchesEnded(touches, touchEvent); foreach (var button in Buttons) { button.OnTouchesEnded(touches, touchEvent); } }
public override void ccTouchesEnded(List <CCTouch> touches, CCEvent eventArgs) { foreach (CCTouch touch in touches) { CCPoint location = touch.locationInView(touch.view()); location = CCDirector.sharedDirector().convertToGL(location); addNewSpriteWithCoords(location); } }
public override void ccTouchesEnded(List<CCTouch> touches, CCEvent eventArgs) { foreach (CCTouch touch in touches) { CCPoint location = touch.locationInView(touch.view()); location = CCDirector.sharedDirector().convertToGL(location); addNewSpriteWithCoords(location); } }
void OnTouchesMoved(List <CCTouch> touches, CCEvent touchEvent) { if (touches.Count > 0) { paddleSprite.RunAction(new CCMoveTo(.1f, new CCPoint(touches[0].Location.X, paddleSprite.PositionY))); // Perform touch handling here } }
/// <summary> /// Method added to the touch listener. Will be executed every time a touch is detected. /// </summary> /// <param name="touches">Touches.</param> /// <param name="touchEvent">Touch event.</param> private void touchBegan(List <CCTouch> touches, CCEvent touchEvent) { if (_spriteNorm.BoundingBoxTransformedToWorld.ContainsPoint(new CCPoint(touches [0].LocationOnScreen.X, _winSize.Height - touches [0].LocationOnScreen.Y))) { _pressed = true; _spritePressed.Visible = true; _spriteNorm.Visible = false; } }
/// <summary> /// Method added to the touch listener. Will be executed every time a touch is dragged. /// </summary> /// <param name="touches">Touches.</param> /// <param name="touchEvent">Touch event.</param> private void touchMoved(List <CCTouch> touches, CCEvent touchEvent) { if (spriteBar.BoundingBoxTransformedToParent.ContainsPoint(new CCPoint(touches [0].LocationOnScreen.X, winSize.Height - touches [0].LocationOnScreen.Y))) { spritePoint.PositionX = (winSize.Height - touches [0].LocationOnScreen.Y - spriteBar.PositionY) / scale; _currentValue = _min + (int)Math.Round((spritePoint.PositionX / spriteBar.ContentSize.Width) * (_max - _min)); lblValue.Text = _currentValue.ToString(); } }
public override void TouchesBegan(List <CCTouch> pTouches, CCEvent pEvent) { foreach (var it in pTouches) { CCTouch touch = it; m_tBeginPos = touch.LocationInView; m_tBeginPos = CCDirector.SharedDirector.ConvertToGl(m_tBeginPos); } }
public override void ccTouchesBegan(List<CCTouch> pTouches, CCEvent pEvent) { foreach (var it in pTouches) { CCTouch touch = it; m_tBeginPos = touch.locationInView(touch.view()); m_tBeginPos = CCDirector.sharedDirector().convertToGL(m_tBeginPos); } }
private protected override void OnTouchesMovedUI(List <CCTouch> touches, CCEvent touchEvent) { var parent = (FlightPathHead)Parent; if (parent.Head == this) { parent.TouchesMoved(touches, touchEvent); } }
private void OnTouchesEnded(List <CCTouch> touches, CCEvent touchEvent) { if (touches.Count > 0) { var gameLayer = GameLayer.CreateScene(GameView, GameLayer.LevelDefinition.Key); var transitionToMenu = new CCTransitionProgressInOut(0.2f, gameLayer); Director.ReplaceScene(transitionToMenu); } }
void onTouchesMoved(List <CCTouch> touches, CCEvent touchEvent) { var diff = touches[0].Delta; var node = GetChildByTag((int)KTag.kTagNode); var currentPos = node.Position; node.Position = currentPos + diff; }
private protected override void OnTouchesBeganUI(List <CCTouch> touches, CCEvent touchEvent) { touchEvent.StopPropogation(); if (touches.Count > 0) { // turn darker when pressed Color = CCColor3B.DarkGray; } }
void onTouchesEnded(List <CCTouch> touches, CCEvent touchEvent) { //Add a new body/atlas sprite at the touched location foreach (CCTouch touch in touches) { CCPoint location = Layer.ScreenToWorldspace(touch.LocationOnScreen); addNewSpriteAtPosition(location); } }
private protected override void OnTouchesBeganUI(List <CCTouch> touches, CCEvent touchEvent) { base.OnTouchesBeganUI(touches, touchEvent); // stops the scroller // bug-fix: let your middle node check for being pressed if (MiddleNode is PartCarouselNode pcn) { pcn.PartCollectionNode.OnTouchesBegan(touches, touchEvent); } }
public override void TouchMoved(CCTouch touch, CCEvent pEvent) { if (!Visible) { return; } if (m_pTouches.Contains(touch)) { if (m_pTouches.Count == 1 && m_bDragging) { // scrolling m_bTouchMoved = true; CCPoint frameOriginal = Parent.ConvertToWorldSpace(Position); var frame = new CCRect(frameOriginal.X, frameOriginal.Y, m_tViewSize.Width, m_tViewSize.Height); CCPoint newPoint = ConvertTouchToNodeSpace(m_pTouches[0]); CCPoint moveDistance = newPoint - m_tTouchPoint; m_tTouchPoint = newPoint; if (frame.ContainsPoint(ConvertToWorldSpace(newPoint))) { switch (m_eDirection) { case CCScrollViewDirection.Vertical: moveDistance = new CCPoint(0.0f, moveDistance.Y); break; case CCScrollViewDirection.Horizontal: moveDistance = new CCPoint(moveDistance.X, 0.0f); break; } m_pContainer.Position = m_pContainer.Position + moveDistance; CCPoint maxInset = m_fMaxInset; CCPoint minInset = m_fMinInset; //check to see if offset lies within the inset bounds float newX = Math.Min(m_pContainer.Position.X, maxInset.X); newX = Math.Max(newX, minInset.X); float newY = Math.Min(m_pContainer.Position.Y, maxInset.Y); newY = Math.Max(newY, minInset.Y); m_tScrollDistance = moveDistance - new CCPoint(newX - m_pContainer.Position.X, newY - m_pContainer.Position.Y); SetContentOffset(new CCPoint(newX, newY), false); } } else if (m_pTouches.Count == 2 && !m_bDragging) { float len = CCPoint.Distance(m_pContainer.ConvertTouchToNodeSpace(m_pTouches[0]), m_pContainer.ConvertTouchToNodeSpace(m_pTouches[1])); ZoomScale = ZoomScale * len / m_fTouchLength; } } }
public override void TouchesEnded(List <CCTouch> touches, CCEvent eventArgs) { foreach (CCTouch touch in touches) { CCPoint location = touch.LocationInView; location = CCDirector.SharedDirector.ConvertToGl(location); addNewSpriteWithCoords(location); } }
private protected override void OnTouchesMovedUI(List <CCTouch> touches, CCEvent touchEvent) { switch (touches.Count) { case 1: { var touch = touches[0]; if (Rows == 1) { var rect = BoundingBoxTransformedToWorld; rect = new CCRect(rect.MinX, rect.MinY + rect.Size.Height / 4, rect.Size.Width, rect.Size.Height / 2); if (!rect.ContainsPoint(touch.Location)) { var boxSize = BoxSize * GetTotalScale(); foreach (var node in Collection) { var ccNode = (CCNode)node; CCRect boxRect = new CCRect(ccNode.PositionWorldspace.X - boxSize.Width / 2, ccNode.PositionWorldspace.Y - boxSize.Height / 2, boxSize.Width, boxSize.Height); if (boxRect.ContainsPoint(new CCPoint(touch.Location.X, touch.StartLocation.Y))) { RemoveFromCollection(node, touch); Pressed = false; return; } } } } else if (Columns == 1) { var rect = BoundingBoxTransformedToWorld; rect = new CCRect(rect.MinX + rect.Size.Width / 4, rect.MinY, rect.Size.Width / 2, rect.Size.Height); if (!rect.ContainsPoint(touch.Location)) { var boxSize = BoxSize * GetTotalScale(); foreach (var node in Collection) { var ccNode = (CCNode)node; CCRect boxRect = new CCRect(ccNode.PositionWorldspace.X - boxSize.Width / 2, ccNode.PositionWorldspace.Y - boxSize.Height / 2, boxSize.Width, boxSize.Height); if (boxRect.ContainsPoint(new CCPoint(touch.StartLocation.X, touch.Location.Y))) { RemoveFromCollection(node, touch); Pressed = false; return; } } } } // move the collectionNode via scroller Scroller.OnTouchesMoved(touches, touchEvent); } break; default: break; } }
public override void TouchesBegan(List<CCTouch> pTouches, CCEvent pEvent) { foreach (var it in pTouches) { CCTouch touch = it; m_tBeginPos = touch.LocationInView; m_tBeginPos = CCDirector.SharedDirector.ConvertToGl(m_tBeginPos); } }
private void HandleTouchesBegan(List <CCTouch> touches, CCEvent touchEvent) { foreach (var item in touches) { if (item.Location.X > owner.ContentSize.Center.X) { touchedOnRightSide = true; } } }
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); }
public override void TouchesEnded(List <CCTouch> touches, CCEvent e) { //Add a new body/atlas sprite at the touched location foreach (CCTouch touch in touches) { CCPoint location = touch.Location; addNewSpriteAtPosition(location); } }
private void HandleInput(System.Collections.Generic.List <CCTouch> touches, CCEvent touchEvent) { if (touches.Count > 0) { CCTouch firstTouch = touches[0]; this.PositionX = firstTouch.Location.X; this.PositionY = firstTouch.Location.Y; } }
internal void TouchesMoved(List <CCTouch> touches, CCEvent touchEvent) { touchEvent.StopPropogation(); if (touches.Count > 0) { var touch = touches[0]; // move to the position that is allowed and closest to the touch (the closest point that is still inside the ManeuverPolygon) MoveHeadToClosestPointInsideManeuverPolygon(touch.Location); } }
void OnTouchEnded(CCTouch touch, CCEvent touchEvent) { bool hits = touchHits(touch); if (hits && Triggered != null) { Triggered(this, EventArgs.Empty); } scaleButtonTo(1); }
public override void ccTouchesMoved(List<CCTouch> touches, CCEvent event_) { var it = touches.FirstOrDefault(); CCTouch touch = (CCTouch)(it); CCPoint touchLocation = touch.locationInView(touch.view()); touchLocation = CCDirector.sharedDirector().convertToGL(touchLocation); m_streak.position = touchLocation; }
void onTouchesEnded(List <CCTouch> touches, CCEvent touchEvent) { foreach (var item in touches) { CCTouch touch = item; TouchPoint pTP = s_dic[touch.Id]; RemoveChild(pTP, true); s_dic.Remove(touch.Id); } }
private void OnTouchesBegan(List <CCTouch> touches, CCEvent touchEvent) { if (touches.Count > 0) { CCScene newGameScene = new CCScene(GameView); var transitionToNewGame = new CCTransitionProgressInOut(0.7f, newGameScene); newGameScene.AddLayer(new GameLayer()); Director.ReplaceScene(transitionToNewGame); } }
public override void TouchMoved(CCTouch pTouch, CCEvent pEvent) { CCPoint location = LocationFromTouch(pTouch); location = new CCPoint(location.X - m_fInitialTouchXPosition, 0); m_bMoved = true; m_pSwitchSprite.SliderXPosition = location.X; }
public override void TouchesEnded(List<CCTouch> touches, CCEvent event_) { CCSpriteBatchNode batch = (CCSpriteBatchNode)GetChildByTag((int)kTags. kTagSpriteBatchNode); if (batch.Texture== m_texture1) batch.Texture=m_texture2; else batch.Texture=m_texture1; //base.ccTouchesEnded(touches, event_); }
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; }
public override void ccTouchesEnded(List<CCTouch> touches, CCEvent event_) { if (nextProjectile != null) return; CCTouch touch = touches.FirstOrDefault(); CCPoint location = touch.locationInView(touch.view()); location = CCDirector.sharedDirector().convertToGL(location); //set up initial location of projectile CCSize winSize = CCDirector.sharedDirector().getWinSize(); //CCSprite projectile = CCSprite.spriteWithFile(@"images/Projectile"); nextProjectile = CCSprite.spriteWithFile(@"images/Projectile2"); nextProjectile.position = new CCPoint(20, winSize.height / 2); //Determine offset of location to projectile float offX = location.x - nextProjectile.position.x; float offY = location.y - nextProjectile.position.y; //Bail out if we are shooting or backwards if (offX <= 0) { return; } //Determine where we wish to shoot the projectile to float realX = winSize.width + nextProjectile.contentSize.width / 2; float ratio = offY / offX; float realY = realX * ratio + nextProjectile.position.y; CCPoint realDest = new CCPoint(realX, realY); //Determine the length of how far we're shooting float offRealX = realX - nextProjectile.position.x; float offRealY = realY - nextProjectile.position.y; float length = (float)Math.Sqrt(offRealX * offRealX + offRealY * offRealY); float velocity = 480 / 1;//480pixls/lsec float realMoveDuration = length / velocity; //Determine angle to face float angleRadians = (float)Math.Atan(offRealY / offRealX); float angleDegrees = MathHelper.ToDegrees(angleRadians); float cocosAngle = -1 * angleDegrees; float rotateSpeed = (float)(0.5 / Math.PI);//Would take 0.5 seconds to rotate 0.5 radians ,or half a circle float rotateDuration = Math.Abs(angleRadians * rotateSpeed); player.runAction(CCSequence.actions(CCRotateTo.actionWithDuration(rotateDuration, cocosAngle), CCCallFunc.actionWithTarget(this, finishShoot))); //Move projectile to actual endpoint nextProjectile.runAction(CCSequence.actions(CCMoveTo.actionWithDuration(realMoveDuration, realDest), CCCallFuncN.actionWithTarget(this, spriteMoveFinished))); nextProjectile.tag = 2; }
/// <summary> /// 触屏事件Ended处理函数 /// </summary> /// <param name="touches"></param> /// <param name="event_"></param> public override void ccTouchesEnded(List<CCTouch> touches, CCEvent event_) { object sender = touches.First();//获取第一个触点 CCTouch touch = (CCTouch)(sender); CCPoint touchLocation = touch.locationInView(touch.view());//获取触屏的坐标位置 CCPoint convertedLocation = CCDirector.sharedDirector().convertToGL(touchLocation);//转换坐标位置 //执行运动 CCActionInterval move = CCMoveTo.actionWithDuration(3, convertedLocation); CCActionInterval move_ease_inout = CCEaseInOut.actionWithAction(move);//ease缓冲 sprite1.runAction(move_ease_inout); }
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(); }
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); }
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; }
public override void ccTouchesEnded(List<CCTouch> touches, CCEvent eventarg) { foreach (CCTouch touch in touches) { if (touch != null) break; CCPoint a = touch.locationInView(touch.view()); CCDirector director = CCDirector.sharedDirector(); CCPoint b = director.convertToUI(director.convertToGL(a)); //CCLog("(%d,%d) == (%d,%d)", (int) a.x, (int)a.y, (int)b.x, (int)b.y ); CCLog.Log("(%d,%d) == (%d,%d)", (int)a.x, (int)a.y, (int)b.x, (int)b.y); } }
public override void TouchesEnded(List<CCTouch> touches, CCEvent eventarg) { foreach (CCTouch touch in touches) { if (touch == null) break; CCPoint a = touch.LocationInView; CCDirector director = CCDirector.SharedDirector; CCPoint b = director.ConvertToUi(director.ConvertToGl(a)); //CCLog("(%d,%d) == (%d,%d)", (int) a.x, (int)a.y, (int)b.x, (int)b.y ); CCLog.Log("({0},{1}) == ({2},{3})", (int)a.X, (int)a.Y, (int)b.X, (int)b.Y); } }