Ejemplo n.º 1
0
CCObject *HTouchEnabledLayerColor::dismissNodeEx(int command, HEndDismissNode *notify) {
    CCNode *node = notify->getNode();
    do {
        if (node->getParent() != this) break;
        HBakNodeInfo *info = NULL;
        for (int i = m_pBakNodeList->count() - 1; i >= 0; --i) {
            info = (HBakNodeInfo *)m_pBakNodeList->objectAtIndex(i);
            if (node == info->m_pNode) {
                break;
            }
            info = NULL;
        }
        if (!info) break;
        
        node->retain();
        node->removeFromParentAndCleanup(false);
        info->m_pParent->addChild(node, info->m_iIndex);
        node->setScaleX(info->m_fScaleX);
        node->setScaleY(info->m_fScaleY);
        node->setPosition(info->m_ptPos);
        node->release();
        
        restoreAllPriorities(info);
        m_pBakNodeList->removeObject(info);
    } while (false);
    if (notify->getTarget() && notify->getAction()) {
        (notify->getTarget()->*notify->getAction())(node);
    }
    return NULL;
}
Ejemplo n.º 2
0
bool IBBTouchElement::doCCTouchBegan(cocos2d::CCTouch *pTouch, cocos2d::CCEvent *pEvent)
{
	if(m_touchListeners->count() == 0) return false;
	bool result = false;
	
	pTouch->retain();
	
	CCPoint pos = pTouch->getLocationInView();
	pos = CCDirector::sharedDirector()->convertToGL(pos);
	
	CCObject* it = NULL;
	
	CCARRAY_FOREACH(m_touchListeners, it)
	{
		CCNode* node = dynamic_cast<CCNode*>(it);
		
		node->retain();
		
		if(BBTouchEventUtils::hitTest(node, pTouch))
		{
						
			result = m_blockTouchFlow;
					
			onTouchPress(node, pTouch);
			BBTouchEventUtils::press(node, pos);
		}
	}
Ejemplo n.º 3
0
CCObject *HTouchEnabledLayerColor::dismissAllNodesEx(int command, CCObject *param) {
    HBakNodeInfo *info = NULL;
    for (int i = m_pBakNodeList->count() - 1; i >= 0; --i) {
        info = (HBakNodeInfo *)m_pBakNodeList->objectAtIndex(i);
        CCNode *node = info->m_pNode;
        node->retain();
        node->removeFromParentAndCleanup(false);
        info->m_pParent->addChild(node, info->m_iIndex);
        node->setScaleX(info->m_fScaleX);
        node->setScaleY(info->m_fScaleY);
        node->setPosition(info->m_ptPos);
        node->release();
        restoreAllPriorities(info);
    }
    m_pBakNodeList->removeAllObjects();
    return NULL;
}
Ejemplo n.º 4
0
CCNode* ActorBoardLayer::viewTabIndex(CCNode* pTabLayer,int index)
{
    CCNode* node = NULL;
    switch (index) {
        case 0:
        {
          //  node = BagLayer::create();
            CCSize winsize = CCDirector::sharedDirector()->getWinSize();
            ClothesLayer* layer1 = ClothesLayer::create();
            BagLayer* layer2 = BagLayer::create();
            node = CCNode::create();
          
            node->addChild(layer1);
            layer1->setAnchorPoint(ccp(0,0));
            layer1->setPosition(ccp(50, winsize.height/3));
            node->addChild(layer2);
            
            layer2->setPosition(layer1->boundingBox().size.width+150,0);
 
            
        }
            break;
        case 1:
            node = CCLabelTTF::create(
                         "1 page", "Arial", 22);
            break;
        case 2:
            node = CCLabelTTF::create(
                                      "2 page", "Arial", 22);
            break;
        case 3:
            node = CCLabelTTF::create(
                                      "3 page", "Arial", 22);
            break;
        default:
            node = CCLabelTTF::create(
                                      "no page", "Arial", 22);
            break;
    }
    node->retain();
    return node;
}
Ejemplo n.º 5
0
bool CCScene::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
    CC_SAFE_RELEASE_NULL(m_touchNode);
    const CCPoint p = pTouch->getLocation();
    CCObject *node;
    CCNode *touchNode = NULL;
    CCNode *checkNode = NULL;
    bool visible = true;
    sortAllTouchableNodes();
    CCARRAY_FOREACH(m_touchableNodes, node)
    {
        checkNode = touchNode = dynamic_cast<CCNode*>(node);

        // check node is visible
        visible = true;
        do
        {
            visible = visible && checkNode->isVisible();
            checkNode = checkNode->getParent();
        } while (checkNode && visible);
        if (!visible) continue;

        const CCRect boundingBox = touchNode->getCascadeBoundingBox();
        if (boundingBox.containsPoint(p))
        {
            touchNode->retain();
            bool ret = touchNode->ccTouchBegan(pTouch, pEvent);
            if (ret && touchNode->isRunning())
            {
                m_touchNode = touchNode;
                m_touchNode->retain();
            }
            touchNode->release();
            if (ret) return true;
        }
    }