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


C++ CCAnimation::setDelayPerUnit方法代码示例

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


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

示例1: initFire

void CSmeltArmor::initFire()
{
	//获取参考位置
	CCNode* pNode = (CCNode*)m_ui->findWidgetById("fire_circle");
	CCPoint pPos = ccp(pNode->getPositionX()+15, pNode->getPositionY()+75);

	if(m_pFire1 == nullptr)
	{
		CCAnimation* pAnimation = AnimationManager::sharedAction()->getAnimation("9010");
		pAnimation->setDelayPerUnit(0.15f);
		m_pFire1 = CCSprite::create("skill/9010.png");
		m_pFire1->setPosition(pPos);
		m_pFire1->runAction(CCRepeatForever::create(CCAnimate::create(pAnimation)));
		m_pFire1->setVisible(false);
		m_pFire1->setScale(1.6f);
		pNode->getParent()->addChild(m_pFire1, pNode->getZOrder());
	}
	if(m_pFire2 == nullptr)
	{
		CCAnimation* pAnimation = AnimationManager::sharedAction()->getAnimation("9011");
		pAnimation->setDelayPerUnit(0.15f);
		m_pFire2 = CCSprite::create("skill/9011.png");
		m_pFire2->setPosition(pPos);
		m_pFire2->runAction(CCRepeatForever::create(CCAnimate::create(pAnimation)));
		m_pFire2->setVisible(false);
		m_pFire2->setScale(1.5f);
		pNode->getParent()->addChild(m_pFire2, pNode->getZOrder());
	}
}
开发者ID:54993306,项目名称:Classes,代码行数:29,代码来源:SmeltArmor.cpp

示例2: updateNowAnt_change

CCAnimate* SpiritsPlayer::updateNowAnt_change(MainRoledata roledata,int RepeatNum)
{
	//NPC动画
	CCAnimation* donghua = SpiritsPlayer::getNowAnt(roledata);
	if(roledata.actiontime>0)
	{
		donghua->setDelayPerUnit(roledata.actiontime/roledata.maxcut_zhan);
	}
	else  
	{
		donghua->setDelayPerUnit(2.0f/15.0f);//执行默认时间
	}
	donghua->setRestoreOriginalFrame(true);
	if(RepeatNum>0)
	{
		donghua->setLoops(RepeatNum);
	}
	else
	{
		donghua->setLoops(-1);
	}
	CCAnimate* playdonghua = CCAnimate::create(donghua);

	return playdonghua;
}
开发者ID:itismyera,项目名称:pro1,代码行数:25,代码来源:SpiritsPlayer.cpp

示例3: createActions

void GameLayer::createActions() {
    
    // Swing action for health drops
    CCFiniteTimeAction* easeSwing = CCSequence::create(CCEaseInOut::create(CCRotateTo::create(1.2f, -10), 2),
                                                       CCEaseInOut::create(CCRotateTo::create(1.2f, 10), 2),
                                                       NULL);
    
    _swingHealth = CCRepeatForever::create((CCActionInterval*)easeSwing);
    _swingHealth->retain();
    
    // Action sequence for shockwave : fade out, callback when done
    _shockwaveSequence = CCSequence::create(CCFadeOut::create(1.0f),
                                            CCCallFunc::create(this, callfunc_selector(GameLayer::shockwaveDone)),
                                            NULL);
    _shockwaveSequence->retain();
    
    // Action to grow bomb
    _growBomb = CCScaleTo::create(6.0f, 1.0);
    _growBomb->retain();
    
    // Action to rotate sprites
    CCActionInterval* rotate = CCRotateBy::create(0.5f, -90);
    _rotateSprite = CCRepeatForever::create(rotate);
    _rotateSprite->retain();
    
    // Animations
    CCAnimation* animation = CCAnimation::create();
    for (int i = 1; i <= 10; ++ i)
    {
        CCString* name = CCString::createWithFormat("boom%i.png", i);
        CCSpriteFrame* frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(name->getCString());
        animation->addSpriteFrame(frame);
    }
    
    animation->setDelayPerUnit(1 / 10.0f);
    animation->setRestoreOriginalFrame(true);
    _groundHit = CCSequence::create(CCMoveBy::create(0, ccp(0, _screenSize.height * 0.12f)),
                                    CCAnimate::create(animation),
                                    CCCallFuncN::create(this, callfuncN_selector(GameLayer::animationDone)),
                                    NULL);
    _groundHit->retain();
    
    
    animation = CCAnimation::create();
    for (int i = 1; i <=7; ++ i)
    {
        CCString* name = CCString::createWithFormat("explosion_small%i.png", i);
        CCSpriteFrame* frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(name->getCString());
        animation->addSpriteFrame(frame);
    }
    
    animation->setDelayPerUnit(0.5 / 7.0f);
    animation->setRestoreOriginalFrame(true);
    _explosion = CCSequence::create(CCAnimate::create(animation),
                                    CCCallFuncN::create(this, callfuncN_selector(GameLayer::animationDone)),
                                    NULL);
    _explosion->retain();

}
开发者ID:ivanchenhz,项目名称:IvanChenGit,代码行数:59,代码来源:GameLayer.cpp

示例4: setupAnimations

void Player::setupAnimations()
{

    CCAnimation* animation;
    CCSpriteFrame * frame;
    
    //create CCAnimation object
    animation = CCAnimation::create();
    //CCString * name;
    
    frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("reload.png");
    animation->addSpriteFrame(frame);
    frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("reloadready.png");
    animation->setDelayPerUnit(.5 / 2.0f);
    animation->setRestoreOriginalFrame(false);
    _cannotReload = CCSequence::create(
                                 CCAnimate::create(animation),
                                 CCCallFuncN::create(this, callfuncN_selector(Player::canReloadAnimationDone)),
                                 NULL);
    _cannotReload->retain();
    
    animation = CCAnimation::create();
    frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("reloadready.png");
    animation->addSpriteFrame(frame);
    frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("reload.png");
    animation->setDelayPerUnit(.5 / 2.0f);
    animation->setRestoreOriginalFrame(false);
    _canReload = CCSequence::create(
                                    CCAnimate::create(animation),
                                    CCCallFuncN::create(this, callfuncN_selector(Player::cannotReloadAnimationDone)),
                                    NULL);
    _canReload->retain();
    
    //create CCAnimation object
    animation = CCAnimation::create();
    CCString * name;
    for(int i = 0; i <= 20; i++) {
        name = CCString::createWithFormat("shell%i.png", i);
        frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(name->getCString());
        animation->addSpriteFrame(frame);
    }
    
    animation->setDelayPerUnit(.5 / 21.0f);
    animation->setRestoreOriginalFrame(false);
    animation->setLoops(10);
    _rotateShells = CCSequence::create(
                                 CCAnimate::create(animation),
                                 CCCallFuncN::create(this, callfuncN_selector(Player::shellAnimationDone)),
                                 NULL);
    _rotateShells->retain();
    
}
开发者ID:xgeraldx,项目名称:ETMG-Week2-3,代码行数:52,代码来源:Player.cpp

示例5: onEnter

void CTopLayer::onEnter()
{
	BaseLayer::onEnter();
	this->setTouchPriority(-100);
	UserData *user = DataCenter::sharedData()->getUser()->getUserData();

	m_coinLabel = (CLabel*)m_ui->getChildByTag(13);
	m_coinLabel->setString(ToString(user->getCoin()));

	m_moneyLabel = (CLabel*)m_ui->getChildByTag(14);
	m_moneyLabel->setString(ToString(user->getRoleGold()));
	// 
	m_foodLabel = (CLabel*)m_ui->getChildByTag(17);
	//m_foodLabel->setString(ToString(user->getRoleFood()));
	m_foodLabel->setString(ToString(user->getFriends()));

	CLabel *action = (CLabel*)(m_ui->findWidgetById("action"));
	action->setString(CCString::createWithFormat("%d/%d",user->getRoleAction(),user->getActionLimit())->getCString());

	CButton* add_food = (CButton*)m_ui->findWidgetById("btn_add_food");
	CButton* add_copper = (CButton*)m_ui->findWidgetById("btn_add_copper");
	CButton* add_soul = (CButton*)m_ui->findWidgetById("btn_add_soul");
	CButton* add_gold = (CButton*)m_ui->findWidgetById("btn_add_gold");
	CButton* add_friendship = (CButton*)m_ui->findWidgetById("btn_add_friendship");
	add_food->getSelectedImage()->setScale(1.1f);
	add_copper->getSelectedImage()->setScale(1.1f);
	add_soul->getSelectedImage()->setScale(1.1f);
	add_gold->getSelectedImage()->setScale(1.1f);
	add_friendship->getSelectedImage()->setScale(1.1f);
	add_food->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
	add_copper->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
	add_soul->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
	add_gold->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
	add_friendship->setOnClickListener(this, ccw_click_selector(CTopLayer::onAddResourceBtn));
	CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_HERO,this,GameMsghandler_selector(CTopLayer::updateRoleProperty));

	//绑定场景隐藏和显示的消息
	NOTIFICATION->addObserver(this, callfuncO_selector(CTopLayer::show), SHOW_TOP_LAYER, nullptr);
	NOTIFICATION->addObserver(this, callfuncO_selector(CTopLayer::hide), HIDE_TOP_LAYER, nullptr);

	CImageView *coin = (CImageView*)(m_ui->findWidgetById("coin"));
	CCAnimation *coinAnim = AnimationManager::sharedAction()->getAnimation("7033");
	coinAnim->setDelayPerUnit(0.3f);
	coin->runAction(CCRepeatForever::create(CCAnimate::create(coinAnim)));

	CImageView *gold = (CImageView*)(m_ui->findWidgetById("gold"));
	CCAnimation *goldAnim = AnimationManager::sharedAction()->getAnimation("7034");
	goldAnim->setDelayPerUnit(0.3f);
	gold->runAction(CCRepeatForever::create(CCAnimate::create(goldAnim)));
}
开发者ID:54993306,项目名称:Classes,代码行数:50,代码来源:TopLayer.cpp

示例6: PublicShowUI

SpiritMain::SpiritMain(CCLayer* layer,MainRoledata roledata,int zOrder)
{
	CCSprite* npc = SpiritMain::create(roledata.spiritUrl->getCString());
	if(npc==NULL)
	{
		CCLog("图层路径有误,请检查路径");
		return;
	}
	//设置NPC初始位置坐标(该坐标取决于当前画层)
	npc->setPosition(roledata.nowpoint);
	//NPC动画
	CCAnimation* donghua = SpiritMain::getNowAnt(roledata);
	if(roledata.actiontime>0)
	{
		donghua->setDelayPerUnit(roledata.actiontime/roledata.maxcut_zhan);
	}
	else
	{
	    donghua->setDelayPerUnit(2.0f/15.0f);//执行默认时间
	}
	donghua->setRestoreOriginalFrame(true);
	donghua->setLoops(-1);
	CCAnimate* playdonghua = CCAnimate::create(donghua);
	npc->runAction(playdonghua);
	layer->addChild(npc,zOrder); 
	//
	p_ui = new PublicShowUI();

	p_ui->setGameText(layer,roledata.spiritname,ccp(roledata.nowpoint.x,roledata.nowpoint.y+(int)(npc->getTexture()->getPixelsHigh()*0.3f)),12);

	//添加NPC人物脚下阴影
	CCSprite* yinzi = CCSprite::create(p_yinzi);
	if(yinzi==NULL)
	{
		CCLog("图层路径有误,请检查路径");
		return;
	}
	yinzi->setZOrder(0);
	yinzi->setPosition(ccp(roledata.nowpoint.x,roledata.nowpoint.y-(int)(npc->getTexture()->getPixelsHigh()*0.2f)));
	layer->addChild(yinzi);

	//添加NPC人物聊天背景
	CCSprite* sp_liaotianbd = CCSprite::create(p_liaotianbd);
	//sp_liaotianbd->setContentSize(CCSize(200,200));
	sp_liaotianbd->setZOrder(2);
	sp_liaotianbd->setPosition(ccp(roledata.nowpoint.x,roledata.nowpoint.y-(int)(npc->getTexture()->getPixelsHigh()*0.2f)));
	layer->addChild(sp_liaotianbd);


}
开发者ID:itismyera,项目名称:pro1,代码行数:50,代码来源:SpiritMain.cpp

示例7: loadPlistForAnimationWithName

CCAnimation* GameObject::loadPlistForAnimationWithName(CCString* animationName, CCString* className){
    
    CCAnimation *animationToReturn = CCAnimation::create();
    CCSpriteFrame *frame;
    CCString *frameName;
    
    CCDictionary *plist = CCDictionary::createWithContentsOfFile(CCString::createWithFormat("%s.plist",className->getCString())->getCString());
    CCDictionary *anim = (CCDictionary*)plist->objectForKey(animationName->getCString());
    CCString *fileNamePrefix = (CCString*)anim->objectForKey("fileNamePrefix");
    CCString *delay = (CCString*)anim->objectForKey("delay");
    CCString *animationFrames = (CCString*)anim->objectForKey("animationFrames");
    
    std::vector<int> vect;
    
    std::stringstream ss(animationFrames->getCString());
    int i;
    
    while (ss >> i)
    {
        vect.push_back(i);
         
        if (ss.peek() == ',')
            ss.ignore();
    }

    for (vector<int>::size_type i = 1; i <= vect.size(); ++i)
    {
        frameName = CCString::createWithFormat("%s%i.png",fileNamePrefix->getCString(),i);
        frame= CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(frameName->getCString());
        animationToReturn->addSpriteFrame(frame);
    }
    animationToReturn->setDelayPerUnit(delay->floatValue());
    return animationToReturn;
}
开发者ID:abhi6699,项目名称:mvcsample,代码行数:34,代码来源:GameObject.cpp

示例8: init

//! 在此层中管理enemy的运动 爆炸 移除 和添加
bool LayerEnemy::init() 			
{ 						
	CCLayer::init(); 			

	m_psmallArray = CCArray::create();
	CC_SAFE_RETAIN(m_psmallArray);
	m_psmallArray->retain();
	m_psmallArray->autorelease();

	//! 缓存爆炸动画
	CCAnimation *smallAnimation = CCAnimation::create();
	smallAnimation->setDelayPerUnit(0.1f);
	char nameBuf[100];
	for (int i = 0; i < 4; i++)
	{
		memset(nameBuf, 0, sizeof(nameBuf));
		sprintf(nameBuf, "enemy1_down%d.png", i + 1);
		smallAnimation->addSpriteFrame
			(CCSpriteFrameCache::sharedSpriteFrameCache()
			->spriteFrameByName(nameBuf));
	}
	CCAnimationCache::sharedAnimationCache()->addAnimation(smallAnimation, "SmallBlowUp");

	schedule(schedule_selector(LayerEnemy::addSmallEnemy), 0.5f);

	return true;				
} 						
开发者ID:dalechngame,项目名称:mygame,代码行数:28,代码来源:LayerEnemy.cpp

示例9: preloadResources

//-----------------------------------------------------------------------------
//todo 预载入资源,实现StartScene后将其删除
void CGameScene::preloadResources()
{
	CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("fishingjoy_resource.plist");

	//以下代码创建了两个不同的动画帧序列,使用时获取动画可以这么做:CCAnimation* animation = CCAnimationCache::sharedAnimationCache()->animationByName(const char* name);
	int frameCount = STATIC_DATA_INT("fish_frame_count");
	for (int type = k_Fish_Type_Red; type < k_Fish_Type_Count; type++)
	{
		//以下代码会创建animation失败
// 		CCAnimation* fishAnimation = CCAnimation::create();
// 		for (int i = 0; i < frameCount; i++)
// 		{
// 			fishAnimation->addSpriteFrameWithFileName(
// 				CCString::createWithFormat(STATIC_DATA_STRING("fish_frame_name_format"), type, i)->getCString());
// 		}

		CCArray* spriteFramesArray = CCArray::createWithCapacity(frameCount);
		for (int i = 0; i < frameCount; i++)
		{
			CCString* fileName = CCString::createWithFormat(STATIC_DATA_STRING("fish_frame_name_format"), type, i);
			CCSpriteFrame* spriteFrame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(fileName->getCString());
			spriteFramesArray->addObject(spriteFrame);
		}
		CCAnimation* fishAnimation = CCAnimation::createWithSpriteFrames(spriteFramesArray);
		fishAnimation->setDelayPerUnit(STATIC_DATA_FLOAT("fish_frame_delay"));		
		CCString* animationName = CCString::createWithFormat(STATIC_DATA_STRING("fish_animation"),type);
		CCAnimationCache::sharedAnimationCache()->addAnimation(fishAnimation, animationName->getCString());
	}

	
}
开发者ID:RainbowMin,项目名称:projects,代码行数:33,代码来源:GameScene.cpp

示例10: startProcess

void UICenterItem::startProcess()
{
	valid = false;
	// 创建一个动画 自身播放时间到后将valid 设置为true
	CCAnimation* animation = CCAnimation::create();
		std::string frameNames[] = {
			std::string("skill_p_00000.png"),
			std::string("skill_p_00001.png"),
			std::string("skill_p_00002.png"),
			std::string("skill_p_00003.png"),
			std::string("skill_p_00004.png"),
			std::string("skill_p_00005.png"),
		};
	for (int i = 0; i < 3; i++)
	{
		CCTexture2D *texture = CCTextureCache::sharedTextureCache()->addImage(frameNames[i].c_str());
		
		CCSpriteFrame *frame = CCSpriteFrame::frameWithTexture(texture,CCRectMake(0,0,texture->getContentSize().width,texture->getContentSize().height));
		
		animation->addSpriteFrame(frame);
	}
	CCSprite * temp = CCSprite::create();
	this->getParent()->addChild(temp);
	temp->setPosition(this->getPosition());
	animation->setDelayPerUnit(1.5f / 2);
	animation->setRestoreOriginalFrame(true);
	temp->runAction(CCSequence::create(CCAnimate::create(animation),
		CCCallFuncND::create(this, callfuncND_selector(UICenterItem::actionEnd_setValid), (void*)temp),NULL));

}
开发者ID:coderHsc,项目名称:sygame,代码行数:30,代码来源:UICenterBag.cpp

示例11: SheldonSecondPeriodCritical

void ASFightLayer::SheldonSecondPeriodCritical(){
    
    //1.击中特效
    CCSprite* hitEffect = CCSprite::createWithSpriteFrameName("Sheldon_C2_0.png");
    hitEffect->setScale(2);
    hitEffect->setPosition(ccp(size.width*2/3,winSize.height/2));
    addChild(hitEffect,4);
    
    CCAnimation* pAnimation = CCAnimation::create();
    for (int i = 0 ; i < 24; i++) {
        string texName = "Sheldon_C2_" + int2string(i) + ".png";
        CCSpriteFrame* frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(texName.c_str());
        pAnimation->addSpriteFrame(frame);
    }
    pAnimation->setDelayPerUnit(0.1);
    pAnimation->setRestoreOriginalFrame(true);
    pAnimation->setLoops(1);
    
    CCAnimate* pAnimate = CCAnimate::create(pAnimation);
    CCCallFunc* remove = CCCallFuncN::create(this, callfuncN_selector(ASFightLayer::removeThis));
    CCSequence* effect1 = CCSequence::create(pAnimate,remove,NULL);
    CCDelayTime* delay = CCDelayTime::create(1.5);
    CCCallFunc* hit = CCCallFuncN::create(this, callfuncN_selector(ASFightLayer::SheldonSecondHitEnemy));
    CCSequence* effect2= CCSequence::create(delay,hit,NULL);
    CCActionInterval* effect3 = CCSpawn::create(effect1,effect2,NULL);
    hitEffect->runAction(effect3);
}
开发者ID:nooboracle,项目名称:ForTest,代码行数:27,代码来源:SheldonCritical.cpp

示例12: init

bool PlaneLayer::init()
{
	bool bRet = false;
	do
	{
		CC_BREAK_IF(!CCLayer::init());
		CCSize winSize = CCDirector::sharedDirector()->getWinSize();
		//CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("ui/shoot.plist");
		CCSprite* plane = CCSprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("hero1.png"));
		plane->setPosition(ccp(winSize.width/2,plane->getContentSize().height/2));
		this->addChild(plane,0,AIRPLANE);

		CCBlink* blink = CCBlink::create(1,3);

		CCAnimation* animation = CCAnimation::create();
		animation->setDelayPerUnit(0.1f);
		animation->addSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("hero1.png"));
		animation->addSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("hero2.png"));
		CCAnimate* animate = CCAnimate::create(animation);

		plane->runAction(blink);
		plane->runAction(CCRepeatForever::create(animate));

		bRet = true;
	} while (0);
	return bRet;
	
}
开发者ID:980538137,项目名称:cocos2dx-demo,代码行数:28,代码来源:PlaneLayer.cpp

示例13: botisGangLied

void ASBot::botisGangLied(){
    
    CCSprite* ani = CCSprite::createWithSpriteFrameName("Miku_GL_0.png");
    ani->setRotation(-90);
    ani->setScale(2);
    ani->setPosition(ccp(size.width*5/40,size.height*80.3/90+winDif*2*alpha*alpha));
    player1->addChild(ani,100);
    
    CCAnimation* pAnimation = CCAnimation::create();
    for (int i = 0 ; i < 16; i++) {
        string texName = "Miku_GL_" + int2string(i) + ".png";
        CCSpriteFrame* frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(texName.c_str());
        pAnimation->addSpriteFrame(frame);
    }
    pAnimation->setDelayPerUnit(0.1);
    pAnimation->setRestoreOriginalFrame(true);
    pAnimation->setLoops(1);
    
    CCAnimate* pAnimate = CCAnimate::create(pAnimation);
    CCActionInterval* attack = CCMoveBy::create(1.8, ccp(size.width*30/40,0));
    CCActionInterval* effect = CCSpawn::create(pAnimate,attack,NULL);
    CCCallFunc* remove = CCCallFuncN::create(player1, callfuncN_selector(ASGame::removeSprite));
    CCCallFunc* add = CCCallFuncN::create(this, callfuncN_selector(ASBot::botMinusHpByGangLie));
    CCSequence* seq = CCSequence::create(effect,remove,add,NULL);
    
    ani->runAction(seq);
}
开发者ID:nooboracle,项目名称:ForTest,代码行数:27,代码来源:ASBotGangLie.cpp

示例14: onEnter

void CSharpTollgate::onEnter()
{
	BaseLayer::onEnter();

	CButton* pClose = CButton::create("common/back.png", "common/back.png");
	pClose->getSelectedImage()->setScale(1.1f);
	pClose->setPosition(VLEFT+50, VTOP-50);
	pClose->setOnClickListener(this,ccw_click_selector(CSharpTollgate::onClose));
	this->addChild(pClose, 999);


	m_cell = (CLayout*)(m_ui->findWidgetById("Cell"));
// 	m_cell->retain();
// 	m_ui->removeChild(m_cell);

	
	CCAnimation *bgAnim = AnimationManager::sharedAction()->getAnimation("8055");
	bgAnim->setDelayPerUnit(0.05f);
	CCSprite *bg = createAnimationSprite("skill/8055.png",VCENTER,bgAnim,true);
	bg->setScale(3.0f);
	m_ui->addChild(bg);

	m_tableView = (CTableView *)(m_ui->findWidgetById("scroll"));
	m_tableView->setDirection(eScrollViewDirectionHorizontal);
	m_tableView->setSizeOfCell(m_cell->getContentSize());
	//m_tableView->setSizeOfCell(CCSizeMake(790,115));
	m_tableView->setCountOfCell(0);
	m_tableView->setBounceable(false);
	m_tableView->setDataSourceAdapter(this,ccw_datasource_adapter_selector(CSharpTollgate::tableviewDataSource));	
	m_tableView->reloadData();

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

示例15: initAction

void RoleJoyPad::initAction()
{
    //元素动作数组
    m_actionArray = CCArray::createWithCapacity(5);
    m_actionArray->retain();
    
    char fileName1[64] = {0};
    char fileName2[64] = {0};
    char fileName3[64] = {0};

    for (int i = 1; i != 6; ++i)
    {
        sprintf(fileName1, "item_%d_3.png", i);
        sprintf(fileName2, "item_%d_4.png", i);
        sprintf(fileName3, "item_%d_5.png", i);
        
        CCSpriteFrame* frame1 = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(fileName1);
        CCSpriteFrame* frame2 = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(fileName2);
        CCSpriteFrame* frame3 = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(fileName3);
        
        //消除帧动画
        CCAnimation* animation = CCAnimation::create();
        animation->addSpriteFrame(frame1);
        animation->addSpriteFrame(frame2);
        animation->addSpriteFrame(frame3);
        animation->setDelayPerUnit(0.3f/3);
        animation->setRestoreOriginalFrame(false);
        CCAnimate* animate = CCAnimate::create(animation);
        
        CCSpawn* animate_action = CCSpawn::create(animate, CCMoveBy::create(0.15f, ccp(0, 30)), NULL);
        
        m_actionArray->addObject(animate_action);
    }
}
开发者ID:jindaw,项目名称:learn,代码行数:34,代码来源:roleJoyPad.cpp


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