Example #1
0
bool GiftListView::ccTouchBegan( CCTouch *pTouch, CCEvent *pEvent )
{
	CCRect listRect = CCRectMake(0,0,getContentSize().width,getContentSize().height);
	if (listRect.containsPoint(convertTouchToNodeSpace(pTouch)))
	{
		//CCLOG("touch begin-------");
		CCPoint locationPoint = pTouch->getLocation();
		mMoveBeginPoint.setPoint(locationPoint.x,locationPoint.y);
		schedule(schedule_selector(GiftListView::touchUpdate));
		
		for (int i=0;i<(int)mPages.count();i++)
			((CCLayer*)mPages.objectAtIndex(i))->stopActionByTag(999);
		
		CCPoint touchPoint = convertTouchToNodeSpace(pTouch);
		int startIndex = (mPageCurr-1)*mPageSize;
		int endIndex = mGiftItems.count();
		for (int i=startIndex;i<endIndex;i++)
		{
			GiftItem* item =(GiftItem*)mGiftItems.objectAtIndex(i);
			CCRect itemRect = CCRectMake(item->getPositionX(),item->getPositionY(),item->getContentSize().width,item->getContentSize().height);
			if(itemRect.containsPoint(touchPoint))
			{
				item->setStatus(GiftItem::seled);
				mNowSeledItem = item;
				CCLOG("begin");
				break;
			}
		}

		return true;
	}
	return false;
	
}
Example #2
0
bool LevelMap::ccTouchBegan(CCTouch *touch, CCEvent *event)
{
    startP =  convertTouchToNodeSpace(touch);
    isTouchMenu=levelsMenu->ccTouchBegan(touch, event);
    CCPoint touchPoint = convertTouchToNodeSpace(touch);
    
    if (touchPoint.y < 80 || touchPoint.y > size.height - 180) {
        return false;
    }
    return true;
}
void CharacterDiceSprite::_onTouchMoved(Touch *touch, Event *event) {
  auto target = event->getCurrentTarget();
  auto layer = target->getParent();
  
  auto bounds = target->getBoundingBox();
  auto touchLocation = layer->convertTouchToNodeSpace(touch);
  
  this->setPosition(touchLocation);
  
  auto dungeonLayer = layer->getParent();
  auto position = dungeonLayer->convertTouchToNodeSpace(touch);
  
  this->getDelegate()->characterIsMovingToLocation(position);
}
void personalinfo::ccTouchMoved(cocos2d::CCTouch *touch, cocos2d::CCEvent *event)
{
    
    tooltip->setVisible(false);
    CCPoint touchPoint=convertTouchToNodeSpace(touch);
    
    if (readdraging) {
        draging = true;
        dragingsp->setData(readydragingsp->itemdata);
        dragingsp->setVisible(true);
        dragingsp->setPosition(touchPoint);
        readdraging = false;
    }
    
    
    
    if(draging)
    {
        dragingsp->setPosition(touchPoint);
    }
    
    
//    if(istouch){
//        
//        btnsMenu->ccTouchMoved(touch, event);
//    }
}
Example #5
0
void ArenaFindPlayer::ccTouchEnded(cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent)
{
	CCPoint endPos = pTouch->getLocation();    

	float delta = 5.0f;
	if (::abs(endPos.x - m_beginPos.x) > delta
		|| ::abs(endPos.y - m_beginPos.y) > delta)
	{
		// not click
		m_beginPos.x = m_beginPos.y = -1;
		return;
	}

	// decide the trackNode is clicked.
	CCPoint point = convertTouchToNodeSpace(pTouch);

	CCRect rect;
	rect.origin = m_InputPlayerName->getPosition();
	rect.size = m_InputPlayerName->getDimensions();
	rect.origin.x -= m_InputPlayerName->getAnchorPointInPoints().x;
	rect.origin.y -= m_InputPlayerName->getAnchorPointInPoints().y;

	if (rect.containsPoint(point))
	{
		m_InputPlayerName->attachWithIME();
	}
	else
	{
		m_InputPlayerName->detachWithIME();
	}
}
Example #6
0
bool MapFlag::onTouchBegan(Touch* touch, Event* event)
{
	auto target = static_cast<Sprite*>(event->getCurrentTarget());

	Point locationInNode = target->convertTouchToNodeSpace(touch);

	Size size = target->getContentSize();
	Rect rect = Rect(0, size.height/3, size.width, size.height/2);
	if (rect.containsPoint(locationInNode))
	{  	
		SoundManager::playClickEffect();
		switch (type)
		{
		case(1):
			flag->setSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("mapFlag_0096.png"));
			break;
		case(0):
			flag->setSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("mapFlag_0023.png"));
			break;
		case(2)://得星个数为4
			flag->setSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("mapFlag_0117.png"));
			break;
		case(3)://得星个数为5
			flag->setSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("mapFlag_0117.png"));

			break;
		default:
			break;
		}
		return true;  
	}  
	return false;  
}
bool WHScrollView::onTouchBegan(cocos2d::Touch *pTouch, cocos2d::Event *pEvent)
{
	CCPoint localPoint = convertTouchToNodeSpace(pTouch);
	CCRect rect = CCRectMake(0, 0, _viewSize.width, _viewSize.height);
	if (!rect.containsPoint(localPoint))
		return false;

	if (!ScrollView::onTouchBegan(pTouch, pEvent))
		return false;

	if (m_PointerId != -1)
		return false;

	m_BeginPoint = localPoint;
	m_PointerId = pTouch->getID();

	//CCScrollView::ccTouchBegan(pTouch, pEvent);
	m_MoveCount = 1;

	for (int i = 0; i < m_TouchLayer.size(); i++)
	{
		CCLayer* pTouchLayer = m_TouchLayer[i];
		m_TouchLayerTouched[i] = pTouchLayer->onTouchBegan(pTouch, pEvent);
		if (m_TouchLayerTouched[i])
			break;
	}

	return true;
}
Example #8
0
void LevelMap::ccTouchMoved(CCTouch *touch, CCEvent *event)
{
    movingP = convertTouchToNodeSpace(touch);
    distanceP = ccpSub(movingP, startP);
    CCPoint tmpP = mapLayer->getPosition();
    
    if(offsetY + distanceP.y > 0)
    {
        offsetY = 0;
        CData::getCData()->levelMapOffsetY = offsetY;
    }
    else if (offsetY + distanceP.y < -442*(mapNum-1))
    {
        offsetY =  -442*(mapNum-1);
        CData::getCData()->levelMapOffsetY = offsetY;
    }
    else
    {
        offsetY +=  distanceP.y;
        CData::getCData()->levelMapOffsetY = offsetY;
    }
    adjustMap(true);
    startP = movingP;
    
    if(isTouchMenu){
        levelsMenu->ccTouchMoved(touch, event);
    }
}
void UINumberPicker::onTouchMoved(cocos2d::Touch *touch, cocos2d::Event *unused_event)
{
    do
    {
        CC_BREAK_IF(!isVisible());
        
        if (containsTouchObject(m_pTouches, touch))
        {
            if (m_pTouches.size() == 1 && m_bDragging)
            {
                m_bTouchMoved = true;
                
                const Point &newPoint = convertTouchToNodeSpace(m_pTouches[0]);
                
//                Point moveDistance = Point(newPoint.x - m_tTouchPoint.x,
//                                           newPoint.y - m_tTouchPoint.y);
                m_tScrollDistance.set(newPoint.x - m_tTouchPoint.x, newPoint.y - m_tTouchPoint.y);
                m_tTouchPoint = newPoint;
                
                if (displayRect.containsPoint(convertToWorldSpace(newPoint)))
                {
                    moveAllCell(m_tScrollDistance);
                }
//                m_tScrollDistance = moveDistance;
            }
        }
    }
    while (0);
}
Example #10
0
void CCutScene::dragFood(Touch *touch)
{
    m_bDraged = true;
    if (m_pCurTouchedFood == NULL)
    {
        if (m_nTouchedPanzi < 0 || m_nTouchedPanzi >= 5) return;
        if (m_aFoods[m_nTouchedPanzi] == NULL) return;
        
        
        
        std::vector<int> vMaterial = m_aFoods[m_nTouchedPanzi]->getMaterials();
        MATERIAL_ID id = (MATERIAL_ID)vMaterial[0];
        if (id >= MI_MAX) return;
        std::string sName = MATERIAL_CONFIG[id].sName;
        m_pCurTouchedFood = CFoodMaterial::create(sName.c_str());
        if (m_pCurTouchedFood != NULL)
        {
            this->addChild(m_pCurTouchedFood, CSZ_OVER);
            std::vector<int> vMaterials;
            vMaterials.clear();
            vMaterials.push_back(id);
            int aTastes[2] = {0, 0};
            m_pCurTouchedFood->initProperty(FT_ORIGIN, vMaterials, aTastes);
            m_pCurTouchedFood->setPanziIndex(m_aFoods[m_nTouchedPanzi]->getPanziIndex());
        }
        
        m_aFoods[m_nTouchedPanzi]->setVisible(false);
    }
    
    m_pCurTouchedFood->setPosition(convertTouchToNodeSpace(touch));
}
Example #11
0
void ConvertAccount::onTouchEnded(cocos2d::Touch *touch, cocos2d::Event *unused_event){
    Vec2 touchLocation = convertTouchToNodeSpace(touch);
    
    if(getChildByTag(CONV_GOBACK)->getBoundingBox().containsPoint(touchLocation)){
        auto trans = TransitionMoveInL::create(0.5, HelloWorld::createScene());
        Director::getInstance()->replaceScene(trans);
    }
    if(getChildByTag(CONV_USEMSG)->getBoundingBox().containsPoint(touchLocation)){
        auto trans = TransitionMoveInR::create(0.5, MsgLogin::createScene());
        Director::getInstance()->replaceScene(trans);
    }
    if(getChildByTag(CONV_LONGIN)->getBoundingBox().containsPoint(touchLocation)){
        
        ui::EditBox* ebAccount = (ui::EditBox*)getChildByTag(CONV_PACCOUNT);
        ui::EditBox* ebPwd = (ui::EditBox*)getChildByTag(CONV_PPWD);
        const char* sAccount = ebAccount->getText();
        const char* sPwd = ebPwd->getText();
        
        if(!Tools::checkInfo(sAccount, sPwd)){
            MyToast::showMsg(this, "手机号码是11位数字\n密码是6-10位字母或数字\n不允许特殊字符", 2.5f);
        }else{
            
        }
    }
    if(getChildByTag(CONV_RESET1)->getBoundingBox().containsPoint(touchLocation)){
        ui::EditBox* ebAccount = (ui::EditBox*)getChildByTag(CONV_PACCOUNT);
        ebAccount->setText("");
    }
    if(getChildByTag(CONV_RESET2)->getBoundingBox().containsPoint(touchLocation)){
        ui::EditBox* ebPwd = (ui::EditBox*)getChildByTag(CONV_PPWD);
        ebPwd->setText("");
    }
}
Example #12
0
bool SimplePanleLayer::onTouchBegan(Touch *touch, Event *event)
{
	auto target = static_cast<BaseBuildIcon*>(event->getCurrentTarget());
    Point locationInNode = target->convertTouchToNodeSpace(touch);
    Size size = target->baseIcon->getContentSize();
	Rect rect = Rect(0-size.width/2, 0-size.height/2, size.width, size.height);
    if (rect.containsPoint(locationInNode))
    {
		if(target->getIsSelected())//如果已经选中(第二次按下)
		{
			if(target->getIsAble())//如果钱够用
			{
				SoundManager::playTowerSell();
				GameManager::getInstance()->MONEY = GameManager::getInstance()->MONEY+ (tower->getBuildMoney()/2);
				tower->sellTower();
				this->setVisible(false);
				isBuilt = true;
			}
		}else{//第一次按下
			target->setSelected();//设置为选中状态
		}
        return true;
    }
    return false;
}
Example #13
0
void BaseMap::addWaveProgressBars(std::vector<Point> waveFlagLocations)
{
	for(unsigned int i = 0;i<waveFlagLocations.size();i++){
		auto waveFlag = WaveFlag::createWaveFlag();
		waveFlag->setPosition(waveFlagLocations.at(i));
		addChild(waveFlag,20);
		auto waveflag_listener = EventListenerTouchOneByOne::create();
		waveflag_listener->onTouchBegan = [&](Touch* touch, Event* event){
		
			auto target = static_cast<WaveFlag*>(event->getCurrentTarget());

			Point locationInNode = target->convertTouchToNodeSpace(touch);

			Size size = target->waveProgressTimer->getContentSize();
			Rect rect = Rect(0 - size.width/2, 0 - size.height/2, size.width, size.height);
			if (rect.containsPoint(locationInNode) && target->isShown)
			{  
				if(target->selected->isVisible())
				{
					for(int i = 0;i<waveFlags.size();i++){
						waveFlags.at(i)->stopRespiration();
					}
				}
				for(int i = 0;i<waveFlags.size();i++){
					waveFlags.at(i)->setSelected();
				}
				return true;  
			}  
			return false;  
		};
		waveflag_listener->setSwallowTouches(true);
		_eventDispatcher->addEventListenerWithSceneGraphPriority(waveflag_listener,waveFlag);
		waveFlags.pushBack(waveFlag);
	}
}
Example #14
0
bool ActionBar::onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *unused_event)
{
	//log("ActionBar touch began:(%d,%d)", touch->getLocation().x, touch->getLocation().y);
	bool bHitted = false;
	if (isVisible())
	{
		Vec2 pos = convertTouchToNodeSpace(touch);
		Size sz = getContentSize();
		Rect rc(0, 0, sz.width, sz.height);
		if (rc.containsPoint(pos))
		{
			bHitted = true;
		}

		if (m_pMenuItemSlideRaise->isVisible())
		{
			rc.size = m_pSpriteBgSlider->getContentSize();
			rc.origin = m_pSpriteBgSlider->getPosition() - Vec2(rc.size.width / 2, rc.size.height / 2);
			if (rc.containsPoint(pos))
			{
				bHitted = true;
			}
		}

		if (!bHitted)
		{
			if (m_pMenuItemSlideRaise->isVisible())
			{
				ShowAction(true);
			}
		}
	}

	return false;
}
bool UINumberPicker::onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *unused_event)
{
    do
    {
        CC_BREAK_IF(!isVisible());
        
        CC_BREAK_IF(m_pTouches.size() > 2);
        
        CC_BREAK_IF(m_bTouchMoved);
        // scrolling,手指移动多少距离,内容区域也移动多少,同步执行 CCScrollView
        //当前坐标转成世界坐标
        const Point &location = touch->getLocationInView();
        const Point &convertedLocation = Director::getInstance()->convertToGL(location);
        
        CC_BREAK_IF(!displayRect.containsPoint(convertedLocation));
        
        unscheduleAllCallbacks();
        
        if (!containsTouchObject(m_pTouches,touch))
        {
            m_pTouches.push_back(touch);
        }
        if (m_pTouches.size() == 1)
        {
            m_tTouchPoint = convertTouchToNodeSpace(touch);
            m_bTouchMoved = false;
            
            m_bDragging = true;
            m_tScrollDistance.set(0, 0);
            m_fTouchLength = 0;
        }
        else if (m_pTouches.size() == 2)
        {
            const Point &p1 = convertTouchToNodeSpace(m_pTouches[0]);
            const Point &p2 = convertTouchToNodeSpace(m_pTouches[1]);
            m_tTouchPoint = p1.getMidpoint(p2);
            m_fTouchLength = p1.getDistance(p2);
            
            m_bDragging = false;
        }
        return true;
    }
    while (0);
    
    return false;
}
Example #16
0
bool GameMap::onTouchBegan(Touch *touch, Event *unused_event)
{
	Point pos = convertTouchToNodeSpace(touch);

	gRobot->SetRunning(false);

	return true;
}
Example #17
0
void ControlLayer::ccTouchesEnded(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent)
{
    CCTouch *touch = (CCTouch *)pTouches->anyObject();
    CCPoint nodePoint = convertTouchToNodeSpace(touch);
    this->mEndPoint = nodePoint;

    this->doMoveLogic(this->mBeginPoint, this->mEndPoint);
}
Example #18
0
void RoundPageScrollView::ccTouchesBegan(cocos2d::CCSet *pTouches, cocos2d::CCEvent *pEvent)
{
	CCTouch *touch = (CCTouch*)pTouches->anyObject();
	CCPoint point = convertTouchToNodeSpace(touch);
    
	if(viewPort.containsPoint(point))
    {
		isTouchMoving = true;
	}
}
void TouchTrailLayer::ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent)
{
    for (CCSetIterator it = pTouches->begin(); it != pTouches->end(); it++) {
        CCTouch *touch = (CCTouch *)*it;
        if (_map.find(touch) == _map.end()) continue;
        
        CCBlade *blade = _map[touch];
        CCPoint point = convertTouchToNodeSpace(touch);
		blade->push(point);
    }
}
bool WHScrollView::canResponseMenu(CCTouch *pTouch)
{
	CCPoint endPoint = convertTouchToNodeSpace(pTouch);
	int deltaX = m_BeginPoint.x - endPoint.x;
	int deltaY = m_BeginPoint.y - endPoint.y;

	if (deltaX < m_ResponseDistanceX && deltaX > -m_ResponseDistanceX
		&& deltaY < m_ResponseDistanceY && deltaY > -m_ResponseDistanceY)
		return true;

	return false;
}
bool UpdatePanleLayer2WithFlag::onTouchBegan(Touch *touch, Event *event)
{
	auto target = static_cast<BaseBuildIcon*>(event->getCurrentTarget());
    Point locationInNode = target->convertTouchToNodeSpace(touch);
    Size size = target->baseIcon->getContentSize();
	Rect rect = Rect(0-size.width/2, 0-size.height/2, size.width, size.height);
    if (rect.containsPoint(locationInNode))
    {
		if(target->getIsSelected())//如果已经选中(第二次按下)
		{
			if(target->getIsAble())//如果钱够用
			{
				switch (target->getTag())
				{
				case(1):
					SoundManager::playTowerUpdate();
					GameManager::getInstance()->MONEY = GameManager::getInstance()->MONEY-tower->getUpdateMoney();
					tower->update1();
					break;
				case(2):
					SoundManager::playTowerUpdate();
					GameManager::getInstance()->MONEY = GameManager::getInstance()->MONEY-tower->getUpdateMoney();
					tower->update2();
					break;
				case(3)://售出
					SoundManager::playTowerSell();
					GameManager::getInstance()->MONEY = GameManager::getInstance()->MONEY+ (tower->getBuildMoney()/2);
					tower->sellTower();
					break;
				}
				this->setVisible(false);
				isBuilt = true;
			}
		}else{//第一次按下
			updateIcon1->setNotSelected();
			updateIcon2->setNotSelected();
			sellIcon->setNotSelected();
			target->setSelected();//设置为选中状态
			switch (target->getTag())
			{
				case(1)://
					static_cast<BaseMap*>(this->getParent()->getParent())->playerState->showTowerInfo(ASSASSIN);
					break;
				case(2)://
					static_cast<BaseMap*>(this->getParent()->getParent())->playerState->showTowerInfo(TEMPLAR);
					break;
			}
		}
        return true;
    }
    return false;
}
bool SGAnnouncementLayer::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
    m_clickPos = convertTouchToNodeSpace(pTouch);
 
	//CCLOG("%f, %f", m_clickPos.x, m_clickPos.y);
    CCLOG("posy====%f",m_clickPos.y);
    
//    CCPoint center = SGLayout::getPoint(kMiddleCenter);
//    CCLOG("center.y - 330==%f",center.y - 320);
//    CCLOG("center.y + 250==%f",center.y + 240);
	
    return true;
}
Example #23
0
void TaskRewardMapWidget::TouchBegan(const std::vector<cocos2d::Touch *> &touches, cocos2d::Event *event)
{
	if (!_isPickEnabled) {
		return;
	}

	Vector2 location = convertTouchToNodeSpace(touches.at(0));
	if (_texture) {
		if (_texture->getBoundingBox().containsPoint(location)) {
			PickReward();
			CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("reward-get.wav");
		}
	}
}
void CharacterDiceSprite::_onTouchEnded(Touch *touch, Event *event) {
  auto target = event->getCurrentTarget();
  auto dungeonLayer = target->getParent()->getParent();
  
  auto position = dungeonLayer->convertTouchToNodeSpace(touch);
  
  bool characterMoved = this->getDelegate()->canCharacterMoveToLocation(position);
  
  if (characterMoved) {
    this->getDelegate()->characterMovedToLocation(this, position);
  } else {
    this->getDelegate()->characterDidNotMove(this);
  }
}
Example #25
0
bool UIColorEditor::beginTouchShowHide(cocos2d::Touch* touch, cocos2d::Event* event){
    auto target = static_cast<Sprite*>(event->getCurrentTarget());

    Point locationInNode = target->convertTouchToNodeSpace(touch);

    Size size = target->getContentSize();
    Rect rect = Rect(0, 0, size.width, size.height);

    if (rect.containsPoint(locationInNode)){
        mColorButtonShow = !mColorButtonShow;
        updateColorButtonDisplay();
    }
    return false;
}
Example #26
0
	bool ScutCxListItem::ccTouchBegan(CCTouch* touch, CCEvent* event)
	{	
		m_pVectorTouchBegan.clear();
		m_bCatchEndNode = false;		

		if(m_bSilence)
			return false;

		CCRect r;
		r.origin = CCPointZero;
		r.size = m_obContentSize;

		CCPoint pos = convertTouchToNodeSpace(touch);					

		if (r.containsPoint(pos))
		{
			if (m_pChildren && m_pChildren->count() > 0)
			{
				CCNode* pItem = NULL;
				for (int i = 0, l = m_pChildren->count(); i < l; ++i)
				{
					pItem = (CCNode *)m_pChildren->objectAtIndex(i);
					if (pItem)
					{
						MyTouchDispatcher((CCLayer*)pItem, TOUCHBEGIN,touch ,event);
					}

				}	 
			}
		} 
		/*
		else
		{
			CCNode* pItem = NULL; 
			if(m_pChildren && selected_)
			{
				for (int i = 0, l = m_pChildren->count(); i < l; ++i)
				{
					pItem = (CCNode *)m_pChildren->objectAtIndex(i);
					if (pItem && pItem->getClassType() >= CCLayer_classID )
					{
						((CCLayer*)pItem)->ccTouchBegan(touch,event);
					}
				}
			}
		}
		*/
		return true;

	}
Example #27
0
bool HSGameGuide::ccTouchBegan( CCTouch *pTouch, CCEvent *pEvent )
{
	CCLog("guide ccTouchBegan");
	if (!this->isVisible())
	{
		return false;
	}

#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
	CCPoint touchPoint =  pTouch->getLocation();
#elif(CC_TARGET_PLATFORM ==CC_PLATFORM_IOS)
	CCPoint touchPoint = convertTouchToNodeSpace(pTouch);
#endif

	if (m_ListerEvent.isTouch)
	{
		return false;
	}
	CCRect r = m_ListerEvent.rect;

	int w = r.size.width;

	int h = r.size.height;

	CCLog("guide w=%d,h=%d",w,h);

	if(w ==128 && h ==76)
	{
		CCLog("");
	}
#if WIN32
	//CCLog("---------------------------------");
	//CCLog("%.2f  %.2f",touchPoint.x,touchPoint.y);
	//CCLog("%.2f  %.2f  %.2f  %.2f",r.origin.x,r.origin.y,r.size.width,r.size.height);
#endif

	if(r.containsPoint(touchPoint))
	{
		CCLog("OK");
		m_ListerEvent.isTouch = true;
		if (r.size.equals(HSBase::GetTemplateScreenSize()))
		{
			return true;
		}
		CCLog("guide retrun false");
		return false;
	}
	return true;
}
void GameLevelLayer::onTouchesEnded(const std::vector<Touch*>& touches, Event *unused_event)
{
    for (int i=0;i<touches.size();++i)
    {
        Vec2 touchLocation = convertTouchToNodeSpace(touches[i]);
        if (touchLocation.x < 240)
        {
            m_pPlayer->setIsMovingFlag(false);
        }
        else
        {
            m_pPlayer->setIsJumpingFlag(false);
        }
    }
}
Example #29
0
bool TowerUpgradePanleLayer::onTouchBegan1(Touch *touch, Event *event)
{
	auto target = static_cast<Sprite*>(event->getCurrentTarget());

	Point locationInNode = target->convertTouchToNodeSpace(touch);
	Size size = target->getContentSize();
	Rect rect = Rect(0, 0, size.width, size.height);

	if (rect.containsPoint(locationInNode))
	{
		//target->setOpacity(180);
		return true;
	}
	return false;
}
Example #30
0
void TouchTrailLayer::onTouchesEnded(const std::vector<cocos2d::Touch*>& pTouches, Event *pEvent)
{
     for(auto& touch : pTouches){
        CCLOG("touch end");
        if (_map.find(touch) == _map.end()) continue;
        CCBlade *blade = _map[touch];
        blade->autoCleanup();
        Point point = convertTouchToNodeSpace(touch);
        if(touchTrailCallback != NULL){
            touchTrailCallback->touchEnd_TouchTrail(point);
        }
        _map.erase(touch);
        _bladeSparkle->stopSystem();
    }
    autoDrawAfterFinger();
}