当前位置: 首页>>代码示例>>C++>>正文


C++ CCString::setString方法代码示例

本文整理汇总了C++中CCString::setString方法的典型用法代码示例。如果您正苦于以下问题:C++ CCString::setString方法的具体用法?C++ CCString::setString怎么用?C++ CCString::setString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCString的用法示例。


在下文中一共展示了CCString::setString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updateCellBySGamePlayer

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());
}
开发者ID:caoguoping,项目名称:warCraft,代码行数:34,代码来源:SGFriendCellBase.cpp

示例2: init

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());
            }
//.........这里部分代码省略.........
开发者ID:caoguoping,项目名称:warCraft,代码行数:101,代码来源:SGStrengConfirm.cpp


注:本文中的CCString::setString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。