Ejemplo n.º 1
0
void SGFriendCellBase::updateCellBySGamePlayer(SGGamePlayer *player)
{
    _player = player;
    CCString *fileName = CCString::createWithFormat("countryIcon_%d.png",player->getImage());
    CCSprite *sprite = CCSprite::createWithSpriteFrameName(fileName->getCString());
    if(NULL == sprite)
    {
        fileName->setString("countryIcon_3.png");
    }

    itemHeadPic->setImage(fileName->getCString());
    itemHeadPic->setFontImage(CCSprite::createWithSpriteFrameName(CCString::createWithFormat("country_%d.png",player->getImage())->getCString())->displayFrame());
    itemHeadPic->setFontImageScale(1.08);
    labelLevel->setString(CCString::createWithFormat(str_Format_ji,player->getLevel())->getCString());;
    if(player->getTime() == 0/*player->getIsOnline()*/)
    {
        labelLoginTime->setInsideColor(ccGREEN);
        labelLoginTime->setString(str_FriendBase_str14);
    }else{
        labelLoginTime->setInsideColor(ccRED);
        if (player->getTime()>0 && player->getTime() < 3600000) {
            labelLoginTime->setString(CCString::createWithFormat(str_FriendBase_str17,player->getTime()/600000)->getCString());
        }
        else if (player->getTime()>= 3600000 && player->getTime() < 1000*60*60*24) {
            labelLoginTime->setString(CCString::createWithFormat(str_FriendBase_str18,player->getTime()/3600000)->getCString());
        }
        else if (player->getTime()>= 1000*60*60*24) {
            labelLoginTime->setString(CCString::createWithFormat(str_FriendBase_str19,player->getTime()/(1000*60*60*24))->getCString());
        }else{
            labelLoginTime->setString(CCString::createWithFormat(str_FriendBase_str20,player->getTime()/(1000*60*60*24*30))->getCString());
        }
    }
    labelName->setString(player->getFriendName()->getCString());
}
Ejemplo n.º 2
0
bool SGStrengConfirm::init(SGBoxDelegate *bdg, SGOfficerCard *card,int type)
{
        CCPoint center = SGLayout::getPoint(kMiddleCenter);
        enterType = type;

    if (!SGBaseBox::init(bdg,box_confirm,CCSizeMake(600, 800),false,true))//!SGBaseBox::init(bdg,box_strengTag,CCSizeMake(535, 635),false,true,CCSizeMake(535, 125)))
    {
        return false;
    }
    
        ResourceManager::sharedInstance()->bindTexture("sggeneralinfolayer/sggeneralinfolayer1.plist", RES_TYPE_LAYER_UI, sg_box_strengBox);
//
    SGCCLabelTTF *title = SGCCLabelTTF::create(str_StrengConfiirm_str1,FONT_XINGKAI,34);
//    title->setColor(ccc3(0xff,0xc8, 0x07));
    title->setPosition(ccpAdd(center,ccp(0,title->getContentSize().height*8.5)));
    this->addChild(title);
    if (enterType ==2) {
        title->setString(str_StrengConfiirm_str2);
    }
    SGMainManager::shareMain()->addHeadIconPlistByNum(card->getHeadSuffixNum(), sg_generalInfoLayer);
    SGMainManager::shareMain()->addOfficerPng(card->getHeadSuffixNum(), sg_generalInfoLayer);
    CCString* str = CCString::createWithFormat("officer_%d.png",card->getHeadSuffixNum());
    
    CCSprite* bigbg = CCSprite::createWithSpriteFrameName("pad武将底图.png");
    this->addChild(bigbg,0);
    bigbg->setScale(500/bigbg->getContentSize().width);
    bigbg->setPosition(ccpAdd(title->getPosition(), ccp(0, -bigbg->getContentSize().height*.38)));


    CCSprite *officer = CCSprite::createWithSpriteFrameName(str->getCString());
    officer->setAnchorPoint(ccp(0.5,0));
    officer->setPosition(ccpAdd(title->getPosition(),ccp(0,-50-officer->getContentSize().height)));
    officer->setScale(.9);
    this->addChild(officer);
    
    CCSprite* tiao = CCSprite::createWithSpriteFrameName("streng_tiao.png");
    tiao->setPosition(ccpAdd(center,ccp(0,0)));
    this->addChild(tiao,1);
    
    CCString *strengnamebefore = CCString::create("");
    CCString *strengnameafter = CCString::create("");
    if (enterType==2) {
        SGSkillDataModel *lordSkill = SGStaticDataManager::shareStatic()->getLordSkillById(_card->getLordId());
        if (lordSkill) {
           strengnamebefore->setString(lordSkill->getSkillName()->getCString());
            SGSkillDataModel *lordSkilla = SGStaticDataManager::shareStatic()->getLordSkillById(lordSkill->getNextId());
            if (lordSkilla) {
                strengnameafter->setString(lordSkilla->getSkillName()->getCString());
            }
            
        }

        
    }
    else
    {
        SGSkillDataModel *officerSkill = SGStaticDataManager::shareStatic()->getGeneralSkillById(_card->getOfficerSkil());
        if (officerSkill) {
        strengnamebefore->setString(officerSkill->getSkillName()->getCString());
        SGSkillDataModel *officerSkilla = SGStaticDataManager::shareStatic()->getGeneralSkillById(officerSkill->getNextId());
            if (officerSkilla) {
                strengnameafter->setString(officerSkilla->getSkillName()->getCString());
            }
        
        }
    }
    SGCCLabelTTF *jibefore = SGCCLabelTTF::create(strengnamebefore->getCString(), FONT_XINGKAI,34 , ccc3(0x54, 0x00, 0x19) , ccWHITE);
    this->addChild(jibefore,1);
    jibefore->setPosition(ccpAdd(center,ccp(-160,0)));
    
    
    SGCCLabelTTF *lvbefore = SGCCLabelTTF::create("", FONT_XINGKAI,28);
    SGCCLabelTTF *lvafter = SGCCLabelTTF::create("", FONT_XINGKAI,28);
    CCString *strlv1 = CCString::create("");
    CCString *strlv2 = CCString::create("");
    
    if (enterType==2) {
        SGSkillDataModel *lordSkill = SGStaticDataManager::shareStatic()->getLordSkillById(_card->getLordId());
        if (lordSkill) {
            strlv1 = CCString::createWithFormat("Lv%d",lordSkill->getLevel());
            SGSkillDataModel *lordSkilla = SGStaticDataManager::shareStatic()->getLordSkillById(lordSkill->getNextId());
            if (lordSkilla) {
                strlv2 = CCString::createWithFormat("Lv%d",lordSkilla->getLevel());
            }
            
        }
        
        lvbefore ->setString(strlv1->getCString());
        lvafter ->setString(strlv2->getCString());

    }
    else
    {
        SGSkillDataModel *officerSkill = SGStaticDataManager::shareStatic()->getGeneralSkillById(_card->getOfficerSkil());
        if (officerSkill) {
           strlv1 =CCString::createWithFormat("Lv%s",officerSkill->getSkillClientLevel()->getCString());
           SGSkillDataModel *officerSkilla = SGStaticDataManager::shareStatic()->getGeneralSkillById(officerSkill->getNextId());
            if (officerSkilla) {
                strlv2 =CCString::createWithFormat("Lv%s",officerSkilla->getSkillClientLevel()->getCString());
            }
           
        }
        lvbefore ->setString(strlv1->getCString());
        lvafter ->setString(strlv2->getCString());
    
    }

    this->addChild(lvbefore,1);
    lvbefore->setPosition(ccpAdd(jibefore->getPosition(),ccp(jibefore->getContentSize().width*.5+2+lvbefore->getContentSize().width*.5,0)));
    
    SGCCLabelTTF *jiafter = SGCCLabelTTF::create(strengnameafter->getCString(), FONT_XINGKAI,34 , ccc3(0x09, 0xc7, 0x00) , ccWHITE);
    this->addChild(jiafter,1);
    jiafter->setPosition(ccpAdd(center,ccp(100,0)));
    
    this->addChild(lvafter,1);
    lvafter->setPosition(ccpAdd(jiafter->getPosition(),ccp(jiafter->getContentSize().width*.5+2+lvafter->getContentSize().width*.5,0)));
   
    ResourceManager::sharedInstance()->bindTexture("sanguobigpic/tipsinside.plist", RES_TYPE_LAYER_UI, sg_generalInfoLayer);

    CCSprite *infobg1 = CCSprite::createWithSpriteFrameName("tipsinside.png");
    infobg1->setAnchorPoint(ccp(0.5,1));
    infobg1->setScale(.5);
    infobg1->setScaleY(.55);
    infobg1->setPosition(ccpAdd(center,ccp(-140, -tiao->getContentSize().height*.4)));
    this->addChild(infobg1,0);
    
    CCSprite *infobg2 = CCSprite::createWithSpriteFrameName("tipsinside.png");
    infobg2->setAnchorPoint(ccp(0.5,1));
    infobg2->setScale(.5);
    infobg2->setScaleY(.55);
    infobg2->setPosition(ccpAdd(center,ccp(140, -tiao->getContentSize().height*.4)));
    this->addChild(infobg2,0);
   
    CCString *infostr = CCString::create("");
    CCString *infostr2 = CCString::create("");
    
    if (enterType==2) {
        SGSkillDataModel *lordSkill = SGStaticDataManager::shareStatic()->getLordSkillById(_card->getLordId());
        if (lordSkill) {
            infostr ->setString(lordSkill->getSkillInfo()->getCString());
            SGSkillDataModel *lordSkilla = SGStaticDataManager::shareStatic()->getLordSkillById(lordSkill->getNextId());
            if (lordSkilla) {
               infostr2->setString(lordSkilla->getSkillInfo()->getCString());
            }
            
        }
        else
        {
            infostr->setString(str_EmbattleLayer_str15);
             infostr2->setString(str_EmbattleLayer_str15);
        }
    
    }
    else
    {
        SGSkillDataModel *officerSkill = SGStaticDataManager::shareStatic()->getGeneralSkillById(_card->getOfficerSkil());
        if (officerSkill) {
            infostr ->setString(officerSkill->getSkillInfo()->getCString());
             SGSkillDataModel *officerSkilla = SGStaticDataManager::shareStatic()->getGeneralSkillById(officerSkill->getNextId());
            if(officerSkilla)
            infostr2->setString(officerSkilla->getSkillInfo()->getCString());

                  }
        else
        {
            infostr->setString(str_StrengConfiirm_str3);
            infostr2->setString(str_StrengConfiirm_str3);
        }

        
    }

    
    CCLabelTTF *info1=CCLabelTTF::create(infostr->getCString(),FONT_BOXINFO, 28, CCSizeMake(200,300), kCCTextAlignmentLeft, kCCVerticalTextAlignmentTop);
    info1->setColor(ccc3(0x35,0x14,0x03));
    info1->setPosition(ccpAdd(infobg1->getPosition(),ccp(0,-15)));
    info1->setAnchorPoint(ccp(0.5,1));
    this->addChild(info1,10);
    
    CCLabelTTF *info2=CCLabelTTF::create(infostr2->getCString(),FONT_BOXINFO, 28, CCSizeMake(200,300), kCCTextAlignmentLeft, kCCVerticalTextAlignmentTop);
    info2->setColor(ccc3(0x0f,0x79,0x01));
    info2->setPosition(ccpAdd(infobg2->getPosition(),ccp(0,-15)));
    info2->setAnchorPoint(ccp(0.5,1));
    this->addChild(info2,10);

    
    
    
    
    CCSprite *jt = CCSprite::createWithSpriteFrameName("streng_jt.png");
    jt->setPosition(ccpAdd(center,ccp(0,-140)));
    this->addChild(jt);
    
    SGButton *cancel = SGButton::create("box_btnbg.png", "public_font_quxiao.png", this, menu_selector(SGStrengConfirm::backhandle),CCPointZero,false,true);
    cancel->setPosition(ccpAdd(center,ccp(140,-340)));
    this->addBtn(cancel);
    
    SGButton *streng = SGButton::create("box_btnbg.png", "public_font_queding.png", this, menu_selector(SGStrengConfirm::strenghandel),CCPointZero,false,true);
    streng->setPosition(ccpAdd(center,ccp(-140,-340)));
    this->addBtn(streng);

//    this->setstar(_card->getCurrStar(), _card->getUpgradestar());
    this->setstar(3 , 3);
    return true;
    

}