//滑动更新cell
void SGSpecialBattleSecionCell::updateSpCell(SpecialBattleSecData *cellData)
{
    if (!cellData)
    {
        return ;
    }
    this->cellData = cellData;
    
    //更新节名称
    sectionName->setString(cellData->sectionName.c_str());
    //战字按钮显示与否
    battleBtn->setVisible(cellData->canJoin);
    battleBtn->setEnabled(cellData->canJoin);
    //条件
    if (cellData->canJoin)
    {
        int suggestPower = cellData->suggestPower;
        openCondition->setString(CCString::createWithFormat(str_SpecialBattleSuggestPower, suggestPower)->getCString());
    }
    else
    {
        openCondition->setString(cellData->conditionTips.c_str());
    }
    //底图改变
    int iconId = cellData->bgIconId;
    SGMainManager::shareMain()->addSpHeadBgPlistByNum(iconId, sg_specialBattleSecionLayer);
    
    CCSprite *newBg = CCSprite::createWithSpriteFrameName(CCString::createWithFormat("sphead%d.png", iconId)->getCString());
    
    bgButton->setFontImage(newBg->displayFrame());
    
    greyMask->setVisible(!cellData->canJoin);
    
}
Esempio n. 2
0
void SGGetSalaryLayer::updateTime1()
{
    int m = nowTime1;
    int secs = m % 60;
    m /= 60;
    int minutes = m % 60;
    m /= 60;
    int hours = m%24;
    int days = m/24;
    char timeStr[32];
    memset(timeStr, 0, 32);
    snprintf(timeStr, 32, str_GetSalaryLayer_str2, days,hours, minutes, secs);
    
    if (nowTime1 == 0&&isShowPvP)
    {
        btn1->setImage("store_lank.png");
        CCSprite *font = CCSprite::createWithSpriteFrameName("reward_font_lingqu.png");
        btn1->setFontImage(font->displayFrame());
        lab_iscanget1->setString(str_GetSalaryLayer_str8);
        if (btn->isVisible()) {
            btn1->setEnabled(true);
        }
        return;
    }
    nowTime1--;
    lab_iscanget1->setString(timeStr);
}
Esempio n. 3
0
void SGVisitItem1::updateTime()
{
//    CCSpriteFrameCache::sharedSpriteFrameCache() -> addSpriteFramesWithFile("sgvisitlayer/sgvisitlayer1.plist");
    int m = officerTime;
    int secs = m % 60;
    m /= 60;
    int minutes = m % 60;
    int hours = m / 60;
    char timeStr[32];
    memset(timeStr, 0, 32);
    snprintf(timeStr, 32, "%02d:%02d:%02d", hours, minutes, secs);
    
    if (officerTime == 0)
    {
        time->setString(timeStr);
//        officerTime = 30;
//        this->unschedule(schedule_selector(SGVisitItem1::updateTime));
        CCSprite *sprte = CCSprite::createWithSpriteFrameName("visit_free.png");
        visit1->setFontImage(sprte->displayFrame());
        m_noticeGoldFree->setVisible(true);
        return;
    }

    officerTime--;
    time->setString(timeStr);
}
Esempio n. 4
0
void GAnimate::startWithTarget(CCNode *pTarget)
{
    if (m_bFirstTick) CCFiniteTimeAction::startWithTarget(pTarget);
        else CCActionInterval::startWithTarget(pTarget);
    CCSprite *pSprite = (CCSprite*)(pTarget);
    
    CC_SAFE_RELEASE(m_pOrigFrame);
    
    if (this->getAnimation()->getRestoreOriginalFrame())
    {
        m_pOrigFrame = pSprite->displayFrame();
        m_pOrigFrame->retain();
    }
    if (m_bFirstTick) m_nNextFrame = 0;
    m_uExecutedLoops = 0;
    m_bFirstTick = false;
}
Esempio n. 5
0
CCSpriteFrame *SpriteUtil::GetFrame(const char *frame_name) {
#ifdef SPRITEUTIL_DEBUG_MODE
  if (is_use_plist) {
    CCSpriteFrame *frame =
      CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(frame_name);
    if (frame == NULL) {
      CCLog("GetFrameInPlist___%s == NUL", frame_name);
    }
    return frame;
  }
#else
  if (is_use_plist) {
    return CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(frame_name);
  }
#endif

  /**** 单个文件方式 ****/
  CCSprite *sp = CCSprite::create(frame_name);
  if (sp == NULL) {
    CCLog("___GetFrame: %s NUL", frame_name);
  }
  return sp->displayFrame();
}
Esempio n. 6
0
void SGGetSalaryLayer::salaryEnterListener(cocos2d::CCObject *obj)
{
	ResourceManager::sharedInstance()->bindTexture("sgrewardlayer/sgrewardlayer.plist", RES_TYPE_LAYER_UI, sg_getsalaryLayer);
	
    SGSocketRequest *sr = (SGSocketRequest *)obj;
    main::RewardSalaryEntryResponse *response = (main::RewardSalaryEntryResponse *)sr->m_msg;
    nowTime = response->levelrewardtime();
    nowTime1 = response->pvprewardtime();
    
    if (nowTime!=0 && nowTime1!= 0 ) {
       // CCString *str = (CCString *)SGPlayerInfo::sharePlayerInfo()->getrewardNotice()->objectAtIndex(3);
       // str->setString(CCString::createWithFormat("%d",0)->getCString());
        CCArray *array = SGPlayerInfo::sharePlayerInfo()->getrewardNotice();
        int nsum = array->count();
        for (int i = 0 ;i < nsum ;i++) {
            SGRewardNoticeItem * item =(SGRewardNoticeItem *) array->objectAtIndex(i);
            if(item->gettypeItem()==Reward_Salary)
            {
                item->setstateItem(0);
                break;
            }
        }
    }
    
    if (nowTime!=0 && nowTime1== 0 && response->pvplevel() == 0) {
       // CCString *str = (CCString *)SGPlayerInfo::sharePlayerInfo()->getrewardNotice()->objectAtIndex(3);
       // str->setString(CCString::createWithFormat("%d",0)->getCString());
        CCArray *array = SGPlayerInfo::sharePlayerInfo()->getrewardNotice();
        int nsum = array->count();
        for (int i = 0 ;i < nsum ;i++) {
            SGRewardNoticeItem * item =(SGRewardNoticeItem *) array->objectAtIndex(i);
            if(item->gettypeItem()==Reward_Salary)
            {
                item->setstateItem(0);
                break;
            }
        }
    }
    
    if (nowTime1 != 0)
    {
        
        btn1->setImage("store_huik.png");
        CCSprite *font = CCSprite::createWithSpriteFrameName("reward_font_yiling.png");
        btn1->setFontImage(font->displayFrame());
        //modify by:zyc. 服务器已经更改背包数据   客户端无需操作。
        //SGPlayerInfo::sharePlayerInfo()->setPlayerCoins(SGPlayerInfo::sharePlayerInfo()->getPlayerCoins() + response->pvplevelcoin());
        EFFECT_PLAY(MUSIC_34);
//        SGMainManager::shareMain()->showMessage(CCString::createWithFormat("成功领取了%d",response->pvplevelcoin())->getCString());
 
        if ( m_type == 1 && response->pvplevelcoin() > 0 )
        {
            //弹出框显示奖励
            CCArray *data=CCArray::create();
            data->retain();
            SGMailSystemAccessoryDataModel *datamodel=new SGMailSystemAccessoryDataModel ;
            datamodel->setType(1);
            datamodel->setCount(response->pvplevelcoin());
            data->addObject(datamodel);
            
            SGShowRewardBox *rewardBox=SGShowRewardBox::create(this, data);
            SGMainManager::shareMain()->showBox(rewardBox);
        }
        
        btn1->setEnabled(false);
    }
    if (nowTime != 0)
    {
        btn->setImage("store_huik.png");
        CCSprite *font = CCSprite::createWithSpriteFrameName("reward_font_yiling.png");
        btn->setFontImage(font->displayFrame());
        //modify by:zyc. 服务器已经更改背包数据   客户端无需操作。
        //SGPlayerInfo::sharePlayerInfo()->setPlayerCoins(SGPlayerInfo::sharePlayerInfo()->getPlayerCoins() + response->levelcoin());
        EFFECT_PLAY(MUSIC_34);
//        SGMainManager::shareMain()->showMessage(CCString::createWithFormat("成功领取了%d",response->levelcoin())->getCString());
        
        if (m_type == 0 &&response->levelcoin() > 0)
        {
            //弹出框显示奖励
            CCArray *data=CCArray::create();
            data->retain();
            SGMailSystemAccessoryDataModel *datamodel=new SGMailSystemAccessoryDataModel ;
            datamodel->setType(1);
            datamodel->setCount(response->levelcoin());
            data->addObject(datamodel);
            
            SGShowRewardBox *rewardBox=SGShowRewardBox::create(this, data);
            SGMainManager::shareMain()->showBox(rewardBox);
        }
        

        
        btn->setEnabled(false);
    }
    SGMainManager::shareMain()->updataUserMsg();
    
}
Esempio n. 7
0
void SGEquipStrengLayer::refreshView(SGEquipCard *card)
{
    _card = card;
    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());

    static_cast<CCSprite *>(this->getChildByTag(123))->setDisplayFrame(item->displayFrame());
    
    
    this->setstar(_card->getCurrStar(),_card->getUpgradestar());
    
    SGEquipmentDataModel *general = SGStaticDataManager::shareStatic()->getEquipById(_card->getItemId());
    this->setCardType(general->getEquipType());
    
    
    equipName->setString(_card->getOfficerName()->getCString());
    int equipStar = _card->getCurrStar() - 2;
    equipStar = equipStar < 0 ? 0 : equipStar;
    if (equipStar >= 0 && equipStar < 5)
    {
        equipName->setInsideColor(ccStarLevelColor[equipStar]);
    }
    else
    {
        equipName->setInsideColor(ccWHITE);
    }
    
    equiplevel->setString(CCString::createWithFormat("Lv %d/%d",_card->getCurrLevel(), SGPlayerInfo::sharePlayerInfo()->getPlayerLevel())->getCString());
    
    
    setEquipLevel(_card->getCurrLevel());
    setCostCount(_card->getCurrLevel());
    setCurrStatus(_card->getCurrLevel());
    
    creatBostLevel(SGLayout::getPoint(kMiddleCenter));
    
    showMainChat(false);
    CCSize winSize = CCDirector::sharedDirector()->getWinSize();
    //更换背景图片
    //创建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 * refreshBg = CCSprite::createWithSpriteFrameName(str_vec[starLev-3].c_str());
    ((CCSprite*)getChildByTag(1919))->setDisplayFrame(refreshBg->displayFrame());

}
//=============================================================
//=============================================================
void CC3DCircleListLayer::initDataCircle(float fEllipseA,float fEllipseB,CCSize itemSize,CCArray* pArray,bool bFlipY)
{
    if(!pArray)
        return;
    m_itemSize = itemSize;
    m_fEllipseA = fEllipseA;
    m_fEllipseB = fEllipseB;
    
    int     nAllItemCount = pArray->count();
    float   fCircleStepDegree = (2*M_PI)/nAllItemCount;
    
    float fMoveX = getContentSize().width*0.5;
    float fMoveY = getContentSize().height*0.5;
    
    m_pButtonArray->removeAllObjects();
    for(int i=0;i<nAllItemCount;i++)
    {
        float fCurDegree = fCircleStepDegree * (i+1);
        float fCircleX = m_fEllipseA * cosf(fCurDegree);
        float fCircleY = m_fEllipseB * sinf(fCurDegree);
        
        fCircleX += fMoveX;
        fCircleY += fMoveY;
        
        CCSprite* pSprite = (CCSprite*)pArray->objectAtIndex(i);
        
        CCScale9Sprite* pScaleSprite = CCScale9Sprite::createWithSpriteFrame(pSprite->displayFrame());
        CCButton* pButton = CCButton::create( pScaleSprite);
        pButton->setTag(i);
        pButton->setZoomOnTouchDown(false);
        
        CCPoint point = ccp(fCircleX,fCircleY);
        pButton->setPosition(point);
        
        CCString* pString = new CCString();
        pString->initWithFormat("%f",fCurDegree);
        pButton->setUserData(pString);
        pButton->addTargetWithActionForControlEvents(this, cccontrol_selector(CC3DCircleListLayer::clickButton), CCControlEventTouchUpInside);
        addChild(pButton);
        m_pButtonArray->addObject(pButton);
        
        if(bFlipY)
        {
            CCSize buttonSize = pButton->getContentSize();
            CCSprite* pFlipYSprite = CCSprite::createWithTexture(pSprite->getTexture());
            CCRect oldRect = pSprite->getTextureRect();
            pFlipYSprite->setFlipY(true);
            pFlipYSprite->setOpacity(255*0.5);
            pFlipYSprite->setAnchorPoint(ccp(0.5,1));
            pFlipYSprite->setPosition(ccp(buttonSize.width*0.5,0));
            pButton->addChild(pFlipYSprite);
        }
        
//        CCSize buttonSize = pButton->getContentSize();
//        char testChr[32];
//        sprintf(testChr, "%d",i);
//        CCLabelTTF* pTestLabel = CCLabelTTF::create(testChr, "Arial", 52);
//        pTestLabel->setColor(ccRED);
//        pTestLabel->setPosition(ccp(buttonSize.width*0.5,buttonSize.height*0.5));
//        pButton->addChild(pTestLabel);
        
    }
    refreshItemWithMoveDegree(0);
}
Esempio n. 9
0
bool SGVisitItem1::initWithSize(int num,int a,int b,bool huoVisitOpen)
{
    if (!SNSTableViewCellItem::init()) {
		return false;
	}
    officerTime = a;
	bgbgbg = NULL;
    
    s = CCDirector::sharedDirector()->getWinSize();
   
    zik = CCSprite::createWithSpriteFrameName("visit_zik.png");
    
    zik->setAnchorPoint(ccp(0.5, 1));
    zik->ignoreAnchorPointForPosition(false);
    zik->setPosition(ccp(0, zik->getContentSize().height/2));
    addChild(zik,-10);
    zik->setScaleX(s.width/zik->getContentSize().width);
    
    float posyRate = 1.1;
    if (s.height > 1024) {
        posyRate = s.height/970;
    }
    int shift = 0;
    int fontShift = 0;
    int timeShift = 0;
    int timeShiftx = 0;
    if (CCDirector::sharedDirector()->getWinSize().height == ipadResource.size.height)
    {
        shift = -30;
        fontShift = 15;
        timeShift = 10;
        timeShiftx = 50;
    }
    if (CCDirector::sharedDirector()->getWinSize().height == 960)
    {
        posyRate = s.height / 940;
        if (CCDirector::sharedDirector()->getWinSize().width <= 640)
        {
            shift = -24;
        }
        else
        {
           shift = 15;
        }
        
        fontShift = 40;
        timeShift = 20;
        timeShiftx = 0;
    }
    else{
        shift = -35;
    }

    zik->setScaleY(posyRate);
    

    CCSprite *font1 = NULL;
    CCSprite *font2 = NULL;
    int currTime = 0;
    if (num == 0) {       
        font1 = CCSprite::createWithSpriteFrameName("font_tfcqwj.png");
        if (huoVisitOpen)
        {
            
            font2 = CCSprite::createWithSpriteFrameName("font_huosong.png");
        }
        else
        {
            font2 = CCSprite::createWithSpriteFrameName("font_3xwj.png");
        }
    }
    else if(num == 1)
    {        
        font1 = CCSprite::createWithSpriteFrameName("font_tfcqzb.png");
        font2 = CCSprite::createWithSpriteFrameName("font_3xzb.png");        
    }
    if (font1) {
        font1->setAnchorPoint(ccp(0, 1));
        font1->ignoreAnchorPointForPosition(false);
        addChild(font1,20);
        font1->setPosition(ccp(-zik->getContentSize().width/2, zik->getContentSize().height/2 -5 ));
    }
    if (font2) {
        addChild(font2,20);
        font2->setAnchorPoint(ccp(0, 0.5));
        font2->cocos2d::CCNode::ignoreAnchorPointForPosition(false);
        font2->setPosition(ccpAdd(ccp(-zik->getContentSize().width/2, 0), ccp(font2->getContentSize().width / 2.5, -font2->getContentSize().height * 2 + fontShift)));
    }

    if (num == 0) {
        visit1 = SGButton::create("visit_anniu.png", "font_300.png", this, menu_selector(SGVisitItem1::test),CCPointZero,false,true);

    }else
    {
        //visit1 = SGButton::create("visit_anniu.png", "font_100.png", this, menu_selector(SGVisitItem1::test),CCPointZero,false,true);
    }
    

    
    
    visit1->setTag(num+110);
    SGButton *visit10 = SGButton::create("visit_anniu.png", "font_tfz1.png", this, menu_selector(SGVisitItem1::confirmHandler),CCPointZero,false,true);
    visit10->setTag(num +120);
    visit10->setAnchorPoint(ccp(1, 1));
    visit10->ignoreAnchorPointForPosition(false);
    visit1->setAnchorPoint(ccp(1, 1));
    visit1->ignoreAnchorPointForPosition(false);
    visit1->setPosition(ccpAdd(font2->getPosition(), ccp(visit10->getContentSize().width / 1.8, -font2->getContentSize().height / 1.9 + shift)));
    visit10->setPosition(ccpAdd(visit1->getPosition(), ccp(visit10->getContentSize().width * 1.2, 0)));
    
    CCMenu *menu1 = CCMenu::create();
	menu1->setTouchPriority(128);
    menu1->setTag(111);
    menu1->setPosition(CCPointZero);
    this->addChild(menu1,5);
    menu1->addChild(visit1);
    menu1->addChild(visit10);
    
    
    //买物品送武将
    SGCCLabelTTF *infoTips = SGCCLabelTTF::create("赠送奖励:武将或者物品", FONT_PANGWA, 30);
    this->addChild(infoTips, 8);
    infoTips->setPosition(ccpAdd(ccp(CCDirector::sharedDirector()->getWinSize().width / 2, CCDirector::sharedDirector()->getWinSize().height / 2),
                                 ccp(0, visit10->getPositionY())));
    
    //有免费元宝探访机会
    m_noticeGoldFree = CCSprite::createWithSpriteFrameName("publc_notice.png");
    m_noticeGoldFree->setPosition(ccp(visit1->getContentSize().width*0.92 , visit1->getContentSize().height*0.92));
    m_noticeGoldFree->setVisible(false);
    visit1->addChild(m_noticeGoldFree);

    if (officerTime == 0)
    {
        CCSprite *sprte = CCSprite::createWithSpriteFrameName("visit_free.png");
        visit1->setFontImage(sprte->displayFrame());
        m_noticeGoldFree->setVisible(true);
    }
   
    
//    if(STATE_YES == SGPlayerInfo::sharePlayerInfo()->getPlayerNoticeById(401 , false))
    
    currTime = a;
    //left->setPercentage(b);
    int secs = currTime % 60;
    currTime /= 60;
    int minutes = currTime % 60;
    int hours = currTime / 60;
    char timeStr[32];
    memset(timeStr, 0, 32);
    snprintf(timeStr, 32, "%02d:%02d:%02d", hours, minutes, secs);
    SGCCLabelTTF *timeMsg = SGCCLabelTTF::create(str_TongQueLayer_str21, FONT_PANGWA, FONTSIZE(13));
    this->addChild(timeMsg,10);
    timeMsg->setPosition(ccpAdd(zik->getPosition(), ccp(zik->getContentSize().width / 2.4 +timeShiftx, -timeMsg->getContentSize().height  + timeShift)));
    
    time = SGCCLabelTTF::create(timeStr, FONT_PANGWA, FONTSIZE(13));
    this->addChild(time,10);
    time->setPosition(ccpAdd(timeMsg->getPosition(), ccp(-timeMsg->getContentSize().width / 1.8 - time->getContentSize().width / 2, 0)));
     CCSize size=CCDirector::sharedDirector()->getWinSize();
    
    
    ResourceManager::sharedInstance()->bindTexture("sanguobigpic/wj_6.1.plist",RES_TYPE_LAYER_UI ,sg_visitShowCard);
    ResourceManager::sharedInstance()->bindTexture("sanguobigpic/wj_6.2.plist",RES_TYPE_LAYER_UI ,sg_visitShowCard);
    ResourceManager::sharedInstance()->bindTexture("sanguobigpic/wj_6.3.plist",RES_TYPE_LAYER_UI ,sg_visitShowCard);
    ResourceManager::sharedInstance()->bindTexture("sanguobigpic/wj_6.4.plist",RES_TYPE_LAYER_UI ,sg_visitShowCard);
    ResourceManager::sharedInstance()->bindTexture("sanguobigpic/wj_6.5.plist",RES_TYPE_LAYER_UI ,sg_visitShowCard);

    
    if (num == 0)
    {
        
    layer = CCLayer::create();
    this->addChild(layer,4);
    char wj[30] = {0};
    index = 0;
    zbIndex = 0;
    for (int i = 0; i<5; i++)
    {
        sprintf(wj,"wj_6.%d.png",i+1);
        CCSprite *sp = CCSprite::createWithSpriteFrameName(wj);
        layer->addChild(sp,1);
        sp->setAnchorPoint(ccp(0, 0));
        sp->setTag(i);
        sp->setScaleY(posyRate);
        sp->setPosition(ccpAdd(zik->getPosition(), ccp(size.width * i - sp->getContentSize().width/2,
                                                       -zik->getContentSize().height*.8 * posyRate)));
    }        
        this->startMove();
    }
    
    else if (num == 1) {      
        
        zbLayer = CCLayer::create();
        this->addChild(zbLayer);
        char zb[30] = {0};
        index = 0;
        zbIndex = 0;
        for (int i = 0; i<6; i++)
        {
            sprintf(zb,"zb_6.%d.png",i+1);
            CCString *str_zbm = CCString::createWithFormat("zbm_6.%d.png",i+1);
            CCSprite *zbm = CCSprite::createWithSpriteFrameName(str_zbm->getCString());
            CCSprite *sp = CCSprite::createWithSpriteFrameName(zb);
            zbLayer->addChild(zbm,1);
            zbm->setTag(i+100);
            zbLayer->addChild(sp);
            zbm->setPosition(ccpAdd(zik->getPosition(), ccp(- zik->getContentSize().width*.17 + size.width*i, zik->getContentSize().height*.26)));
            sp->setAnchorPoint(ccp(0, 0));
            sp->setTag(i+10);
            sp->setPosition(ccpAdd(zik->getPosition(), ccp(size.width * i - zik->getContentSize().width*.6,-zik->getContentSize().height*.4)));
        }
        this->zbStartMove();
    }
    this->schedule(schedule_selector(SGVisitItem1::updateTime), 1.0);
    
    if (font1) {
        labelDesc = SGCCLabelTTF::create(str_TongQueLayer_str22, FONT_BOXINFO, FONTSIZE(12));
        labelDesc->setAnchorPoint(ccp(1, 1));
        labelDesc->ignoreAnchorPointForPosition(false);
        labelDesc->setPosition(ccpAdd(font1->getPosition(), ccp(zik->getContentSize().width*0.8  , -labelDesc->getContentSize().height)));
    }

    labelTime = SGCCLabelTTF::create("00:00", FONT_BOXINFO, FONTSIZE(15));

    labelTime->setAnchorPoint(ccp(0.5f, 0));
    labelTime->ignoreAnchorPointForPosition(false);

    labelTime->setPosition(ccpAdd(labelDesc->getPosition(), ccp(size.width*0.08, labelTime->getContentSize().height/3-15)));
    labelTime->setVisible(false);
    this->addChild(labelTime,20,1);

    return true;
}
Esempio n. 10
0
//滑动时更新cell
void SGPiecesCell::updatePiecesCard(SGPiecesCard *card)
{
    ResourceManager::sharedInstance()->bindTexture("sgpieceslayer/sgpieceslayer.plist", RES_TYPE_LAYER_UI, sg_piecesLayer);
    
    char officerName[256] = "\0";
	int shift = 0;// 名称黑色背景右向偏移
	
	int iconId = -1;
	if (card->getItemType() == 0)//武将
	{
		SGOfficerDataModel *temp = SGStaticDataManager::shareStatic()->getOfficerById(card->getCallCardId());
		iconId = temp->getIconId();
	}
	else if (card->getItemType() == 1)//装备
	{
		SGEquipmentDataModel *temp =SGStaticDataManager::shareStatic()->getEquipById(card->getCallCardId());
		iconId = temp->getIconId();
	}
	
	SGMainManager::shareMain()->addHeadIconPlistByNum(iconId,sg_piecesLayer);
	sprintf(officerName, "head%d.png", iconId);
	
	shift = 10;
	
	//滑动过后重置cell上的头像
	CCSprite *piecesHeadTemp = CCSprite::createWithSpriteFrameName(officerName);
    static_cast<CCSprite *>(this->getChildByTag(HEAD_TAG))->setDisplayFrame(piecesHeadTemp->displayFrame());
    
	
	//滑动过后的品质框
	char pinzhi[256] = "\0";
	
	if (card->getItemType() == 0)
	{
		SGOfficerDataModel *temp = SGStaticDataManager::shareStatic()->getOfficerById(card->getCallCardId());
		int starlvl = temp->getOfficerCurrStarLevel();
		if (starlvl>1)
        {
			starlvl-=1;
		}
		sprintf(pinzhi, "officerPinzhi_%d_0.png",starlvl);
	}
	else if (card->getItemType() == 1)
	{
		SGEquipmentDataModel *equipModel = SGStaticDataManager::shareStatic()->getEquipById(info->getCallCardId());
		sprintf(pinzhi, "equipPinzhi_%d_0.png", equipModel->getEquipStarPinzhi());
	}
	
    //更新的时候重围品质框
	CCSprite *pzTemp = CCSprite::createWithSpriteFrameName(pinzhi);
    static_cast<CCSprite *>(this->getChildByTag(PINZHI_TAG))->setDisplayFrame(pzTemp->displayFrame());
	
    //头像蒙版不需要更新
	
    
	int addCommonPieces = 0;//加到当前碎片数上,值由isUseCommon来决定是0,还是可使用的通用碎片数
	int piecesCommonNum = 0;
	CCArray *piecesArray = SGPlayerInfo::sharePlayerInfo()->getPiecesCommonCards();
	if (piecesArray->data && piecesArray->data->arr && piecesArray->count())
	{
		piecesCommonNum = ((SGPiecesCard *)piecesArray->objectAtIndex(0))->getPiecesCurNum();//能使用的通用碎片
	}
	
	//重置碎片名称
    piecesName->setString(card->getPiecesName()->getCString());
    
    
	//更新显示进度
    totalAndCurProgress->setString(CCString::createWithFormat(str_PiecesCell_str4, card->getPiecesCurNum())->getCString());
    
//	if (card->getPiecesCurNum() >= card->getSummonNeed())//拥有的碎片数能召唤
//	{
//		totalAndCurProgress->setInsideColor(COLOR_GREEN);
//	}
//	else
//	{
//		totalAndCurProgress->setInsideColor(ccWHITE);
//	}
}