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;
}
Exemple #4
0
//对敌方阵营随机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));
    }
    
}
// on "init" you need to initialize your instance
bool HelloWorld::init()
{
    bool bRet = false;
    do 
    {
        //////////////////////////////////////////////////////////////////////////
        // super init first
        //////////////////////////////////////////////////////////////////////////

        CC_BREAK_IF(! CCLayer::init());

        //////////////////////////////////////////////////////////////////////////
        // add your codes below...
        //////////////////////////////////////////////////////////////////////////

        // 1. Add a menu item with "X" image, which is clicked to quit the program.

        // Create a "close" menu item with close icon, it's an auto release object.
        CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
            "CloseNormal.png",
            "CloseSelected.png",
            this,
            menu_selector(HelloWorld::menuCloseCallback));
        CC_BREAK_IF(! pCloseItem);

        // Place the menu item bottom-right conner.
        pCloseItem->setPosition(ccp(CCDirector::sharedDirector()->getWinSize().width - 20, 20));

        // Create a menu with the "close" menu item, it's an auto release object.
        CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
        pMenu->setPosition(CCPointZero);
        CC_BREAK_IF(! pMenu);

        // Add the menu to HelloWorld layer as a child layer.
        this->addChild(pMenu, 1);

        // 2. Add a label shows "Hello World".

        // Create a label and initialize with string "Hello World".
        CCLabelTTF* pLabel = CCLabelTTF::create("Spriter Demo", "Arial", 24);
        CC_BREAK_IF(! pLabel);

        // Get window size and place the label upper. 
        CCSize size = CCDirector::sharedDirector()->getWinSize();
        pLabel->setPosition(ccp(size.width / 2, size.height - 50));

        // Add the label to HelloWorld layer as a child layer.
        this->addChild(pLabel, 1);

		// 3. create sprite from spriter resource 

		// create 'Example.SCML'
		{
			CCSpriterX* animator = CCSpriterX::create( "Example.SCML" );
			CC_BREAK_IF(! animator);
			animator->setPosition(ccp(110, 350));
			animator->setScale(0.5f); // half size 
			int tag = 100;
			this->addChild(animator, 0, tag);
		}
		

		// create 'Example.SCML' 
		{
			CCSpriterX* animator = CCSpriterX::create( "Example.SCML" );
			CC_BREAK_IF(! animator);
			animator->setPosition(ccp(380, 160));
			animator->setScale(1.0f);
			// animator->PlayNext(); // play next 
			int tag = 110;
			this->addChild(animator, 0, tag);
		}

		// create 'Hero.SCML'
		{
			CCSpriterX* animator = CCSpriterX::create( "Hero.SCML" );
			CC_BREAK_IF(! animator);
			animator->setPosition(ccp(50, 200));
			animator->setScale(0.5f); // half size  
			int tag = 200;
			this->addChild(animator, 0, tag);
		}

		// create 'Hero.SCML'
		{
			CCSpriterX* animator = CCSpriterX::create( "Hero.SCML" );
			CC_BREAK_IF(! animator);
			animator->setPosition(ccp(130, 200));
			animator->setScale(1.0f);
			// animator->PlayNext(); // play next 
			int tag = 210;
			this->addChild(animator, 0, tag); 
		}

		CCDirector* pDirector = CCDirector::sharedDirector();
		pDirector->getTouchDispatcher()->addTargetedDelegate(this, 0, true);

		// test code 		
		schedule( schedule_selector(HelloWorld::TestChangeAnimation), 4.0 );

        bRet = true;

    } while (0);

    return bRet;
}
//对敌方全列,进行武将攻击力总额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;
}