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


C++ TextNode::setColor方法代码示例

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


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

示例1: showInvitationCode

void FriendInvitationLayer::showInvitationCode(const char *invitationCode) {
    CCSprite *spInvitationBg = CCSprite::spriteWithFile("invitation_bg.png");
    spInvitationBg->setPosition(CCPointMake(320, 440));
    addChild(spInvitationBg);
    
    CCSprite *tempSprite1 = CCSprite::spriteWithSpriteFrameName("shareWeibo.png");
    CCSprite *tempSprite2 = CCSprite::spriteWithSpriteFrameName("shareWeibo.png");
    CCMenuItem *menuItemSina = CCMenuItemImage::itemFromNormalSprite(tempSprite1, 
                                                                     tempSprite2,
                                                                     this, 
                                                                     menu_selector(FriendInvitationLayer::inviteFriendFromWeibo));
    menuItemSina->setAnchorPoint(CCPointMake(0, 0));
    CCMenu *menu = CCMenu::menuWithItem(menuItemSina);
    menu->setPosition(CCPointMake(280, 505));
    addChild(menu);
    
    if(CGameData::Inst()->getLoginType() == enLoginReqType_TencentLogin){
        menuItemSina ->setIsVisible(CGameData::Inst()->getCommonInfo()->qq_voice_fg |CGameData::Inst()->getCommonInfo()->weixin_voice_fg);
        
    }else if(CGameData::Inst()->getLoginType() ==  enLoginReqType_SinaLogin){
        menuItemSina->setIsVisible(CGameData::Inst()->getCommonInfo()->sina_voice_fg |CGameData::Inst()->getCommonInfo()->weixin_voice_fg);
        
    }else {
        menuItemSina->setIsVisible(CGameData::Inst()->getCommonInfo()->sina_voice_fg|CGameData::Inst()->getCommonInfo()->qq_voice_fg |CGameData::Inst()->getCommonInfo()->weixin_voice_fg);
    }
    
    
    
    TextNode *lbInvitationCode = TextNode::textWithString(invitationCode, CCSizeMake(500, 40), CCTextAlignmentLeft, 32);
    lbInvitationCode->setColor(ccRED);
    lbInvitationCode->setPosition(CCPointMake(550, 646));
    addChild(lbInvitationCode);
}
开发者ID:haoliumilan,项目名称:AgainstSango,代码行数:33,代码来源:FriendInvitationLayer.cpp

示例2: TextNode

osg::ref_ptr<Object> PrimitivesFactory::createTextNode(const std::string& text,
                                                       double fontSize,
                                                       osg::Vec4 color)
{
    TextNode* node = new TextNode(text, fontSize);
    node->setColor(color);
    return node;
}
开发者ID:rock-gui,项目名称:gui-osgviz-osgviz,代码行数:8,代码来源:PrimitivesFactory.cpp

示例3: addChild

BonusPanel::BonusPanel()
{
    m_commDlg = NULL;
    m_cntryDialog = NULL;
    
    m_lyPanel = CCLayer::node();
    addChild(m_lyPanel);
    
    CCSprite* spBg = CCSprite::spriteWithFile("bonuspanel.png");
    if (spBg) {
        m_lyPanel->addChild(spBg, -1);
        spBg->setAnchorPoint(ccp(0,1));
        spBg->setPosition(CCPointZero);
    }

    char buf[64];

    //元宝数
    long lGuildCoin = CGameData::Inst()->getGuildCoin();
    snprintf(buf, sizeof(buf), "%s:%ld", CGameData::Inst()->getLanguageValue("deadDlgtip6"), lGuildCoin);
    m_txtCoin = TextNode::textWithString(buf, 22);
    m_txtCoin->setPosition(CCPointMake(307, -34));
    m_txtCoin->setColor(ccBLACK);
    m_lyPanel->addChild(m_txtCoin);
    
    //成员、近5次伤害、上次伤害
    TextNode* txtMember = TextNode::textWithString(CGameData::Inst()->getLanguageValue("cntry_member_alone"), 22);
    txtMember->setPosition(CCPointMake(120, -70));
    txtMember->setColor(ccc3(93, 0, 4));
    m_lyPanel->addChild(txtMember);
    
    TextNode* txtRecentScore = TextNode::textWithString(CGameData::Inst()->getLanguageValue("jifeng_recentscore"), 22);
    txtRecentScore->setPosition(CCPointMake(270, -70));
    txtRecentScore->setColor(ccc3(93, 0, 4));
    m_lyPanel->addChild(txtRecentScore);
    
    TextNode* txtLastScore = TextNode::textWithString(CGameData::Inst()->getLanguageValue("jifeng_lastscore"), 22);
    txtLastScore->setPosition(CCPointMake(410, -70));
    txtLastScore->setColor(ccc3(93, 0, 4));
    m_lyPanel->addChild(txtLastScore);
    
    //列表
    m_pBonusList = new BonusList(this, callfuncO_selector(BonusPanel::cbBonusList));
    m_lyPanel->addChild(m_pBonusList);
    m_pBonusList->setPosition(CCPointZero);
}
开发者ID:haoliumilan,项目名称:AgainstSango,代码行数:46,代码来源:BonusPanel.cpp

示例4: initRetry

//******************************************************************************
// initRetry
//******************************************************************************
void CommDlg::initRetry()
{
    CCSprite* sp = CCSprite::spriteWithSpriteFrameName("commdlg.png");
    if(sp)
        addChild(sp);
    char buf[100];
    initBtn();
     
    if(m_iRc == kReqConnectErr){
        //title
        snprintf(buf, 99, "%s", OcProxy::Inst()->localizedStringStatic("net_error"));
        TextNode* lbText = TextNode::textWithString(buf,45);
        lbText->setPosition(CCPointMake(0, 86));
        lbText->setColor(ccWHITE);
        lbText->setShadowColor(ccBLACK);
        addChild(lbText, 1);
        
        lbText = TextNode::textWithString(HttpComm::Inst()->getLocalErrStr().c_str(), CCSizeMake(400, 60), CCTextAlignmentCenter,26);
        lbText->setPosition(CCPointMake(0, 30));
        lbText->setColor(ccWHITE);
        lbText->setShadowColor(ccBLACK);
        addChild(lbText, 1);
        
        snprintf(buf, 99, "%s", OcProxy::Inst()->localizedStringStatic("net_again"));
        lbText = TextNode::textWithString(buf,26);
        lbText->setPosition(CCPointMake(0, -16));
        lbText->setColor(ccWHITE);
        lbText->setShadowColor(ccBLACK);
        addChild(lbText, 1);
    }
    else{
        //服务器来的错误提示
        const char* errMsg = CGameData::Inst()->getErrMsg();
        
        if(errMsg != NULL){
            TextNode* lbText = TextNode::textWithString(errMsg, CCSizeMake(400, 120), CCTextAlignmentCenter,26);
            lbText->setAnchorPoint(CCPointMake(0.5, 1));
            lbText->setPosition(CCPointMake(0, 100));
            lbText->setColor(ccWHITE);
            lbText->setShadowColor(ccBLACK);
            addChild(lbText, 1);
        }
    }
}
开发者ID:haoliumilan,项目名称:AgainstSango,代码行数:47,代码来源:CommDlg.cpp

示例5: initConnecting

//******************************************************************************
// initConnecting
//******************************************************************************
void CommDlg::initConnecting()
{
    CCSprite* sp = CCSprite::spriteWithSpriteFrameName("commdlg.png");
    if(sp){
        addChild(sp);
    }
    
    char buf[100];
    
    CCSprite *temSp = CCSprite::spriteWithSpriteFrameName("loading0001.png");
    temSp->setPosition(CCPointMake(-120 - 15, 30));
    addChild(temSp);
    
    CCAnimation *loadingAnim = CCAnimation::animation();
    char loadingAnimName[100] = {0};
    for (int i = 1; i <= 8 ; i++) {
        sprintf(loadingAnimName, "loading00%02d.png", i);
        CCSpriteFrame* frame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName( loadingAnimName );
        loadingAnim->addFrame(frame);
    }
    loadingAnim->setDelay(1.0f / 8);
    CCAnimate* loadingAction = CCAnimate::actionWithAnimation(loadingAnim, true);
    temSp->runAction(CCRepeatForever::actionWithAction(loadingAction));
    
    snprintf(buf, 99, "%s",OcProxy::Inst()->localizedStringStatic("loading_title"));
    TextNode* lbText = TextNode::textWithString(buf, CCSizeMake(200, 45), CCTextAlignmentCenter,45);
    lbText->setColor(ccWHITE);
    lbText->setShadowColor(ccBLACK);
    lbText->setPosition(CCPointMake(60 - 45, 20));
    addChild(lbText, 2);
    
    CCLabelTTF* ttfText = CCLabelTTF::labelWithString(OcProxy::Inst()->localizedStringStatic("loading_prompt"), CCSizeMake(360, 60), CCTextAlignmentCenter, "default.ttf", 20);
    ttfText->setColor(ccc3(233, 183, 72));
    ttfText->setPosition(CCPointMake(0, -80));
    addChild(ttfText);
}
开发者ID:haoliumilan,项目名称:AgainstSango,代码行数:39,代码来源:CommDlg.cpp

示例6: showCardItem

void CardShop::showCardItem()
{
    CCSprite* sp = CGameData::Inst()->getHeadSprite(1);
    m_cardSize = sp->getContentSize();
    
    m_iColumn = 640 / m_cardSize.width;
    m_iGap = (640 - m_iColumn * m_cardSize.width) / (m_iColumn + 1);
    
    m_ptStart.x = m_iGap;
    m_ptStart.y = 720;
    
    CCPoint pt;
    m_iRmBtn = 0;
    
    int npIndex = 0;
    for (int i=0; i<pShopCardsArr->count(); i++)
    {
        CShopCardInfo* pShopCard = pShopCardsArr->getObjectAtIndex(i);
        pt.x = m_ptStart.x + ((npIndex + m_iRmBtn) % m_iColumn) * (m_iGap + m_cardSize.width);
        pt.y = m_ptStart.y - ((npIndex + m_iRmBtn) / m_iColumn) * (m_iGap + m_cardSize.height);
        
        sp = CGameData::Inst()->getHeadSprite(pShopCard->sCid);
        addChild(sp);
        sp->setAnchorPoint(ccp(0,1));
        sp->setPosition(pt);
        sp->setTag(CARD_TAG + i);
        
        
        
        CCSprite* spState = NULL;
        switch (pShopCard->status)
        {
            case 1:
                spState = CCSprite::spriteWithFile("card_shop_hot.png");
                break;
                
            case 2:
                spState = CCSprite::spriteWithFile("card_shop_new.png");
                break;
                
            case 3:
            default:
                spState = CCSprite::spriteWithFile("card_shop_sale.png");
                break;
        }
        
        sp->addChild(spState);
        spState->setPosition(ccp(82, 82));
        
        CCSprite* spPriceBG = CCSprite::spriteWithFile("card_shop_coin.png");
        sp->addChild(spPriceBG);
        spPriceBG->setPosition(ccp(56, 6));
        
        char buf[50];
        snprintf(buf, 49, "%d",pShopCard->iPrice);
        TextNode* textPrice = TextNode::textWithString(buf, 16);
        spPriceBG->addChild(textPrice);
        textPrice->setAnchorPoint(ccp(0.5, 0));
        textPrice->setPosition(ccp(68, 10));
        textPrice->setColor(ccc3(250, 237, 66));
        textPrice->setShadowColor(ccBLACK);
        
        npIndex++;
    }
    m_shopCardNum = npIndex;
    
    m_fUpLimitY = gfMoveDownLimitY - (pt.y - m_cardSize.height);
    if (m_fUpLimitY > 0) {
        m_pScrollBar = new CScrollBar();
        addChild(m_pScrollBar);
        m_pScrollBar->setTag(1);
        m_pScrollBar->release();
        float dBarSize = 1.0/((m_fUpLimitY / (m_ptStart.y - gfMoveDownLimitY))+2);
        m_pScrollBar->setBarSize(dBarSize);
        m_pScrollBar->setPercent(0.0);
        m_pScrollBar->setPosition(CCPointMake(630, 435));
        m_pScrollBar->setScaleY(1);
      
    }
}
开发者ID:haoliumilan,项目名称:AgainstSango,代码行数:80,代码来源:CardShop.cpp

示例7: createRLayer

CCLayer* RemindLayer::createRLayer(const char *tStr, int remindType){
    CCLayer* layer = new CCLayer();
    int tagOpen = 0;
    int tagClose = 0;
    bool typeOn;
    switch (remindType) {
        case EN_REMIND_ACTIVITY:
            tagOpen = kActivityOnTag;
            tagClose = kActivityOffTag;
            typeOn = CGameData::Inst()->isActivityRemind;
            break;
        case EN_REMIND_TWOUP:
            tagOpen = kTwoupOnTag;
            tagClose = kTwoupOffTag;
            typeOn = CGameData::Inst()->isTwoUpRemind;
            break;
        case EN_REMIND_CNTRYCD:
            tagOpen = kCntryCdOnTag;
            tagClose = kCntryCdOffTag;
            typeOn = CGameData::Inst()->isCntryCdRemind;
            break;
        case EN_REMIND_POWER:{
            tagOpen = kPowerOnTag;
            tagClose = kPowerOffTag;
            typeOn = CGameData::Inst()->intPowerRemind;

            CCSprite* spMenu1 = CCSprite::spriteWithFile("pushConfig_tilizhi.png");
            CCSprite* spMenu2 = CCSprite::spriteWithFile("pushConfig_tilizhi.png");
            CCMenuItem* item = CCMenuItemImage::itemFromNormalSprite(spMenu1,spMenu2,
                                                                      this, menu_selector(RemindLayer::MoveUpKeyboard));
            item->setPosition(ccp(0,0));
            item->setAnchorPoint(CCPointZero);
            CCMenu *menu = CCMenu::menuWithItems (item, NULL);
            menu->setPosition(ccp(-50,20));
            layer->addChild(menu, 2);
            
            char buf[100];
            snprintf(buf, 99,"%d", CGameData::Inst()->intPowerRemind);
            powerNumber = CCTextFieldTTF::textFieldWithPlaceHolder(buf,CCSizeMake(100, 200) ,CCTextAlignmentCenter,"huakangfont.ttf", 32);
            powerNumber->setPosition(ccp(12, 40));
            powerNumber->setColor(ccWHITE);
            powerNumber->setDelegate(this);
            layer->addChild(powerNumber,10);
            CCEGLView * pGlView = CCDirector::sharedDirector()->getOpenGLView();
            pGlView->setIMEKeyboardNumber();
            break;
        }
        default:
            tagOpen = kActivityOnTag;
            tagClose = kActivityOffTag;
            typeOn = CGameData::Inst()->isCntryCdRemind;
            break;
    }
    CCSprite* spFrame = CCSprite::spriteWithFile("pushConfig_Bg.png");
    spFrame->setPosition(CCPointMake(2, 0));
    layer->addChild(spFrame);
    TextNode *remindLabel = TextNode::textWithString(tStr, 32);
    remindLabel->setColor(ccc3(255, 255, 255));
    remindLabel->setShadowColor(ccc3(0, 0, 0));
    remindLabel->setPosition(ccp(0,40));
    layer->addChild(remindLabel);
    
    CCSprite* spMenu1 = CCSprite::spriteWithSpriteFrameName("fr_open.png");
    CCSprite* spMenu2 = CCSprite::spriteWithSpriteFrameName("fr_open.png");
    CCSprite* spMenu3 = CCSprite::spriteWithSpriteFrameName("fr_open2.png");
    CCMenuItem* item1 = CCMenuItemImage::itemFromNormalSprite(spMenu1,spMenu2,spMenu3,
                                                          this, menu_selector(RemindLayer::switchOnOff));
    item1->setPosition(ccp(-170, -50));
    item1->setAnchorPoint(ccp(0, 0));
    item1->setTag(tagOpen);
    
    spMenu1 = CCSprite::spriteWithSpriteFrameName("fr_close.png");
    spMenu2 = CCSprite::spriteWithSpriteFrameName("fr_close.png");
    spMenu3 = CCSprite::spriteWithSpriteFrameName("fr_close2.png");
    CCMenuItem* item2 = CCMenuItemImage::itemFromNormalSprite(spMenu1,spMenu2,spMenu3,
                                                           this, menu_selector(RemindLayer::switchOnOff));
    item2->setPosition(ccp(30, -50));
    item2->setAnchorPoint(ccp(0, 0));
    item2->setTag(tagClose);
    
    item1->setIsEnabled(!typeOn);
    item2->setIsEnabled(typeOn);
    
    CCMenu *menu = CCMenu::menuWithItems (item1,item2,
                                          NULL);
    menu->setPosition(ccp(0, 0));
    layer->addChild(menu);
    return layer;
}
开发者ID:haoliumilan,项目名称:AgainstSango,代码行数:89,代码来源:RemindLayer.cpp

示例8: initBtn

//******************************************************************************
// initBtn
//******************************************************************************
void CommDlg::initBtn()
{
    char buf[100];
    //如果还未登录,只显示一个按钮,即要求一定要重试, //付费失败必须重试
    if( ((m_iRc == kReqConnectErr) || (m_iRc == 100) || (m_iRc == 401)) 
        && ((CGameData::Inst()->chkLogin() == false) || (CGameData::Inst()->isPaying() ))){
        //ok
        CCSprite* sp = CCSprite::spriteWithSpriteFrameName("fr_button.png");
        if(sp){
            sp->setPosition(CCPointMake(0, -78));
            addChild(sp, 0, kCommBtnTagOk);
        }
            
        snprintf(buf, 99, "%s", OcProxy::Inst()->localizedStringStatic("sureTip"));
        TextNode* lbText = TextNode::textWithString(buf, CCSizeMake(100, 36), CCTextAlignmentCenter,kBtnTitleHeight);
        lbText->setPosition(CCPointMake(-4, -74));
        lbText->setColor(ccWHITE);
        lbText->setShadowColor(ccBLACK);
        addChild(lbText, 1);
        lbText->setTag(kCommTextTagOk);
    }
    else if((m_iRc == kReqConnectErr) || (m_iRc == 100) || (m_iRc == 401)){
        //ok
        CCSprite* sp = CCSprite::spriteWithSpriteFrameName("fr_button.png");
        if(sp){
            sp->setPosition(CCPointMake(-104, -78));
            addChild(sp, 0, kCommBtnTagOk);
        }
        
        snprintf(buf, 99, "%s", OcProxy::Inst()->localizedStringStatic("sureTip"));
        TextNode* lbText = TextNode::textWithString(buf, CCSizeMake(100, 36), CCTextAlignmentCenter,kBtnTitleHeight);
        lbText->setPosition(CCPointMake(-108, -74));
        lbText->setColor(ccWHITE);
        lbText->setShadowColor(ccBLACK);
        addChild(lbText, 1);
        lbText->setTag(kCommTextTagOk);
        
        //cancel
        sp = CCSprite::spriteWithSpriteFrameName("fr_button.png");
        if(sp){
            sp->setPosition(CCPointMake(104, -78));
            addChild(sp, 0, kCommBtnTagCancel);
        }
        
        snprintf(buf, 99, "%s", CGameData::Inst()->getLanguageValue("cancelTip"));
        lbText = TextNode::textWithString(buf, CCSizeMake(100, 36), CCTextAlignmentCenter,kBtnTitleHeight);
        lbText->setPosition(CCPointMake(100, -74));
        lbText->setColor(ccWHITE);
        lbText->setShadowColor(ccBLACK);
        addChild(lbText, 1);
        lbText->setTag(kCommTextTagCancel);
    }
    else if((m_iRc == 502) || (HttpComm::Inst()->getMaintenance() != 0)){
        //ok
        CCSprite* sp = CCSprite::spriteWithSpriteFrameName("fr_button.png");
        if(sp){
            sp->setPosition(CCPointMake(0, -78));
            addChild(sp, 0, kCommBtnTagOk);
        }
        
        snprintf(buf, 99, "%s", OcProxy::Inst()->localizedStringStatic("sureTip"));
        TextNode* lbText = TextNode::textWithString(buf, CCSizeMake(100, 36), CCTextAlignmentCenter,kBtnTitleHeight);
        lbText->setPosition(CCPointMake(-4, -74));
        lbText->setColor(ccWHITE);
        lbText->setShadowColor(ccBLACK);
        addChild(lbText, 1);
        lbText->setTag(kCommTextTagOk);
    }
    //服务器返回的提示,无需重试,仅显示取消按钮(文字显示为确定)
    else{
        const char* errMsg = CGameData::Inst()->getErrMsg();
        if(errMsg != NULL){
            string eMsg = errMsg;
            if (eMsg.find("武将不存在")!=string::npos) {
                //ok
                CCSprite* sp = CCSprite::spriteWithSpriteFrameName("fr_button.png");
                if(sp){
                    sp->setPosition(CCPointMake(-104, -78));
                    addChild(sp, 0, kCommBtnTagOk);
                }
                
                snprintf(buf, 99, "%s", CGameData::Inst()->getLanguageValue("re_login"));
                TextNode* lbText = TextNode::textWithString(buf, CCSizeMake(100, 36), CCTextAlignmentCenter,kBtnTitleHeight);
                lbText->setPosition(CCPointMake(-108, -74));
                lbText->setColor(ccWHITE);
                lbText->setShadowColor(ccBLACK);
                addChild(lbText, 1);
                lbText->setTag(kCommTextTagOk);
                
                //cancel
                sp = CCSprite::spriteWithSpriteFrameName("fr_button.png");
                if(sp){
                    sp->setPosition(CCPointMake(104, -78));
                    addChild(sp, 0, kCommBtnTagCancel);
                }
                
                snprintf(buf, 99, "%s", CGameData::Inst()->getLanguageValue("cancelTip"));
//.........这里部分代码省略.........
开发者ID:haoliumilan,项目名称:AgainstSango,代码行数:101,代码来源:CommDlg.cpp

示例9: setCardState

//setstate
void Card::setCardState(int state, int param1)
{
    switch (state)
    {
        case EN_CARD_STATE_FNEGYIN:
        {
            if (param1 > 0)
            {
                Player* pPlayer = (Player*)getParent();
                int iOccurOdds = getCanUseNumByAwakeId(enAwakeSkill_16) * 50;
                if (SaveData::Inst()->getrand()%100+1 <= iOccurOdds || pPlayer->haveAwakeSkill_33()){   //新增
                    char fileName[100];
                    CCSprite* spAnim = CCSprite::spriteWithSpriteFrameName("blank.png");
                    addChild(spAnim,100,FENGYINDEFENSETAG);
                    spAnim->setPosition(getCardPos());
                    
                    CCAnimation *animation1 = CCAnimation::animation();
                    for(int i=1;i<=9;i++)
                    {
                        sprintf(fileName, "dikang00%02d.png",i);
                        animation1->addFrameWithFileName(fileName);
                    }
                    animation1->setDelay(1.0/20.0);
                    CCAnimate* animate1 = CCAnimate::actionWithAnimation(animation1);
                    spAnim->runAction(animate1);
                    return;
                }
                
            }
            
            m_FengYinCD += param1;

            if (m_state == state)
            {
                char buf[10];
                sprintf(buf, "%d",m_FengYinCD);
                TextNode* tempText =  (TextNode*)getChildByTag(FENGYINPNGTAG+1);
                tempText->setString(buf);
            }
            else
            {
                if (param1 > 0)
                {
                    if (m_idx == 0 || m_idx == 5)
                    {
                        Player* pPlayer = (Player*)getParent();
                        pPlayer->fengYinAutoSkill(m_idx);
                    }
                }
                
                CCSprite* cardLock = CCSprite::spriteWithSpriteFrameName("cardlock.png");
                addChild(cardLock,100,FENGYINPNGTAG);
                cardLock->setPosition(getCardPos());
                
                cardLock->runAction(CCRepeatForever::actionWithAction((CCActionInterval *)CCSequence::actions(CCFadeIn::actionWithDuration(1.0),CCFadeOut::actionWithDuration(1.0),NULL)));
                
                char buf[10];
                sprintf(buf, "%d",m_FengYinCD);
                TextNode* textCD = TextNode::textWithString(buf,55);
                addChild(textCD,101,FENGYINPNGTAG+1);
                textCD->setPosition(getCardPos());
                textCD->setShadowColor(ccBLACK);
                textCD->setColor(ccWHITE);
                m_spCard->setColor(ccc3(60, 60, 60));
            }
        }
            break;
            
        case EN_CARD_STATE_NORMAL:
            if (m_state == EN_CARD_STATE_FNEGYIN)
            {
                m_FengYinCD = 0;
                removeChildByTag(FENGYINPNGTAG, true);
                removeChildByTag(FENGYINPNGTAG+1, true);
                removeChildByTag(FENGYINDEFENSETAG, true);
                
                if (m_idx == 0 || m_idx == 5)
                {
                    Player* pPlayer = (Player*)getParent();
                    pPlayer->unFengYinAutoSkill(m_idx);
                }
            }
            m_spCard->setColor(ccWHITE);
            break;
            
        default:
            break;
    }
    
    if (state!=m_state)
    {
        m_state = state;
        if (Player *pPlayer = dynamic_cast<Player*>(getParent()))
        {
            pPlayer->updateNumByAwakeId();
        }
        
        if (EN_CARD_STATE_NORMAL==state)
        {
//.........这里部分代码省略.........
开发者ID:haoliumilan,项目名称:AgainstSango,代码行数:101,代码来源:Card.cpp

示例10: if

DeadDlg::DeadDlg(CCObject *listener,SEL_CallFuncO selector,int type)
{
   // CCLayerColor *layer = CCLayerColor::layerWithColor)
    m_listener = listener;
    m_selector = selector;
    
    m_backGround = CCSprite::spriteWithSpriteFrameName("fr_window2.png");
    m_backGround->setScale(2.0);
    addChild(m_backGround);
    m_backGround->setPosition(ccp(320, 500));
    
    CCSprite* spMenu1 = CCSprite::spriteWithSpriteFrameName("fr_button.png");
    CCSprite* spMenu2 = CCSprite::spriteWithSpriteFrameName("fr_button.png");
    sureItem = CCMenuItemImage::itemFromNormalSprite(spMenu1, spMenu2, this, menu_selector(DeadDlg::menuCallback)); 
    sureItem->setTag(111);
    sureItem->setPosition(ccp(88, 284));
    
    int need;
    long hold;
    if (CGameData::Inst()->chkLogin()) {
        need =  CGameData::Inst()->getCommonInfo()->revive_coin;
    }
    else {
        need = SaveData::Inst()->getReviveCoin();
    }
    
    if(CGameData::Inst()->getUsrInfo()->login_time > 0){
        hold =  CGameData::Inst()->getUsrInfo()->coin;
        SaveData::Inst()->setCurCoin(hold);
    }
    else{
        hold = SaveData::Inst()->getCurCoin();
    }
    char buf[100];
    if(type == enDeadType_normal)
    {
        if (hold<need) {
            strncpy(buf, CGameData::Inst()->getLanguageValue("shopTip14"), 99);
        }
        else
        {
            strncpy(buf, CGameData::Inst()->getLanguageValue("sureTip"), 99);
        }
    }
    else if(type == enDeadType_free)
    {
       strncpy(buf, CGameData::Inst()->getLanguageValue("sureTip"), 99);
    }
    
    
    TextNode *sureLabel = TextNode::textWithString(buf, 42);
    sureLabel->setColor(ccc3(255, 255, 255));
    sureLabel->setShadowColor(ccBLACK);
    sureLabel->setPosition(CCPointMake(spMenu1->getContentSize().width * 0.5 - 2,
                                       spMenu1->getContentSize().height * 0.5 + 2));
    sureItem->addChild(sureLabel);
    
    spMenu1 = CCSprite::spriteWithSpriteFrameName("fr_button.png");
    spMenu2 = CCSprite::spriteWithSpriteFrameName("fr_button.png");
    cancelItem = CCMenuItemImage::itemFromNormalSprite(spMenu1, spMenu2, this, menu_selector(DeadDlg::menuCallback)); 
    cancelItem->setTag(112);
    cancelItem->setPosition(ccp(394, 284));
    
    TextNode *cancelLabel = TextNode::textWithString(CGameData::Inst()->getLanguageValue("cancelTip"), 42);
    cancelLabel->setColor(ccc3(255, 255, 255));
    cancelLabel->setShadowColor(ccBLACK);
    cancelLabel->setPosition(CCPointMake(spMenu1->getContentSize().width * 0.5 - 2,
                                         spMenu1->getContentSize().height * 0.5 + 2));
    cancelItem->addChild(cancelLabel);
    
    sureItem->setAnchorPoint(ccp(0, 0));
    cancelItem->setAnchorPoint(ccp(0, 0));
    
    CCMenu *menu = CCMenu::menuWithItems(sureItem,cancelItem,NULL);
    menu->setPosition(ccp(0, 0));
    addChild(menu);
    
    TextNode *titleLabel = TextNode::textWithString(CGameData::Inst()->getLanguageValue("deadDlgtip1"), 55);
    titleLabel->setColor(ccc3(122, 37, 8));
    addChild(titleLabel);
    titleLabel->setPosition(ccp(320, 420+255));
    
    if(type == enDeadType_normal)
    {
        if (hold<need) {
            snprintf(buf, 99, "%s%d%s",CGameData::Inst()->getLanguageValue("deadDlgtip2"),need,CGameData::Inst()->getLanguageValue("deadDlgtip3"));
        }
        else
        {
            snprintf(buf, 99, "%s%d%s",CGameData::Inst()->getLanguageValue("deadDlgtip2"),need,CGameData::Inst()->getLanguageValue("deadDlgtip4"));
        }
        infoLabel = TextNode::textWithString(buf, CCSize(388, 70), CCTextAlignmentCenter, 30);
        infoLabel->setPosition(ccp(320, 300+255));
        infoLabel->setColor(ccc3(63, 23, 13));
        addChild(infoLabel);
    }
    else if(type == enDeadType_free)
    {
         snprintf(buf, 99,CGameData::Inst()->getLanguageValue("deadDlgtip7"),CGameData::Inst()->getCommonInfo()->free_revive_lv);
        infoLabel = TextNode::textWithString(buf, CCSize(388, 110), CCTextAlignmentCenter, 30);
//.........这里部分代码省略.........
开发者ID:haoliumilan,项目名称:AgainstSango,代码行数:101,代码来源:DeadDlg.cpp


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