当前位置: 首页>>代码示例>>C++>>正文


C++ CCSequence类代码示例

本文整理汇总了C++中CCSequence的典型用法代码示例。如果您正苦于以下问题:C++ CCSequence类的具体用法?C++ CCSequence怎么用?C++ CCSequence使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CCSequence类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CCAssert

void Object::performAnimation(string name, SEL_CallFunc func){
    if (this->getCurrentObjectState() == ObjectStateDead && name.compare("Dead") != 0) {
        return;
    }
    
    CCSpriteBatchNode *currentSpriteBatchNode = m_pobBatchNode;
    CCSpriteBatchNode *newSpriteBatchNode = NULL;

    // Get the action pair by key name
    CCArray *actionPair = (CCArray *)actionsHashes->objectForKey(name);
    // If the action pair does not exist, return early
    if (!actionPair) {
        return;
    }
    newSpriteBatchNode = (CCSpriteBatchNode *)actionPair->objectAtIndex(1);
    ActionNode *actionNode = (ActionNode *)actionPair->objectAtIndex(0);
    
    this->stopActionByTag(ACTION_ANIMATION_TAG);
    
    // If required spriteBatchNode is different from current, replace it
    if (currentSpriteBatchNode != newSpriteBatchNode) {
        this->removeFromParentAndCleanup(false);
        this->setTexture(actionNode->getFirstSpriteFrame()->getTexture());
        this->setTextureRect(actionNode->getFirstSpriteFrame()->getRect());
        newSpriteBatchNode->addChild(this);
    }

    if (func != NULL) {
        CCAssert(dynamic_cast<CCRepeatForever*>(actionNode->getAnimation()) == NULL, "Not able to call function for CCRepeatForever action.");
        
        // Create animation followed by a function call
        CCSequence *seq = CCSequence::createWithTwoActions(actionNode->getAnimation(), CCCallFunc::create(this, func));
        seq->setTag(ACTION_ANIMATION_TAG);
        this->runAction(seq);
    } else {
        // Run the action
        actionNode->getAnimation()->setTag(ACTION_ANIMATION_TAG);
        this->runAction(actionNode->getAnimation());
    }
    
    // Run AI in this action
    {
        if (actionPair->count() > 2) {
            CCArray *AIActions = (CCArray *)actionPair->objectAtIndex(2);
            CCLOG("%s is running AI, total AIAction count: %d", identifier.c_str(), AIActions->count());
            for (int i = 0; i < AIActions->count(); i++) {
                CCAction *action = (CCAction*)AIActions->objectAtIndex(i);
                this->runAction(action);
            }
        }
    }
}
开发者ID:killing333,项目名称:Colors,代码行数:52,代码来源:Object.cpp

示例2: setContentOffsetInDurationWithoutCheck

void CScrollView::setContentOffsetInDurationWithoutCheck(const CCPoint& tOffset, float fDuration)
{
	m_pContainer->stopActionByTag(CSCROLLVIEW_MOVE_ACTION_TAG);
    CCSequence* pSequence = CCSequence::create(
		CCMoveTo::create(fDuration, tOffset),
		CCCallFunc::create(this, callfunc_selector(CScrollView::stoppedAnimatedScroll)),
		NULL);
	pSequence->setTag(CSCROLLVIEW_MOVE_ACTION_TAG);
	m_pContainer->runAction(pSequence);

	perpareAnimatedScroll();
	this->onScrolling();
	this->executeScrollingHandler(this);
}
开发者ID:Lewis2012,项目名称:CocosWidget,代码行数:14,代码来源:ScrollView.cpp

示例3: doShake

void GameEntityView::doShake()
{
	//CCLog("shake entity view ");
#define SHAKE_TAG 0xDEADBEEF
	if( getActionByTag(SHAKE_TAG) == NULL ) {
		CCSequence* shake = CCSequence::create(
			CCRotateBy::create(0.1f, 10, 0),
			CCRotateBy::create(0.2f, -20, 0),
			CCRotateBy::create(0.1f, 10, 0), 
			NULL);
		shake->setTag(SHAKE_TAG);

		runAction(shake);
	}
}
开发者ID:keless,项目名称:CastEngine,代码行数:15,代码来源:GameEntityView.cpp

示例4: setVelocity

void Witch::jump()
{ 
   setVelocity(1000);
	mIsJump = true;
	mWitch->stopActionByTag(1);
	mWitch->setRotation(0);
  
	auto callback = CallFunc::create([&](){slowDrop(); });
	CCActionInterval*   action = CCRotateBy::create(0.3f, 360);
	 
	CCSequence* sqn = CCSequence::create(action, callback, NULL);
	sqn->setTag(1);
	mWitch->runAction(sqn);

	SimpleAudioEngine::sharedEngine()->playEffect(SE::Jump);
}
开发者ID:sandfresh,项目名称:HalloweenJump,代码行数:16,代码来源:Witch.cpp

示例5: ccp

void GoBattleLayer::moveOutTouchUICompent() {
    if (m_pBgSprite->getActionByTag(MOVEIN_TAG)) {
        m_pBgSprite->stopAllActions();
        m_pBgSprite->setPosition(ccp(0.0, 615.0f + m_pGameState->getBottomOffset()));
        CCSequence* pMoveOUtAction = CCSequence::create(CCMoveTo::create(ANIMATION_DURING, ccp(0, 975.0f + m_pGameState->getBottomOffset())),
                CCCallFunc::create(this, callfunc_selector(GoBattleLayer::moveOutCallback)), NULL);
        pMoveOUtAction->setTag(MOVEOUT_TAG);
        m_pBgSprite->runAction(pMoveOUtAction);
        return;
    }
    if (!m_pBgSprite->getActionByTag(MOVEOUT_TAG)) {
        CCSequence* pMoveOUtAction = CCSequence::create(CCMoveTo::create(ANIMATION_DURING, ccp(0, 975.0f + m_pGameState->getBottomOffset())), CCCallFunc::create(this, callfunc_selector(GoBattleLayer::moveOutCallback)), NULL);
        pMoveOUtAction->setTag(MOVEOUT_TAG);
        m_pBgSprite->runAction(pMoveOUtAction);
    }
    
    m_isInScreen = false;
}
开发者ID:qjsy,项目名称:QjGit,代码行数:18,代码来源:GoBattleLayer.cpp

示例6: CCPoint

void CANavigationController::pushViewController(CAViewController* viewController, bool animated)
{
    if (this->getView()->getSuperview() == NULL)
    {
        return;
    }

    if (m_pContainer->getActionByTag(0))
    {
        return;
    }

    float x = m_pContainer->getFrame().size.width;
    
    CAViewController* lastViewController = m_pViewControllers.back();
    lastViewController->getView()->setFrame(CCRect(-x, 0, 0, 0));
    viewController->retain();
    viewController->m_pNavigationController = this;
    m_pViewControllers.push_back(viewController);
    if (viewController->getNavigationBarItem() == NULL && viewController->getTitle().compare("") != 0)
    {
        viewController->setNavigationBarItem(CANavigationBarItem::create(viewController->getTitle()));
    }
    m_pNavigationBar->pushItem(viewController->getNavigationBarItem());
    viewController->addViewFromSuperview(m_pContainer);
    
    if (animated)
    {
        m_pContainer->stopAllActions();
        m_pContainer->setFrame(CCRect(x, m_pContainer->getFrame().origin.y, 0, 0));
        
        CCDelayTime* delayTime = CCDelayTime::create(0.1f);
        CCMoveBy* moveBy = CCMoveBy::create(0.3f, CCPoint(-x, 0));
        CCEaseSineOut* easeBack = CCEaseSineOut::create(moveBy);
        CCCallFunc* finish = CCCallFunc::create(this, callfunc_selector(CANavigationController::pushViewControllerFinish));
        CCSequence* actions = CCSequence::create(delayTime, easeBack, finish, NULL);
        m_pContainer->runAction(actions);
        actions->setTag(0);
    }
    else
    {
        this->pushViewControllerFinish();
    }
}
开发者ID:jonesgithub,项目名称:CrossApp,代码行数:44,代码来源:CAViewController.cpp

示例7: CCPoint

CAViewController* CANavigationController::popViewControllerAnimated(bool animated)
{
    if (m_pViewControllers.size() == 1)
    {
        return NULL;
    }

    if (m_pContainer->getActionByTag(0))
    {
        return NULL;
    }

    unsigned int index = m_pViewControllers.size() - 2;
    CAViewController* showViewController = m_pViewControllers.at(index);
    showViewController->getView()->setFrame(CCRectZero);
    m_pContainer->addSubview(showViewController->getView());

    CAViewController* backViewController = m_pViewControllers.back();

    float x = m_pContainer->getFrame().size.width;
    backViewController->getView()->setFrame(CCRect(x, 0, 0, 0));

    if (animated)
    {
        m_pContainer->stopAllActions();
        m_pContainer->setFrameOrigin(CCPoint(-x, m_pContainer->getFrameOrigin().y));

        CCDelayTime* delayTime = CCDelayTime::create(0.2f);
        CCFrameOrginTo* moveTo = CCFrameOrginTo::create(0.4f, CCPoint(0, m_pContainer->getFrameOrigin().y));
        CCEaseSineOut* easeBack = CCEaseSineOut::create(moveTo);
        CCCallFunc* finish = CCCallFunc::create(this, callfunc_selector(CANavigationController::popViewControllerFinish));
        CCSequence* actions = CCSequence::create(delayTime, easeBack, finish, NULL);
        m_pContainer->runAction(actions);
        actions->setTag(0);
    }
    else
    {
        this->popViewControllerFinish();
    }
    return backViewController;
}
开发者ID:Rogerlin2013,项目名称:CrossApp,代码行数:41,代码来源:CAViewController.cpp

示例8: CC_BREAK_IF

bool CATableView::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{
    if (m_pTouches->count() > 0)
        return false;
    
    if (!CAScrollView::ccTouchBegan(pTouch, pEvent))
        return false;
    
    if (m_bAllowsSelection && this->isScrollWindowNotOutSide() == false)
    {
        CCPoint point = m_pContainer->convertTouchToNodeSpace(pTouch);
        
        std::deque<CATableViewCell*>::iterator itr;
        for (itr=m_pTableCells.begin(); itr!=m_pTableCells.end(); itr++)
        {
            CATableViewCell* cell = *itr;
            if (cell->getFrame().containsPoint(point))
            {
                CC_BREAK_IF(cell->isDisabled());
                
                m_pHighlightedTableCells = cell;

                CC_BREAK_IF(cell->isSelected());
                
                CCDelayTime* delayTime = CCDelayTime::create(0.1f);
                CCCallFunc* func = CCCallFunc::create(cell, callfunc_selector(CATableViewCell::setControlStateHighlighted));
                CCSequence* actions = CCSequence::create(delayTime, func, NULL);
                actions->setTag(0xffff);
                this->runAction(actions);
                break;
            }
        }
    }
    
    m_tBeginPoint = pTouch->getLocation();
    
    return true;
}
开发者ID:Jimlan,项目名称:CrossApp,代码行数:38,代码来源:CATableView.cpp

示例9: CCSequence

CCObject* CCSequence::copyWithZone(CCZone *pZone)
{
	CCZone* pNewZone = NULL;
	CCSequence* pCopy = NULL;
	if(pZone && pZone->m_pCopyObject) 
	{
		//in case of being called at sub class
		pCopy = (CCSequence*)(pZone->m_pCopyObject);
	}
	else
	{
		pCopy = new CCSequence();
		pZone = pNewZone = new CCZone(pCopy);
	}

	CCActionInterval::copyWithZone(pZone);

	pCopy->initOneTwo((CCFiniteTimeAction*)(m_pActions[0]->copy()->autorelease()), 
				(CCFiniteTimeAction*)(m_pActions[1]->copy()->autorelease()));

	CC_SAFE_DELETE(pNewZone);
	return pCopy;
}
开发者ID:Openxlive,项目名称:cocos2d-x-win8-tests-metro-style,代码行数:23,代码来源:CCActionInterval.cpp

示例10: DisplayChatMessage

void AwaiterInfoNode::DisplayChatMessage(const STRING& message)
{
    const INT ChatBallonTag = 67;
    
    m_ChatBalloon->stopActionByTag(ChatBallonTag);

    m_ChatBalloon->setOpacity(233);
    m_ChatBalloon->setVisible(true);
    m_ChatLabel->setVisible(true);
    m_ChatLabel->setOpacity(233);
    
    m_ChatLabel->setString(message.c_str());
    
    CCScaleTo* popEffect = CCScaleTo::create(0.3f, 1.3f);
    CCScaleTo* popReverse = CCScaleTo::create(0.3f, 1.f);
    CCDelayTime* delayTime = CCDelayTime::create(5.f);
    CCFadeOut* fadeOut = CCFadeOut::create(2.f);
    CCHide* hide = CCHide::create();
    CCSequence* popUpSequence = CCSequence::create(popEffect, popReverse, delayTime, fadeOut, hide, nullptr);
    popUpSequence->setTag(ChatBallonTag);
    
    m_ChatBalloon->runAction(popUpSequence);
}
开发者ID:Sinhyub,项目名称:GooRoomClient,代码行数:23,代码来源:AwaiterView.cpp

示例11: ccp

void GameScene::birdFlyLogic() {
    M3AudioManager::shareInstance()->playSound(SOUND_FLY);
    
    CCSprite* bird = (CCSprite*)getChildByTag(TAG_BIRD);
    bird->stopActionByTag(100);
    
    bird->setRotation(340);
    
    CCMoveBy* moveUp = CCMoveBy::create(0.2f, ccp(0, bird->getContentSize().height * 1.25f));
    CCEaseOut* upEout = CCEaseOut::create(moveUp, 2.25f);
    
    CCDelayTime* delay = CCDelayTime::create(0.2f);
    CCRotateBy* rotate = CCRotateBy::create(0.35f, 75);
    CCSequence* seq0 = CCSequence::create(delay, rotate, NULL);
    
    CCMoveBy* moveDown = CCMoveBy::create(1.5f, ccp(0, -screenSize.height * 1.5f));
    CCEaseIn* downIn = CCEaseIn::create(moveDown, 1.95f);
    
    CCSpawn* spawn = CCSpawn::create(seq0, downIn, NULL);
    
    CCSequence* seq = CCSequence::create(upEout, spawn, NULL);
    seq->setTag(100);
    bird->runAction(seq);
}
开发者ID:eclipsezym,项目名称:Cocos2d-x_studying,代码行数:24,代码来源:GameScene.cpp

示例12: MIN

void CAIndicator::setIndicator(const CCSize& parentSize, const CCRect& childrenFrame)
{
    CCScale9Sprite* indicator = dynamic_cast<CCScale9Sprite*>(m_pIndicator);
    
    int x = (int)indicator->getCenterOrigin().x * 10;
    int y = (int)indicator->getCenterOrigin().y * 10;
    
    
    if (m_eType == CAIndicatorTypeHorizontal)
    {
        float size_scale_x = parentSize.width / childrenFrame.size.width;
        size_scale_x = MIN(size_scale_x, 1.0f);
        
        float lenght_scale_x = parentSize.width / 2 - childrenFrame.origin.x;
        lenght_scale_x /= childrenFrame.size.width;
        
        CCSize size = m_obContentSize;
        size.width *= size_scale_x;
        
        if (lenght_scale_x < size_scale_x / 2)
        {
            size.width *= lenght_scale_x / (size_scale_x / 2);
        }
        if (1 - lenght_scale_x < size_scale_x / 2)
        {
            size.width *= (1 - lenght_scale_x) / (size_scale_x / 2);
        }
        size.width = MAX(size.height, size.width);
        indicator->setPreferredSize(size);
        
        CCPoint point = m_obContentSize;
        point.y *= 0.5f;
        point.x *= lenght_scale_x;
        point.x = MAX(point.x, size.width/2);
        point.x = MIN(point.x, m_obContentSize.width - size.width/2);
        indicator->setCenterOrigin(point);
    }
    else if (m_eType == CAIndicatorTypeVertical)
    {
        float size_scale_y = parentSize.height / childrenFrame.size.height;
        size_scale_y = MIN(size_scale_y, 1.0f);
        
        float lenght_scale_y = parentSize.height / 2 - childrenFrame.origin.y;
        lenght_scale_y /= childrenFrame.size.height;
        
        CCSize size = m_obContentSize;
        size.height *= size_scale_y;
        
        if (lenght_scale_y < size_scale_y / 2)
        {
            size.height *= lenght_scale_y / (size_scale_y / 2);
        }
        if (1 - lenght_scale_y < size_scale_y / 2)
        {
            size.height *= (1 - lenght_scale_y) / (size_scale_y / 2);
        }
        size.height = MAX(size.height, size.width);
		indicator->setPreferredSize(size);
        
        
        CCPoint point = m_obContentSize;
        point.x *= 0.5f;
        point.y *= lenght_scale_y;
        point.y = MAX(point.y, size.height/2);
        point.y = MIN(point.y, m_obContentSize.height - size.height/2);
        
        indicator->setCenterOrigin(point);
    }
    
    do
    {
        if (x == (int)indicator->getCenterOrigin().x * 10 && y == (int)indicator->getCenterOrigin().y * 10)
        {
            CC_BREAK_IF(indicator->getActionByTag(0xfff));
            
            CC_BREAK_IF(indicator->getOpacity() < 255);
            
            CCDelayTime* delayTime = CCDelayTime::create(0.2f);
            CCFadeOut* fadeOut = CCFadeOut::create(0.3f);
            CCEaseSineOut* easeSineOut = CCEaseSineOut::create(fadeOut);
            CCSequence* actions = CCSequence::create(delayTime, easeSineOut, NULL);
            actions->setTag(0xfff);
            this->runAction(actions);
        }
        else
        {
            CC_BREAK_IF(indicator->getOpacity() == 255);
            
            indicator->stopAllActions();
            this->setOpacity(255);
        }
    }
    while (0);
}
开发者ID:chuzig,项目名称:CrossApp,代码行数:94,代码来源:CAScrollView.cpp

示例13: changeLabel

void CTopLayer::updateRoleProperty(const TMessage& tMsg)
{
	UserData *user = DataCenter::sharedData()->getUser()->getUserData();

	CCScaleTo* sc1 = CCScaleTo::create(0.15f,1.3f);
	CCScaleTo* sc2 = CCScaleTo::create(0.35f,1.0f);
	CCSequence* sqes = CCSequence::create(sc1,sc2,nullptr);

	if (user->getCoin()!=atoi(m_coinLabel->getString()))
	{
		CProgressLabel *prolab = CProgressLabel::create();
		prolab->setLabel(m_coinLabel);
		prolab->changeValueTo(user->getCoin(),0.5f);
		CCSequence* sqes1 = (CCSequence*)sqes->copy();
		m_coinLabel->runAction(sqes1);
		this->addChild(prolab);

		CLabel *label = (CLabel*)m_ui->getChildByTag(130);
		int coin = user->getCoin()-atoi(m_coinLabel->getString());
		changeLabel(label, coin);
	}
	
	if (user->getRoleGold()!=atoi(m_moneyLabel->getString()))
	{
		CProgressLabel *prolab = CProgressLabel::create();
		prolab->setLabel(m_moneyLabel);
		prolab->changeValueTo(user->getRoleGold(),0.5f);
		CCSequence* sqes1 = (CCSequence*)sqes->copy();
		m_moneyLabel->runAction(sqes1);
		this->addChild(prolab);

		CLabel *label = (CLabel*)m_ui->getChildByTag(140);
		int coin = user->getRoleGold()-atoi(m_moneyLabel->getString());
		changeLabel(label, coin);
	}
	/*
	if (user->getRoleFood()!=atoi(m_foodLabel->getString()))
	{
		CProgressLabel *prolab = CProgressLabel::create();
		prolab->setLabel(m_foodLabel);
		prolab->changeValueTo(user->getRoleFood(),0.5f);
		CCSequence* sqes1 = (CCSequence*)sqes->copy();
		m_foodLabel->runAction(sqes1);
		this->addChild(prolab);

		CLabel *label = (CLabel*)m_ui->getChildByTag(170);
		int coin = user->getRoleFood()-atoi(m_foodLabel->getString());
		changeLabel(label, coin);
	}
	*/
	if (user->getFriends()!=atoi(m_foodLabel->getString()))
	{
		CProgressLabel *prolab = CProgressLabel::create();
		prolab->setLabel(m_foodLabel);
		prolab->changeValueTo(user->getFriends(),0.5f);
		CCSequence* sqes1 = (CCSequence*)sqes->copy();
		m_foodLabel->runAction(sqes1);
		this->addChild(prolab);

		CLabel *label = (CLabel*)m_ui->getChildByTag(170);
		int coin = user->getFriends()-atoi(m_foodLabel->getString());
		changeLabel(label, coin);
	}

	CLabel *action = (CLabel*)(m_ui->findWidgetById("action"));
	if (user->getRoleAction()!=atoi(action->getString()))
	{
		CCSequence* sqes2 = (CCSequence*)sqes->copy();
		action->runAction(sqes2);
		action->setString(CCString::createWithFormat("%d/%d",user->getRoleAction(), user->getActionLimit())->getCString());
	}

}
开发者ID:54993306,项目名称:Classes,代码行数:73,代码来源:TopLayer.cpp


注:本文中的CCSequence类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。