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;
}
Example #2
0
bool FLGameBlock::ccTouchBegan(CCTouch *touch, CCEvent *event)
{
    if (containsTouchLocation(touch)) {
        return true;
    }
    return false;
}
Example #3
0
bool Ship::ccTouchBegan(CCTouch* touch, CCEvent* event)
{
    if (m_state != kShipStateUngrabbed) return false;
    if ( !containsTouchLocation(touch) ) return false;
    
    m_state = kShipStateGrabbed;
    return true;
}
Example #4
0
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;
}
Example #5
0
bool Paddle::ccTouchBegan(CCTouch* touch, UIEvent* event)
{
	if (m_state != kPaddleStateUngrabbed) return false;
	if ( !containsTouchLocation(touch) ) return false;
	
	m_state = kPaddleStateGrabbed;
	return true;
}
Example #6
0
bool PlayerSprite::ccTouchBegan( CCTouch *pTouch, CCEvent *pEvent )
{
	if (m_bIsTouch) return false;
	if (!containsTouchLocation(pTouch)) return false;

	m_bIsTouch = true;

	return true;
}
Example #7
0
void WildcardButton::ccTouchEnded(CCTouch* touch, CCEvent* event)
{
  if (containsTouchLocation(touch))
  {      
    if(m_pTarget != 0 && m_fnpChangedDelegate != 0)
      (m_pTarget->*m_fnpChangedDelegate)(this);
  }

  setButtonState(UNGRABBED);
}
Example #8
0
bool MySprite::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
	if(reMoveTouch)
		return false;
	if (! containsTouchLocation(pTouch))
		return false;
	oldPoint = this->getPosition();
	//自动收缩boxSprite
	canBoxMove = true;
	return true;
}
Example #9
0
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;
	}
Example #10
0
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;
}
Example #11
0
void WildcardButton::ccTouchMoved(CCTouch* touch, CCEvent* event)
{
  if (containsTouchLocation(touch))
  {      
    setButtonState(GRABBED);
  }
  else
  {
    setButtonState(UNGRABBED);
  }
}
Example #12
0
bool City::ccTouchBegan(CCTouch* touch, CCEvent* event)
{
    if ( !containsTouchLocation(touch) ) 
    {
	m_state = kCityStateUnTouched;
    	return false;
    }else
    {
	m_state = kCityStateTouched;
    }
    return true;
}
Example #13
0
bool BlockSprite::onTouchBegan(Touch* touch, Event* event)
{
    if(containsTouchLocation(touch))
    {
        runAnimation(3);
        log("inside");
   
    }else{
        
        //log("outside");
    }
   
    return true;
}
Example #14
0
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;
}
Example #15
0
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;
}
Example #16
0
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;
}
Example #17
0
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;   
}
Example #18
0
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;
}
Example #19
0
/**
*	开始触摸
*/
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;
}
Example #20
0
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;
}
Example #21
0
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;
    }
} 
Example #22
0
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;
}
Example #23
0
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;
}
Example #24
0
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;
}
Example #25
0
bool BaseObject::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
	return getIsDrag() && containsTouchLocation(pTouch->getLocation());
}
Example #26
0
bool Mark::ccTouchBegan(CCTouch* touch, CCEvent* event) {
    //CCLog("Mark::ccTouchBegan(): called");
    if (!containsTouchLocation(touch)) return false;
    return true;
}
Example #27
0
bool CSSprite::ccTouchBegan(CCTouch* touch, cocos2d::CCEvent* event)
{
	if ( !containsTouchLocation(touch) ) return false;

	return true;
}
Example #28
0
bool ScrollView::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
	if ( !containsTouchLocation(pTouch) ) return false;
	CCLog("scrollView TouchBegan");
	return true;
}