本文整理汇总了C++中BaseSprite::getContentSize方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseSprite::getContentSize方法的具体用法?C++ BaseSprite::getContentSize怎么用?C++ BaseSprite::getContentSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseSprite
的用法示例。
在下文中一共展示了BaseSprite::getContentSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: select
void GongJiang_EquipSelect::select()
{
CCTableViewCell* lastCell = mTableView->cellAtIndex(0);
if (lastCell)
{
BaseSprite* bg = (BaseSprite*)lastCell->getChildByTag(TAG_EquipBaseBody_TABLE_ITEM);
bool isFirstIn = false;
// 先不管是否点击了图片
if(GameGuideManager::getManager()->isGuideNow(GameGuideManager::GID_GongJiang_QiangHua))
{
//GameGuideManager::getManager()->setOneGuideStart(GameGuideManager::GID_GongJiang_SelectZhuangBei);
//GameGuideManager::getManager()->setOneGuideEnd(GameGuideManager::GID_GongJiang_SelectZhuangBei);
if (bg)
{
CCPoint pos = bg->getParent()->convertToWorldSpace(bg->getPosition());
GuideLayerBase *guideLayer1 = new GuideLayer_SimpleLayer;
guideLayer1->init(bg->getContentSize(), ccp(pos.x,pos.y + bg->getContentSize().height / 2)
, LFStrings::getValue("qiangxuanzezhuangbei"), NULL, false);
//((GuideLayer_SimpleLayer*)guideLayer1)->setCallBack(this,SEL_CallFunc(&JiuGongGeLayer::GuiDeLayerCallBack));
CCDirector::sharedDirector()->getRunningScene()->addChild(guideLayer1, 128);
}
}
}
}
示例2: 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);
}
}
}
示例3: 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;
}
示例4: 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());
}
}
示例5: 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;
}
}
示例6: 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();
}
}
示例7: tableCellAtIndex
CCTableViewCell* TanSuoLayer::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
CCTableViewCell *cell = table->dequeueCell();
if (cell != NULL)
{
cell->removeAllChildren();
}
else
{
cell = new CCTableViewCell();
cell->autorelease();
}
if (table->getParent() != NULL)
{
CCSize cellSize = tableCellSizeForIndex(table, idx);
Profession profId = mHeros.at(idx)->getCurrentProperty().profession;
//head Profession 1-10
BaseSprite *headImg = BaseSprite::create(ImageManager::getManager()->getImageData_ProfessionHead(profId).getCurrentImageFile());
cell->addChild(headImg);
headImg->setPosition(ccp(cellSize.width/2, 92));
//menu
FXScrollMenu *menu = FXScrollMenu::create(
table->getParent()->convertToWorldSpace(table->getPosition()), table->getViewSize());
cell->addChild(menu, 1);
menu->setPosition(ccp(0,0));
CCMenuItemImage *item = CCMenuItemImage::create(
"renxing_renwu_touxiang.png",
"renxing_renwu_touxiang_select.png",
"renxing_renwu_touxiang_select.png",
this, menu_selector(TanSuoLayer::menuItemClicked_JieFenHeroSelect));
menu->addChild(item, 0, profId);
m_lMenuItemList.push_back(item);
item->setPosition(headImg->getPosition());
//name
CCLabelTTF *nameLabel = CCLabelTTF::create(BaseActorPropertyParser::getParser()->getExtraProerty(profId).nameInChinese.c_str()
, fontStr_kaiti, m_nFontSize);
cell->addChild(nameLabel);
nameLabel->setPosition(ccp(headImg->getPositionX()
, headImg->getPositionY()-headImg->getContentSize().height/2-nameLabel->getContentSize().height/2));
nameLabel->setColor(ccc3(195, 145, 96));
}
return cell;
}
示例8: 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();
}
示例9: 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;
}
}
示例10: 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));
//.........这里部分代码省略.........
示例11: 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
//.........这里部分代码省略.........
示例12: 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;
}
}
//.........这里部分代码省略.........
示例13: 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:
//.........这里部分代码省略.........
示例14: showMessageBar
//.........这里部分代码省略.........
+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);
}
}
//英雄榜
else if (info.type == MarqueeType_TopList)
{
if (info.object.top_order == 1)
{
firstStr = LFStrings::getValue("Paomadeng_Top1");
}
else if (info.object.top_order == 2)
{
firstStr = LFStrings::getValue("Paomadeng_Top2");
}
else if (info.object.top_order == 3)
{
firstStr = LFStrings::getValue("Paomadeng_Top3");
}
secondStr = info.subject;
thirdlyStr = LFStrings::getValue("Paomadeng_Shangxian");
fullStr = pText->getConversionMsgStr(firstStr, ccWHITE)
+pText->getConversionMsgStr(secondStr, fonColor_FaGuang)
+pText->getConversionMsgStr(thirdlyStr, ccWHITE);
}
//守护之灵
else if (info.type == MarqueeType_ProtectSpirit)
{
firstStr = "";
// secondStr = "MarqueeType_ProtectSpirit";
}
//寻宝 破外封印
else if (info.type == MarqueeType_Discover_Destroy)
{
secondStr = LFStrings::getValue("Paomadeng_Xunbao_Pohuaifengyin");
fullStr = pText->getConversionMsgStr(LFStrings::getValue("Paomadeng_Wanjia"), ccWHITE)
+pText->getConversionMsgStr(firstStr, fonColor_FaGuang)
+pText->getConversionMsgStr(secondStr, ccWHITE)
+pText->getConversionMsgStr(thirdlyStr, ccWHITE);
}
//寻宝 解封装备
else if (info.type == MarqueeType_Discover_Unlock)
{
secondStr = LFStrings::getValue("Paomadeng_Xunbao_Jiefeng");
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);
}
if (firstStr == "")
{
return;
}
if (!pLable)
{
pText->setTextWidth(this->getContentSize().width*10);
pText->setTextSize(20);
fullStr = pText->getConversionMsgStr(LFStrings::getValue("Paomadeng_XiTong"), ccWHITE) + fullStr;
pText->addMessage(fullStr);
NetLabelTTF* pLable = NetLabelTTF::create(pText->getMsgString().c_str(), fontStr_kaiti, 20);
pLable->setMsgColorTexCoords(pText->getMsgColorTexCoordsList());
pLable->setHorizontalAlignment(kCCTextAlignmentLeft);
pLable->setHeight(pText->getHeight());
messageBar->addChild(pLable, 101, Tag_MessageTipStr);
pLable->setAnchorPoint(ccp(0.0f, 0.5f));
pLable->setPosition(ccp(messageBar->getContentSize().width, messageBar->getContentSize().height/2-7));
float distance = messageBar->getContentSize().width+pLable->getContentSize().width;
float speed = 100.0f;
float dt = 4.0f;
dt = distance/speed;
pLable->runAction(CCSequence::create(
CCMoveBy::create(dt, ccp(-distance, 0)),
CCCallFuncN::create(this, callfuncN_selector(MainFooterLayer::messageMoveDone)),
CCDelayTime::create(3.0f),
CCCallFuncN::create(this, callfuncN_selector(MainFooterLayer::getNewMessageInfo)),
NULL));
}
}
示例15: 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();
}
}