void SGTaskLayer::showTaskBlank() { for (int ii = 0; ii < pxData->count(); ii++) { CCSpriterX *resultx = (CCSpriterX *)pxData->objectAtIndex(ii); resultx->setVisible(true); resultx->play(); } }
void SG_SkillsID25::activateBuffSkills(SGBattleMap *battleMap, SGAttackList *attackList, GameIndex index, GameIndex index1) { SGHeroLayer* heroLayer = NULL; bool isMy = false; if(SGBattleManager::sharedBattle()->getBattleLayer()->getIsMyRound()) { heroLayer = getenemyHero(); isMy = false; }else{ heroLayer = getmyHero(); isMy = true; } int rand = 0; if (attackList->getAttackType() == kattacktwo) { rand = 1; }else{ rand = 2; } SGGridBase *grid = heroLayer->battleMap->m_seveBuffGrid[index.i][index.j]; SG_BuffBase *buff = SG_BuffManager::initBuffManager(this, attackList)->getbfBase(); bool isExist = grid->setBuffListObj(buff); if (rand == 2) { SGGridBase *grid1 = heroLayer->battleMap->m_seveBuffGrid[index1.i][index1.j]; SG_BuffBase *buff1 = SG_BuffManager::initBuffManager(this, attackList)->getbfBase(); grid1->setBuffListObj(buff1); } if (isExist) { ResourceManager::sharedInstance()->bindTexture("animationFile/dmdy.plist", RES_TYPE_BATTLE_IMAGE, sg_battleLayer); int tag = buff->getEffectType() * BUFF_EFFECT_TAG; for (int i = 0; i < rand; i++) { CCSpriterX *fermEffect = CCSpriterX::create("animationFile/dmdy.scml", true, true); fermEffect->setanimaID(0); fermEffect->setisloop(true); fermEffect->setPosition(GameConfig::getGridPoint(index.i, index.j - i,isMy)); heroLayer->addChild(fermEffect, 0, tag); fermEffect->play(); } } }
// 在我方底线放置一排防御墙,可以抵御下回合75%伤害, //(上限为武将攻击力)如果没有受到伤害,将以主将攻击力25%的伤害进行全列攻击 void SGHeroSkill27::activateSkill_20063(SGHeroLayer *heroLayer, SGHeroLayer *heroLayer1, int roleid, int buffid, int round, float value1, float value2, float value3) { CCDictionary *buff = CCDictionary::create(); buff->setObject(heroLayer, "hero"); buff->setObject(heroLayer1, "hero1"); buff->setObject(CCString::createWithFormat("%d",roleid), "roleid"); buff->setObject(CCString::createWithFormat("%d",buffid), "buffId");// buff->setObject(CCString::createWithFormat("%d",round), "round"); buff->setObject(CCString::createWithFormat("%f",value1), "value1"); if (buffid == 1012) {//虚空盾 if (heroLayer && value2 > 0) { heroLayer->changBloodNum(value2, true, true); } }else{ buff->setObject(CCString::createWithFormat("%f",value2), "value2"); } heroLayer->addBuff(buff); bool isme = true; if (SGPlayerInfo::sharePlayerInfo()->getPlayerRoleId() != roleid) { isme = false; } // CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("animationFile/dq.plist"); ResourceManager::sharedInstance()->bindTexture("animationFile/dq.plist", RES_TYPE_BATTLE_IMAGE, sg_battleLayer); for (int i = 0; i < mapList; i++) { CCSpriterX *fermEffect = CCSpriterX::create("animationFile/dq.scml", true, true); fermEffect->setanimaID(0); fermEffect->setisloop(true); CCPoint pos = GameConfig::getGridPoint(isme ? mapRow : -mapRow, abs(isme ? -i : (mapList - 1 - i)),true); fermEffect->setPosition(ccp(pos.x, isme ? heroLayer->uibgY : (screenheight - heroLayer->uibgY))); fermEffect->play(); heroLayer->addChild(fermEffect, SKILLS_BULLET_TAG, SKILLS_BULLET_TAG + i); } }
//星空上加入随机闪烁的星星 void SGSpecialBattleLayer::flashStarOnSpace() { ResourceManager::sharedInstance()->bindTexture("animationFile/flashStar.plist", RES_TYPE_LAYER_UI, sg_specialBattleLayer); CCSize winSize = CCDirector::sharedDirector()->getWinSize(); for (int i = 0; i < 3; i++) { //生成随机位置 int posX = CCRANDOM_0_1() * (winSize.width - 30) + 15; int posY = CCRANDOM_0_1() * (winSize.width - 200) + 160; CCSpriterX *star = CCSpriterX::create("animationFile/lanxing.scml", true, true); this->addChild(star, 11); star->setanimaID(0); star->setisloop(true); star->setPosition(ccpAdd(ccp(posX, posY), ccp(0, 0))); star->play(); } }
//将所有己方墙转化为火球进行攻击(墙当前的列不变)攻击力等同于当前墙的防御值。 void SGHeroSkill21::activateSkill_20038(SGHeroLayer *heroLayer, SGHeroLayer *heroLayer1, float value1, int roleid, int jianid) { // 业务逻辑无关 seconds = 0; //如果没有array数据 if (SGSkillManager::shareSkill()->array->count()) { ShiBing* sb = (ShiBing*)SGSkillManager::shareSkill()->array->objectAtIndex(0); int ap = /*sb->getDef() * */value1; SGGridBase* sbgrid = (SGGridBase*)sb->getPrinceGridArray()->objectAtIndex(0); heroLayer->battleMap->removeAttackedSB(sb, 0); heroLayer->showEffectLayer(7, true, sb->getSbindex()); float a = 0.5 * ANIMA_TIME_NUM; CCDelayTime *dtime = CCDelayTime::create(a); seconds += a; CCCallFuncND *call = CCCallFuncND::create(SGSkillManager::shareSkill(), callfuncND_selector(SGSkillManager::huoQiu), (void*)sb); heroLayer->runAction(CCSequence::create(dtime, call, NULL)); float b = 0.6 * ANIMA_TIME_NUM; float c = a + b; float time = 0.5; float sbTime = time/ (mapRow + sbgrid->getIndex().i); bool isme = true; if (SGPlayerInfo::sharePlayerInfo()->getPlayerRoleId() != roleid) { isme = false; } int num = jianid; num = 1; // CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(CCString::createWithFormat("animationFile/jian_%d.plist", num)->getCString()); ResourceManager::sharedInstance()->bindTexture(CCString::createWithFormat("animationFile/jian_%d.plist", num)->getCString(), RES_TYPE_BATTLE_IMAGE, sg_battleLayer); CCSpriterX *fermEffect = CCSpriterX::create(CCString::createWithFormat("animationFile/jian_%d.scml",num)->getCString(), true, true); fermEffect->setanimaID(0); fermEffect->setisloop(true); fermEffect->play(); heroLayer->addChild(fermEffect, SKILLS_BULLET_TAG, SKILLS_BULLET_TAG + num); if (false == isme) { //MMDEBUG: FLIPY fermEffect->setScaleY(-1); fermEffect->setPosition(ccp(0, GameConfig::getGridSize().height * 1.5)); // fermEffect->setCCSpriterXFlipY(true); } fermEffect->setPosition(GameConfig::getGridPoint(isme ? sbgrid->getIndex().i : -sbgrid->getIndex().i + OLD_EFFECT_FLIPY_FIX, abs(isme ? -sbgrid->getIndex().j : (mapList - 1 - sbgrid->getIndex().j)),true)); CCHide *hide = CCHide::create(); CCDelayTime *time_d = CCDelayTime::create(c); CCShow *show = CCShow::create(); CCMoveTo *move = CCMoveTo::create(time, GameConfig::getGridPoint(isme ? -mapRow : mapRow + OLD_EFFECT_FLIPY_FIX, abs(isme ? -sbgrid->getIndex().j : (mapList - 1 - sbgrid->getIndex().j)) ,true)); fermEffect->runAction(CCSequence::create(hide, time_d, show, move, NULL)); seconds += c; // 逻辑开始 for (int i = 0; i <= mapRow; i++) { if (ap > 0) { float b = sbTime * (i+sbgrid->getIndex().i); b = b + c; if (i == mapRow) { //播放打到底线动作 GameSbIndex *sbin = new GameSbIndex(); sbin->i = mapRow; sbin->j = sbgrid->getIndex().j; CCDelayTime* delay1 = CCDelayTime::create(b + sbTime); seconds += (b + sbTime); CCCallFuncND* call1 = CCCallFuncND::create(this, callfuncND_selector(SGHeroSkill21::removeBullet), (void*)(SKILLS_BULLET_TAG + num)); CCCallFuncND* call12 = CCCallFuncND::create(SGSkillManager::shareSkill(), callfuncND_selector(SGSkillManager::playBulletBlast), (void*)sbin); heroLayer->runAction(CCSequence::create( delay1, call1, call12, NULL)); CCDelayTime* delay11 = CCDelayTime::create(b); seconds += b; CCCallFuncND* call11 = CCCallFuncND::create(SGSkillManager::shareSkill(), callfuncND_selector(SGSkillManager::changBloodNum), (void*)ap); CCDelayTime* delay13 = CCDelayTime::create(0.4); seconds += 0.4; CCCallFunc* call3 = CCCallFunc::create(this, callfunc_selector(SGHeroSkill21::callback)); heroLayer1->runAction(CCSequence::create( delay11, call11, delay13, call3, NULL)); }else{ SGGridBase *grid = heroLayer1->battleMap->myGrids[i][abs(mapList-1-sbgrid->getIndex().j)]; if (grid) { if (grid->getStype() == knormal) { ShiBing* sb = heroLayer1->battleMap->getShiBingWithGrid(grid); if(sb) { CCDelayTime* delay = CCDelayTime::create(b); seconds += b; CCCallFuncND* call = CCCallFuncND::create(SGSkillManager::shareSkill(), callfuncND_selector(SGSkillManager::removesb), heroLayer1); sb->runAction(CCSequence::create( delay, call, NULL)); ap = ap - sb->getDef(); { heroLayer1->showBattleLabel( sb->getDef() , "battle/sub_hp_label.png", SB_ADD_AND_SUB_AP_W, SB_ADD_AND_SUB_AP_H, sb->getSbindex(),false,b); } if (sb->getSbType() == ksbtwo || sb->getSbType() == ksbfour) { i++; } } }else if(grid->getStype() == kdefend) { ShiBing* sb = heroLayer1->battleMap->getShiBingWithGrid(grid); if(sb) { ap = ap - sb->getDef(); //if (ap < 0) { heroLayer1->showBattleLabel( sb->getDef() + ap , "battle/sub_hp_label.png", SB_ADD_AND_SUB_AP_W, SB_ADD_AND_SUB_AP_H, sb->getSbindex(),false,b); } sb->setDef(-ap); CCDelayTime* delay = CCDelayTime::create(b); seconds += b; CCCallFuncND* call = CCCallFuncND::create(SGSkillManager::shareSkill(), callfuncND_selector(SGSkillManager::removesb), heroLayer1); sb->runAction(CCSequence::create( delay, call, NULL)); } }else { SGAttackList* attack = heroLayer1->battleMap->getAttackListByGrid(grid); if(attack) { ap = ap - attack->getAp(); int a = 0; if (ap >= 0) { a = attack->getAp(); }else{ a = ap; } attack->heroSkillSubAp(a); attack->setAp(-ap); if ((grid->getStype() == kattackfour || grid->getStype() == kattacktwo) && ap > 0) { attack->playEffectWithType(kAttackEffect); } CCDelayTime* delay = CCDelayTime::create(b); seconds += b; CCCallFuncND* call = CCCallFuncND::create(SGSkillManager::shareSkill(), callfuncND_selector(SGSkillManager::removesb), heroLayer1); ShiBing *sb = (ShiBing*)attack->attackSbs->objectAtIndex(0); sb->runAction(CCSequence::create( delay, call, NULL)); //if (ap < 0) { heroLayer1->showBattleLabel( sb->getDef() + ap , "battle/sub_hp_label.png", SB_ADD_AND_SUB_AP_W, SB_ADD_AND_SUB_AP_H, sb->getSbindex(),false,b); } if (attack->getAttackType() == kattacknormal) { i += 2; }else{ i += 1; } } } if (ap <= 0) { GameSbIndex *sbin = new GameSbIndex(); sbin->i = i; sbin->j = sbgrid->getIndex().j; CCDelayTime* delay12 = CCDelayTime::create(b); seconds += b; CCCallFuncND* call12 = CCCallFuncND::create(this, callfuncND_selector(SGHeroSkill21::removeBullet), (void*)(SKILLS_BULLET_TAG + num)); CCCallFuncND* call14 = CCCallFuncND::create(SGSkillManager::shareSkill(), callfuncND_selector(SGSkillManager::playBulletBlast), (void*)sbin); CCDelayTime* delay13 = CCDelayTime::create(0.4); seconds += 0.4; CCCallFunc* call3 = CCCallFunc::create(this, callfunc_selector(SGHeroSkill21::callback)); heroLayer->runAction(CCSequence::create( delay12, call12, call14, delay13, call3, NULL)); } } } } else{ break; } } } else { SGSkillManager::shareSkill()->array->removeAllObjects(); SGSkillManager::shareSkill()->num = 0; SGSkillManager::shareSkill()->valueNum = 0; SGSkillManager::shareSkill()->roleidNum = 0; SGSkillManager::shareSkill()->jianNum = 0; SGSkillManager::shareSkill()->heroMe->battleMap->refreshMapGrid(true); } }
void SGEquipStrengLayer::initView() { ResourceManager::sharedInstance()->bindTexture("sgequipslayer/sgequipslayer.plist", RES_TYPE_LAYER_UI, sg_equipstrengLayer); ResourceManager::sharedInstance()->bindTexture("animationFile/qhtexiao.plist", RES_TYPE_LAYER_UI, sg_equipstrengLayer); ResourceManager::sharedInstance()->bindTexture("animationFile/wjzs.plist", RES_TYPE_LAYER_UI, sg_equipstrengLayer); ResourceManager::sharedInstance()->bindTexture("sgpropslayer/sgpropslayer.plist", RES_TYPE_LAYER_UI, sg_equipstrengLayer); ResourceManager::sharedInstance()->bindTexture("sgvipinfolayer/sgvipinfolayer.plist", RES_TYPE_LAYER_UI, sg_equipstrengLayer); //提供横条图 ResourceManager::sharedInstance()->bindTexture("sggeneralinfolayer/ofcNewUi.plist", RES_TYPE_LAYER_UI, sg_equipstrengLayer); SGNotificationCenter *notification = SGNotificationCenter::sharedNotificationCenter(); notification->addObserver(MSG_EQUIP_NEWSTRENG, this, callfuncO_selector(SGEquipStrengLayer::equipStrenghListener)); notification->addObserver(MSG_EQUIP_NEWAUTOSTRENG, this, callfuncO_selector(SGEquipStrengLayer::autoEquipStrenghListener)); if (CCEGLView::sharedOpenGLView()->getFrameSize().width == ipadResource.size.width ||CCEGLView::sharedOpenGLView()->getFrameSize().width == ipadhdResource.size.width) { adpt_wid = -40; adpt_hei = -20; shift_ipad = 70; } else if (CCEGLView::sharedOpenGLView()->getFrameSize().height == iphonehdResource.size.height ||CCEGLView::sharedOpenGLView()->getFrameSize().height == iphoneResource.size.height) { adpt_wid = -10; adpt_hei = -50; } else { adpt_wid = -20; adpt_hei = -50; } CCSize winSize = CCDirector::sharedDirector()->getWinSize(); float btmheight = SGMainManager::shareMain()->getBottomHeight(); float frameheight1 = skewingY(81); float hgt=skewingY(233); menu->setZOrder(10); if (winSize.height == 1136) { frameheight1 = skewing(81); hgt = skewing(233); } //左火 CCSpriterX *fermEffect = CCSpriterX::create("animationFile/qhhyA.scml", true, true); fermEffect->setanimaID(0); fermEffect->setisloop(true); addChild(fermEffect, 10, 0); //右火 CCSpriterX *fermEffect1 = CCSpriterX::create("animationFile/qhhyB.scml", true, true); fermEffect1->setCCSpriterXFlipX(true); fermEffect1->setanimaID(0); fermEffect1->setisloop(true); addChild(fermEffect1, 10, 1); SGEquipmentDataModel *temp = SGStaticDataManager::shareStatic()->getEquipById(_card->getItemId()); SGMainManager::shareMain()->addEquipPng(temp->getIconId(),sg_equipstrengLayer); CCString *str = CCString::createWithFormat("equip%d.png",temp->getIconId()); CCSprite *item = CCSprite::createWithSpriteFrameName(str->getCString()); this->addChild(item,2, 123); //创建4中颜色武将背景 std::vector<std::string> str_vec; if(winSize.height != 1136) { str_vec.push_back("greenBg.png"); str_vec.push_back("blueBg.png"); str_vec.push_back("purpleBg.png"); str_vec.push_back("orangeBg.png"); } //inphone 5 根据武将地图来 else { str_vec.push_back("greenBgI5.png"); str_vec.push_back("blueBgI5.png"); str_vec.push_back("purpleBgI5.png"); str_vec.push_back("orangeBgI5.png"); } int starLev = _card->getCurrStar(); starLev = starLev<3?3:starLev; starLev = starLev>6?6:starLev; //光效背景图片 CCSprite * lightBg = CCSprite::createWithSpriteFrameName(str_vec[starLev-3].c_str()); this->addChild(lightBg , 0 , 1919); float adjustY = 0; CCSprite *bigbg = NULL; item->setAnchorPoint(ccp(0.5, 0)); if (winSize.height == 960) { adjustY = 40; frameSize = CCRectMake(0, 0 , 768, 413); this->setItemID("pad装备底图.png",true); fermEffect->setScale(winSize.width/768); fermEffect1->setScale(winSize.width/768); fermEffect->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(-264, -287 +26))); fermEffect1->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(264, -287 +26))); item->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(0, -365))); lightBg->setZOrder(0); lightBg->setScaleX(winSize.width / lightBg->getContentSize().width); lightBg->setScaleY(1.6); lightBg->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(0, -title_bg->getContentSize().height - lightBg->getContentSize().height*0.5*lightBg->getScaleY())));; } else if (winSize.height == 1136) { adjustY=31; frameSize = CCRectMake(0, 520 -(winSize.height - hgt*1.18 - title_bg->getContentSize().height), 768, (winSize.height - hgt*1.18 - title_bg->getContentSize().height)); this->setItemID("carditembg.png",true); fermEffect->setScaleX(winSize.width/768); fermEffect1->setScaleX(winSize.width/768); fermEffect->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(-264, -361+26))); fermEffect1->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(264, -361+26))); item->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(0, -450))); CCSprite *temp = CCSprite::createWithSpriteFrameName("carditembg.png"); lightBg->setScaleX(winSize.width / lightBg->getContentSize().width); lightBg->setScaleY(temp->getContentSize().height * 0.75 / lightBg->getContentSize().height); lightBg->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(0, -title_bg->getContentSize().height - temp->getContentSize().height * 0.8 /2 + 16) )); } else { adjustY = 55; bigbg = CCSprite::createWithSpriteFrameName("pad装备底图.png"); this->addChild(bigbg,-100); bigbg->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(0, - title_bg->getContentSize().height - bigbg->getContentSize().height*.45))); fermEffect->setPosition(ccpAdd(bigbg->getPosition(), ccp(-bigbg->getContentSize().width*.41, bigbg->getContentSize().height*.02 -bigbg->getContentSize().height*.098))); fermEffect1->setPosition(ccpAdd(bigbg->getPosition(), ccp(bigbg->getContentSize().width*.41, bigbg->getContentSize().height*.02-bigbg->getContentSize().height*.098))); item->setPosition(ccpAdd(bigbg->getPosition(), ccp(0, -bigbg->getContentSize().height*.362))); lightBg->setScaleX(winSize.width / lightBg->getContentSize().width); lightBg->setScaleY(1.9); lightBg->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(0, -title_bg->getContentSize().height-5 - lightBg->getContentSize().height*0.5*lightBg->getScaleY()))); } equipItem = item; fermEffect->play(); fermEffect1->play(); this->setstar(_card->getCurrStar(),_card->getUpgradestar()); this->setTitle(str_zhuangbeiqianghua);//_card->getOfficerName()->getCString() ////////////////////// float btnwidth = skewing(5); float btnwid = skewing(33); equipStrengBtn = SGButton::createFromLocal(IMG_BTN_ON, str_qianghua_, this, menu_selector(SGEquipStrengLayer::equipStrengHandler),CCPointZero,FONT_PANGWA,ccWHITE,32,false,true); this->addBtn(equipStrengBtn); if(winSize.height==1136) equipStrengBtn->setPosition(ccp(winSize.width/2- btnwid*3 - btnwidth - adpt_wid, btmheight*.55 + equipStrengBtn->getContentSize().height*0.7+ adjustY*0.6)); else if (winSize.height == 1024) equipStrengBtn->setPosition(ccp(winSize.width/2- btnwid*3 - btnwidth - adpt_wid, btmheight*.55 + equipStrengBtn->getContentSize().height*0.7)); else equipStrengBtn->setPosition(ccp(winSize.width/2- btnwid*3 - btnwidth - adpt_wid, btmheight*.55 + equipStrengBtn->getContentSize().height*0.7 + 10)); equipAutoStrengBtn = SGButton::createFromLocal(IMG_BTN_ON, str_autoqianghua, this, menu_selector(SGEquipStrengLayer::autoEquipStrengHandler),CCPointZero,FONT_PANGWA,ccWHITE,32,false,true); this->addBtn(equipAutoStrengBtn); equipAutoStrengBtn->setPosition(ccpAdd(equipStrengBtn->getPosition(), ccp( equipAutoStrengBtn->getContentSize().width - adpt_wid,0 ))); int limittag = SGStaticDataManager::shareStatic()->getimitTagById(limitEquipGuide,9); equipAutoStrengBtn->setTag(limittag); SGButton *backBtn = SGButton::createFromLocal(IMG_BTN_ON, str_Back_, this, menu_selector(SGEquipStrengLayer::backHandler),CCPointZero,FONT_PANGWA,ccWHITE,32); backBtn->setScale(1.05); this->addBtn(backBtn); backBtn->setPosition(ccpAdd(equipAutoStrengBtn->getPosition(), ccp( backBtn->getContentSize().width - adpt_wid,0))); SGEquipmentDataModel *general = SGStaticDataManager::shareStatic()->getEquipById(_card->getItemId()); this->setCardType(general->getEquipType()); //////////////////////// float bigFrmWidth = winSize.width - 40; float bigFrmHeight = (int)winSize.height/3 -20; CCScale9Sprite *bigFrm = CCScale9Sprite::createWithSpriteFrameName("barrack_kuang.png"); bigFrm->setPreferredSize(CCSizeMake(bigFrmWidth, bigFrmHeight)); this->addChild(bigFrm,7); if(winSize.height==1136) bigFrm->setPosition(ccpAdd(ccp(winSize.width/2,equipStrengBtn->getPosition().y), ccp(0, equipStrengBtn->getContentSize().height/2 + bigFrmHeight/2 + 4 + adjustY*0.6))); else if(winSize.height==1024) bigFrm->setPosition(ccpAdd(ccp(winSize.width/2,equipStrengBtn->getPosition().y), ccp(0, equipStrengBtn->getContentSize().height/2 + bigFrmHeight/2 + 4))); else bigFrm->setPosition(ccpAdd(ccp(winSize.width/2,equipStrengBtn->getPosition().y), ccp(0, equipStrengBtn->getContentSize().height/2 + bigFrmHeight/2 + 10 ))); CCSprite *bigFrmBg = CCSprite::createWithSpriteFrameName("barrack_kuangbg.png"); this->addChild(bigFrmBg,6); bigFrmBg->setScaleX(bigFrmWidth/bigFrmBg->getContentSize().width); bigFrmBg->setScaleY(bigFrmHeight/bigFrmBg->getContentSize().height); bigFrmBg->setPosition(bigFrm->getPosition()); CCSprite* admsBkg = CCSprite::createWithSpriteFrameName("store_redbg.png"); float scaleX = winSize.width / admsBkg->getContentSize().height; float scaleY = 60 / admsBkg->getContentSize().height; admsBkg->setScaleX(scaleX); admsBkg->setScaleY(scaleY); this->addChild(admsBkg, 9); // admsBkg->setPosition(ccpAdd(bigFrm->getPosition(), ccp(0,admsBkg->getContentSize().height*scaleY/2 + bigFrm->getContentSize().height/2) )); admsBkg->setPosition(ccpAdd(lightBg->getPosition(), ccp(0, -lightBg->getScaleY() *lightBg->getContentSize().height*0.5 - admsBkg->getContentSize().height*0.5*lightBg->getScaleY() + adjustY)) ); ///////////////////////////////// equipName = SGCCLabelTTF::create(_card->getOfficerName()->getCString(), FONT_PANGWA, 26); equipName->setPosition(ccpAdd(bigFrm->getPosition(), ccp(-40,bigFrm->getContentSize().height/2 - 26 ))); int equipStar = _card->getCurrStar() - 2; equipStar = equipStar < 0 ? 0 : equipStar; if (equipStar >= 0 && equipStar < 5) { equipName->setInsideColor(ccStarLevelColor[equipStar]); } else { equipName->setInsideColor(ccWHITE); } addChild(equipName,11); equiplevel = SGCCLabelTTF::create(CCString::createWithFormat("Lv %d/%d",_card->getCurrLevel(),SGPlayerInfo::sharePlayerInfo()->getPlayerLevel())->getCString(), FONT_PANGWA, 26); addChild(equiplevel,11); equiplevel->setPosition(ccpAdd(equipName->getPosition(), ccp(equipName->getContentSize().width/2 + equiplevel->getContentSize().width/2 + 20,0))); /////////////////////////// SGCCLabelTTF *costMoney = SGCCLabelTTF::create(str_zbqianghuancost, FONT_PANGWA, 24 , COLOR_UNKNOW_TAN); this->addChild(costMoney,11); costMoney->setPosition( ccp(costMoney->getContentSize().width/2 +20, admsBkg->getPosition().y)); SGCCLabelTTF *totalMoney = SGCCLabelTTF::create(str_zbqianghuantotalMy, FONT_PANGWA, 24 , COLOR_UNKNOW_TAN); this->addChild(totalMoney,11); totalMoney->setPosition( ccp(winSize.width/2 + totalMoney->getContentSize().width/2 + 10 , costMoney->getPosition().y)); CCSprite *font_bg = CCSprite::createWithSpriteFrameName(FONTBG); font_bg->setScaleY(1.4); this->addChild(font_bg,9); font_bg->setPosition(ccpAdd(costMoney->getPosition(), ccp(costMoney->getContentSize().width/2 + font_bg->getContentSize().width/2+ 6,0))); font_bg = CCSprite::createWithSpriteFrameName(FONTBG); font_bg->setScaleY(1.4); this->addChild(font_bg,9); font_bg->setPosition(ccpAdd(totalMoney->getPosition(), ccp(totalMoney->getContentSize().width/2 + font_bg->getContentSize().width/2+6,0))); CCSprite *coins = CCSprite::createWithSpriteFrameName("coinicon.png"); coins->setPosition(ccpAdd(costMoney->getPosition(),ccp(costMoney->getContentSize().width/2 +coins->getContentSize().width/2+4,0))); addChild(coins,11); costCount = SGCCLabelTTF::create("999999", FONT_PANGWA, 24); costCount->setPosition(ccpAdd(coins->getPosition(),ccp(coins->getContentSize().width/2+costCount->getContentSize().width/2+8,0))); addChild(costCount,11); coins = CCSprite::createWithSpriteFrameName("coinicon.png"); coins->setPosition(ccpAdd(totalMoney->getPosition(),ccp(totalMoney->getContentSize().width /2+coins->getContentSize().width/2+4,0))); addChild(coins,11); totalCount = SGCCLabelTTF::create("999999", FONT_PANGWA, 24); totalCount->setPosition(ccpAdd(coins->getPosition(),ccp(coins->getContentSize().width/2+totalCount->getContentSize().width/2 +8,0))); addChild(totalCount,11); ///////////////////////////////// float f1Height = (int)bigFrmHeight*2/3; float f1Width = (int)f1Height* 0.85; CCScale9Sprite *frame1 = CCScale9Sprite::createWithSpriteFrameName(STATUSBG); frame1->setPreferredSize(CCSizeMake(f1Width, f1Height)); this->addChild(frame1,11); frame1->setPosition(ccp(40 + f1Width/2, bigFrm->getPosition().y - 30)); CCScale9Sprite *frame2 = CCScale9Sprite::createWithSpriteFrameName(STATUSBG); frame2->setPreferredSize(CCSizeMake(f1Width, f1Height)); this->addChild(frame2,11); frame2->setPosition( ccp(winSize.width - frame1->getPosition().x, frame1->getPosition().y)); SGCCLabelTTF *currentTitle = SGCCLabelTTF::create(str_zbqianghuacurstatus, FONT_PANGWA, 32); this->addChild(currentTitle,11); currentTitle->setPosition( ccp(frame1->getPosition().x, frame1->getPosition().y + frame1->getContentSize().height/2 + 30)); SGCCLabelTTF *nextTitle = SGCCLabelTTF::create(str_zbqianghuanextstatus, FONT_PANGWA, 32 , ccGREEN); this->addChild(nextTitle,11); nextTitle->setPosition( ccp(frame2->getPosition().x, currentTitle->getPosition().y)); //modify by:zyc. merge into create. //nextTitle->setColor(ccGREEN); CCSprite *equipArrow = CCSprite::createWithSpriteFrameName("equipArrow.png"); this->addChild(equipArrow,20); equipArrow->setPosition(ccp(SGLayout::getPoint(kMiddleCenter).x, frame1->getPosition().y)); this->addCurrStatus( ccpAdd(frame1->getPosition(),ccp( -f1Width/2,f1Height/2)),f1Width * 0.4,1.4*winSize.height/1140); this->addNextStatus( ccpAdd(frame2->getPosition(),ccp( -f1Width/2,f1Height/2)),f1Width * 0.4,1.4*winSize.height/1140); setEquipLevel(_card->getCurrLevel()); setCostCount(_card->getCurrLevel()); setCurrStatus(_card->getCurrLevel()); creatBostLevel(SGLayout::getPoint(kMiddleCenter)); showMainChat(false); }
void SGAdvancedEffectLayer::initView() { // ccColor3B color[4] = {ccc3(0 , 239 , 22) , ccc3(75, 147, 255) ,ccc3(215,56,255) , ccc3(249, 158, 0)}; // // ccColor3B titleColor; ResourceManager::sharedInstance()->bindTexture("animationFile/Lightspot.plist",RES_TYPE_LAYER_UI ,sg_advancedEffectLayer); ResourceManager::sharedInstance()->bindTexture("animationFile/VisitArray.plist",RES_TYPE_LAYER_UI ,sg_advancedEffectLayer); int adNum = 0; int quality=0; //类型是全局通用的那个物品类型 char beforeItemPicStr[32] = "\0"; char afterItemPicStr[32] = "\0"; char itemNameStr[32] = "\0"; char itemAdNum[32] = "\0";// 小转生次次数 //6:将领卡牌 7:装备卡牌 8:士兵卡牌 9:道具卡牌 1:铜钱 0:金子 2天梯积分 3:军功 5:炼丹秘方 4:小喇叭 10:碎片 11军魂 12体力 13军粮 14号(废弃) 15消耗品 16 勋章 17 材料 //各种类型参数 switch (itemType) { case BIT_EQUIP://装备卡牌 { SGEquipmentDataModel *beforeEquipModel = SGStaticDataManager::shareStatic()->getEquipById(beforeAdvanceItemId); SGEquipmentDataModel *afterEquipModel = SGStaticDataManager::shareStatic()->getEquipById(afterAdvanceItemId); int beforeId = beforeEquipModel->getIconId(); int afterId = afterEquipModel->getIconId(); SGMainManager::shareMain()->addEquipPng(beforeId, sg_advancedEffectLayer); SGMainManager::shareMain()->addEquipPng(afterId, sg_advancedEffectLayer); sprintf(beforeItemPicStr, "equip%d.png", beforeId); sprintf(afterItemPicStr, "equip%d.png", afterId); sprintf(itemNameStr, "%s", afterEquipModel->getEquipName()->getCString()); adNum = afterEquipModel->getAdvNum(); if (adNum > 0) { sprintf(itemAdNum, "+%d", adNum); } //装备边框颜色 quality = afterEquipModel->getEquipCurrStarLevel(); // if(quality < 3 || quality > 6) // titleColor = ccGREEN; // else // titleColor = color[quality - 3]; } break; case BIT_OFFICER://武将卡牌 { SGOfficerDataModel *beforeEquipModel = SGStaticDataManager::shareStatic()->getOfficerById(beforeAdvanceItemId); SGOfficerDataModel *afterEquipModel = SGStaticDataManager::shareStatic()->getOfficerById(afterAdvanceItemId); int beforeId = beforeEquipModel->getIconId(); int afterId = afterEquipModel->getIconId(); SGMainManager::shareMain()->addOfficerPng(beforeId, sg_advancedEffectLayer); SGMainManager::shareMain()->addOfficerPng(afterId, sg_advancedEffectLayer); sprintf(beforeItemPicStr, "officer_%d.png", beforeId); sprintf(afterItemPicStr, "officer_%d.png", afterId); sprintf(itemNameStr, "%s", afterEquipModel->getOfficerName()->getCString()); adNum = afterEquipModel->getAdvNum(); if (adNum > 0) { sprintf(itemAdNum, "+%d", adNum); } //装备边框颜色 quality = afterEquipModel->getOfficerCurrStarLevel(); // if(quality < 3 || quality > 6) // titleColor = ccGREEN; // else // titleColor = color[quality - 3]; break; } default: break; } //构造sprite beforeAdvancedItemPic = CCSprite::createWithSpriteFrameName(beforeItemPicStr); afterAdvancedItemPic = CCSprite::createWithSpriteFrameName(afterItemPicStr); itemName = SGCCLabelTTF::create(itemNameStr, FONT_PANGWA, 35, SGTools::getColorByQuality(quality)); if (adNum) { adNumLabel = SGCCLabelTTF::create(itemAdNum, FONT_PANGWA, 34, ccGREEN); } //黑背景 CCLayerColor *blackBg = CCLayerColor::create(ccc4(0, 0, 0, 255), CCDirector::sharedDirector()->getWinSize().width, CCDirector::sharedDirector()->getWinSize().height); this->addChild(blackBg, 0); blackBg->setPosition(ccp(0, 0)); blackBg->addChild(beforeAdvancedItemPic, 1); blackBg->addChild(itemName, 1); beforeAdvancedItemPic->setPosition(ccpAdd(blackBg->getPosition(), ccp(blackBg->getContentSize().width / 2, blackBg->getContentSize().height / 2))); itemName->setPosition(ccpAdd(beforeAdvancedItemPic->getPosition(), ccp(0, beforeAdvancedItemPic->getContentSize().height / 2 + itemName->getContentSize().height + 20))); if (adNumLabel) { blackBg->addChild(adNumLabel, 1); adNumLabel->setPosition(ccpAdd(itemName->getPosition(), ccp(itemName->getContentSize().width / 2 + 10 + adNumLabel->getContentSize().width, 0))); } CCSize winSize = CCDirector::sharedDirector()->getWinSize(); //添加动画 法阵旋转 CCSpriterX *visitArray = CCSpriterX::create("animationFile/Array.scml",true,true); visitArray->setisloop(true); visitArray->play(); visitArray->setanimaID(0); blackBg->addChild(visitArray,1); visitArray->setPosition(ccp(winSize.width/2, winSize.height*(0.8-0.28) - 50)); //法阵上升粒子 CCSpriterX *lightSpot = CCSpriterX::create("animationFile/Lightspot.scml",true,true); lightSpot->setisloop(true); lightSpot->play(); lightSpot->setanimaID(0); blackBg->addChild(lightSpot,50); lightSpot->setPosition(ccp(winSize.width/2, winSize.height*(0.8-0.2))); //构造动画 CCCallFuncN *setPicVisiable = CCCallFuncN::create(this, callfuncN_selector(SGAdvancedEffectLayer::setPictureVisiable)); CCCallFuncN *setTipsVisiable = CCCallFuncN::create(this, callfuncN_selector(SGAdvancedEffectLayer::setSuccessTipsVisiable)); CCCallFuncN *setComplete = CCCallFuncN::create(this, callfuncN_selector(SGAdvancedEffectLayer::setisPlayCompleted)); afterAdvancedItemPic->setScale(5); blackBg->addChild(afterAdvancedItemPic, 2); afterAdvancedItemPic->setPosition(beforeAdvancedItemPic->getPosition()); CCString * str = NULL; int fSize = 36; if(m_officerFrom == 1) str = CCString::create(str_adv_eff_1); else if (2 == m_officerFrom) str = CCString::create(str_adv_eff_2); else if(-1 == m_officerFrom) str = CCString::create(str_adv_eff_1); else if (3 == m_officerFrom) { str = CCString::createWithFormat(str_adv_eff_3, _extArg); fSize = 26; } else { //默认只显示 『转生成功』 str = CCString::create(str_adv_eff_1); } successTips = SGCCLabelTTF::create(str->getCString(), FONT_PANGWA, fSize); blackBg->addChild(successTips, 3); successTips->setPosition(ccpAdd(afterAdvancedItemPic->getPosition(), ccp(0, -afterAdvancedItemPic->getContentSize().height / 2 - successTips->getContentSize().height - 100))); successTips->setVisible(false); CCSequence *seq = CCSequence::create(CCDelayTime::create(0.1),setPicVisiable, CCScaleTo::create(SHOWCARDGAPTIME*2,0.89), CCScaleTo::create(SHOWCARDGAPTIME,1.13), CCScaleTo::create(SHOWCARDGAPTIME,1.06), CCScaleTo::create(SHOWCARDGAPTIME,1), CCDelayTime::create(0.15), setTipsVisiable, CCDelayTime::create(0.15), setComplete, NULL); afterAdvancedItemPic->runAction(seq); CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this, -255, true); }
void SGConsumableInfoLayer::initView() { ResourceManager::sharedInstance()->bindTexture("animationFile/qhtexiao.plist",RES_TYPE_LAYER_UI ,sg_comsumableInfoLayer); ResourceManager::sharedInstance()->bindTexture("sgequipslayer/sgequipslayer.plist",RES_TYPE_LAYER_UI ,sg_comsumableInfoLayer); ResourceManager::sharedInstance()->bindTexture("sggeneralinfolayer/sggeneralinfolayer1.plist",RES_TYPE_LAYER_UI ,sg_comsumableInfoLayer); ResourceManager::sharedInstance()->bindTexture("sgrewardlayer/sgrewardlayer2.plist",RES_TYPE_LAYER_UI ,sg_comsumableInfoLayer); ResourceManager::sharedInstance()->bindTexture("sgsoldierslayer/sgsoldierslayer.plist",RES_TYPE_LAYER_UI ,sg_comsumableInfoLayer, LIM_PNG_AS_PNG); ResourceManager::sharedInstance()->bindTexture("sgpropslayer/sgpropslayer.plist",RES_TYPE_LAYER_UI ,sg_comsumableInfoLayer); CCSize s = CCDirector::sharedDirector()->getWinSize(); float btmheight = SGMainManager::shareMain()->getBottomHeight(); //float frameheight = skewingY(155); float hgt = skewingY(244); if (s.height == 1136) { //frameheight = skewing(155); hgt = skewing(244); } //左火 CCSpriterX *fermEffect = CCSpriterX::create("animationFile/qhhyA.scml", true, true); fermEffect->setanimaID(0); fermEffect->setisloop(true); addChild(fermEffect, 10, 0); //右火 CCSpriterX *fermEffect1 = CCSpriterX::create("animationFile/qhhyB.scml", true, true); fermEffect1->setCCSpriterXFlipX(true); fermEffect1->setanimaID(0); fermEffect1->setisloop(true); addChild(fermEffect1, 10, 1); CCLOG("type%d",_card->getItemType()); // if (_card->getType()) { // statements // } SGMainManager::shareMain()->addPropPng(_card->getHeadSuffixNum(),sg_comsumableInfoLayer); CCString *str = CCString::createWithFormat("prop%d.png",_card->getHeadSuffixNum()); CCSprite *item = CCSprite::createWithSpriteFrameName(str->getCString()); this->addChild(item,2); item->setAnchorPoint(ccp(0.5, 0)); if (s.height == 960) { frameSize = CCRectMake(0, 0 , 768, 413); this->setItemID("pad装备底图.png",true); fermEffect->setScale(s.width/768); fermEffect1->setScale(s.width/768); fermEffect->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(-264, -287+26))); fermEffect1->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(264, -287+26))); item->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(0, -365))); } else if (s.height == 1136) { frameSize = CCRectMake(0, 520 -(s.height - hgt*1.13 - title_bg->getContentSize().height), 768, (s.height - hgt*1.13 - title_bg->getContentSize().height)); this->setItemID("carditembg.png",true); fermEffect->setScaleX(s.width/768); fermEffect1->setScaleX(s.width/768); fermEffect->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(-264, -361+26))); fermEffect1->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(264, -361+26))); item->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(0, -450))); }else { CCSprite *a = CCSprite::createWithSpriteFrameName("pad装备底图.png"); this->addChild(a,-100); a->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(0, - title_bg->getContentSize().height - a->getContentSize().height*.45))); fermEffect->setPosition(ccpAdd(a->getPosition(), ccp(-a->getContentSize().width*.41, a->getContentSize().height*.02 -a->getContentSize().height*.09))); fermEffect1->setPosition(ccpAdd(a->getPosition(), ccp(a->getContentSize().width*.41, a->getContentSize().height*.02-a->getContentSize().height*.09))); item->setPosition(ccpAdd(a->getPosition(), ccp(0, -a->getContentSize().height*.362))); } fermEffect->play(); fermEffect1->play(); menu->setZOrder(7); this->setstar(_card->getCurrStar()); this->setTitle(_card->getOfficerName()->getCString()); SGButton *backBtn = SGButton::createFromLocal("store_exchangebtnbg.png", str_back, this, menu_selector(SGConsumableInfoLayer::backHandler),CCPointZero,FONT_PANGWA,ccWHITE,32); backBtn->setScale(1.05); this->addBtn(backBtn); backBtn->setPosition(ccpAdd(SGLayout::getPoint(kUpLeft), ccp( backBtn->getContentSize().width*.55, - backBtn->getContentSize().height*.55))); if(enterType == 101) { ResourceManager::sharedInstance()->bindTexture("sanguobigpic/barrack_bg.plist", RES_TYPE_LAYER_UI, sg_comsumableInfoLayer); CCSprite *bg1 = CCSprite::create("storyBg.png"); //CCRect r = CCRectMake(0, 1136/2 - (hgt*1.13)/2, s.width, hgt*1.13); //bg1->setTextureRect(r); bg1->setScaleY(s.height/2 / bg1->getContentSize().height); bg1->setScaleX(s.width / bg1->getContentSize().width); bg1->setAnchorPoint(ccp(0.5, 0)); bg1->setPosition(SGLayout::getPoint(kBottomCenter)); this->addChild(bg1,5); } else { CCSprite *bg1 = CCSprite::createWithSpriteFrameName("info_redbg.png"); bg1->setAnchorPoint(ccp(0.5, 0)); bg1->setScaleX(s.width/bg1->getContentSize().width); bg1->setScaleY((hgt*1.13-btmheight*.68)/bg1->getContentSize().height); bg1->setPosition(ccpAdd(SGLayout::getPoint(kBottomCenter), ccp(0, btmheight*.68 ))); this->addChild(bg1,5); } CCSprite* jinbian = CCSprite::createWithSpriteFrameName("jinbian.png"); jinbian->setPosition(ccp(s.width/2, hgt*1.13)); jinbian->setScaleX(s.width/jinbian->getContentSize().width); this->addChild(jinbian,6); CCScale9Sprite *frame2 = CCScale9Sprite::createWithSpriteFrameName("barrack_kuang.png"); frame2->setPreferredSize(CCSizeMake(568+20, 320)); this->addChild(frame2,7); frame2->setPosition(ccpAdd(jinbian->getPosition(), ccp(0, -frame2->getContentSize().height/2 - 30))); CCSprite *frame2bg = CCSprite::createWithSpriteFrameName("barrack_kuangbg.png"); this->addChild(frame2bg,6); frame2bg->setScaleX(590/frame2bg->getContentSize().width); frame2bg->setScaleY(320/frame2bg->getContentSize().height); frame2bg->setPosition(frame2->getPosition()); CCSprite *guang2l = CCSprite::createWithSpriteFrameName("barrack_kuang_guangl.png"); this->addChild(guang2l,6); guang2l->setAnchorPoint(ccp(0, 1)); CCSprite *guang2r = CCSprite::createWithSpriteFrameName("barrack_kuang_guangl.png"); this->addChild(guang2r,6); guang2r->setFlipX(true); guang2r->setAnchorPoint(ccp(1, 1)); CCSprite *guang2m = CCSprite::createWithSpriteFrameName("barrack_kuang_guangm.png"); this->addChild(guang2m,6); guang2m->setScaleX(468/guang2m->getContentSize().width); guang2m->setAnchorPoint(ccp(0.5, 1)); guang2m->setPosition(ccpAdd(frame2->getPosition(), ccp(0, frame2->getContentSize().height*.5))); guang2r->setPosition(ccpAdd(guang2m->getPosition(), ccp(284+10, 0))); guang2l->setPosition(ccpAdd(guang2m->getPosition(), ccp(-284-10, 0))); CCScale9Sprite *fontbg = CCScale9Sprite::createWithSpriteFrameName("box_fontbg.png"); fontbg->setPreferredSize(CCSizeMake(538, 205)); this->addChild(fontbg,6); fontbg->setPosition(ccpAdd(frame2->getPosition(), ccp(0, 26))); SGConsumableDataModel *temp = SGStaticDataManager::shareStatic()->getConsumableById(_card->getItemId()); SGCCLabelTTF* a = SGCCLabelTTF::create(temp->getConsumeDesc()->getCString(), FONT_BOXINFO, 28, CCSizeMake(504,400)); a->setAnchorPoint(ccp(0.5f, 1)); this->addChild(a,6); a->setPosition(ccpAdd(fontbg->getPosition(), ccp(0, fontbg->getContentSize().height*.33))); //setCardType,“强化合成“ SGConsumableDataModel *consumeData = SGStaticDataManager::shareStatic()->getConsumableById(_card->getItemId()); this->setCardType(consumeData->getConsumeType()); }
//创建一个对应的简单的button,代表具体的章 CCLayerColor *SGSpecialBattleLayer::createChapButton(int buttonTag, SpecialBattleData *data) { CCLayerColor *layerColor = CCLayerColor::create(ccc4(0, 255, 0, 0), 160, 160); layerColor->setTag(111); layerColor->setAnchorPoint(ccp(0.5, 0.5)); if (data) { CCSprite *headIcon = SGDrawCards::createPureSprite(data->itemId, data->itemType, sg_specialBattleLayer); CCSprite *borderIcon = CCSprite::createWithSpriteFrameName("equipPinzhi_5_0.png"); headIcon->addChild(borderIcon, 1); borderIcon->setPosition(ccpAdd(ccp(headIcon->getContentSize().width / 2, headIcon->getContentSize().height / 2), ccp(0, 0))); CCSprite *headIcon1 = SGDrawCards::createPureSprite(data->itemId, data->itemType, sg_specialBattleLayer); CCSprite *borderIcon1 = CCSprite::createWithSpriteFrameName("equipPinzhi_5_0.png"); headIcon1->addChild(borderIcon1, 1); borderIcon1->setPosition(ccpAdd(ccp(headIcon1->getContentSize().width / 2, headIcon1->getContentSize().height / 2), ccp(0, 0))); //章节的按钮 SGButton *chapButton = SGButton::createFromSprite(headIcon, headIcon1, this, menu_selector(SGSpecialBattleLayer::enterSpBattleSection)); chapButton->setTag(buttonTag); //章节的名称 //250 197 68 SGCCLabelTTF *chapNameTTF = SGCCLabelTTF::create(data->chapName.c_str(), FONT_PANGWA, 24); chapButton->addChild(chapNameTTF, 2); chapNameTTF->setInsideColor(ccc3(250, 197, 68)); chapNameTTF->setPosition(ccpAdd(ccp(chapNameTTF->getContentSize().width / 2, chapNameTTF->getContentSize().height / 3.5), ccp(0, 0))); //如果没有开启,蒙灰 if (!data->isOpen) { CCSprite *greyMask = CCSprite::createWithSpriteFrameName("sp_battle_entry_mask.png"); greyMask->setOpacity(150); chapButton->addChild(greyMask, 10); greyMask->setPosition(ccpAdd(ccp(greyMask->getContentSize().width / 2 - 5, greyMask->getContentSize().height / 2 - 5), ccp(0, 0))); //未开启,不可用 chapButton->setEnabled(false); } CCMenu *menu = CCMenu::create(); menu->setTouchPriority(10); menu->setPosition(CCPointZero); menu->addChild(chapButton); layerColor->addChild(menu); chapButton->setPosition(ccpAdd(ccp(0, 0), ccp(layerColor->getContentSize().width / 2, layerColor->getContentSize().height / 1.5))); //显示描述的背景 CCSprite *descBg = CCSprite::createWithSpriteFrameName("sp_battle_infobg.png"); layerColor->addChild(descBg, 1); descBg->setPosition(ccpAdd(chapButton->getPosition(), ccp(0, -descBg->getContentSize().height / 2 - chapButton->getContentSize().height / 1.7))); //下方对应的描述 std::string desc; if (data->isOpen) { desc = data->chapOpenDesc; //如果是开启的,加上光效 ResourceManager::sharedInstance()->bindTexture("animationFile/ms_niubility.plist", RES_TYPE_LAYER_UI, sg_specialBattleLayer); CCSpriterX *newRewardEffect = CCSpriterX::create("animationFile/ms_niubility.scml", true, true); layerColor->addChild(newRewardEffect, -1); newRewardEffect->setanimaID(0); newRewardEffect->setisloop(true); newRewardEffect->setScale(1.15); newRewardEffect->setPosition(ccpAdd(chapButton->getPosition(), ccp(0, 0))); newRewardEffect->play(); } else { desc = data->chapClosedDesc; } SGCCLabelTTF *chapDescTTF = SGCCLabelTTF::create(desc.c_str(), FONT_PANGWA, 21); descBg->addChild(chapDescTTF, 1); chapDescTTF->setPosition(ccpAdd(ccp(descBg->getContentSize().width / 2, descBg->getContentSize().height / 2), ccp(0, 0))); //如果开启状态,显示剩余次数 if (data->isOpen) { SGCCLabelTTF *residueTimeTTF = SGCCLabelTTF::create(CCString::createWithFormat(str_SpecailBattleResidueCoint, data->freePlayTimes)->getCString(), FONT_PANGWA, 20); residueTimeTTF->setInsideColor(ccGREEN); layerColor->addChild(residueTimeTTF, 1); residueTimeTTF->setPosition(ccpAdd(descBg->getPosition(), ccp(0, -residueTimeTTF->getContentSize().height * 1.2))); } } else { //没有的,直接问号显示 SGButton *chapButton = SGButton::create("sp_battle_unlock.png", "equipPinzhi_5_0.png", this, NULL); chapButton->setEnabled(false); layerColor->addChild(chapButton); chapButton->setPosition(ccpAdd(ccp(0, 0), ccp(layerColor->getContentSize().width / 2, layerColor->getContentSize().height / 1.5))); } return layerColor; }
//对敌方阵营随机5个位置进行伤害,总额为主将攻击力的100% void SGHeroSkill7::activateSkill_20006(SGHeroLayer *heroLayer, SGHeroLayer *heroLayer1, float value1, CCPoint point, int skillId) { if (!heroLayer1 || !heroLayer) { return ; } SGBattleMap *opponentBattleMap = heroLayer1->getBattleMap(); if (!opponentBattleMap) { return ; } SGGridBase *grid = opponentBattleMap->myGrids[(int)point.y][(int)point.x]; if (!grid) { return ; } ShiBing * sb = opponentBattleMap->getShiBingWithGrid(grid); if (!sb) { return ; } bool a = !heroLayer->isme; CCString *name = NULL; CCString *name1 = NULL; if (skillId == skill_id_20026 || skillId == skill_id_20027 || skillId == skill_id_20086 || skillId == skill_id_20096) { name = CCString::create("animationFile/yinsi.plist"); name1 = CCString::create("animationFile/yinsi.scml"); }else{ name = CCString::create("animationFile/ll.plist"); name1 = CCString::create("animationFile/ll.scml"); } // CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(name->getCString()); ResourceManager::sharedInstance()->bindTexture(name->getCString(), RES_TYPE_BATTLE_IMAGE, sg_battleLayer); CCSpriterX *fermEffect = CCSpriterX::create(name1->getCString(), true, true); fermEffect->setanimaID(0); fermEffect->setisloop(false); // fermEffect->setPosition(GameConfig::getGridPoint(a ? -((int)point.y + 1) : (int)point.y, a ? mapList - 1 - (int)point.x :(int)point.x)); fermEffect->setPosition(GameConfig::getGridPoint((int)point.y, (int)point.x, a)); fermEffect->play(); if (heroLayer->isme) { heroLayer->addChild(fermEffect, 100); }else{ heroLayer1->addChild(fermEffect, 100); } if (!grid) { return; } bool isDe = false; CCLOG(">>>>>%f",value1); //掉血效果显示,数值是技能攻击的数值 heroLayer->showBattleLabel(value1, "battle/sub_hp_label.png", SB_ADD_AND_SUB_AP_W, SB_ADD_AND_SUB_AP_H, grid->getIndex()); if (grid->getStype() == knormal) { CCLOG("散兵"); isDe = true; } else if (grid->getStype() == kattack) { CCLOG("攻击阵列"); SGAttackList *attackList = opponentBattleMap->getAttackListByGrid(grid); if (attackList) { if (value1 >= attackList->getAp()) { int newValue = attackList->getAp(); attackList->heroSkillSubAp(newValue); CCLOG("被打死"); isDe = true; } else { //显示掉血效果 attackList->heroSkillSubAp(value1); CCLOG("未被打死"); float newValue = attackList->getAp() - value1; attackList->setAp(newValue); //造成伤害,播放音效 if (value1 > 0) { attackList->playEffectWithType(kAttackEffect); } //攻击后血量减少显示 attackList->drawXueTiaoProportion(); attackList->changAPLabel(); CCLOG("val1 = %f, da = %d, max = %d", value1, attackList->damageNum, attackList->getMax_Ap()); } } } else if(grid ->getStype() == kdefend) { if (!sb) { return ; } CCLOG("防御"); if (value1 >= sb->getDef()) { CCLOG("被打死"); isDe = true; } else { CCLOG("未被打死"); sb->setDef(sb->getDef()- value1); } } if (isDe) { int a = (fermEffect->getAnimaTimeLength(0, 0) * ANIMA_TIME_NUM); CCDelayTime *time = CCDelayTime::create(a); CCCallFuncND *call = CCCallFuncND::create(SGSkillManager::shareSkill(), callfuncND_selector(SGSkillManager::sbSkill_20005), (void*)(a* 10000)); sb->runAction(CCSequence::create(time, call, NULL)); } }
//对敌方全列,进行武将攻击力总额75%的伤害 float SGHeroSkill15::activateSkill_20022(SGHeroLayer *heroLayer, SGHeroLayer *heroLayer1, float value1, int roleid) { float time = 1.2; float sbTime = time/12; bool isme = true; if (SGPlayerInfo::sharePlayerInfo()->getPlayerRoleId() != roleid) { isme = false; } float skillDelayTime = 0; for (int i = 0; i < mapList; i++) { //和业务逻辑无关 CCString *name = NULL; CCString *name1 = NULL; name = CCString::createWithFormat("animationFile/jian_%d.plist", heroLayer->m_jianId); name1 = CCString::createWithFormat("animationFile/jian_%d.scml", heroLayer->m_jianId); ResourceManager::sharedInstance()->bindTexture(name->getCString(), RES_TYPE_BATTLE_IMAGE, sg_battleLayer); CCSpriterX *fermEffect = CCSpriterX::create(name1->getCString(), true, true); fermEffect->setanimaID(0); fermEffect->setisloop(true); fermEffect->setPosition(GameConfig::getGridPoint(isme ? 5 : -5 + OLD_EFFECT_FLIPY_FIX, abs(isme ? -i : (mapList - 1 - i)),true)); fermEffect->play(); heroLayer->addChild(fermEffect, SKILLS_BULLET_TAG, SKILLS_BULLET_TAG + i); if (!isme) { //MMDEBUG: FLIPY fermEffect->setScaleY(-1); // fermEffect->setPosition(ccp(0, GameConfig::getGridSize().height * 1.5)); // fermEffect->setCCSpriterXFlipY(true); } CCDelayTime *delaytime = CCDelayTime::create(sbTime*0.5*i); CCMoveTo *move = CCMoveTo::create(time, GameConfig::getGridPoint(isme ? -mapRow : mapRow + OLD_EFFECT_FLIPY_FIX, abs(isme ? -i : (mapList - 1 - i)) ,true)); fermEffect->runAction(CCSequence::create(delaytime, move, NULL)); // int a = (fermEffect->getAnimaTimeLength(0, 0) * ANIMA_TIME_NUM) * 10000; // // // CCDelayTime *time = CCDelayTime::create(a); // CCCallFuncND *call = CCCallFuncND::create(this, callfuncND_selector(SGSkillManager::sbSkill_20005), (void*)a); // sb->runAction(CCSequence::create(time, call, NULL)); } for (int j = 0; j < mapList; j++) { int ap = value1; for (int i = 0; i <= mapRow; i++) { if (ap > 0) { float a = sbTime * 0.5 * j; float b = sbTime * (i+5.5); skillDelayTime = a + b ; if (i == mapRow) { //播放打到底线动作 GameSbIndex *sbin = new GameSbIndex(); sbin->i = mapRow; sbin->j = j; CCDelayTime* deal0 = CCDelayTime::create(a); CCDelayTime* delay1 = CCDelayTime::create(b + sbTime); CCCallFuncND* call1 = CCCallFuncND::create(this, callfuncND_selector(SGHeroSkill15::removeBullet), (void*)(SKILLS_BULLET_TAG + j)); CCCallFuncND* call3 = CCCallFuncND::create(SGSkillManager::shareSkill(), callfuncND_selector(SGSkillManager::playBulletBlast), (void*)sbin); heroLayer->runAction(CCSequence::create( deal0, delay1, call1, call3, NULL)); CCDelayTime* deal01 = CCDelayTime::create(a); CCDelayTime* delay11 = CCDelayTime::create(b + sbTime); CCCallFuncND* call11 = CCCallFuncND::create(SGSkillManager::shareSkill(), callfuncND_selector(SGSkillManager::changBloodNum), (void*)ap); heroLayer1->runAction(CCSequence::create( deal01, delay11, call11, NULL)); }else{ SGGridBase *grid = heroLayer1->battleMap->myGrids[i][abs(mapList-1-j)]; if (grid) { if (grid->getStype() == knormal) { ShiBing* sb = heroLayer1->battleMap->getShiBingWithGrid(grid); if(sb) { ap = ap - sb->getDef(); heroLayer1->showBattleLabel( sb->getDef() - (ap * -1), "battle/sub_hp_label.png", SB_ADD_AND_SUB_AP_W, SB_ADD_AND_SUB_AP_H, sb->getSbindex(),false,a+b); if (sb->getSbType() == ksbtwo || sb->getSbType() == ksbfour) { // sb->removeSBGrid(); i++; } sb->setDef(0); CCDelayTime* deal = CCDelayTime::create(a); CCDelayTime* delay = CCDelayTime::create(b); CCCallFuncND* call = CCCallFuncND::create(SGSkillManager::shareSkill(), callfuncND_selector(SGSkillManager::removesb), heroLayer1); sb->runAction(CCSequence::create( deal, delay, call, NULL)); } } else if(grid->getStype() == kdefend) { ShiBing* sb = heroLayer1->battleMap->getShiBingWithGrid(grid); if(sb) { ap = ap - sb->getDef(); //if (ap < 0) { heroLayer1->showBattleLabel( sb->getDef() + ap, "battle/sub_hp_label.png", SB_ADD_AND_SUB_AP_W, SB_ADD_AND_SUB_AP_H, sb->getSbindex(),false,a+b); } sb->setDef(-ap); CCDelayTime* deal = CCDelayTime::create(a); CCDelayTime* delay = CCDelayTime::create(b); CCCallFuncND* call = CCCallFuncND::create(SGSkillManager::shareSkill(), callfuncND_selector(SGSkillManager::removesb), heroLayer1); sb->runAction(CCSequence::create( deal, delay, call, NULL)); } } else { SGAttackList* attack = heroLayer1->battleMap->getAttackListByGrid(grid); if(attack) { ap = ap - attack->getAp(); int aa = 0; if (ap >= 0) { aa = attack->getAp(); }else{ aa = ap; } attack->heroSkillSubAp(aa); attack->setAp(-ap); if ((grid->getStype() == kattackfour || grid->getStype() == kattacktwo) && ap > 0) { attack->playEffectWithType(kAttackEffect); } CCDelayTime* deal = CCDelayTime::create(a); CCDelayTime* delay = CCDelayTime::create(b); CCCallFuncND* call = CCCallFuncND::create(SGSkillManager::shareSkill(), callfuncND_selector(SGSkillManager::removesb), heroLayer1); ShiBing *sb = (ShiBing*)attack->attackSbs->objectAtIndex(0); sb->runAction(CCSequence::create( deal, delay, call, NULL)); //if (ap < 0) { heroLayer1->showBattleLabel( sb->getDef() + ap, "battle/sub_hp_label.png", SB_ADD_AND_SUB_AP_W, SB_ADD_AND_SUB_AP_H, sb->getSbindex(),false,a+b); } if (attack->getAttackType() == kattacknormal) { i += 2; }else{ i += 1; } } } if (ap <= 0) { GameSbIndex *sbin = new GameSbIndex(); sbin->i = i; sbin->j = j; //george//10.23 sbin->autorelease(); CCDelayTime* deal0 = CCDelayTime::create(a); CCDelayTime* delay1 = CCDelayTime::create(b); CCCallFuncND* call1 = CCCallFuncND::create(this, callfuncND_selector(SGHeroSkill15::removeBullet), (void*)(SKILLS_BULLET_TAG + j)); heroLayer->runAction(CCSequence::create( deal0, delay1, call1, NULL)); } } } } else{ break; } } } return (skillDelayTime + sbTime)*3; }