bool ColorButton::onTouchBegan(Touch* touch, Event* event){ log("============Touch Began=============="); if (!containsTouchLocation(touch)){ return false; } switch (this->getTag()) { case 0: log("======== Move To CommonGameScene ========="); Director::getInstance()->replaceScene(CommonGameScene::createScene()); break; case 1: log("======== Move To GameScene ========="); Director::getInstance()->replaceScene(GameScene::createScene()); break; case 2: log("======== Move To ZenGameScene ========="); Director::getInstance()->replaceScene(ZenGameScene::createScene()); break; default: break; } return true; }
bool FLGameBlock::ccTouchBegan(CCTouch *touch, CCEvent *event) { if (containsTouchLocation(touch)) { return true; } return false; }
bool Ship::ccTouchBegan(CCTouch* touch, CCEvent* event) { if (m_state != kShipStateUngrabbed) return false; if ( !containsTouchLocation(touch) ) return false; m_state = kShipStateGrabbed; return true; }
bool TouchableSprite::ccTouchBegan(CCTouch* touch, CCEvent* event) { if (!containsTouchLocation(touch)) return false; card_mgr_->OnTouch(getTag()); CCPoint pos = getPosition(); CCLOG("%s, this:%p %d, x%f, y%f\n", __FUNCTION__, this, getTag(), pos.x, pos.y); return true; }
bool Paddle::ccTouchBegan(CCTouch* touch, UIEvent* event) { if (m_state != kPaddleStateUngrabbed) return false; if ( !containsTouchLocation(touch) ) return false; m_state = kPaddleStateGrabbed; return true; }
bool PlayerSprite::ccTouchBegan( CCTouch *pTouch, CCEvent *pEvent ) { if (m_bIsTouch) return false; if (!containsTouchLocation(pTouch)) return false; m_bIsTouch = true; return true; }
void WildcardButton::ccTouchEnded(CCTouch* touch, CCEvent* event) { if (containsTouchLocation(touch)) { if(m_pTarget != 0 && m_fnpChangedDelegate != 0) (m_pTarget->*m_fnpChangedDelegate)(this); } setButtonState(UNGRABBED); }
bool MySprite::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) { if(reMoveTouch) return false; if (! containsTouchLocation(pTouch)) return false; oldPoint = this->getPosition(); //自动收缩boxSprite canBoxMove = true; return true; }
bool TouchSprite::onTouchBegan(Touch* touch, Event* event) { //CCLOG("Paddle::onTouchBegan id = %d, x = %f, y = %f", touch->getID(), touch->getLocation().x, touch->getLocation().y); if (_state != kPaddleStateUngrabbed) return false; if (!containsTouchLocation(touch)) return false; m_oldPoint = touch->getLocation(); _state = kPaddleStateGrabbed; // CCLOG("return true"); return true; }
bool FramePart::onTouchBegan(Touch* touch, Event* event) { CCLOG("FramePart::onTouchBegan id = %d, x = %f, y = %f", touch->getID(), touch->getLocation().x, touch->getLocation().y); if (_state != kFramePartStateUngrabbed) return false; if ( !containsTouchLocation(touch) ) return false; _state = kFramePartStateGrabbed; CCLOG("return true"); return true; }
void WildcardButton::ccTouchMoved(CCTouch* touch, CCEvent* event) { if (containsTouchLocation(touch)) { setButtonState(GRABBED); } else { setButtonState(UNGRABBED); } }
bool City::ccTouchBegan(CCTouch* touch, CCEvent* event) { if ( !containsTouchLocation(touch) ) { m_state = kCityStateUnTouched; return false; }else { m_state = kCityStateTouched; } return true; }
bool BlockSprite::onTouchBegan(Touch* touch, Event* event) { if(containsTouchLocation(touch)) { runAnimation(3); log("inside"); }else{ //log("outside"); } return true; }
bool GameObjHero::ccTouchBegan(CCTouch* touch,CCEvent* event) { if(! containsTouchLocation(touch)) return false; isControl = true; CCPoint touchPoint = touch->getLocationInView(); touchPoint = CCDirector::sharedDirector()->convertToGL(touchPoint); offset.x = touchPoint.x - this->getPosition().x; offset.y = touchPoint.y - this->getPosition().y; return true; }
bool BaseBug::ccTouchBegan(cocos2d::CCTouch *pTouch, cocos2d::CCEvent *event){ if(hasDie()) return false; if(containsTouchLocation(pTouch)){ this->m_HP -= 1; byPress(); this->stopMove(); if(hasDie()){ GameManager::getInstance()->getScoreManager()->addScore(EACH_BUG_SCORE); addScoreAnimation(); m_bug->playAnimation("death"); } return true; } return false; }
bool Menu::ccTouchBegan(CCTouch* pTouches, CCEvent* event) { if (((Menu*)getParent()->getChildByTag(MENU_TAG))->isActiveTouchMenu == false) { return false; } //cocos2d-x의 화면 바깥쪽에서의 터치를 막기위해 추가함 int nTouchHeight = 0; CCPoint touchPoint = pTouches->getLocationInView(); nTouchHeight = touchPoint.y; CCSize s = CCDirector::sharedDirector()->getWinSize(); if ( !containsTouchLocation(pTouches) || nTouchHeight > s.height) return false; return true; }
bool GameObjHero::ccTouchBegan(CCTouch* touch, CCEvent* event) { if(((GameMain *)this->getParent())->isover) return false; if(! containsTouchLocation(touch)){ return false; }else{ //获得触摸偏移位置 iscontrol = true; CCPoint touchPoint = touch->getLocation(); //touchPoint = CCDirector::sharedDirector()->convertToGL(touchPoint); offset.x = touchPoint.x - this->getPosition().x; offset.y = touchPoint.y - this->getPosition().y; } return true; }
bool WildcardButton::ccTouchBegan(CCTouch* touch, CCEvent* event) { if (!this->isVisible() || !this->m_isEnabled) return false; if (containsTouchLocation(touch)) { setButtonState(GRABBED); return true; } else { setButtonState(UNGRABBED); } return false; }
/** * 开始触摸 */ bool YJTabTitle::ccTouchBegan(CCTouch* pTouch, CCEvent* event) { CCLog("YJTabTitle++++++++++++++++++++++++++++++++++++++++++++") ; CCPoint point = convertTouchToNodeSpace(pTouch); CCLog("YJTabTitle:clickedAt(%f, %f)", point.x, point.y); if(! containsTouchLocation(pTouch)) { return false; } beginPos = pTouch->locationInView(); CCLog("beginPos locationInView: x: %f, y: %f", beginPos.x, beginPos.y) ; beginPos = CCDirector::sharedDirector()->convertToGL(beginPos); CCLog("beginPos convertToGL: x: %f, y: %f", beginPos.x, beginPos.y) ; return true; }
bool GameObjHero::onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *event) { // CCLOG("onTouchBegin"); if (!containsTouchLocation(touch)) { return false; }else{ isControl = true; Point touchPoint = touch->getLocationInView(); touchPoint = Director::getInstance()->convertToGL(touchPoint); offset.x = touchPoint.x - this->getPosition().x; offset.y = touchPoint.y - this->getPosition().y; } // CCLOG("offset x:%f, y:%f", offset.x, offset.y); return true; }
void City::ccTouchEnded(CCTouch* touch, CCEvent* event) { if ( !containsTouchLocation(touch) ) { m_state = kCityStateUnTouched; }else { if(m_state == kCityStateTouched) { //CCLOG("City Touched"); BattleScene* pScene = BattleScene::create(); if (pScene) { CCDirector::sharedDirector()->pushScene(pScene); } } m_state = kCityStateUnTouched; } }
bool CardSprite::ccTouchBegan(cocos2d::CCTouch *touch, cocos2d::CCEvent *event) { bool bRet = false; if (containsTouchLocation(touch)) { CCLog("Touchable Sprite Began"); CCLog("id %d",this->getTag()); CCPoint point = this->getPosition(); CCSize size = CCDirector::sharedDirector()->getWinSize(); UtilTool::sharedUtilTool()->moveWithBezier(this,this->getPosition(),ccp(size.width/2,size.height/2),0.5); bRet = true; } return bRet; }
bool SpriteButton::ccTouchBegan(CCTouch *touch, CCEvent *pEvent) { if (m_state != kSpriteStateUngrabbed) return false; if ( !containsTouchLocation(touch) ) return false; m_state = kSpriteStateGrabbed; CCAction *action =getActionByTag(kZoomActionTag); if (action) { stopAction(action); } float scaleValue = 1.1f * scale; CCAction *zoomAction = CCScaleTo::create(0.05f, scaleValue); zoomAction->setTag(kZoomActionTag); runAction(zoomAction); return true; }
bool Palette::ccTouchBegan(CCTouch* pTouches, CCEvent* event) { if (!containsTouchLocation(pTouches)) return false; if( ((DrawPaint*)getParent())->m_bDoingSelectAction ) return false; if (nPrevTag == getTag()) return false; if(((DrawPaint*)getParent())->isDoingJumping() == true) return false; if (bBtouched == false) return false; CCLOG("Palette ccTouchBegan (tag : %d )",this->getTag()); ((DrawPaint*)getParent())->selectTool(this->getTag(), nPrevTag); bBtouched = false; return true; }
bool BaseObject::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) { return getIsDrag() && containsTouchLocation(pTouch->getLocation()); }
bool Mark::ccTouchBegan(CCTouch* touch, CCEvent* event) { //CCLog("Mark::ccTouchBegan(): called"); if (!containsTouchLocation(touch)) return false; return true; }
bool CSSprite::ccTouchBegan(CCTouch* touch, cocos2d::CCEvent* event) { if ( !containsTouchLocation(touch) ) return false; return true; }
bool ScrollView::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) { if ( !containsTouchLocation(pTouch) ) return false; CCLog("scrollView TouchBegan"); return true; }