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


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

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


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

示例1: onEnter

void ZhuangbeiXilianOverOption::onEnter()
{
	CCSprite::onEnter();

	if (m_nLevel != -1)
	{
		BaseSprite *bgSpr = BaseSprite::create("zhuangbei_xiangxi_xilian_shuxing.png");
		addChild(bgSpr);

		this->setContentSize(bgSpr->getContentSize());
		BaseSprite *xingxingImg = BaseSprite::create(CCString::createWithFormat("gongming_anniu_%d.png",m_nLevel)->getCString());
		bgSpr->addChild(xingxingImg);
		xingxingImg->setPosition(ccp(40, bgSpr->getContentSize().height / 2));
		xingxingImg->setScale(0.58f);

		ZBAttr zb_attr;
		zb_attr.attr_type = m_nAtter_type_index;
		zb_attr.attr_value = m_nPercent;
		string attrStr = GetMoFaShuXing_ByZBAttr(zb_attr, true);
		CCLabelTTF *label = CCLabelTTF::create(attrStr.c_str(), fontStr_kaiti, 20);
		bgSpr->addChild(label);
		label->setColor(ccc3(255,255,255));
		label->setPosition(ccp(bgSpr->getContentSize().width / 2, bgSpr->getContentSize().height / 2));

		bgSpr->setPosition(ccp(bgSpr->getContentSize().width / 2,bgSpr->getContentSize().height / 2));

		if (m_bIsBiger)
		{
			CCSprite *spr = CCSprite::create("renxing_zhuangbeitisheng.png");
			spr->setPosition(ccp(230,this->getContentSize().height / 2));
			bgSpr->addChild(spr);
		}
		if (m_bIsFirst)
		{
			CCSprite *spr = CCSprite::create("zhuangbei_xiangxi_xilian_shuxing_xiaoguo.png");
			spr->setPosition(ccp(this->getContentSize().width / 2,this->getContentSize().height / 2));
			bgSpr->addChild(spr);

			float time = 0;
			float minTime = 0.5f;
			float maxTime = 1.2f;
			time = CCRANDOM_0_1()*(maxTime - minTime) + minTime;
			Blink(spr,time);
		}
	}
	else
	{
		BaseSprite *xingxingImg = BaseSprite::create("zhuangbei_xiangxi_xilian_shuxing_suoding.png");
		addChild(xingxingImg);
		xingxingImg->setPosition(ccp(xingxingImg->getContentSize().width / 2,xingxingImg->getContentSize().height / 2));
		this->setContentSize(xingxingImg->getContentSize());
	}
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:53,代码来源:ZhuangbeiXilianOverOption.cpp

示例2: clickXilianJingHua

void ZhuangbeiXilianUI::clickXilianJingHua(CCObject *obj)
{
	if (m_dInfoDialog)
	{
		m_dInfoDialog->removeFromParent();
		m_dInfoDialog = NULL;
	}
	string tishiStr = LFStrings::getValue("XilianJingHuaShuoMing");
	string cailiaoFileStr = "daoju_youlanzhiye.png";

	//弹框背景
	BaseSprite* dialog = BaseSprite::create("gongjiang_duanzao_cailiaobuzu_tanchukuang.png");
	dialog->setPosition(ccp(mWinSize.width/2, mWinSize.height/2 + 50));
	//提示
	{
		BaseSprite *cailiaoBg = BaseSprite::create("daoju_kuang_bg.png");
		dialog->addChild(cailiaoBg);
		cailiaoBg->setPosition(ccp(cailiaoBg->getContentSize().width/2 + 10, dialog->getContentSize().height/2));
		BaseSprite *cailiaoImg = BaseSprite::create(cailiaoFileStr);
		cailiaoBg->addChild(cailiaoImg);
		cailiaoImg->setPosition(ccp(cailiaoBg->getContentSize().width/2, cailiaoBg->getContentSize().height/2));

		CCLabelTTF* lable = CCLabelTTF::create(tishiStr.c_str(), fontStr_kaiti,20,CCSize(240, 0), kCCTextAlignmentLeft);
		dialog->addChild(lable);
		lable->setAnchorPoint(ccp(0,0.5));
		lable->setPosition(ccp(cailiaoBg->getPositionX()+cailiaoBg->getContentSize().width/2 , dialog->getContentSize().height/2));
	}
	//按键
	CCMenu* menu = CCMenu::create();
	{
		CCMenuItemImage* item = CCMenuItemImage::create(
			"gongjiang_duanzao_cailiaobuzu_tanchukuang.png",
			"gongjiang_duanzao_cailiaobuzu_tanchukuang.png",
			this, menu_selector(ZhuangbeiXilianUI::clickCiaoliaoShuoMing));
		menu->addChild(item);
		item->setPosition(ccp(dialog->getContentSize().width/2, dialog->getContentSize().height/2));
		item->setOpacity(0);
		item->setScaleX(mWinSize.width / dialog->getContentSize().width);
		item->setScaleY(mWinSize.height / dialog->getContentSize().height);
		// 		item->setScaleX(mWinSize.width / item->getContentSize().width);
		// 		item->setScaleY(mWinSize.height / item->getContentSize().height);
	}
	//弹框
	{

		LFAlert* lfAlert = new LFAlert();
		lfAlert->setBaseContainer(dialog,menu);
		CCDirector::sharedDirector()->getRunningScene()->addChild(lfAlert,128);
		lfAlert->release();
		m_dInfoDialog = lfAlert;
	}
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:52,代码来源:ZhuangbeiXilianUI.cpp

示例3: CCSizeMake

// 06-15 11:43:50.179: D/cocos2d-x debug info(1716): Get data from file(tabulation_armor_helmet_1.png) failed!
MainLayerZhuangBeiBaseBody::MainLayerZhuangBeiBaseBody(ZhuangbeiXiangQingFrom from)
{
    mFrom = from;

    mTableView = CCTableView::create(this, CCSizeMake(624,678));
    addChild(mTableView);
    mTableView->setDirection(kCCScrollViewDirectionVertical);
    mTableView->setVerticalFillOrder(kCCTableViewFillTopDown);
    mTableView->setPosition(ccp(8,74));
    mTableView->setDelegate(this);
    mFooterForPop = NULL;

    mClickedIdx = 0;


    BaseSprite *bar = BaseSprite::create("mianban_zhuangbeishuliang_bg.png");
    addChild(bar, 10);
    bar->setPosition(ccp(320, 43));
    CCString temp;
    temp.initWithFormat("%s: %d/%u", LFStrings::getValue("zhuangbei").c_str()
                        , MyselfManager::getManager()->getAllEquipmentsWithOutEquipedOrChuanQi().size(), MAX_COUNTS_IN_KNAPSACK);
    m_zbTotalLabel = CCLabelTTF::create(temp.getCString(), fontStr_kaiti, 20);
    m_zbTotalLabel->setAnchorPoint(ccp(1, 0.5));
    m_zbTotalLabel->setPosition(ccp(bar->getContentSize().width-20, bar->getContentSize().height/2));
    bar->addChild(m_zbTotalLabel);
    //分解提示
    m_zbFenJieTiShi = CCLabelTTF::create(LFStrings::getValue("ZBCountMax_GanKuaiQuFenJieBa").c_str(), fontStr_kaiti, 20);
    bar->addChild(m_zbFenJieTiShi);
    m_zbFenJieTiShi->setPosition(ccp(bar->getContentSize().width/2, bar->getContentSize().height/2));
    m_zbFenJieTiShi->setColor(fonColor_JingGao);
    m_zbFenJieTiShi->setVisible(false);
    m_zbFenJieMenu = CCMenu::create();
    bar->addChild(m_zbFenJieMenu);
    m_zbFenJieMenu->setPosition(ccp(0,0));
    m_zbFenJieMenu->setVisible(false);
    CCMenuItemImage *fenjie = CCMenuItemImage::create(
                                  "mianban_zhuangbei_qufenjie.png",
                                  "mianban_zhuangbei_qufenjie_select.png",
                                  this, menu_selector(MainLayerZhuangBeiBaseBody::menuitemClicked_GotoFenJie));
    m_zbFenJieMenu->addChild(fenjie);
    fenjie->setPosition(ccp(m_zbTotalLabel->getPositionX()-fenjie->getContentSize().width/2, m_zbTotalLabel->getPositionY()));
    if (mFrom != From_ZhuangBeiList)
    {
        m_zbFenJieMenu->removeFromParent();
    }
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:47,代码来源:MainLayerZhuangBeiBaseBody.cpp

示例4: tableCellTouched

void GongJiang_EquipSelect::tableCellTouched(CCTableView* table, CCTableViewCell* cell)
{
	BaseSprite* bg = (BaseSprite*)cell->getChildByTag(TAG_EquipBaseBody_TABLE_ITEM);
	// 先不管是否点击了图片

	// 先移除上一个点击的
	if (selectedIndex >= 0)
	{
		CCTableViewCell* lastCell = table->cellAtIndex(selectedIndex);
		if (lastCell)
		{
			lastCell->getChildByTag(TAG_EquipBaseBody_TABLE_ITEM)->removeChildByTag(TAG_BG_MASK_PIC);
		}
	}
	// 再次选自己,代表取消
	if (selectedIndex == cell->getIdx())
	{
		selectedIndex = -1;
	}
	else
	{
		selectedIndex = cell->getIdx();
		BaseSprite* addEff = BaseSprite::create("mianban_zhuangbei_xiangxi_select.png");
		bg->addChild(addEff,10,TAG_BG_MASK_PIC);
		addEff->setPosition(ccp(bg->getContentSize().width/2,bg->getContentSize().height/2));
	}

	if(selectedIndex < 0)
	{
		mMenuItemMakeSure->setEnabled(false);
	}
	else
	{
		mMenuItemMakeSure->setEnabled(true);
	}
	bool isFirstIn = false;
	// 先不管是否点击了图片
	if(GameGuideManager::getManager()->isGuideNow(GameGuideManager::GID_GongJiang_QiangHua))
	{
		//GameGuideManager::getManager()->setOneGuideStart(GameGuideManager::GID_GongJiang_QhHt);
		GameGuideManager::getManager()->setOneGuideEnd(GameGuideManager::GID_GongJiang_QiangHua);

		if (mMenuItemMakeSure)
		{
			CCPoint pos =  mMenuItemMakeSure->getParent()->convertToWorldSpace(mMenuItemMakeSure->getPosition());
			GuideLayerBase *guideLayer1 = new GuideLayer_SimpleLayer;
			guideLayer1->init(mMenuItemMakeSure->getContentSize(),pos
				, LFStrings::getValue("DingjiQueding"), NULL, false);
			//((GuideLayer_SimpleLayer*)guideLayer1)->setCallBack(this,SEL_CallFunc(&JiuGongGeLayer::GuiDeLayerCallBack));
			CCDirector::sharedDirector()->getRunningScene()->addChild(guideLayer1, 128);
		}
	}
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:53,代码来源:GongJiang_EquipSelect.cpp

示例5: getItemContentByIndex

BaseSprite* GongJiang_EquipSelect::getItemContentByIndex(unsigned int index)
{
	BaseSprite* ret = MainLayerZhuangBeiBaseBody::getItemContentByIndex(index);

	if (selectedIndex == index)
	{
		BaseSprite* addEff = BaseSprite::create("mianban_zhuangbei_xiangxi_select.png");
		ret->addChild(addEff,10,TAG_BG_MASK_PIC);
		addEff->setPosition(ccp(ret->getContentSize().width/2,ret->getContentSize().height/2));
	}

	return ret;
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:13,代码来源:GongJiang_EquipSelect.cpp

示例6: menuItemClicked_jiesuoHero

void MainLayerHerosBaseBody::menuItemClicked_jiesuoHero(CCObject *pSender)
{
	int idx = ((CCMenuItemImage*)pSender)->getTag();

	char buf[128];

	if (mHerosVec.at(idx)->canUnlock())
	{
		mJieSuo_HeroId = mHerosVec.at(idx)->getId();
		//弹框背景
		BaseSprite* dialog = BaseSprite::create("shangpin_goumai_tishikuang.png");
		dialog->setPosition(ccp(mWinSize.width/2, mWinSize.height/2));
		dialog->setTag(Tag_Window_JieSuo);
		//label
		CCString temp;
		//解锁此助手需要花费\n%d荣誉值\n(当前荣誉:%d)
		temp.initWithFormat(LFStrings::getValue("JieSuoZhuShouXuYao_RongYuZhi").c_str(), 
			CS::AssistantUnLockNeedHonor(MyselfManager::getManager()->getTeamActors_ZhenShen(Actor_All, LF_Locked).size()),
			MyselfManager::getManager()->getEdiableArenaTeamBasicInfo()->jifen);
		CCLabelTTF *label = CCLabelTTF::create(temp.getCString(), fontStr_kaiti, 30, CCSize(400, 0), kCCTextAlignmentCenter);
		dialog->addChild(label);
		label->setAnchorPoint(ccp(0.5, 1));
		label->setPosition(ccp(dialog->getContentSize().width/2, 278));

		//按键
		CCMenu* menu;
		{
			CCMenuItemImage* menuItemMakeSure = CCMenuItemImage::create(
				"shangpin_goumai_queren.png",
				"shangpin_goumai_queren_select.png",
				this,SEL_MenuHandler(&MainLayerHerosBaseBody::menuItemClicked_LockHero_OkCancel));


			CCMenuItemImage* menuItemCacel = CCMenuItemImage::create(
				"shangpin_goumai_quxiao.png",
				"shangpin_goumai_quxiao_select.png",
				this,SEL_MenuHandler(&MainLayerHerosBaseBody::menuItemClicked_LockHero_OkCancel));

			menu = CCMenu::create(menuItemMakeSure, menuItemCacel, NULL);
			menu->setPosition(CCPointZero);

			menuItemMakeSure->setTag(10);
			menuItemCacel->setTag(20);
			menuItemMakeSure->setPosition(ccp(dialog->getContentSize().width/3*2,70));
			menuItemCacel->setPosition(ccp(dialog->getContentSize().width/3, 70));
		}

		//弹框
		{
			LFAlert* lfAlert = new LFAlert();
			lfAlert->setTag(Tag_Window_JieSuo);
			lfAlert->setBaseContainer(dialog,menu);
			CCDirector::sharedDirector()->getRunningScene()->addChild(lfAlert, 128, Tag_Window_JieSuo);
			lfAlert->release();
		}
	}
	else
	{
		sprintf(buf, LFStrings::getValue("XuYaoZhuJueDengJi_jiesuo").c_str(), 15);
		MessageDisplay *layer = MessageDisplay::create(buf);
		CCDirector::sharedDirector()->getRunningScene()->addChild(layer);
		return;
	}
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:64,代码来源:MainLayerHerosBaseBody.cpp

示例7: getItemContentByIndex

BaseSprite* MainLayerHerosBaseBody::getItemContentByIndex(unsigned int index)
{

	BaseSprite* bg = BaseSprite::create("duiwu_yingxiong_bg.png");
	bg->setPosition(ccp(bg->getContentSize().width/2,bg->getContentSize().height/2));

	//图片
	{
		ImageData data = ImageManager::getManager()->getImageData_ProfessionHead((Profession)mHerosVec[index]->getActorType());

		CCLOG("----------------->%s",data.getCurrentImageFile().c_str());
		BaseSprite *sprite = BaseSprite::create( data.getCurrentImageFile());
		BaseSprite *sprite2 = BaseSprite::create( data.getCurrentImageFile());
		BaseSprite *sprite3 = BaseSprite::create( data.getCurrentImageFile());
		CCMenuItemSprite* heroItem = CCMenuItemSprite::create(sprite, sprite2, sprite3, this, menu_selector(MainLayerHerosBaseBody::menuItemClicked_heroImg));
		CCMenu* menu = CCMenu::create(heroItem, NULL);
		bg->addChild(menu, 0, TAG_BaseBody_TABLE_HERO_IMG);
		heroItem->setPosition(ccp(74, bg->getContentSize().height/2));
		menu->setPosition(CCPointZero);

		BaseSprite *biankuang = BaseSprite::create("renxing_renwu_touxiang_select.png");
		bg->addChild(biankuang, 1);
		biankuang->setPosition(heroItem->getPosition());
		BaseSprite *item = NULL;
		Profession iType = (Profession)mHerosVec[index]->getActorType();
		if (iType == Profession_Yemanren)
		{
			item = BaseSprite::create("touxiang_jiaobiao_3.png");
		}
		else if (iType == Profession_Chike)
		{
			item = BaseSprite::create("touxiang_jiaobiao_2.png");
		}
		else if (iType == Profession_Fashi)
		{
			item = BaseSprite::create("touxiang_jiaobiao_1.png");
		}
		else if (iType == Profession_Qishi)
		{
			item = BaseSprite::create("touxiang_jiaobiao_3.png");
		}
		else if (iType == Profession_ShenJianShou)
		{
			item = BaseSprite::create("touxiang_jiaobiao_4.png");
		}
		else if (iType == Profession_MiShu)
		{
			item = BaseSprite::create("touxiang_jiaobiao_1.png");
		}
		else if (iType == Profession_WuSeng)
		{
			item = BaseSprite::create("touxiang_jiaobiao_5.png");
		}
		else if (iType == Profession_YouXia)
		{
			item = BaseSprite::create("touxiang_jiaobiao_2.png");
		}
		else if (iType == Profession_LieShou)
		{
			item = BaseSprite::create("touxiang_jiaobiao_4.png");
		}
		else if (iType == Profession_WuShi)
		{
			item = BaseSprite::create("touxiang_jiaobiao_6.png");
		}

		if (item)
		{
			item->setAnchorPoint(ccp(1, 0));
			biankuang->addChild(item);
			item->setPosition(ccp(biankuang->getContentSize().width, 0));
		}		
	}

	//name
	HeroFixedPro info = BaseActorPropertyParser::getParser()->getExtraProerty((Profession)mHerosVec[index]->getActorType());
	LF::lable(bg, info.nameInChinese,ccp(140, 106),22,fontStr_kaiti)->setTag(TAG_BaseBody_LABLE_NAME);

	// 英雄介绍
	{
		Profession profId = mHerosVec[index]->getActorType();
		CCLabelTTF *directionLabel = CCLabelTTF::create(getHeroDirectionByProfessionId(profId).c_str(), fontStr_kaiti, 20, CCSize(380, 0), kCCTextAlignmentLeft);
		bg->addChild(directionLabel, 1, Tag_Label_HeroDirection);
		directionLabel->setColor(ccc3(165, 125, 76));
		directionLabel->setAnchorPoint(ccp(0, 1));
		directionLabel->setPosition(ccp(140, 94));
	}

	if (mFlag == 1)
	{
		CCMenuItemImage* chose = CCMenuItemImage::create(
			"duiwu_yingxiong_weixuanzhong.png"
			, "duiwu_yingxiong_weixuanzhong.png"
			, this, menu_selector(MainLayerHerosBaseBody::menuItemClicked_choseHero));
		chose->setPosition(558, 83);
		CCMenu* menu = CCMenu::create(chose, NULL);
		menu->setPosition(CCPointZero);
		bg->addChild(menu, 0, TAG_Menu);

		CCSprite* unlock = CCSprite::create("duiwu_yingxiong_unlock.png", CCRect(0, 0, 610, 129));
//.........这里部分代码省略.........
开发者ID:longguai,项目名称:game-DarkWar,代码行数:101,代码来源:MainLayerHerosBaseBody.cpp

示例8: CCSize

GetAwardLayer::GetAwardLayer(CCString info, vector<ItemInfo> items, vector<Flat_DuanzaoGroupZBInfo> equips)
{
	CCLayerColor::initWithColor(ccc4(0,0,0,255));


	CCSize visSize = CCDirector::sharedDirector()->getWinSize();
	mBoard = BaseSprite::create("shangpin_goumai_tishikuang.png");
	addChild(mBoard);
	mBoard->setPosition(ccp(visSize.width/2, visSize.height/2));

	//label 提示
	{
		CCLabelTTF* label = CCLabelTTF::create(info.getCString(), 
			fontStr_kaiti, 20, CCSize(425, 0), kCCTextAlignmentLeft);
		label->setColor(ccWHITE);
		mBoard->addChild(label, 1);
		if (items.size() == 0 && equips.size() == 0)
		{
			label->setAnchorPoint(ccp(0.5, 0.5));
			label->setPosition(ccp(mBoard->getContentSize().width/2, 222));
		}
		else
		{
			label->setAnchorPoint(ccp(0.5, 1));
			label->setPosition(ccp(mBoard->getContentSize().width/2, 326));
		}
	}

	//材料
	int label_size = 20;
	ccColor3B label_color = ccWHITE;

	int allNum = items.size() + equips.size();
	int posIdx = 0;
	for (int i=0; i < items.size(); ++i, ++posIdx)
	{
		BaseSprite* cailiaoImg = BaseSprite::create("daoju_kuang_bg.png");
		mBoard->addChild(cailiaoImg);

		int pos_x = mBoard->getContentSize().width/2;
		int delta = posIdx - allNum/2;
		if(allNum % 2 == 0) 
		{
			float del = delta + 0.5;
			pos_x += del * (cailiaoImg->getContentSize().width + 10);
		}
		else
		{
			pos_x += delta * (cailiaoImg->getContentSize().width + 10);
		}
		cailiaoImg->setPosition(ccp(pos_x, mBoard->getContentSize().height/2+24));
		//item img
		BaseSprite * itemImg = BaseSprite::create(
			ImageManager::getManager()->getItemFilename(items.at(i).type)); // .count .type
		cailiaoImg->addChild(itemImg);
		itemImg->setPosition(ccp(cailiaoImg->getContentSize().width/2, cailiaoImg->getContentSize().height/2));

		//数量
		char buf[20];
		sprintf(buf, "\nx%u", items.at(i).count);
		string temp = CS::getItemName(items.at(i).type);
		temp += buf;
		CCLabelTTF *labelShuliang = CCLabelTTF::create(temp.c_str(), fontStr_kaiti, label_size
			, CCSize(0,0), kCCTextAlignmentCenter);
		cailiaoImg->addChild(labelShuliang);
		labelShuliang->setPosition(ccp(cailiaoImg->getContentSize().width/2, -labelShuliang->getContentSize().height/2));
		labelShuliang->setColor(label_color);
	}	
	for (int i=0; i<equips.size(); ++i, ++posIdx)
	{
		BaseSprite* diwenImg = BaseSprite::create(
			ImageManager::getManager()->getImageData_DiWen_WithBianKuang(equips.at(i).zhuangbei_colour)); // .count .type
		mBoard->addChild(diwenImg);

		int pos_x = mBoard->getContentSize().width/2;
		int delta = posIdx - allNum/2;
		if(allNum % 2 == 0) 
		{
			float del = delta + 0.5;
			pos_x += del * (diwenImg->getContentSize().width + 10);
		}
		else
		{
			pos_x += delta * (diwenImg->getContentSize().width + 10);
		}
		diwenImg->setPosition(ccp(pos_x, mBoard->getContentSize().height/2+24));
		//equip pic
		string equipfile = equips.at(i).zhuangbei_pic;
		equipfile = "minute_" + equipfile + ".png";
		BaseSprite *s = BaseSprite::create(equipfile);
		diwenImg->addChild(s);
		s->setScale(0.23f);
		s->setPosition(ccp(diwenImg->getContentSize().width/2,diwenImg->getContentSize().height/2));

		//数量
		char buf[20];
		sprintf(buf, "\nx%d", 1);
		string temp = equips.at(i).zhuangbei_name;
		temp += buf;
		CCLabelTTF *labelShuliang = CCLabelTTF::create(temp.c_str(), fontStr_kaiti, label_size
//.........这里部分代码省略.........
开发者ID:longguai,项目名称:game-DarkWar,代码行数:101,代码来源:GetAwardLayer.cpp

示例9: menuItemClicked_TanSuo

void TanSuoLayer::menuItemClicked_TanSuo(CCObject *pSender)
{
	int tag = ((CCMenuItem*)pSender)->getTag();

	if (tag == Tag_MenuItem_YiJianTanSuo)
	{
		if (m_bIsJieFeng)
		{
			string infoStr = LFStrings::getValue("XuYaoJieFeng");
			UnblockWarnDialog* pDlg = UnblockWarnDialog::create(infoStr);
			CCDirector::sharedDirector()->getRunningScene()->addChild(pDlg, 300);
			return;
		}
		if (MyselfManager::getManager()->getMyZhuJueData()->getVipLevel() < 3)
		{
			FXToast *layer = FXToast::create(LFStrings::getValue("XunBao_VipNeed"));
			CCDirector::sharedDirector()->getRunningScene()->addChild(layer);
			return;
		}

		m_bDiscoverAll = true;
		addObserver(callfuncO_selector(TanSuoLayer::rsp_tansuo), MSG_discoverRsp);
		mCmdHlp->cmdDiscover(m_bDiscoverAll);
	}
	else if (tag == Tag_MenuItem_TanSuo)
	{
		m_bDiscoverAll = false;
		addObserver(callfuncO_selector(TanSuoLayer::rsp_tansuo), MSG_discoverRsp);
		mCmdHlp->cmdDiscover(m_bDiscoverAll);
	}
	else if (tag == Tag_MenuItem_JieFen)
	{
		if (mDestroyCount >= m_nMaxCountDestroy)
		{
			m_bIsJieFeng = true;
			m_nSelectProId = -1;
			if (! EquipmentManager::getManager()->isSpareEnoughToSaveEquip(1))
			{
				EquipBagNotEnoughDialog *layer = new EquipBagNotEnoughDialog;
				layer->showGoToFenJieDialog();
			}


			CCSize visSize = CCDirector::sharedDirector()->getWinSize();
			BaseSprite* dialog = BaseSprite::create("juqing_duihuakuang.png");
			dialog->setPosition(ccp(visSize.width/2, visSize.height/2));
			//label 提示
			{
				/*CCLabelTTF* label = CCLabelTTF::create(LFStrings::getValue("XunBao_XuanZeHeroTiShi").c_str(), 
				fontStr_kaiti, m_nFontSize, CCSize(425, 0), kCCTextAlignmentLeft);
				label->setAnchorPoint(ccp(0.5, 1));
				label->setPosition(ccp(dialog->getContentSize().width/2, 250));
				dialog->addChild(label, 1);*/

				CCLabelTTF *title = CCLabelTTF::create(LFStrings::getValue("JieChuFengYin").c_str(),fontStr_kaiti,m_nFontSize);
				title->setAnchorPoint(ccp(0.5,1));
				title->setPosition(ccp(dialog->getContentSize().width/2, 250));
				dialog->addChild(title, 1);


				CCLabelTTF *chuanqi = CCLabelTTF::create(LFStrings::getValue("ChuanQiZhuangBei").c_str(),fontStr_kaiti,m_nFontSize);
				chuanqi->setAnchorPoint(ccp(0.5,1));
				chuanqi->setPosition(ccp(title->getPositionX() - title->getContentSize().width / 2 + m_nFontSize * 7 + chuanqi->getContentSize().width / 2, 250));
				dialog->addChild(chuanqi, 1);
				chuanqi->setColor(ccc3(235,106,12));
			}
			{
				m_lMenuItemList.clear();
				//mHeros = MyselfManager::getManager()->getTeamActors_ZhenShen(Actor_All, LF_UnLock);
				mHeros = MyselfManager::getManager()->getTeamActors_ZhenShen(Actor_ShangZheng, LF_UnLock);
				//tabel view
				CCTableView *tabelView = CCTableView::create(this, CCSizeMake(560, 158));
				tabelView->setDirection(kCCScrollViewDirectionHorizontal);
				tabelView->setPosition(ccp(41, 44));
				tabelView->setDelegate(this);
				dialog->addChild(tabelView);
				tabelView->reloadData();
			}
			//确认 取消按键  
			CCMenu* menu = CCMenu::create();
			menu->setPosition(CCPointZero);
			menu->setTag(0);
			//
			{
				LFAlert* lfAlert = new LFAlert();
				lfAlert->setTag(TAG_AwardDisplayer_Layer);
				lfAlert->setBaseContainer(dialog,menu);
				lfAlert->setZoneCanotTouch();
				CCDirector::sharedDirector()->getRunningScene()->addChild(lfAlert,128, TAG_AwardDisplayer_Layer);
				lfAlert->release();
			}
			return;
		}
		else
		{
			MessageDisplay* layer = MessageDisplay::create("ERROR!");
			CCDirector::sharedDirector()->getRunningScene()->addChild(layer);
			return;
		}
	}
//.........这里部分代码省略.........
开发者ID:longguai,项目名称:game-DarkWar,代码行数:101,代码来源:TanSuoLayer.cpp

示例10: getItemContentByIndex

BaseSprite* MainLayerZhuangBeiBaseBody::getItemContentByIndex(unsigned int index)
{
    BaseSprite* bg = BaseSprite::create("mianban_zhuangbei_xiangxi.png");

    CCString tempStr;

    CCPoint picPos = ccp(75.0f, bg->getContentSize().height/2);

    {
        ImageData diWenData = ImageManager::getManager()->getImageData_DiWen_List(
                                  mEquipmentVec[index]->getEquipColor(),
                                  false,
                                  mEquipmentVec[index]->isPartOfSuit(),
                                  mEquipmentVec[index]->haveZhuanke());
        BaseSprite* diWen = BaseSprite::create(diWenData.getCurrentImageFile());
        diWen->setScale(diWenData.scale);
        diWen->setPosition(picPos);
        bg->addChild(diWen,0,TAG_BaseBody_TABLE_ITEM_DiWen);

        {
            BaseSprite *sprite = ImageManager::getManager()->getSpriteOfZhuangbei(mEquipmentVec[index],true,true);
            //sprite->setScale(data.scale);
            sprite->setScale(0.43f);
            sprite->setPosition(picPos);
            bg->addChild(sprite,0,TAG_BaseBody_TABLE_ITEM_Image);
        }

        //封印
        if (mEquipmentVec[index]->isInFengYin())
        {
            BaseSprite *fyImg = BaseSprite::create("shenbing_fengyin_suo.png");
            bg->addChild(fyImg, 0, TAG_BaseBody_TABLE_FengYin_Img);
            fyImg->setPosition(diWen->getPosition());
            fyImg->setScale(diWen->getContentSize().width*diWen->getScale() / fyImg->getContentSize().width);
        }

    }

    // 添加图片识别区
    {
        ImageData selecedData = ImageManager::getManager()->getImageData_DiWen_Selected(
                                    mEquipmentVec[index]->getEquipColor(),
                                    false,//mEquipmentVec[index]->isShenBing(),
                                    mEquipmentVec[index]->isPartOfSuit());
        BaseSprite* menuItemSel = BaseSprite::create(selecedData.getCurrentImageFile());
        menuItemSel->setScale(selecedData.scale);
        CCSprite* menuRect = CCSprite::createWithTexture(menuItemSel->getTexture());
        menuRect->setScale(0.0f);

        FXScrollMenu *menu = FXScrollMenu::create(
                                 mTableView->getParent()->convertToWorldSpace(mTableView->getPosition()), mTableView->getViewSize());
        bg->addChild(menu, 0, TAG_BaseBody_MENU);
        menu->setPosition(ccp(0,0));
        CCMenuItemSprite* t = CCMenuItemSprite::create(menuRect,menuItemSel,this,SEL_MenuHandler(&MainLayerZhuangBeiBaseBody::itemImageClicked));
        menu->addChild(t, 0, index);
        t->setPosition(picPos);
    }

    float left_x_start = 160 - 4;
    //名称
    {
        CCLabelTTF* label;
        char str[64];
        if (mEquipmentVec[index]->getEquipData().qianghua_data.qianghua_count != 0)
        {
            sprintf(str, "%s", mEquipmentVec[index]->getName().c_str());
        }
        else
        {
            sprintf(str, "%s", mEquipmentVec[index]->getName().c_str());
        }

        label = LF::lable(bg,str,ccp(left_x_start,190),24,fontStr_kaiti);
        label->setTag(TAG_BaseBody_LABLE_NAME);
        ccColor3B color = ImageManager::getManager()->getShowColor(mEquipmentVec[index]->getEquipColor(),false,mEquipmentVec[index]->isPartOfSuit());
        label->setColor(color);
    }

    //类型
    {
        std::string typeStr =
            CS::getZhuangbeiTypeName(mEquipmentVec[index]->getType(), mEquipmentVec[index]->getEquipColor());

        CCLabelTTF* label;
        label = LF::lable(bg,typeStr,ccp(left_x_start,165),18,fontStr_kaiti);
        label->setTag(TAG_BaseBody_LABLE_TYPE);
        label->setColor(fonColor_CiYao);
    }

    //白字
    {
        CCLabelTTF* label_baizhi = NULL;
        bool hasBaiZhi = false;
        {
            float baizi = 0;
            switch(mEquipmentVec[index]->getType())
            {
            case ZhuangbeiType_DanshouJian:
            case ZhuangbeiType_ShuangshouBishou:
            case ZhuangbeiType_ShuangshouFu:
//.........这里部分代码省略.........
开发者ID:longguai,项目名称:game-DarkWar,代码行数:101,代码来源:MainLayerZhuangBeiBaseBody.cpp

示例11: clickShuoming

void ZhuangbeiXilianUI::clickShuoming(CCObject *obj)
{
	//弹框
	BaseSprite* dialog = BaseSprite::create("shangpin_goumai_tishikuang.png");
	dialog->setPosition(ccp(mWinSize.width/2, mWinSize.height/2));
	//确认 取消按键  
	CCMenu* menu = CCMenu::create();
	menu->setPosition(CCPointZero);
	{
		//返回
		CCMenuItemImage *fanhui = CCMenuItemImage::create(
			"shuxing_renwu_fanhui.png"
			, "shuxing_renwu_fanhui_select.png"
			, this, menu_selector(ZhuangbeiXilianUI::menuItemClicked_ShuoMingMenu));
		menu->addChild(fanhui, 1, 20);
		fanhui->setPosition(ccp(dialog->getContentSize().width/2,70));
	}
	//content
	{
		CCSize size = dialog->getContentSize();
		//title
		CCLabelTTF *titleLabel = CCLabelTTF::create(LFStrings::getValue("XilianTitle").c_str(), fontStr_kaiti, 20);
		titleLabel->setHorizontalAlignment(kCCTextAlignmentCenter);
		dialog->addChild(titleLabel);
		titleLabel->setAnchorPoint(ccp(0.5,1));
		titleLabel->setPosition(ccp(size.width/2, size.height-56));
		CCLabelTTF *shuoMingLabel = CCLabelTTF::create(LFStrings::getValue("XilianInfo").c_str(), fontStr_kaiti, 20 );
		
		shuoMingLabel->setHorizontalAlignment(kCCTextAlignmentRight);
		dialog->addChild(shuoMingLabel);
		shuoMingLabel->setColor(fonColor_PuTong);
		shuoMingLabel->setAnchorPoint(ccp(0.5,1));
		shuoMingLabel->setPosition(ccp(size.width/2, size.height-110));


		CCPoint pos = shuoMingLabel->getPosition();
		pos.x += shuoMingLabel->getContentSize().width / 2 - 45;
		pos.y += 5;

		int side_y = 20;
		for (int i = 0 ; i < 4 ; i ++)
		{
			BaseSprite *xingxingImg = BaseSprite::create(CCString::createWithFormat("gongming_anniu_%d.png",i + 1)->getCString());
			dialog->addChild(xingxingImg);

			CCPoint point;
			point.x = pos.x - xingxingImg->getContentSize().width / 2 * 0.38f;
			point.y = pos.y - i * side_y - xingxingImg->getContentSize().height / 2 * 0.38f;
			xingxingImg->setPosition(point);

			xingxingImg->setScale(0.38f);
		}
	}
	//
	{
		LFAlert* lfAlert = new LFAlert();
		lfAlert->setTag(Tag_Board_ShuoMing);
		lfAlert->setBaseContainer(dialog,menu);
		CCDirector::sharedDirector()->getRunningScene()->addChild(lfAlert,128, Tag_Board_ShuoMing);
		lfAlert->release();
	}
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:62,代码来源:ZhuangbeiXilianUI.cpp

示例12: getSpriteOfZhuangbei

BaseSprite* ImageManager::getSpriteOfZhuangbei(string equipKeyWords,ZhuangbeiColourExt color,unsigned holdNum,vector<ItemsType> diamonds,QianghuaData qinghua,unsigned int jingLianTime /* = 0 */)
{
	std::string pic_file = "minute_" + equipKeyWords + ".png";

	BaseSprite* sprite = BaseSprite::create(pic_file);

	BaseSprite* hole1 = BaseSprite::create();
	BaseSprite* hole2 = BaseSprite::create();
	BaseSprite* hole3 = BaseSprite::create();

	// 精炼
	{
		if (jingLianTime > 0)
		{
			//BaseSprite* icon = BaseSprite::create("gongjiang_jinglian_tubiao.png");
			BaseSprite* icon = BaseSprite::create();
			icon->setContentSize(CCSizeMake(20,50));
			char temp[16];
			sprintf(temp,"+%u",jingLianTime);
			CCLabelTTF* lableNum = CCLabelTTF::create(temp,fontStr_BookAntiqua,40,CCSizeMake(0,0),kCCTextAlignmentRight);
			lableNum->setAnchorPoint(ccp(1.0f,0.5f));

			//{
			//	ccColor3B lableColor;
			//	switch (color)
			//	{
			//	case ImageManager::ZhuangbeiColourExt_Baizhuang:
			//		//lableColor = get
			//		break;
			//	case ImageManager::ZhuangbeiColourExt_Fumo:
			//		break;
			//	case ImageManager::ZhuangbeiColourExt_Xiyou:
			//		break;
			//	case ImageManager::ZhuangbeiColourExt_Chuanqi:
			//		break;
			//	case ImageManager::ZhuangbeiColourExt_ChuanQiTaoZhuang:
			//		break;
			//	case ImageManager::ZhuangbeiColourExt_ShengBing:
			//		break;
			//	case ImageManager::ZhuangbeiColourExt_ShengBingTaoZhuang:
			//		break;
			//	default:
			//		break;
			//	}
			//	lableNum->setColor(lableColor);
			//}

			
			sprite->addChild(lableNum);
			sprite->addChild(icon);
			icon->setPositionY(sprite->getContentSize().height - icon->getContentSize().height/2);
			lableNum->setPosition(ccp(sprite->getContentSize().width - lableNum->getContentSize().width/2,icon->getPositionY()));
			icon->setPositionX(lableNum->getPositionX() - lableNum->getContentSize().width/2 - icon->getContentSize().width/2);
		}
	}

	// 强化
	{

		//sort
		for(int i=0; i<qinghua.qianghua_count; ++i)
		{
			for(int j=i; j<qinghua.qianghua_count; ++j)
			{
				if(  (qinghua.info_arr[i].level < qinghua.info_arr[j].level)   
					|| (qinghua.info_arr[i].level == qinghua.info_arr[j].level && 
					qinghua.info_arr[i].percent < qinghua.info_arr[j].percent)  )
				{
					swap(qinghua.info_arr[i], qinghua.info_arr[j]);
				}
			}
		}

		//float scale = 0.32f/(124/297.0f);
		float scale = 0.3f/(124/297.0f);
		BaseSprite* temp = BaseSprite::create("gongjiang_qianghua_jieguo_jin.png");
		float posX = temp->getContentSize().width/2 * scale;
		float posY = temp->getContentSize().height/2;

		for (int i=0;i<qinghua.max_qianghua_time;i++)
		{
			BaseSprite* imageStar = NULL;
			if (i < qinghua.qianghua_count)
			{
				switch (qinghua.info_arr[i].level)
				{
				case 4:
				case QianghuaLevel_jin_special:
					imageStar = BaseSprite::create("gongjiang_qianghua_jieguo_jin.png");
					break;
				case 3:
					imageStar = BaseSprite::create("gongjiang_qianghua_jieguo_yin.png");
					break;
				case 2:
					imageStar = BaseSprite::create("gongjiang_qianghua_jieguo_tong.png");
					break;
				case 1:
					imageStar = BaseSprite::create("gongjiang_qianghua_jieguo_tie.png");
					break;
				default:
//.........这里部分代码省略.........
开发者ID:longguai,项目名称:game-DarkWar,代码行数:101,代码来源:ImageManager.cpp

示例13: displayXiangQing

void MailInfoListLayer::displayXiangQing(Flat_DuanzaoGroupZBInfo zbInfo)
{
	//this->disableAllTouchBegin();
	mCurTaoZhuang_Info = zbInfo;

	

	BaseSprite *board = BaseSprite::create("zhuangbei_xiangxi_mianban.png");
	
	/*BaseLayer *layer = new BaseLayer();
	layer->setContentSize(board->getContentSize());
	layer->setPosition(board->getPosition());
	layer->addChild(board);*/
	CCDirector::sharedDirector()->getRunningScene()->addChild(board,1030);

	//MainLayerBase::getCurrentMainBase()->getHeader()->setContent(BaseSprite::create());
	//MainLayerBase::getCurrentMainBase()->setContaintLayer(layer,false);
	//layer->release();
	refreshEquipBoard(board, zbInfo);
	board->setPosition(ccp(CCDirector::sharedDirector()->getWinSize().width/2, CCDirector::sharedDirector()->getWinSize().height/2 + 106));

	ListMenu *menu = ListMenu::create();
	board->addChild(menu, 10);
	menu->setPosition(CCPointZero);
	//	menu->setTouchPriority(-131);
	BaseSprite *norImg = BaseSprite::create("close.png");
	BaseSprite *selImg = BaseSprite::create("close_select.png");
	CCMenuItemSprite *item = CCMenuItemSprite::create(norImg, selImg, NULL, this, menu_selector(MailInfoListLayer::menuItemClicked_close));
	menu->addChild(item, 0);
	item->setPosition(ccp(board->getContentSize().width-44+12, board->getContentSize().height-36+2));
	//底纹
	ImageData diWenData = ImageManager::getManager()->getImageData_DiWen_XiangQing(
		zbInfo.zhuangbei_colour
		, false
		, SuitPool::getPool()->isSuit(zbInfo.zb_group_id));
	BaseSprite* diWen = BaseSprite::create(diWenData.getCurrentImageFile());
	diWen->setScale(0.7f);
	board->addChild(diWen);
	diWen->setPosition(ccp(123, 838-240+122));
	// 装备图片
	string equipfile = zbInfo.zhuangbei_pic;
	equipfile = "minute_" + equipfile + ".png";
	BaseSprite *s = BaseSprite::create(equipfile);
	diWen->addChild(s);
	s->setPosition(ccp(diWen->getContentSize().width/2,diWen->getContentSize().height/2));
	//套装按钮
	if(SuitPool::getPool()->isSuit(zbInfo.zb_group_id))
	{
		string norStr = "zhuangbei_xiangxi_mianban_anniu_taozhuang.png";
		string selStr = "zhuangbei_xiangxi_mianban_anniu_taozhuang_select.png";
		// 		if (ChuanqiPool::getPool()->isShenBing(mEquipVec.at(idx).zb_group_id))
		// 		{
		// 			norStr = "zhuangbei_xiangxi_mianban_anniu_taozhuang_shenbing.png";
		// 			selStr = "zhuangbei_xiangxi_mianban_anniu_taozhuang_shenbing_select.png";
		// 		}  
		CCMenuItemImage *taozhuangItem = CCMenuItemImage::create(
			norStr.c_str()
			, selStr.c_str()
			, this ,menu_selector(MailInfoListLayer::menuItemClicked_equipDetailMenu));
		menu->addChild(taozhuangItem, 0);
		taozhuangItem->setAnchorPoint(ccp(1, 0));
		taozhuangItem->setPosition(ccp(diWen->getPositionX()+diWen->getContentSize().width/2*diWen->getScaleX()
			, diWen->getPositionY()-diWen->getContentSize().height/2*diWen->getScaleY()));
		taozhuangItem->setEnabled(false);
	}
	m_dEquimentDialog = board;
	m_mDEquipmentMenu = menu;
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:68,代码来源:MailInfoListLayer.cpp

示例14: 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

示例15: initBSandMagic

void SpriteSystem::initBSandMagic()
{
    //初始化人物
    struct _stHeroConf
    {
        float spScale[3];//缩放
        Point spPosStart[3];//起始位置
        Point spPosEnd[3];//结束位置
        bool  spFlip[3];//是否翻转,英雄翻转,敌人不翻转,面对面
        
        _stHeroConf()
        {
            spScale[0] = 1.5f; spScale[1] = 1.5f; spScale[2] = 1.5f;
            spFlip[0] = true; spFlip[1] = true; spFlip[2] = true;
            spPosStart[0] = PointS_1; spPosStart[1] = PointS_2; spPosStart[2] = PointS_3;
            spPosEnd[0] = PointE_1; spPosEnd[1] = PointE_2; spPosEnd[2] = PointE_3;
        }
    }_stHeroConf;
    
    struct _stEnemyConf
    {
        float spScale[3];//缩放
        Point spPosStart[3];//起始位置
        Point spPosEnd[3];//结束位置
        bool  spFlip[3];//是否翻转,英雄翻转,敌人不翻转,面对面
        
        _stEnemyConf()
        {
            spScale[0] = 1.5f; spScale[1] = 1.5f; spScale[2] = 1.5f;
            spFlip[0] = false; spFlip[1] = false; spFlip[2] = false;
            spPosStart[0] = PointS_4; spPosStart[1] = PointS_5; spPosStart[2] = PointS_6;
            spPosEnd[0] = PointE_4; spPosEnd[1] = PointE_5; spPosEnd[2] = PointE_6;
        }
    }_stEnemyConf;
    
    //初始化英雄和敌人
    for (unsigned int i = 0; i < 3; i++)
    {
        BaseSprite* hero = BaseSprite::create(m_bsConf[i]);
        hero->setScale(_stHeroConf.spScale[i]);
        hero->setPosition(_stHeroConf.spPosStart[i]);
        hero->setFlippedX(_stHeroConf.spFlip[i]);
        hero->startAction(SPRITESTATE_IDLE);
        hero->move(MoveType_To, _stHeroConf.spPosEnd[i], 4.5f);//执行完有回调
        addChild(hero,1);
        //加入向量
        m_vHeros.pushBack(hero);
        
        BaseSprite* enemy = BaseSprite::create(m_bsConf[i+3]);
        enemy->setScale(_stEnemyConf.spScale[i]);
        enemy->setPosition(_stEnemyConf.spPosStart[i]);
        enemy->setFlippedX(_stEnemyConf.spFlip[i]);
        enemy->startAction(SPRITESTATE_IDLE);
        enemy->move(MoveType_To, _stEnemyConf.spPosEnd[i], 4.5f);//执行完有回调
        addChild(enemy,1);
        //加入向量
        m_vEnemys.pushBack(enemy);
        
        Node* node = Node::create();
        Sprite* lifebg = Sprite::create(s_ptBg);//背景
        m_ptLifeTop[i] = ProgressTimer::create(Sprite::create(s_ptLife2));//进度条
        m_ptLifeTop[i]->setType(ProgressTimer::Type::BAR);//条形
        m_ptLifeTop[i]->setMidpoint(Point::ANCHOR_MIDDLE_LEFT);//(0,0.5)锚点为增长原点
        m_ptLifeTop[i]->setBarChangeRate(Point::ANCHOR_MIDDLE_RIGHT);//向(1,0.5)增长
        m_ptLifeTop[i]->setPercentage(100);
        
        node->setPosition(enemy->getContentSize().width/2,enemy->getContentSize().height*0.8);
        enemy->addChild(node);
        node->addChild(lifebg, 0);
        node->addChild(m_ptLifeTop[i], 1);
        node->setScale(0.8);
        
        //添加敌人生命值
    }
 
    setAttackTarget();//设置攻击目标
    
//    //初始化技能、远程攻击 --》不能这样,因为多个英雄释放同一种技能时,会重复addChild
//    for(int i = 0; i < 5; i++)
//    {
//        Magic* magic = Magic::create(m_magConf[i]);
//        m_vMagics.pushBack(magic);//这里会retain一下
//    }
    scheduleUpdate();
}
开发者ID:lcc47uk49,项目名称:DemonElimate,代码行数:85,代码来源:SpriteSystem.cpp


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