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


C++ BaseSprite::getChildByTag方法代码示例

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


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

示例1: rsp_DuanZao

void ChuanqiduanzaoItem::rsp_DuanZao(CCObject *msg_f)
{
	CCNotificationCenter::sharedNotificationCenter()->removeObserver(this, MSG_DuanzaoRsp_F);
	GameDirector::getDirector()->hideWaiting();

	Flat_DuanzaoRsp *data = (Flat_DuanzaoRsp*)((Flat_MSG_Rsp*)msg_f)->getData();
	if (data->err_code != Success)
	{
		if (data->err_code == CEC_NoMoreFreeSpaceToStoreEquip)
		{
			EquipBagNotEnoughDialog *layer = new EquipBagNotEnoughDialog;
			layer->showGoToFenJieDialog();
		}
		else
		{
			MessageDisplay *layer = MessageDisplay::create(CmdHelper::getHelper()->getMessage(data->err_code));
			CCDirector::sharedDirector()->getRunningScene()->addChild(layer);
		}
		return;
	}

	//刷新头部金币
	{
		int gold = 0;
		WuPin* wp = WuPinManager::getManager()->getWuPin(ItemsType_Gold);
		if (wp != NULL)
		{
			gold = wp->getCount();
		}

		BaseSprite* header = MainLayerBase::getCurrentMainBase()->getHeader()->getHeaderContent();

		CCLabelTTF* lable = (CCLabelTTF*)header->getChildByTag(STORE_FRAM_TAG_HEAD_JINBI);
		char str[64];
		sprintf(str, "%d", gold);
		lable->setString(str);
	}

	ShenBingShangDianDuanZao *layer = new ShenBingShangDianDuanZao(data->equips);
	CCDirector::sharedDirector()->getRunningScene()->addChild(layer, 1000);
	layer->release();
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:42,代码来源:ChuanqiduanzaoLayerScrollView.cpp

示例2: getNewMessageInfo

void MainFooterLayer::getNewMessageInfo(CCNode* pInfoStr)
{
	if (pInfoStr)
	{
		pInfoStr->removeFromParent();
	}

	BaseSprite *messageBar = (BaseSprite*)this->getChildByTag(Tag_MessageInfoBar);
	if (messageBar)
	{
		NetLabelTTF* pLable = (NetLabelTTF*)messageBar->getChildByTag(Tag_MessageTipStr);
		if (!pLable)
		{
			if (SystemPushMessagePool::getPool()->getCurMsgCount() < 1)
			{
				messageBar->removeFromParent();
			}
			else
			{
				MarqueeMessage info;
				if (SystemPushMessagePool::getPool()->getOneMessage(info))
				{
					showMessageBar(info);
				}
			}
		}
	}
	else
	{
		MarqueeMessage info;
//		info.uid=186384394; 
// 		info.type = 5;
// 		info.count=1;
// 		sprintf(info.subject, "%s", "assdf");
		if (SystemPushMessagePool::getPool()->getOneMessage(info))
		{
			showMessageBar(info);
		}
	}
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:40,代码来源:MainFooterLayer.cpp

示例3: getItemContentByIndex


//.........这里部分代码省略.........
    else
    {
        CCLabelTTF* label;
        label = LF::lable(bg,"",ccp(left_x_start,87),20,fontStr_kaiti);
        label->setTag(TAG_BaseBody_LABLE_SHANGHAIXIANGXI_NUM);
        CCLabelTTF* label2;
        label2 = LF::lable(bg,""
                           ,ccp(label->getPosition().x + label->getContentSize().width, label->getPositionY()),20,fontStr_kaiti);
        label2->setTag(TAG_BaseBody_LABLE_SHANGHAIXIANGXI_TXT);
    }

    //等级
    {
        CCLabelTTF* label;
        char str[64];
        sprintf(str, "%s %u ", LFStrings::getValue("dengji").c_str(), mEquipmentVec[index]->getEquipData().zhuangbei_level);
        label = LF::lable(bg,str,ccp(left_x_start,28),20,fontStr_kaiti);
        label->setColor(fonColor_FaGuang);
        label->setTag(TAG_BaseBody_LABLE_Level);
    }

    //人物
    {
        CCLabelTTF* label;
        int actorId = mEquipmentVec[index]->getActorId();
        if (actorId != INVALID_ID)
        {
            BaseActor* actor = MyselfManager::getManager()->getMyTeamActor(actorId);
            CCAssert(actor!=NULL,"");
            BaseActorProperty prop = actor->getCurrentProperty();
            label = LF::lable(bg,LF::getString("zhuangBeiYu")+prop.nameInChinese,ccp(0, 0),20,fontStr_kaiti);
        }
        else
        {
            label = LF::lable(bg,LF::getString("meiYouZhuangBei"),ccp(0, 0),20,fontStr_kaiti);
        }
        label->setColor(fonColor_FaGuang);
        label->setAnchorPoint(ccp(1, 0.5));
        label->setPosition(ccp( 590, 200));
        label->setTag(TAG_BaseBody_LABLE_OWNTO);
        if (actorId == INVALID_ID && mEquipmentVec[index]->getEquipData().profession_id != 0)
        {
            CCString temp;
            temp.initWithFormat("%s(%s)", LFStrings::getValue("ZhiYeXianZhi").c_str(),
                                BaseActorPropertyParser::getParser()->getExtraProerty((Profession)mEquipmentVec[index]->getEquipData().profession_id).nameInChinese.c_str());
            label->setString(temp.getCString());
            label->setColor(fonColor_JingGao);
        }
    }

    //魔法属性
    {
        int start_x = 400 + 38;
        Equipment* equip = mEquipmentVec[index];
        std::vector<std::string> vec = equip->getAllMofaShuxing(false);

        //大于5个  第五个就是 ......
        for(int i=0; i<vec.size(); ++i)
        {
            std::string txt = vec[i];

            BaseSprite* biaoji = BaseSprite::create("zhuangbei_xiangxi_biaoji.png");
            bg->addChild(biaoji, 0, TAG_BIAOJI+i);
            biaoji->setPosition(ccp(start_x, 170-i*28));
            //biaoji->setOpacity(80);

            CCLabelTTF* label;
            label = LF::lable(bg,txt,ccp(0,0),20,fontStr_kaiti);
            label->setColor(ImageManager::getManager()->getShowColor(ZhuangbeiColour_Fumo, false, false));
            label->setAnchorPoint(ccp(0, 0.5));
            label->setPosition(ccp(start_x+15, 170-i*28));
            label->setTag(i);

            if(vec.size()>6)
            {
                CCLog("Warrior:%s ---> equipment property > 6, current is [%d]", __FUNCTION__, vec.size());
                //	break;
            }
        }
        //洗练
        string xxx;
        CCSprite *diwen = (CCSprite*)bg->getChildByTag(TAG_BaseBody_TABLE_ITEM_DiWen);
        if (equip->canPurify(xxx,1) && diwen)
        {
            ZhuangbeiOptionLevel *layer = ZhuangbeiOptionLevel::createWithEquipment(equip);
            bg->addChild(layer,20);
            //layer->setScale(1/diwen->getScale());
            CCPoint pos = diwen->getPosition();
            pos.x -= diwen->getContentSize().width * diwen->getScaleX() / 2;
            pos.y -= diwen->getContentSize().height * diwen->getScaleY() / 2;

            int width = pos.x + layer->getContentSize().width / 2 + 12;
            int height = pos.y + layer->getContentSize().height / 2 + 4;
            layer->setPosition(ccp(width,height));
        }
    }

    bg->setPosition(ccp(bg->getContentSize().width/2,bg->getContentSize().height/2));
    return bg;
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:101,代码来源:MainLayerZhuangBeiBaseBody.cpp

示例4: showMessageBar

void MainFooterLayer::showMessageBar(MarqueeMessage info)
{
	//system message info barbg
	BaseSprite *messageBar = (BaseSprite*)this->getChildByTag(Tag_MessageInfoBar);
	if (!messageBar)
	{
		messageBar = BaseSprite::create("zhuye_xitongtonggao.png");
		this->addChild(messageBar, 100, Tag_MessageInfoBar);
		messageBar->setPosition(ccp(320, 1152-1039));
	}
		
	//context
	NetLabelTTF* pLable = (NetLabelTTF*)messageBar->getChildByTag(Tag_MessageTipStr);
	if (pLable)
	{
		return;
	}

	NetTextListShowUI* pText = NetTextListShowUI::create();
	//普通字符串
	string firstStr = info.subject;
	string secondStr = "";
	string thirdlyStr = "";
	string fullStr = "";
	string name = "";
	int	iCount = 0;
	ChuanQi chuanqiinfo;
	//传奇锻造
	if (info.type == MarqueeType_ForgeLegend)
	{
		secondStr = LFStrings::getValue("Paomadeng_DuanZao_Chuanqi");
		
		if (ChuanqiPool::getPool()->getChuanQiData(info.object.group_id, chuanqiinfo))
		{
			name = chuanqiinfo.allChuanqiFenShenInLifeSpan.at(0).zhuangbei_name;
		}
		iCount = info.count;
		thirdlyStr = CCString::createWithFormat("*%d", iCount)->getCString();
		fullStr = pText->getConversionMsgStr(LFStrings::getValue("Paomadeng_Wanjia"), ccWHITE)
				 +pText->getConversionMsgStr(firstStr, fonColor_FaGuang)
				 +pText->getConversionMsgStr(secondStr, ccWHITE)
				 +pText->getConversionMsgStr(name, ImageManager::getManager()->getShowColor(ZhuangbeiColour_Chuanqi, true))
				 +pText->getConversionMsgStr(thirdlyStr, ccWHITE);
	}
	//杂货铺
	else if (info.type == MarqueeType_VarietyStore)
	{
		secondStr = LFStrings::getValue("Paomadeng_Zahuopu");
		string name = CS::getItemName(info.object.item_type);
		iCount = info.count;
		thirdlyStr = CCString::createWithFormat("*%d", iCount)->getCString();
		fullStr = pText->getConversionMsgStr(LFStrings::getValue("Paomadeng_Wanjia"), ccWHITE)
			+pText->getConversionMsgStr(firstStr, fonColor_FaGuang)
			+pText->getConversionMsgStr(secondStr, ccWHITE)
			+pText->getConversionMsgStr(name, FX_CommonFunc::getCaiLiaoColor(info.object.item_type))
			+pText->getConversionMsgStr(thirdlyStr, ccWHITE);
	}
	//传奇合成
	else if (info.type == MarqueeType_Compound)
	{
		secondStr =  LFStrings::getValue("Paomadeng_Hecheng_Chuanqi");
		if (ChuanqiPool::getPool()->getChuanQiData(info.object.group_id, chuanqiinfo))
		{
			name = chuanqiinfo.allChuanqiFenShenInLifeSpan.at(0).zhuangbei_name;
		}
		iCount = info.count;
		thirdlyStr = CCString::createWithFormat("*%d", iCount)->getCString();
		fullStr = pText->getConversionMsgStr(LFStrings::getValue("Paomadeng_Wanjia"), ccWHITE)
			+pText->getConversionMsgStr(firstStr, fonColor_FaGuang)
			+pText->getConversionMsgStr(secondStr, ccWHITE)
			+pText->getConversionMsgStr(name, fonColor_PuTong)
			+pText->getConversionMsgStr(thirdlyStr, ccWHITE);
	}
	//巅峰对决
	else if (info.type == MarqueeType_TopArena)
	{
		//四强,八强
		if (info.object.round == 0)
		{
			secondStr =  LFStrings::getValue("Paomadeng_Dianfengduijue");
			fullStr = pText->getConversionMsgStr(LFStrings::getValue("Paomadeng_Wanjia"), ccWHITE)
				+pText->getConversionMsgStr(firstStr, fonColor_FaGuang)
				+pText->getConversionMsgStr(secondStr, ccWHITE);
		}
		//决赛
		else if (info.object.round == 1)
		{
			secondStr =  LFStrings::getValue("Paomadeng_Juesai");
			fullStr = pText->getConversionMsgStr(LFStrings::getValue("Paomadeng_Wanjia"), ccWHITE)
				+pText->getConversionMsgStr(firstStr, fonColor_FaGuang)
				+pText->getConversionMsgStr(secondStr, ccWHITE);
		}
		//冠军
		else if (info.object.round == 2)
		{
			secondStr = LFStrings::getValue("Paomadeng_Guanjun");
			fullStr = pText->getConversionMsgStr(LFStrings::getValue("Paomadeng_Wanjia"), ccWHITE)
				+pText->getConversionMsgStr(firstStr, fonColor_FaGuang)
				+pText->getConversionMsgStr(secondStr, ccWHITE);
		}
//.........这里部分代码省略.........
开发者ID:longguai,项目名称:game-DarkWar,代码行数:101,代码来源:MainFooterLayer.cpp


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