Example #1
0
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;
}
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;
}
Example #3
0
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();
}
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;
}
Example #5
0
/* 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;
}
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();
    }    
Example #7
0
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;
}
Example #8
0
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 ;
}
Example #9
0
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;
}
Example #10
0
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);
		}
	}
}
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");
        }
        
    }
}
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);
}
Example #13
0
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
}
Example #14
0
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;
}
Example #15
0
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;
}
Example #16
0
bool HeroSprite::init()
{
	if(!HeroSprite::initWithSpriteFrameName("hero_idle_00.png"))
		return false;

	/*空闲动作*/
	CCArray *idleArray = CCArray::create();
	idleArray->retain();
	
	for (int i=0;i<6;i++)
	{
		CCSpriteFrame *frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(
			CCString::createWithFormat("hero_idle_%02d.png",i)->getCString());
	
		idleArray->addObject(frame);
	}

	CCAnimation *idleAnimation = CCAnimation::createWithSpriteFrames(idleArray,0.3f);
	this->idleAction = CCRepeatForever::create(CCAnimate::create(idleAnimation));
	idleAction->retain();

	/*攻击动作*/
	CCArray *attackArray = CCArray::create();
	attackArray->retain();

	for (int i=0;i<3;i++)
	{
		CCSpriteFrame *frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(
			CCString::createWithFormat("hero_attack_00_%02d.png",i)->getCString());

		attackArray->addObject(frame);
	}

	CCAnimation *attackAnimation = CCAnimation::createWithSpriteFrames(attackArray,0.1f);
	this->attackAction = CCSequence::create(CCAnimate::create(attackAnimation),
		CCCallFunc::create(this,callfunc_selector(ActionSprite::idle)),NULL);
	attackAction->retain();

	/*行走动作*/
	CCArray *walkArray = CCArray::create();
	walkArray->retain();

	for(int i= 0;i<8;i++)
	{
		CCSpriteFrame *frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(
			CCString::createWithFormat("hero_walk_%02d.png",i)->getCString());

		walkArray->addObject(frame);
	}

	CCAnimation *walkAnimation = CCAnimation::createWithSpriteFrames(walkArray,0.1f);
	walkAction = CCRepeatForever::create(CCAnimate::create(walkAnimation));
	walkAction->retain();

	/**
	*受伤动作
	*/

	CCArray *hurtArray = CCArray::create();
	hurtArray->retain();

	for (int i=0;i<3;i++)
	{
		CCSpriteFrame *frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(
			CCString::createWithFormat("hero_hurt_%02d.png",i)->getCString());

		hurtArray->addObject(frame);
	}

	CCAnimation *hurtAnimation = CCAnimation::createWithSpriteFrames(hurtArray,0.1f);
	this->hurtAction = CCSequence::create(CCAnimate::create(hurtAnimation),
		CCCallFunc::create(this,callfunc_selector(ActionSprite::idle)),NULL);
	hurtAction->retain();


	/*死亡动作*/

	CCArray *deadArray = CCArray::create();
	deadArray->retain();

	for (int i=0;i<5;i++)
	{
		CCSpriteFrame *frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(
			CCString::createWithFormat("hero_knockout_%02d.png",i)->getCString());

		deadArray->addObject(frame);
	}

	CCAnimation *deadAnimation = CCAnimation::createWithSpriteFrames(deadArray,0.1f);
	this->deadAction = CCSequence::create(CCAnimate::create(deadAnimation),
		CCBlink::create(2.0,10.0),NULL);
	deadAction->retain();


	this->centerToBottom = 39.0f;
	this->centerToSlide = 29.0f;
	this->hitPoints = 100;
	this->danage = 20;
	this->walkSpeed = 80;

	hitBox = this->createBoundBoxWithOrigin(ccp(-this->centerToSlide,-centerToBottom),CCSizeMake(centerToSlide*2,centerToBottom*2));
	attackBox = this->createBoundBoxWithOrigin(ccp(centerToSlide,-10),CCSizeMake(20,20));

	return true;

}
Example #17
0
bool Robot::init(){
	if(!ActionSprite::initWithSpriteFrameName("robot_idle_00.png")){
		return false;
	}
	
	int i;

	CCArray* idleFrame = CCArray::create();  //创建空闲动作的帧数组
	idleFrame->retain();   //防止函数返回时数组被释放

	for(i = 0;i < 5;i++ ){
		CCSpriteFrame* _frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(
			CCString::createWithFormat("robot_idle_%02d.png",i)->getCString());    //从内存中获得精灵帧
		idleFrame->addObject(_frame);
	}

	CCAnimation* idleAnimation = CCAnimation::createWithSpriteFrames(idleFrame,0.1f);
	CCAnimate* idleAnimate = CCAnimate::create(idleAnimation);
	this->_idleAction = CCRepeatForever::create(idleAnimate);
	this->_idleAction->retain();

	CCArray* attackFrame = CCArray::create();
	attackFrame->retain();

	for(i = 0;i < 5;i++ ){
		CCSpriteFrame* _frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(
			CCString::createWithFormat("robot_attack_%02d.png",i)->getCString());    //从内存中获得精灵帧
		attackFrame->addObject(_frame);
	}

	CCAnimation* attackAnimation = CCAnimation::createWithSpriteFrames(attackFrame,0.05f);
	CCAnimate* attackAnimate = CCAnimate::create(attackAnimation);
	this->_attackAction = CCSequence::create(attackAnimate,CCCallFunc::create(this,callfunc_selector(ActionSprite::idle)),NULL);
	this->_attackAction->retain();

	//行走动作
	CCArray* walkFrame = CCArray::createWithCapacity(8);
	walkFrame->retain();

	for(i=0;i<6;i++){
		CCSpriteFrame* _frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(
			CCString::createWithFormat("robot_walk_%02d.png",i)->getCString());
		walkFrame->addObject(_frame);
	}

	CCAnimation* walkAnimation = CCAnimation::createWithSpriteFrames(walkFrame,0.1f);
	CCAnimate* walkAnimate = CCAnimate::create(walkAnimation);
	this->_walkAction =  CCRepeatForever::create(walkAnimate);
	this->_walkAction->retain();

	//受伤动作
	CCArray* hurtFrame = CCArray::createWithCapacity(3);
	hurtFrame->retain();

	for(i=0;i<3;i++){
		CCSpriteFrame* _frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(
			CCString::createWithFormat("robot_hurt_%02d.png",i)->getCString());
		hurtFrame->addObject(_frame);
	}

	CCAnimation*  hurtAnimation = CCAnimation::createWithSpriteFrames( hurtFrame,0.1f);
	CCAnimate*  hurtAnimate = CCAnimate::create( hurtAnimation);
	this->_hurtAction =  CCSequence::create(hurtAnimate,CCCallFunc::create(this,callfunc_selector(ActionSprite::idle)),NULL);
	this->_hurtAction->retain();

	//死亡动作
	CCArray* deadFrame = CCArray::createWithCapacity(5);
	deadFrame->retain();

	for(i=0;i<5;i++){
		CCSpriteFrame* _frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(
			CCString::createWithFormat("robot_knockout_%02d.png",i)->getCString());
		deadFrame->addObject(_frame);
	}

	CCAnimation*  deadAnimation = CCAnimation::createWithSpriteFrames( deadFrame,0.1f);
	CCAnimate*  deadAnimate = CCAnimate::create( deadAnimation);
	this->_deadAction =  CCSequence::create(deadAnimate,CCBlink::create(1.0,10.0),NULL);
	this->_deadAction->retain();

	this->centerToSide = 39.0f;
	this->centerToBottom = 29.f;
	this->hurtPoint = 100;
	this->damage = 20;
	this->walkSpeed = 60;

	this->_hitBox = this->createBoundingBoxWithOrigin(ccp(-this->centerToSide,-this->centerToBottom),CCSizeMake(this->centerToSide*2,this->centerToBottom*2));
	this->_attackBox = this->createBoundingBoxWithOrigin(ccp(this->centerToSide,-5),CCSizeMake(25,20));

	return true;
}
Example #18
0
void GameLayer::checkingCollision() {

	CCArray *readyToRemoveEnemies = CCArray::create();
	readyToRemoveEnemies->retain();
	for (unsigned int i = 0; i < enemies->count(); i++) {
		CCSprite *enemy = (CCSprite *) enemies->objectAtIndex(i);
		//玩家
		if (enemy->boundingBox().intersectsRect(playerPlane->boundingBox())) {
			this->unschedule(schedule_selector(GameLayer::checkingCollision));
			this->unschedule(schedule_selector(GameLayer::shootBullet));

			backgroundSprite_1->stopAllActions();
			backgroundSprite_2->stopAllActions();

			this->unschedule(schedule_selector(GameLayer::showEnemy));
			this->unschedule(schedule_selector(GameLayer::showProp));
			//printf(": hero_blowup_%i.png\n", i);
			CCFiniteTimeAction *gameOverAction =
					this->frameAnimationWithFrameName("hero_blowup_%i.png",
							4, 0.1f, 1);
			CCCallFuncND *actionEnd = CCCallFuncND::create(this,
			callfuncND_selector(GameLayer::gameOverBlowUpEndedWithAction),
					playerPlane);
			playerPlane->runAction(
					CCSequence::create(gameOverAction, actionEnd, NULL));
		}

		CCObject* it = NULL;
		CCARRAY_FOREACH(bullets, it) {
			CCSprite *bullet = dynamic_cast<CCSprite*>(it);
			if (enemy->boundingBox().intersectsRect(bullet->boundingBox())) {
				if (enemy->boundingBox().origin.y
						+ enemy->boundingBox().size.height < winSize.height) {
					if (this->getEnemyHpWithTag(enemy->getTag()) >= 2
							&& superBullet) {
						enemy->setTag(enemy->getTag() - 2);
					} else {
						enemy->setTag(enemy->getTag() - 1);
					}
					int hp = this->getEnemyHpWithTag(enemy->getTag());
					if (hp <= 0) {
						readyToRemoveEnemies->addObject(enemy);
					} else {
						int type = this->getEnemyTypeWithTag(enemy->getTag());
						if (type == 2) {
							enemy->setDisplayFrame(
									CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(
											"enemy2_hit_1.png"));
						} else if (type == 3) {
							CCFiniteTimeAction *hitAction =
									this->frameAnimationWithFrameName(
											CCString::createWithFormat(
													"enemy3_hit_%i.png", i)->getCString(),
											2, 0.1f, 1);
							enemy->runAction(hitAction);
						}
					}
				}
			}
		}
	}
Example #19
0
    void startElement(void *ctx, const char *name, const char **atts)
    {
        CC_UNUSED_PARAM(ctx);
        CC_UNUSED_PARAM(atts);
        std::string sName((char*)name);
        if( sName == "dict" )
        {
            m_pCurDict = new CCDictionary();
            if (m_eResultType == SAX_RESULT_DICT && ! m_pRootDict)
            {
				// Because it will call m_pCurDict->release() later, so retain here.
                m_pRootDict = m_pCurDict;
				m_pRootDict->retain();
            }
            m_tState = SAX_DICT;

            CCSAXState preState = SAX_NONE;
            if (! m_tStateStack.empty())
            {
                preState = m_tStateStack.top();
            }

            if (SAX_ARRAY == preState)
            {
                // add the dictionary into the array
                m_pArray->addObject(m_pCurDict);
            }
            else if (SAX_DICT == preState)
            {
                // add the dictionary into the pre dictionary
                CCAssert(! m_tDictStack.empty(), "The state is wrong!");
                CCDictionary* pPreDict = m_tDictStack.top();
                pPreDict->setObject(m_pCurDict, m_sCurKey);
            }

			m_pCurDict->release();

            // record the dict state
            m_tStateStack.push(m_tState);
            m_tDictStack.push(m_pCurDict);
        }
        else if(sName == "key")
        {
            m_tState = SAX_KEY;
        }
        else if(sName == "integer")
        {
            m_tState = SAX_INT;
        }
        else if(sName == "real")
        {
            m_tState = SAX_REAL;
        }
        else if(sName == "string")
        {
            m_tState = SAX_STRING;
        }
        else if (sName == "array")
        {
            m_tState = SAX_ARRAY;
            m_pArray = new CCArray();
            if (m_eResultType == SAX_RESULT_ARRAY && m_pRootArray == NULL)
            {
                m_pRootArray = m_pArray;
                m_pRootArray->retain();
            }
            CCSAXState preState = SAX_NONE;
            if (! m_tStateStack.empty())
            {
                preState = m_tStateStack.top();
            }

            //CCSAXState preState = m_tStateStack.empty() ? SAX_DICT : m_tStateStack.top();
            if (preState == SAX_DICT)
            {
                m_pCurDict->setObject(m_pArray, m_sCurKey);
            }
            else if (preState == SAX_ARRAY)
            {
                CCAssert(! m_tArrayStack.empty(), "The state is worng!");
                CCArray* pPreArray = m_tArrayStack.top();
                pPreArray->addObject(m_pArray);
            }
            m_pArray->release();
            // record the array state
            m_tStateStack.push(m_tState);
            m_tArrayStack.push(m_pArray);
        }
        else
        {
            m_tState = SAX_NONE;
        }
    }
Example #20
0
void SGGeneralsLayer::initMsg()
{
    SGCardItem::addCardItemRes(sg_generalsLayer);//添加item资源
//    tableViewColumns = 5;
    
    tableViewHeight = 120;


    _allData = CCArray::create();
     _allData->retain();
    CCArray *array =CCArray::create();
    array->retain();
    array =SGPlayerInfo::sharePlayerInfo()->getOfficerCards();
    ;
    for (int i=0;i<6;i++) {
        stars[i]=0;
    }
    for(int i=0;i<array->count();i++)//统计素材每个星级的数量
    {
        SGBaseMilitaryCard *baseMilitaryCard = (SGBaseMilitaryCard *)array->objectAtIndex(i);
//        CCString *str_ = CCString::create(baseMilitaryCard->getClassName());
//        if (str_->isEqual(CCString::create("SGOfficerCard")))
//        {
        SGOfficerCard *card = (SGOfficerCard *)baseMilitaryCard;
        int po1 = SGTeamgroup::shareTeamgroupInfo()->getPositionId(1,card);
        int po2 = SGTeamgroup::shareTeamgroupInfo()->getPositionId(2,card);
        int po3 = SGTeamgroup::shareTeamgroupInfo()->getPositionId(3,card);
        if ( po1 == 0 && po2 ==0 && po3 == 0 && card->getIsProt() == 0)
        {
            int s = card->getCurrStar()-1;
            stars[s]+=1;
        }

//        }
    }

   
    for(int i=0;i<array->count();i++)
    {
        if (enterType==4) {//首页-强化-主将计
            SGSkillDataModel *lordSkill = SGStaticDataManager::shareStatic()->getLordSkillById(((SGOfficerCard *)array->objectAtIndex(i))->getLordId());
            if(lordSkill && lordSkill->getNextId() && ((SGOfficerCard *)array->objectAtIndex(i))->getLordMaxLevel()>lordSkill->getLevel())
            _allData->addObject(array->objectAtIndex(i));
            
        }
        else if (enterType==5)//首页-强化-武将计
        {
            SGSkillDataModel *officerSkill = SGStaticDataManager::shareStatic()->getGeneralSkillById(((SGOfficerCard *)array->objectAtIndex(i))->getOfficerSkil());
            if (officerSkill && officerSkill->getNextId() && ((SGOfficerCard *)array->objectAtIndex(i))->getSkillMaxLevel()>officerSkill->getSkillMaxLevel()) {
                 _allData->addObject(array->objectAtIndex(i));
            }
        }
        else if (enterType ==2)//首页-强化按键-强化武将
        {
            if (((SGOfficerCard *)array->objectAtIndex(i))->getCurrLevel() < ((SGOfficerCard *)array->objectAtIndex(i))->getMaxLevel())
            {
                _allData->addObject(array->objectAtIndex(i));
            }

        }
        else if(enterType == 3)//首页-转生-武将
        {
            SGOfficerCard *card = (SGOfficerCard *)array->objectAtIndex(i);
            int usednum = 0;
            
            if (card->getMaxStar())
            {
                if (card->getCurrStar()>=1)
                {
                    
                    CCArray* array =SGPlayerInfo::sharePlayerInfo()->getOfficerCards();
                    for(int i=0;i<array->count();i++)
                    {
                        SGBaseMilitaryCard *baseMilitaryCard = (SGBaseMilitaryCard *)array->objectAtIndex(i);
                        SGOfficerCard *card1 = (SGOfficerCard *)baseMilitaryCard;
                        int po1 = SGTeamgroup::shareTeamgroupInfo()->getPositionId(1,card1);
                        int po2 = SGTeamgroup::shareTeamgroupInfo()->getPositionId(2,card1);
                        int po3 = SGTeamgroup::shareTeamgroupInfo()->getPositionId(3,card1);
                        if ( po1 == 0 && po2 ==0 && po3 == 0 && card1->getIsProt() == 0 && card1->getSsid()!=card->getSsid() && card1->getProtoId() ==((SGOfficerCard*)card)->getProtoId() && card->getCurrStar() == card1->getCurrStar())
                        {
                            usednum++;
                        }
                    }
                    
                    
                }
                else
                {
                    int star = card->getCurrStar()-1;
                    bool po = !(SGTeamgroup::shareTeamgroupInfo()->isOnEmbattle((SGOfficerCard*)card));
                    usednum = stars[star]-(int)po;
                    
                }

                card->setAdvanceStuffNum(usednum);
                _allData->addObject(card);
            }
                                   
        
        }
        else
        {
            
            SGOfficerCard *card = (SGOfficerCard *)array->objectAtIndex(i);
            int usednum = 0;
           
            if (card->getMaxStar())
            {
                if (card->getCurrStar()>=1)
                {
                    
                    CCArray* array =SGPlayerInfo::sharePlayerInfo()->getOfficerCards();
                    for(int i=0;i<array->count();i++)
                    {
                        SGBaseMilitaryCard *baseMilitaryCard = (SGBaseMilitaryCard *)array->objectAtIndex(i);
                        SGOfficerCard *card1 = (SGOfficerCard *)baseMilitaryCard;
                        int po1 = SGTeamgroup::shareTeamgroupInfo()->getPositionId(1,card1);
                        int po2 = SGTeamgroup::shareTeamgroupInfo()->getPositionId(2,card1);
                        int po3 = SGTeamgroup::shareTeamgroupInfo()->getPositionId(3,card1);
                        if ( po1 == 0 && po2 ==0 && po3 == 0 && card1->getIsProt() == 0 && card1->getSsid()!=card->getSsid() && card1->getProtoId() ==((SGOfficerCard*)card)->getProtoId() && card->getCurrStar() == card1->getCurrStar())
                        {
                            usednum+=1;
                            if(usednum>3)
                                break;
                        }
                        //        }
                    }
                    
                    
                }
                else
                {
                    int star = card->getCurrStar()-1;
                    bool po = !(SGTeamgroup::shareTeamgroupInfo()->isOnEmbattle((SGOfficerCard*)card));
                    usednum = stars[star]-(int)po;
                    
                }
                
                card->setAdvanceStuffNum(usednum);
            }
           
            
            //SGSkillDataModel *lordSkill = SGStaticDataManager::shareStatic()->getLordSkillById(((SGOfficerCard *)array->objectAtIndex(i))->getLordId());
//            if ((lordSkill && lordSkill->getNextId() &&)|| lordSkill ==NULL)
			//如果不是小于等于,新手引导完,对应的武将就不见了,因为10级不小于10级,这个人就被加入武将列表了
            
			//if (((SGOfficerCard *)array->objectAtIndex(i))->getCurrLevel() <= ((SGOfficerCard *)array->objectAtIndex(i))->getMaxLevel())
            //{
                _allData->addObject(array->objectAtIndex(i));
            //}
            //else if(lordSkill && lordSkill->getNextId() && lordSkill->getLevel() < ((SGOfficerCard *)array->objectAtIndex(i))->getLordMaxLevel())
            //{
             // _allData->addObject(array->objectAtIndex(i));
            //}
            
            
            
        }
    }
    //_allData->retain();

    CCArray *offices = SGPlayerInfo::sharePlayerInfo()->getPropCards();
    //4.从强化主将计进入5.强化被动技进入
    if (enterType ==2 ||enterType ==3 ||enterType==4 ||enterType==5) {
            }
            else
            {
                CCObject *obj_ = NULL;
                CCARRAY_FOREACH(offices, obj_)
                {
                    SGPropsCard *card = (SGPropsCard *)obj_;
                    if (card && card->getType() == 1)
                    {
                        _allData->addObject(card);
                    }
                } 

            }