本文整理汇总了C++中CCArray::retain方法的典型用法代码示例。如果您正苦于以下问题:C++ CCArray::retain方法的具体用法?C++ CCArray::retain怎么用?C++ CCArray::retain使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCArray
的用法示例。
在下文中一共展示了CCArray::retain方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CCPoint
CCArray * GameBoard::getNeighbors(Bubble * bubble){
CCArray * outArray = CCArray::create();
outArray->retain();
//left
if(bubble->col-1 >= 0) outArray->addObject(new CCPoint(bubble->col-1, bubble->row));
//right
if(bubble->col+1 < BUBBLE_COL) outArray->addObject(new CCPoint(bubble->col+1, bubble->row));
if(bubble->row % 2 == 0){
//topLeft
if(bubble->col-1 >= 0 && bubble->row-1 >= 0)
outArray->addObject(new CCPoint(bubble->col-1, bubble->row-1));
//topRight
if(bubble->row - 1 >= 0)
outArray->addObject(new CCPoint(bubble->col, bubble->row-1));
//bottomLeft
if(bubble->col-1 >= 0)
outArray->addObject(new CCPoint(bubble->col-1, bubble->row+1));
//bottomRight
outArray->addObject(new CCPoint(bubble->col, bubble->row+1));
}else{
//same like top
if(bubble->row-1 >= 0)
outArray->addObject(new CCPoint(bubble->col, bubble->row-1));
if(bubble->col+1 < BUBBLE_COL && bubble->row - 1 >= 0)
outArray->addObject(new CCPoint(bubble->col+1, bubble->row-1));
outArray->addObject(new CCPoint(bubble->col, bubble->row+1));
if(bubble->col+1 < BUBBLE_COL)
outArray->addObject(new CCPoint(bubble->col+1, bubble->row+1));
}
return outArray;
}
示例2: js_PluginFacebookJS_PluginFacebook_getFriends
JSBool js_PluginFacebookJS_PluginFacebook_getFriends(JSContext *cx, uint32_t argc, jsval *vp)
{
if (argc == 0) {
std::vector<sdkbox::FBGraphUser> ret = sdkbox::PluginFacebook::getFriends();
size_t size = ret.size();
CCArray *array = CCArray::create();
array->retain();
for (int i = 0; i < size; i++)
{
const sdkbox::FBGraphUser& friendInfo = ret.at(i);
CCDictionary *friendInfoDict = CCDictionary::create();
friendInfoDict->setObject(CCString::create(friendInfo.uid), FBGraphUser_ID);
friendInfoDict->setObject(CCString::create(friendInfo.name), FBGraphUser_NAME);
friendInfoDict->setObject(CCString::create(friendInfo.firstName), FBGraphUser_FIRST_NAME);
friendInfoDict->setObject(CCString::create(friendInfo.lastName), FBGraphUser_LAST_NAME);
friendInfoDict->setObject(CCBool::create(friendInfo.isInstalled), FBGraphUser_INSTALLED);
array->addObject(friendInfoDict);
}
jsval jsret = ccarray_to_jsval(cx, array);
JS_SET_RVAL(cx, vp, jsret);
return JS_TRUE;
}
JS_ReportErrorUTF8(cx, "wrong number of arguments");
return JS_FALSE;
}
示例3: animate
void Trooper::animate(const char* animationName, ...){
va_list params;
va_start(params, animationName);
const char* nextName = animationName;
if (m_current_sprite != NULL && m_animate_action != NULL){
m_current_sprite->stopAction(m_animate_action);
m_animate_action = NULL;
}
CCArray* animations = CCArray::array();
while (nextName){
CCAnimation* anim = TFAnimationCache::sharedAnimationCache()->animationByName(nextName);
if (m_current_sprite == NULL){
m_current_sprite = CCSprite::spriteWithSpriteFrame(anim->getFrames()->getObjectAtIndex(0));
this->addChild(m_current_sprite);
}
CCCallFuncO* notifyAction = CCCallFuncO::actionWithTarget(this, callfuncO_selector(Trooper::onAnimationStart), new CCString(nextName));
animations->addObject(notifyAction);
nextName = va_arg(params, const char*);
if (nextName == NULL){
CCCallFuncO* animAction = CCCallFuncO::actionWithTarget(this, callfuncO_selector(Trooper::animateForever), anim);
animations->addObject(animAction);
animAction->retain();
} else {
animations->addObject(CCAnimate::actionWithAnimation(anim));
}
notifyAction->retain();
}
m_current_sprite->runAction(CCSequence::actionsWithArray(animations));
va_end(params);
animations->retain();
}
示例4: attack
SGAttackInfo SGMonster::attack() {
atkState = MONSTER_ATK_PREV;
int actWhat = selectAttack();
CCLog("Monster Attack Dir = %d", actWhat);
nowAttackInfo.atk = this->atk;
nowAttackInfo.atkDir = act_attack[actWhat].atkDir;
nowAttackInfo.nFrames = act_attack[actWhat].nFrames;
int frame1, frame2;
frame1 = nowAttackInfo.nFrames / 2;
if(nowAttackInfo.nFrames%2 == 0) frame2 = frame1;
else frame2 = frame1 + 1;
monsterSprite->stopAllActions();
func_attack_first();
CCArray* pAttackChange = CCArray::create();
pAttackChange->retain();
pAttackChange->addObject(CCDelayTime::create(GAME_FRAME_SPEED*(frame1)));
pAttackChange->addObject(CCCallFunc::create(this, callfunc_selector(SGMonster::func_attack_second)));
pAttackChange->addObject(CCDelayTime::create(GAME_FRAME_SPEED*(frame2)));
pAttackChange->addObject(CCCallFunc::create(this, callfunc_selector(SGMonster::func_attack_end)));
pAttackChange->addObject(CCDelayTime::create(GAME_FRAME_SPEED));
monsterSprite->runAction(CCSpawn::create(act_attack[actWhat].act_attack,
CCSequence::create(pAttackChange)));
pAttackChange->release();
return nowAttackInfo;
}
示例5: findPathFromTo
/* Our implementation of the A* search algorithm */
CCArray* AStarPathNode::findPathFromTo(AStarNode *fromNode, AStarNode *toNode) {
CCArray *foundPath = CCArray::createWithCapacity(2);
foundPath->retain();
if(fromNode->position.x == toNode->position.x && fromNode->position.y == toNode->position.y){
return NULL;
}
CCArray *openList = CCArray::create();
CCArray *closedList = CCArray::create();
AStarPathNode *currentNode = NULL;
AStarPathNode *aNode = NULL;
AStarPathNode *startNode = AStarPathNode::createWithAStarNode(fromNode);
AStarPathNode *endNode = AStarPathNode::createWithAStarNode(toNode);
openList->addObject(startNode);
while(openList->count() > 0){
currentNode = AStarPathNode::lowestCostNodeInArray(openList);
if( currentNode->node->position.x == endNode->node->position.x &&
currentNode->node->position.y == endNode->node->position.y){
//Path Found!
aNode = currentNode;
while(aNode!=NULL&&aNode->previous != NULL){
//Mark path
foundPath->addObject(CCValue::valueWithCCPoint(ccp(aNode->node->position.x, aNode->node->position.y)));
aNode = aNode->previous;
}
foundPath->addObject(CCValue::valueWithCCPoint(ccp(aNode->node->position.x, aNode->node->position.y)));
return foundPath;
}else{
//Still searching
closedList->addObject(currentNode);
openList->removeObject(currentNode);
for(int i=0; i<currentNode->node->neighbors->count(); i++){
AStarPathNode *aNode = AStarPathNode::createWithAStarNode((AStarNode*)currentNode->node->neighbors->objectAtIndex(i));
aNode->cost = currentNode->cost+currentNode->node->costToNode(aNode->node)+aNode->node->costToNode(endNode->node);
aNode->previous = currentNode;
if(aNode->node->active && ! AStarPathNode::isPathNodeinList(aNode, openList) && !AStarPathNode::isPathNodeinList(aNode, closedList)){
openList->addObject(aNode);
}
}
}
}
//No Path Found
return NULL;
}
示例6: CCLOG
void CCAnimationCache::parseVersion1(CCDictionary* animations)
{
CCSpriteFrameCache *frameCache = CCSpriteFrameCache::sharedSpriteFrameCache();
CCDictElement* pElement = NULL;
CCDICT_FOREACH(animations, pElement)
{
CCDictionary* animationDict = (CCDictionary*)pElement->getObject();
CCArray* frameNames = (CCArray*)animationDict->objectForKey("frames");
float delay = animationDict->valueForKey("delay")->floatValue();
CCAnimation* animation = NULL;
if ( frameNames == NULL )
{
CCLOG("cocos2d: CCAnimationCache: Animation '%s' found in dictionary without any frames - cannot add to animation cache.", pElement->getStrKey());
continue;
}
CCArray* frames = CCArray::createWithCapacity(frameNames->count());
frames->retain();
CCObject* pObj = NULL;
CCARRAY_FOREACH(frameNames, pObj)
{
const char* frameName = ((CCString*)pObj)->getCString();
CCSpriteFrame* spriteFrame = frameCache->spriteFrameByName(frameName);
if ( ! spriteFrame ) {
CCLOG("cocos2d: CCAnimationCache: Animation '%s' refers to frame '%s' which is not currently in the CCSpriteFrameCache. This frame will not be added to the animation.", pElement->getStrKey(), frameName);
continue;
}
CCAnimationFrame* animFrame = new CCAnimationFrame();
animFrame->initWithSpriteFrame(spriteFrame, 1, NULL);
frames->addObject(animFrame);
animFrame->release();
}
if ( frames->count() == 0 ) {
CCLOG("cocos2d: CCAnimationCache: None of the frames for animation '%s' were found in the CCSpriteFrameCache. Animation is not being added to the Animation Cache.", pElement->getStrKey());
continue;
} else if ( frames->count() != frameNames->count() ) {
CCLOG("cocos2d: CCAnimationCache: An animation in your dictionary refers to a frame which is not in the CCSpriteFrameCache. Some or all of the frames for the animation '%s' may be missing.", pElement->getStrKey());
}
animation = CCAnimation::create(frames, delay, 1);
CCAnimationCache::sharedAnimationCache()->addAnimation(animation, pElement->getStrKey());
frames->release();
}
示例7: createAni
CCAnimate* createAni(const char* preName, int count,float unit,bool zero){
CCArray* frames = CCArray::create();
frames->retain();
std::string format(preName);
for(int i = 0;i < count; i++){
char name[50];
sprintf(name,(format + "%d.png").c_str(),zero ? i : i + 1);
CCSpriteFrame* frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(name);
frames->addObject(frame);
}
CCAnimation* ani = CCAnimation::createWithSpriteFrames(frames,unit);
CCAnimate* animate = CCAnimate::create(ani);
return animate;
}
示例8: checkDeleteBubbles
void GameBoard::checkDeleteBubbles(Bubble * bubble){
CCArray * neighbors = getNeighbors(bubble);
neighbors->retain();
Bubble * tempBubble;
bool hasChecked = false;
CCPoint *point;
CCPoint *checkedPoint;
for(int i = 0; i < neighbors->count(); i++){
point = (CCPoint *) neighbors->objectAtIndex(i);
//CCLOG("P:%i", (int) point->y);
//CCLOG("PP:%i", (int) point->x);
tempBubble = getBubble(point->y, point->x);
if (tempBubble == NULL) {
continue;
}
tempBubble->retain();
for (int j = 0; j < bubblesChecked->count(); j++) {
checkedPoint = (CCPoint *) bubblesChecked->objectAtIndex(j);
// CCLOG("XX:%i", (int) checkedPoint->x);
// CCLOG("YX:%i", (int) checkedPoint->y);
// CCLOG("XXX:%i", (int) tempBubble->col);
// CCLOG("YXX:%i", (int) tempBubble->row);
if (checkedPoint->x == tempBubble->col && checkedPoint->y == tempBubble->row) {
hasChecked = true;
break;
}
}
if (hasChecked) {
hasChecked = false;
continue;
}else{
bubblesChecked->addObject(point);
}
// CCLOG("ID:%i", (int) tempBubble->bubbleID);
// CCLOG("X:%i", (int) point->x);
// CCLOG("Y:%i", (int) point->y);
if(bubble->bubbleID == tempBubble->bubbleID){
bubblesDeleted->addObject(point);
checkDeleteBubbles(tempBubble);
}
}
return ;
}
示例9:
bool IntroLayer3::init()
{
if(!CCLayer::init())
return false;
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("Menus/Intro/Intro.plist");
//CCSpriteFrame *firstFrame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("bgIntro31.png");
CCSprite *firstFrame = CCSprite::create("Menus/Intro/bgIntro31.png");
this->addChild(firstFrame);
CCSize size = CCDirector::sharedDirector()->getWinSize();
firstFrame->setPosition(ccp(size.width/2,size.height/2));
CCArray *frameArray = CCArray::create();
frameArray->retain();
for(int i =1;i<4;i++)
{
CCSpriteFrame *frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(
CCString::createWithFormat("bgIntro3%d.png",i)->getCString()
);
frameArray->addObject(frame);
}
CCAnimation *animation = CCAnimation::createWithSpriteFrames(frameArray,1.0f);
CCAnimate *animate = CCAnimate::create(animation);
CCAction *loopAction = CCSequence::create(animate,CCCallFunc::create(this,callfunc_selector(IntroLayer3::startGame)),NULL);
loopAction->retain();
firstFrame->runAction(loopAction);
//firstFrame->runAction()
return true;
}
示例10: initEnemies
void EnemyCache::initEnemies() {
// create the enemies array containing further arrays for each type
enemies = CCArray::create();
enemies->initWithCapacity(EnemyEntity::EnemyType_MAX);
enemies->retain();
// create the arrays for each type
for (int i = 0; i < EnemyEntity::EnemyType_MAX; i++) {
// depending on enemy type the array capacity is set to hold the desired number of enemies
int capacity;
switch (i) {
case EnemyEntity::EnemyTypeVirus:
capacity = 50;
break;
// case EnemyEntity::EnemyTypeBoss:
// capacity = 1;
// break;
default:
break;
}
// no alloc needed since the enemies array will retain anything added to it
CCArray* enemiesOfType = CCArray::create();
enemiesOfType->createWithCapacity(capacity);
enemiesOfType->retain();
enemies->insertObject(enemiesOfType, i);
}
for (int i = 0; i < EnemyEntity::EnemyType_MAX; i++) {
CCArray* enemiesOfType = (CCArray*)enemies->objectAtIndex(i);
int numEnemiesOfType = enemiesOfType->capacity();
for (int j = 0; j < numEnemiesOfType; j++) {
EnemyEntity* enemy = EnemyEntity::enemyWithType(i);
batch->addChild(enemy, 0, i);
enemiesOfType->addObject(enemy);
}
}
}
示例11: getUserResultHandler
void getUserResultHandler(C2DXResponseState state, C2DXPlatType platType, CCDictionary *userInfo, CCDictionary *error)
{
if (state == C2DXResponseStateSuccess)
{
//输出用户信息
try
{
CCArray *allKeys = userInfo -> allKeys();
allKeys->retain();
for (int i = 0; i < allKeys -> count(); i++)
{
CCString *key = (CCString *)allKeys -> objectAtIndex(i);
CCObject *obj = userInfo -> objectForKey(key -> getCString());
CCLog("key = %s", key -> getCString());
if (dynamic_cast<CCString *>(obj))
{
CCLog("value = %s", dynamic_cast<CCString *>(obj) -> getCString());
}
else if (dynamic_cast<CCInteger *>(obj))
{
CCLog("value = %d", dynamic_cast<CCInteger *>(obj) -> getValue());
}
else if (dynamic_cast<CCDouble *>(obj))
{
CCLog("value = %f", dynamic_cast<CCDouble *>(obj) -> getValue());
}
}
allKeys->release();
}
catch(...)
{
CCLog("==============error");
}
}
}
示例12: Init
void Solider::Init()
{
m_frameCache = CCSpriteFrameCache::sharedSpriteFrameCache();
m_frameCache->addSpriteFramesWithFile("Solider.plist");
m_batchNode = CCSpriteBatchNode::create("Solider.png");
m_Solider = CCSprite::createWithSpriteFrameName("attack_0.png");
m_Solider->setPosition(m_pos);
m_batchNode->addChild(m_Solider);
m_layer->addChild(m_batchNode);
m_arrayAction = CCArray ::createWithCapacity(3);
m_arrayAction->retain();
CCArray *idleAnimFrames = CCArray::createWithCapacity(2);
idleAnimFrames->retain();
for(int i = 0 ;i < 2 ;i++)
{
CCSpriteFrame *frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(CCString::createWithFormat("stand_%d.png",i)->getCString());
idleAnimFrames->addObject(frame);
}
CCAnimation *idleAnimation = CCAnimation ::createWithSpriteFrames(idleAnimFrames,float(1.0/5.0)) ;
//move animation
CCArray *moveAnimFrames = CCArray::createWithCapacity(10);
moveAnimFrames->retain();
for(int i = 0 ;i < 8 ;i++)
{
CCSpriteFrame *frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(CCString::createWithFormat("move_%d.png",i)->getCString());
moveAnimFrames->addObject(frame);
}
CCAnimation* moveAnimation = CCAnimation ::createWithSpriteFrames(moveAnimFrames,float(1.0/12.0)) ;
//attack animation
CCArray *attackAnimFrames = CCArray::createWithCapacity(10);
attackAnimFrames->retain();
for(int i = 0 ;i < 7 ;i++)
{
CCSpriteFrame *frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(CCString::createWithFormat("attack_%d.png",i)->getCString());
attackAnimFrames->addObject(frame);
}
CCAnimation* attackAnimation = CCAnimation ::createWithSpriteFrames(attackAnimFrames,float(1.0/12.0)) ;
this->m_actionStand = CCRepeatForever::create(CCAnimate::create(idleAnimation));
this->m_actionStand->retain();
m_arrayAction->addObject(m_actionStand);
this->m_actionMove = CCRepeatForever::create(CCAnimate::create(moveAnimation));
this->m_actionMove->retain();
m_arrayAction->addObject(m_actionMove);
this->m_actionAttack = CCRepeatForever::create(CCAnimate::create(attackAnimation));
this->m_actionAttack->retain();
m_arrayAction->addObject(m_actionAttack);
m_Solider->setScale(0.3);
m_Solider->runAction(m_actionMove);
timeFinishMove = ccpLength(ccpSub(m_targetPos, m_pos))/ m_maxVelocity/60;
CCLOG("timefinishMove is : %f", timeFinishMove);
}
示例13: GameUserSelectedNotification
void GameUserSelectedNotification(const char *userlist)
{
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
if(NULL == gSDKCallback)
{
CCLOG("The gSDKCallback pointer is null, please SetSDKCallback!");
return;
}
if(userlist)
{
CCArray *UserList = CCArray::create();
UserList->retain();
CFMJson::Reader reader;
CFMJson::FMValue root;
if (!reader.parse(std::string(userlist), root, false))//userlist
{
return;
}
CFMJson::FMValue arr = root["userlist"];
printf("arr.size() = %d\n", arr.size());
if (arr.size() > 0)
{
for(int i = 0; i < arr.size(); i++)
{
BnUser *user = BnUser::create();
user->BnSetUserKey(arr[i]["userkey"].asCString());
user->BnSetUserName(arr[i]["username"].asCString());
user->BnSetUserHead(arr[i]["headurl"].asCString());
user->BnSetGameData(arr[i]["gamedata"].asCString());
user->BnSetGameScore(arr[i]["gamescore"].asCString());
UserList->addObject(user);
}
}
gSDKCallback->BnGameUserSelectedNotification(UserList);
}
#endif
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
if (gSDKCallback)
{
CCArray *UserList = CCArray::create();
CFMJson::Reader reader;
CFMJson::FMValue root;
if (!reader.parse(userlist, root, false))//userlist
{
return;
}
log("a—0");
CFMJson::FMValue arr = root;
for (int i = 0; i < arr.size(); i++)
{
BnUser *user = new BnUser();
user->BnSetUserKey(arr[i]["userkey"].asCString());
user->BnSetUserName(arr[i]["username"].asCString());
user->BnSetUserHead(arr[i]["headurl"].asCString());
user->BnSetGameData(arr[i]["gamedata"].asCString());
user->BnSetGameScore(arr[i]["gamescore"].asCString());
log("a_1");
if(UserList==NULL)
{
log("+++++");
}
UserList->addObject(user);
log("a_2");
}
log("123_3");
gSDKCallback->BnGameUserSelectedNotification(UserList);
log("123_34");
}
else
__android_log_print(ANDROID_LOG_INFO,"SDKCallbackError","The gSDKCallback pointer is null ,please SetSDKCallback!");
#endif
}
示例14: SimulationSkill
bool BattleCharacter::SimulationSkill(BattleCharacter* pInvoker,CCArray* pTargets)
{
CCArray* pEffectTargets =CCArray::createWithCapacity(pTargets->count());
pEffectTargets->retain();
bool bCommandSuc = false;
for(unsigned int index = 0;index<pTargets->count();index++)
{
SkillDataLoader* pData = SkillDataLoader::instance();
int nID = pInvoker->m_nOnUseID;
int nType = 0;
pData->GetSkillValue(DATA_SKILL_TYPE,nID,&nType);
BattleCharacter* pTarget = (BattleCharacter*)pTargets->objectAtIndex(index);
//判断是否产生伤害
bool bDamage = (nType == SKILL_TYPE_DAMAGE)||(nType == SKILL_TYPE_DAMAGE_AND_HEALING);
bool bHealing = (nType == SKILL_TYPE_HEALING)||(nType == SKILL_TYPE_DAMAGE_AND_HEALING);
if(bDamage&&(!pInvoker->InSameRace(pTarget)))
{
int nDamage = BattleCharacter::GetSkillHPDam(pInvoker,pTarget);
pTarget->m_nHP += -nDamage;
pTarget->m_nHPoffset += -nDamage;
//pTarget->ShowMapDam(nDamage);
//pTarget->RefreshHPBar();
bCommandSuc = true;
AquireExpFromAttack(pInvoker,pTarget);
if (!pEffectTargets->containsObject(pTarget))
{
pEffectTargets->addObject(pTarget);
}
}
else if(bHealing&&pInvoker->InSameRace(pTarget))
{
int nHealing = BattleCharacter::GetSkillHPHeal(pInvoker,pTarget);
pTarget->m_nHP += nHealing;
pTarget->m_nHPoffset += nHealing;
bCommandSuc = true;
AquireExpFromAttack(pInvoker,pTarget);
if (!pEffectTargets->containsObject(pTarget))
{
pEffectTargets->addObject(pTarget);
}
}
}
if(bCommandSuc)
{
CCArray* pAnimations = AnimationManager::instance()->CreateMapSkillAnimations(pInvoker->m_nOnUseID);
CCAnimation* pMapSkillAnimation = (CCAnimation*)pAnimations->objectAtIndex(0);
CCSprite* pMapSkillSprite = CCSprite::createWithSpriteFrame(dynamic_cast<CCAnimationFrame*>(pMapSkillAnimation->getFrames()->objectAtIndex(0))->getSpriteFrame());
CCSprite* pMapSkillBackgroundSprite = NULL;
CCAnimation* pMapSkillBackgroundAniation = NULL;
if (pAnimations->count()>1)
{
pMapSkillBackgroundAniation = (CCAnimation*)pAnimations->lastObject();
pMapSkillBackgroundSprite = CCSprite::createWithSpriteFrame(dynamic_cast<CCAnimationFrame*>(pMapSkillBackgroundAniation->getFrames()->objectAtIndex(0))->getSpriteFrame());
}
if (pMapSkillBackgroundSprite!=NULL)
{
pMapSkillBackgroundSprite->setPosition(ccp(pInvoker->m_nCommandX,pInvoker->m_nCommandY));
CharacterStatus::m_pMap->addChild(pMapSkillBackgroundSprite,MAX_LAYER_ZORDER-1,LAYER_MAPSKILLBACKGROUND_ID);
pMapSkillBackgroundSprite->runAction(CCRepeatForever::create(CCAnimate::create(pMapSkillBackgroundAniation)));
pMapSkillSprite->setPosition(ccp(pMapSkillBackgroundSprite->getPositionX(),pMapSkillBackgroundSprite->getPositionY()+GetSpriteTextureHeight(pMapSkillBackgroundSprite)));
}
else
{
pMapSkillSprite->setPosition(ccp(pInvoker->m_nCommandX,pInvoker->m_nCommandY));
}
CharacterStatus::m_pMap->addChild(pMapSkillSprite,MAX_LAYER_ZORDER);
pMapSkillSprite->runAction(CCSequence::create(CCAnimate::create(pMapSkillAnimation),CCCallFuncND::create(pInvoker,callfuncND_selector(BattleCharacter::MapSkillEffectsCallBack),(void*)pEffectTargets),NULL));
}
return bCommandSuc;
}
示例15: CCArray
CCArray * GameBoard::getFloatBubbles(){
if (bubblesConnected != NULL && bubblesConnected->count() > 0) {
bubblesConnected->removeAllObjects();
}else{
bubblesConnected = new CCArray();
}
CCLOG("CL:%i", bubblesConnected->count());
Bubble * bubble;
for (int i=0; i<BUBBLE_COL; i++) {
bubble = getBubble(0, i);
if(bubble != NULL){
bubblesConnected->addObject(new CCPoint(bubble->col, bubble->row));
}
}
for (int i=0; i<BUBBLE_COL; i++) {
bubble = getBubble(0, i);
if(bubble != NULL){
getConnectedBubble(bubble);
}
}
CCLOG("CL:%i", bubblesConnected->count());
if(bubblesConnected != NULL){
CCPoint *p;
CCLog("(==Connected==)");
for (int i=0; i<bubblesConnected->count(); i++) {
p = (CCPoint *) bubblesConnected->objectAtIndex(i);
//CCLog("(%d,%d)", (int) p->y, (int) p->x);
}
CCLog("(====)");
}
CCArray * out = CCArray::create();
out->retain();
Bubble *tempbubble;
CCPoint * tempPoint;
bool hasFLoat;
for (int i=0; i<bubblesData->count(); i++) {
tempbubble = (Bubble*) bubblesData->objectAtIndex(i);
if (tempbubble->bubbleID == 0) continue;
hasFLoat = true;
for (int m = 0; m<bubblesConnected->count(); m++) {
tempPoint = (CCPoint *) bubblesConnected->objectAtIndex(m);
if (tempPoint->x == tempbubble->col && tempPoint->y == tempbubble->row) {
hasFLoat = false;
break;
}
}
if (hasFLoat) {
out->addObject(new CCPoint(tempbubble->col, tempbubble->row));
}
}
CCPoint *p;
CCLog("(==Out==)");
for (int i=0; i<out->count(); i++) {
p = (CCPoint *) out->objectAtIndex(i);
CCLog("(%d,%d)", (int) p->y, (int) p->x);
}
CCLog("(====)");
return out;
}