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


C++ CCLabelTTF::getPositionY方法代码示例

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


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

示例1: showImmediately

void AchievementNotification::showImmediately(Achievement a)
{
	mShowing = true;
	CCTexture2D* tex = CCTextureCache::sharedTextureCache()->textureForKey(fileName.c_str());
	if (tex == NULL)
	{
		tex = CCTextureCache::sharedTextureCache()->addImage(fileName.c_str());
	}
	CCSize winSize = CCDirector::sharedDirector()->getWinSize();


	CCScale9Sprite* pBoard = CCScale9Sprite::create(CCRectMake(tex->getContentSize().width/2, 0, 2, tex->getContentSize().height), fileName.c_str());
	addChild(pBoard,0,Tag_Board);
	pBoard->setPosition(ccp(winSize.width/2,winSize.height + pBoard->getContentSize().height) );

	CCSprite* pJinBei = CCSprite::create(ResManager::getManager()->getFilePath(g_public+"CJ_icon_jiangbei.png").c_str());
	pBoard->addChild(pJinBei, 1);
	pJinBei->setPosition(ccp(pJinBei->getContentSize().width, pBoard->getContentSize().height/2));

	CCLabelTTF* pName = CCLabelTTF::create(a.name.c_str(), fontStr_KlavikaBold, 40);
	pName->setColor(fontColor_Acheivement_TTF);
	CCSprite* pIcon = CCSprite::create(ResManager::getManager()->getFilePath(g_public+"CJ_icon_wancheng.png").c_str());
	int x = pName->getContentSize().width + pIcon->getContentSize().width - 420;
	if (x > 0)
	{
		pBoard->setContentSize(ccp(pBoard->getContentSize().width+x, pBoard->getContentSize().height));
	}
	pBoard->addChild(pName);

	int xoffset = 10;

	pName->setPosition(ccp(pBoard->getContentSize().width/2 + pIcon->getContentSize().width/2 + xoffset, pBoard->getContentSize().height/2));

	pBoard->addChild(pIcon);
	pIcon->setPosition(ccp(pName->getPositionX() - pName->getContentSize().width/2 - pIcon->getContentSize().width/2 - xoffset, pName->getPositionY()));

	Achievement* achievementCopy = new Achievement(a);
//	*achievementCopy = a;
	temp_Must_Delete.insert(temp_Must_Delete.end(),achievementCopy);

	pBoard->runAction(CCSequence::create(
		CCMoveTo::create(0.5f,ccp(pBoard->getPositionX(),winSize.height-pBoard->getContentSize().height/2)),
		CCDelayTime::create(0.1f),
		CCCallFuncND::create(this,SEL_CallFuncND(&AchievementNotification::boardShowing),achievementCopy),
		CCDelayTime::create(1.3f),
		CCMoveTo::create(0.2f,ccp(pBoard->getPositionX(),winSize.height+pBoard->getContentSize().height)),
		CCFadeTo::create(0.1f,0),
		CCCallFuncN::create(this,SEL_CallFuncN(&AchievementNotification::boardShowEnd)),NULL));

	createPar(ccp(winSize.width/2,winSize.height),parFileName.c_str(),pBoard->getContentSize().width * 1.2f,pBoard->getContentSize().height);

	Music::sharedMusicPlayer()->playEffectSound("achievement.wav");

	CCLog("AchievementNotification::showImmediately name = %s" ,a.name.c_str());
}
开发者ID:SongCF,项目名称:game-LostStar,代码行数:55,代码来源:AchievementNotification.cpp

示例2: setSystemMail


//.........这里部分代码省略.........
			}
			break;
		case 2:
			{
				CCLabelTTF *ttf = CCLabelTTF::create(info.c_str(),fontStr_kaiti,20.0f);
				ttf->setAnchorPoint(ccp(0,1.0f));
				ttf->setPosition(ccp(ttf->getContentSize().height ,bgSpr->getContentSize().height - titleSpr->getContentSize().height - side));
				ttf->setDimensions(CCSizeMake(bgSpr->getContentSize().width - 2 * ttf->getContentSize().height,bgSpr->getContentSize().height - titleSpr->getContentSize().height));
				ttf->setHorizontalAlignment(kCCTextAlignmentLeft);
				bgSpr->addChild(ttf);
				ttf->setColor(m_cTTFColor);
				if (mail.is_read)
				{
					CCMenuItemImage *menuItem = CCMenuItemImage::create("youxiang_anniu_xiangqing.png","youxiang_anniu_xiangqing_select.png","youxiang_anniu_xiangqing_select.png",this,SEL_MenuHandler(&MailListTile::selectCheckInfo));
					menuItem->setTag(mail.email_id);
					menuItem->setPosition(ccp(bgSpr->getPositionX() + bgSpr->getContentSize().width - menuItem->getContentSize().width / 2 - m_nSide * 2 - menuItem->getContentSize().width,pos.y + m_nSide + menuItem->getContentSize().height / 2));
					m_mMenu->addChild(menuItem);


					CCMenuItemImage *menuItem2 = CCMenuItemImage::create("youxiang_anniu_shanchu.png","youxiang_anniu_shanchu_select.png","youxiang_anniu_shanchu_select.png",this,SEL_MenuHandler(&MailListTile::selectDelete));
					menuItem2->setTag(mail.email_id);
					menuItem2->setPosition(ccp(bgSpr->getPositionX() + bgSpr->getContentSize().width - menuItem2->getContentSize().width / 2 - m_nSide,pos.y + m_nSide + menuItem2->getContentSize().height / 2));
					m_mMenu->addChild(menuItem2);
				}
				else
				{
					CCMenuItemImage *menuItem = CCMenuItemImage::create("youxiang_anniu_xiangqing.png","youxiang_anniu_xiangqing_select.png","youxiang_anniu_xiangqing_select.png",this,SEL_MenuHandler(&MailListTile::selectCheckInfo));
					menuItem->setTag(mail.email_id);
					menuItem->setPosition(ccp(bgSpr->getPositionX() + bgSpr->getContentSize().width - menuItem->getContentSize().width / 2 - m_nSide,pos.y + m_nSide + menuItem->getContentSize().height / 2));
					m_mMenu->addChild(menuItem);
				}
			}
			break;
		case 3:
			{
				CCLabelTTF *ttf = CCLabelTTF::create(CCString::createWithFormat("%s",mail.addresserName.c_str())->getCString(),fontStr_kaiti,20.0f);
				ttf->setAnchorPoint(ccp(0,1.0f));
				ttf->setPosition(ccp(ttf->getContentSize().height ,bgSpr->getContentSize().height - titleSpr->getContentSize().height - side));
				//ttf->setDimensions(CCSizeMake(bgSpr->getContentSize().width - 2 * ttf->getContentSize().height,bgSpr->getContentSize().height - titleSpr->getContentSize().height));
				ttf->setHorizontalAlignment(kCCTextAlignmentLeft);
				bgSpr->addChild(ttf);

				
				

				CCLabelTTF *ttf2 = CCLabelTTF::create(CCString::createWithFormat("%s",info.c_str())->getCString(),fontStr_kaiti,20.0f);
				ttf2->setAnchorPoint(ccp(0,1.0f));
				ttf2->setPosition(ccp(ttf->getPositionX() + ttf->getContentSize().width ,ttf->getPositionY()));
				ttf2->setDimensions(CCSizeMake(bgSpr->getContentSize().width - ttf->getPositionX() - ttf->getContentSize().width ,ttf->getPositionY()));
				ttf2->setHorizontalAlignment(kCCTextAlignmentLeft);
				bgSpr->addChild(ttf2);
				ttf2->setColor(m_cTTFColor);
				if (ttf->getContentSize().height == 0)
				{
					ttf2->setPosition(ccp(30.0f ,ttf->getPositionY()));
				}

				if (mail.is_read)
				{
					CCMenuItemImage *menuItem = CCMenuItemImage::create("youxiang_anniu_shanchu.png","youxiang_anniu_shanchu_select.png","youxiang_anniu_shanchu_select.png",this,SEL_MenuHandler(&MailListTile::selectDelete));
					menuItem->setTag(mail.email_id);
					menuItem->setPosition(ccp(bgSpr->getPositionX() + bgSpr->getContentSize().width - menuItem->getContentSize().width / 2 - m_nSide,pos.y + m_nSide + menuItem->getContentSize().height / 2));
					m_mMenu->addChild(menuItem);
				}
				else
				{
					CCMenuItemImage *menuItem = CCMenuItemImage::create("youxiang_anniu_jieshou.png","youxiang_anniu_jieshou_select.png","youxiang_anniu_jieshou_select.png",this,SEL_MenuHandler(&MailListTile::selectOK));
					menuItem->setTag(mail.email_id);
					menuItem->setPosition(ccp(bgSpr->getPositionX() + bgSpr->getContentSize().width - menuItem->getContentSize().width / 2 - m_nSide * 2 - menuItem->getContentSize().width,pos.y + m_nSide + menuItem->getContentSize().height / 2));
					m_mMenu->addChild(menuItem);


					CCMenuItemImage *menuItem2 = CCMenuItemImage::create("youxiang_anniu_jujue.png","youxiang_anniu_jujue_select.png","youxiang_anniu_jujue_select.png",this,SEL_MenuHandler(&MailListTile::selectCancel));
					menuItem2->setTag(mail.email_id);
					menuItem2->setPosition(ccp(bgSpr->getPositionX() + bgSpr->getContentSize().width - menuItem2->getContentSize().width / 2 - m_nSide,pos.y + m_nSide + menuItem2->getContentSize().height / 2));
					m_mMenu->addChild(menuItem2);
				}

			}
			break;
		case 4:
			{
				CCLabelTTF *ttf = CCLabelTTF::create(CCString::createWithFormat("%s",info.c_str())->getCString(),fontStr_kaiti,20.0f);
				ttf->setAnchorPoint(ccp(0,1.0f));
				ttf->setPosition(ccp(ttf->getContentSize().height ,bgSpr->getContentSize().height - titleSpr->getContentSize().height - side));
				ttf->setDimensions(CCSizeMake(bgSpr->getContentSize().width - 2 * ttf->getContentSize().height,bgSpr->getContentSize().height - titleSpr->getContentSize().height));
				ttf->setHorizontalAlignment(kCCTextAlignmentLeft);
				bgSpr->addChild(ttf);
				ttf->setColor(ccRED);
				CCMenuItemImage *menuItem = CCMenuItemImage::create("youxiang_anniu_shanchu.png","youxiang_anniu_shanchu_select.png","youxiang_anniu_shanchu_select.png",this,SEL_MenuHandler(&MailListTile::selectDelete));
				menuItem->setTag(mail.email_id);
				menuItem->setPosition(ccp(bgSpr->getPositionX() + bgSpr->getContentSize().width - menuItem->getContentSize().width / 2 - m_nSide,pos.y + m_nSide + menuItem->getContentSize().height / 2));
				m_mMenu->addChild(menuItem);
			}
			break;
		default:
			break;
		}
	}
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:101,代码来源:MailListTile.cpp

示例3: tableCellAtIndex

CCTableViewCell* FriendList::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
    EziFacebookFriend* friendDetails = (EziFacebookFriend*)mFriendList->objectAtIndex(idx);
    std::string friendID            = friendDetails->getFBID();
    std::string friendName          = friendDetails->getName();
    std::string installed           = "";
    std::string score               = "";
    CCSprite* profilePic            = NULL;
    
    // Set the score.
    long mylong = friendDetails->getScore();
    std::stringstream mystream;
    mystream << mylong;
    score = mystream.str();
    
    // Set the install status
    if (friendDetails->isInstalled())
    {
        installed = "Installed";
    }
    else
    {
        installed = "Not Installed";
    }
    
    
    CCTableViewCell *cell = table->dequeueCell();
    
    
    if (!cell) // Creation of Cell.
    {
        cell = new CCTableViewCell();
        cell->autorelease();
        
        CCLayerColor* colorLayer = CCLayerColor::create(ccc4(20, 0, 40, 255), SCREEN_WIDTH, CELL_HEIGHT);
        cell->addChild(colorLayer);
        
        CCSprite *sprite = NULL;
        
        if (strcmp(friendDetails->getPhotoPath(), "") != 0)
        {
            const char*  picPath = friendDetails->getPhotoPath();
            sprite = CCSprite::create(picPath);
        }
        else
        {
            sprite = CCSprite::create(FB_DEFAULT_PHOTO);
        }
        
        if (sprite == NULL)
        {
            CCLOG("Sprite is NULL");
        }
        
        sprite->setAnchorPoint(ccp(0, 0.5));
        sprite->setPosition(ccp(20, CELL_HEIGHT/2));
        cell->addChild(sprite);
        //sprite->setScale(0.9);
        sprite->setTag(FRIEND_PHOTO_TAG);
        
        // Friend Facebook ID
        CCLabelTTF *friendIDLabel = CCLabelTTF::create(friendID.c_str(), "Helvetica", 20.0 * MENU_FONT_SCALE);
        
        float gapY =  (CELL_HEIGHT - (friendIDLabel->getContentSize().height * 2)) / 3;
        
        if (sprite)
        {
            friendIDLabel->setPosition(ccp(sprite->getPositionX() + sprite->getContentSize().width + 20, CELL_HEIGHT - gapY));
        }
        
		friendIDLabel->setAnchorPoint(ccp(0, 1));
        friendIDLabel->setTag(FRIEND_ID_LABEL_TAG);
        cell->addChild(friendIDLabel);
        
        // Friend Facebook Name
        CCLabelTTF *friendNameLabel = CCLabelTTF::create(friendName.c_str(), "Helvetica", 20.0 * MENU_FONT_SCALE);
        friendNameLabel->setPosition(ccp(friendIDLabel->getPositionX(),
                                         friendIDLabel->getPositionY() - friendIDLabel->getContentSize().height - gapY));
        
		friendNameLabel->setAnchorPoint(ccp(0, 1));
        friendNameLabel->setTag(FRIEND_NAME_LABEL_TAG);
        cell->addChild(friendNameLabel);
        
        
        // High Score
        CCLabelTTF *scoreLabel = CCLabelTTF::create(score.c_str(), "Helvetica", 20.0 * MENU_FONT_SCALE);
        scoreLabel->setPosition(ccp(SCREEN_WIDTH - 20, friendIDLabel->getPositionY()));
        
        scoreLabel->setAnchorPoint(ccp(1, 1));
        scoreLabel->setTag(FRIEND_SCORE_LABEL_TAG);
        cell->addChild(scoreLabel);
        
        // Installed String
        CCLabelTTF *installedLabel = CCLabelTTF::create(installed.c_str(), "Helvetica", 20.0 * MENU_FONT_SCALE);
        installedLabel->setPosition(ccp(SCREEN_WIDTH - 20, friendNameLabel->getPositionY()));
        
        installedLabel->setAnchorPoint(ccp(1, 1));
        installedLabel->setTag(FRIEND_INSTALLED_LABEL_TAG);
        cell->addChild(installedLabel);
        
//.........这里部分代码省略.........
开发者ID:chenbk85,项目名称:EziSocialDemo,代码行数:101,代码来源:FriendList.cpp

示例4: init

bool CCAlertView::init(const char *_title, const char *_message, const char *_cancel, const char *_ok, CCObject *_object, SEL_CallFuncO _selector1, SEL_CallFuncO _selector2) {
    this->setTouchPriority(0);
    object    = _object;
    selector1 = _selector1;
    selector2 = _selector2;

    CCSize size = CCDirector::sharedDirector()->getWinSize();
    this->setTouchEnabled(true);
    this->setPosition(ccp(size.width / 2.0f, size.height / 2.0f));

    CCSprite *bgSprite = CCSprite::create(getResPath("images/mainmenuScene/blank.png"));
    bgSprite->setTextureRect(CCRect(0, 0, size.width, size.height));
    bgSprite->setColor(ccc3(0, 0, 0));
	bgSprite->setOpacity(0);
    this->addChild(bgSprite, 1000);

    CCSprite *alertViewSprite = CCSprite::create(getResPath("images/mainmenuScene/alert_bg.png"));
    this->addChild(alertViewSprite, 1001);


    CCMenuItemImage *button1 = CCMenuItemImage::create(getResPath("images/mainmenuScene/btn_ok_nor.png"), getResPath("images/mainmenuScene/btn_ok_prs.png"), this, menu_selector(CCAlertView::button1Callback));
    CCMenuItemImage *button2 = CCMenuItemImage::create(getResPath("images/mainmenuScene/btn_cancel_nor.png"), getResPath("images/mainmenuScene/btn_cancel_prs.png"), this, menu_selector(CCAlertView::button2Callback));
//	button1->setOpacity(180);
//	button2->setOpacity(180);

    CCMenu *alertMenu = CCMenu::create(button1, button2, NULL);
    alertMenu->alignItemsHorizontallyWithPadding(20);
    alertMenu->setPosition(ccp(alertViewSprite->getContentSize().width / 2.0f, (button1->getContentSize().height / 2.0f)));
    alertViewSprite->addChild(alertMenu);
 
    //80,150
    
    
    CCLabelTTF *titleLabel = CCLabelTTF::create(_title, STANDARD_FONT, 70);
    titleLabel->setAnchorPoint(CCPoint(0.5, 1.0));
    titleLabel->setPosition(ccp(alertViewSprite->getContentSize().width / 2.0f, alertViewSprite->getContentSize().height - 20 * SCALE));
    alertViewSprite->addChild(titleLabel);

    CCLabelTTF *messageLabel = CCLabelTTF::create(_message, STANDARD_FONT, 40, CCSizeMake(alertViewSprite->getContentSize().width - 50 * SCALE, 0), kCCTextAlignmentCenter);
    messageLabel->setAnchorPoint(CCPoint(0.5, 1.0));
    messageLabel->setPosition(ccp(alertViewSprite->getContentSize().width / 2.0f, titleLabel->getPositionY() - 100));
    alertViewSprite->addChild(messageLabel);

    CCLabelTTF *cancelLabel = CCLabelTTF::create(_cancel, STANDARD_FONT, 18);
    cancelLabel->setPosition(ccp(button2->getContentSize().width / 2.0f, button2->getContentSize().height / 2.0f));
    button1->addChild(cancelLabel);

    CCLabelTTF *OKlabel = CCLabelTTF::create(_ok, STANDARD_FONT, 18);
    OKlabel->setPosition(ccp(button1->getContentSize().width / 2.0f, button1->getContentSize().height / 2.0f));
    button2->addChild(OKlabel);

    bgSprite->runAction(CCFadeTo::create(0.1f, 150));

//    CCFiniteTimeAction *scale1 = CCScaleTo::create(0.15f, 1.1f);
//    CCFiniteTimeAction *scale2 = CCScaleTo::create(0.1f, 0.9f);
//    CCFiniteTimeAction *scale3 = CCScaleTo::create(0.05f, 1.0f);
    alertViewSprite->setScaleX(SCALEX);
    alertViewSprite->setScaleY(SCALEY);
    //alertViewSprite->runAction(CCSequence::create(scale1, scale2, scale3, NULL));

	return true;
}
开发者ID:JinMyong,项目名称:Language_Arabic,代码行数:62,代码来源:CCAlertView.cpp

示例5: rsp_query

void TanSuoLayer::rsp_query(CCObject *msg)
{
	removeObserver(MSG_queryDiscoverInfoRsp);
	GameDirector::getDirector()->hideWaiting();

	SPCmd_QueryDiscoverInfoRsp* data = (SPCmd_QueryDiscoverInfoRsp*) ((MSG_Rsp*)msg)->getData();

	if(data->err_code != Success)
	{
		MessageDisplay* layer = MessageDisplay::create(mCmdHlp->getMessage(data->err_code));
		CCDirector::sharedDirector()->getRunningScene()->addChild(layer);
		return;
	}

	mMainMenu->setVisible(true);

	CCString temp;

	int xunBaoCount = CS::getDiscoverLimitTimes(MyselfManager::getManager()->getMyZhuJueData()->getVipLevel());//寻宝次数上限
	//当前剩余次数
	/*temp.initWithFormat("%u/%u", data->remainder_times, 
		CS::getDiscoverLimitTimes(MyselfManager::getManager()->getMyZhuJueData()->getVipLevel()));*/
	temp.initWithFormat("%u", data->remainder_times);
	CCLabelTTF *numLabel = CCLabelTTF::create(temp.getCString(), fontStr_BookAntiqua, m_nFontSize);
	mBg->addChild(numLabel, 1, Tag_Label_CurNum);
	//numLabel->setAnchorPoint(ccp(0, 0.5));
	numLabel->setPosition(ccp(374, mBg->getContentSize().height-762));
	numLabel->setColor(ccGREEN);
	//int shengyuTimes = MAX_TANSUOTIMES - data->discovered_times;
	int shengyuTimes = MAX_TANSUOTIMES - data->discovered_times;

	unsigned int serverTime = ServerTime::getTime();
	int tm = 360 - (serverTime - data->last_modify_timestamp) % 360;
	string timeStr = getTimeForString(tm);
	m_nRefreshTime = tm;
	CCLabelTTF *timeTTF = CCLabelTTF::create(CCString::createWithFormat("(%s)",timeStr.c_str())->getCString(), fontStr_kaiti, m_nFontSize);
	mBg->addChild(timeTTF, 1);
	//haixuNumLabel->setAnchorPoint(ccp(0,0.5));
	timeTTF->setPosition(ccp( numLabel->getPositionX() + numLabel->getContentSize().width / 2 + timeTTF->getContentSize().width / 2 + 10, numLabel->getPositionY()));
	timeTTF->setColor(ccWHITE);
	m_tRefreshTimeTTF = timeTTF;

	if (xunBaoCount == data->remainder_times)
	{
		timeTTF->setVisible(false);
		//haixuNumLabel->setPosition(ccp( mBg->getContentSize().width / 2 - 15, 44));
	}
	else
	{
		schedule(SEL_SCHEDULE(&TanSuoLayer::refreshTime),1.0f);
		//str = CCString::createWithFormat("()")
	}

	if (data->discovered_times >= MAX_TANSUOTIMES)
	{
		temp.initWithFormat(LFStrings::getValue("XunBaoYiJing_DianLiang_String").c_str());
		CCLabelTTF *yidianliangLabel = CCLabelTTF::create(temp.getCString(), fontStr_kaiti, m_nFontSize, CCSize(0,0), kCCTextAlignmentCenter);
		mBg->addChild(yidianliangLabel, 1, Tag_Label_YiDianLiang);
		//yidianliangLabel->setAnchorPoint(ccp(0,0.5));
		//yidianliangLabel->setPosition(ccp(370, 54));
		yidianliangLabel->setPosition(ccp( mBg->getContentSize().width / 2, 44));
		yidianliangLabel->setColor(fonColor_PuTong);
		m_tHaixuTTF = NULL;
		m_nHadCount = data->remainder_times;
	}
	else
	{
		CCString *str = CCString::createWithFormat("%s  %s",LFStrings::getValue("XunBaoHaixu_String").c_str(),LFStrings::getValue("XunBaoDianLiang_String").c_str());
		CCLabelTTF *haixuNumLabel1 = CCLabelTTF::create(str->getCString(), fontStr_kaiti, m_nFontSize, CCSize(0,0), kCCTextAlignmentCenter);
		mBg->addChild(haixuNumLabel1, 1,Tag_Label_ShengyuNum);
		//haixuNumLabel->setAnchorPoint(ccp(0,0.5));
		haixuNumLabel1->setPosition(ccp( mBg->getContentSize().width / 2, 44));
		haixuNumLabel1->setColor(fonColor_PuTong);

		CCLabelTTF *haixuNumLabel = CCLabelTTF::create(CCString::createWithFormat("%d",shengyuTimes)->getCString(), fontStr_kaiti, m_nFontSize, CCSize(0,0), kCCTextAlignmentCenter);
		mBg->addChild(haixuNumLabel, 1,Tag_Label_Haixu);
		//haixuNumLabel->setAnchorPoint(ccp(0,0.5));
		haixuNumLabel->setPosition(ccp(haixuNumLabel1->getPositionX() - haixuNumLabel1->getContentSize().width / 2 + m_nFontSize * 2 + haixuNumLabel->getContentSize().width / 2, haixuNumLabel1->getPositionY()));
		haixuNumLabel->setColor(ccWHITE);

		m_tHaixuTTF = haixuNumLabel;
		m_nHadCount = data->remainder_times;

		
		


		
		/*
		//还需
		temp.initWithFormat(LFStrings::getValue("XunBaoHaixu_String").c_str());
		CCLabelTTF *haixuNumLabel = CCLabelTTF::create(temp.getCString(), fontStr_kaiti, m_nFontSize, CCSize(0,0), kCCTextAlignmentCenter);
		mBg->addChild(haixuNumLabel, 1, Tag_Label_Haixu);
		//haixuNumLabel->setAnchorPoint(ccp(0,0.5));
		haixuNumLabel->setPosition(ccp( mBg->getContentSize().width / 2, 44));
		haixuNumLabel->setColor(fonColor_PuTong);

		//右边剩余次数
		temp.initWithFormat(" %d ", shengyuTimes);
		CCLabelTTF *rightnumLabel = CCLabelTTF::create(temp.getCString(), fontStr_BookAntiqua, m_nFontSize, CCSize(40,0), kCCTextAlignmentCenter);
//.........这里部分代码省略.........
开发者ID:longguai,项目名称:game-DarkWar,代码行数:101,代码来源:TanSuoLayer.cpp

示例6: init

bool HelpLayer::init(){
	//////////////////////////////
	// 1. super init first
	if (!CCLayer::init()){
		return false;
	}
	CCScale9Sprite *pBackground = CCScale9Sprite::create("Dialog_bg.png");

	pBackground->setAnchorPoint(ccp(0.5f,0.5f));
	CCSize frameSize = CCEGLView::sharedOpenGLView()->getFrameSize();
	float scale = frameSize.width / DESIGN_WIDTH;
	float newScaleY = 1.0f;
	if (scale > 0){
		float scaleY = frameSize.height / DESIGN_HEIGHT;
		if (scaleY > scale){
			newScaleY = scaleY / scale;
		}		
	}	
	pBackground->setPreferredSize(CCSizeMake(DESIGN_WIDTH - 20,(DESIGN_HEIGHT - 130) * newScaleY));
	CCSize size = pBackground->getContentSize();
	pBackground->setPosition(VisibleRect::center());
	addChild(pBackground);

	CCSprite *pTitleBgSp = CCSprite::create("Dialog_Title.png");
	pTitleBgSp->setPosition(ccp(pBackground->getPositionX(),pBackground->getPositionY() + pBackground->getContentSize().height / 2));
	addChild(pTitleBgSp);

	CCSprite *pTitleSp = CCSprite::create("Title_Help.png");
	pTitleSp->setPosition(ccp(pTitleBgSp->getPositionX(),pTitleBgSp->getPositionY() + pTitleSp->getContentSize().height / 2 + 5));
	addChild(pTitleSp);

	CCSprite *pItemNormal = CCSprite::create("cancel_s.png");
	CCSprite *pItemSelected = CCSprite::create("cancel_s.png");
	CCMenuItem *pClose = CCMenuItemSprite::create(pItemNormal, pItemSelected, this, menu_selector(HelpLayer::close));
	pClose->setPosition(ccp(pTitleSp->getPositionX() + pTitleSp->getContentSize().width * 3 / 2, pTitleSp->getPositionY()));
	pItemSelected->setScale(1.1f);
	pItemSelected->setAnchorPoint(ccp(0.05f, 0.05f));

	CCMenu *pMenu = CCMenu::create(pClose, NULL);
	pMenu->setPosition(CCPointZero);
	addChild(pMenu, 1);
	CCDictionary *text = CCDictionary::createWithContentsOfFile(XML_DATA);
	CCString *msg = (CCString*)text->objectForKey("rule");
	CCLabelTTF *msgLabel = CCLabelTTF::create(msg->getCString(), "Arial", 21,CCSizeMake(DESIGN_WIDTH - 40, 0),kCCTextAlignmentLeft);
	msgLabel->setColor(ccc3(0,0,0));
	msgLabel->setPosition(ccp(pTitleBgSp->getPositionX(),pTitleBgSp->getPositionY() - pTitleBgSp->getContentSize().height / 2 - msgLabel->getContentSize().height / 2 - 5));
	addChild(msgLabel);

	CCSprite *phSp = CCSprite::create("Help_1.png");
	phSp->setPosition(ccp(msgLabel->getPositionX(),msgLabel->getPositionY() - msgLabel->getContentSize().height / 2 - phSp->getContentSize().height / 2 - 3));
	addChild(phSp);

	msg = (CCString*)text->objectForKey("scoreTips");
	msgLabel = CCLabelTTF::create(msg->getCString(), "Arial", 21,CCSizeMake(DESIGN_WIDTH - 40, 0),kCCTextAlignmentCenter);
	msgLabel->setColor(ccc3(0,0,0));
	msgLabel->setPosition(ccp(phSp->getPositionX(),phSp->getPositionY() - phSp->getContentSize().height / 2 - msgLabel->getContentSize().height / 2 - 10));
	addChild(msgLabel);

	phSp = CCSprite::create("Help_2.png");
	phSp->setPosition(ccp(msgLabel->getPositionX(),msgLabel->getPositionY() - msgLabel->getContentSize().height / 2 - phSp->getContentSize().height / 2 - 3));
	addChild(phSp);

	msg = (CCString*)text->objectForKey("pro");
	msgLabel = CCLabelTTF::create(msg->getCString(), "Arial", 21,CCSizeMake(DESIGN_WIDTH - 40, 0),kCCTextAlignmentLeft);
	msgLabel->setColor(ccc3(0,0,0));
	msgLabel->setPosition(ccp(pBackground->getPositionX() - pBackground->getContentSize().width / 2 + msgLabel->getContentSize().width / 2 + 10,
		phSp->getPositionY() - phSp->getContentSize().height / 2 - msgLabel->getContentSize().height / 2 - 3));
	addChild(msgLabel);

	CCSprite* bombSp = CCSprite::create("Props_Bomb.png");
	bombSp->setPosition(ccp(pBackground->getPositionX() - pBackground->getContentSize().width / 2 + bombSp->getContentSize().width / 2 + 10,
		msgLabel->getPositionY() - msgLabel->getContentSize().height / 2 - bombSp->getContentSize().height / 2 - 3));
	addChild(bombSp);

	msg = (CCString*)text->objectForKey("bomb");
	msgLabel = CCLabelTTF::create(msg->getCString(), "Arial", 18,CCSizeMake(DESIGN_WIDTH - 40, 0),kCCTextAlignmentLeft);
	msgLabel->setColor(ccc3(0,0,0));
	msgLabel->setPosition(ccp(bombSp->getPositionX() + bombSp->getContentSize().width / 2 + msgLabel->getContentSize().width / 2 + 5,
		bombSp->getPositionY() + 13));
	addChild(msgLabel);

	msg = (CCString*)text->objectForKey("useCoin");
	CCString *showUseString = CCString::createWithFormat(msg->getCString(),GameData::getInstance()->m_nBombUseCoin);
	CCLabelTTF *showUseLabel = CCLabelTTF::create(showUseString->getCString(), "Arial", 14,CCSizeMake(DESIGN_WIDTH - 40, 0),kCCTextAlignmentLeft);
	showUseLabel->setColor(ccc3(0,0,0));
	showUseLabel->setPosition(ccp(bombSp->getPositionX() + bombSp->getContentSize().width / 2 + showUseLabel->getContentSize().width / 2 + 5,
		msgLabel->getPositionY() - msgLabel->getContentSize().height / 2 - showUseLabel->getContentSize().height / 2 - 2));
	addChild(showUseLabel);

	CCSprite *paintSp = CCSprite::create("Props_Paint.png");
	paintSp->setPosition(ccp(pBackground->getPositionX() - pBackground->getContentSize().width / 2 + paintSp->getContentSize().width / 2 + 10,
		bombSp->getPositionY() - bombSp->getContentSize().height / 2 - paintSp->getContentSize().height / 2 - 10));
	addChild(paintSp);

	msg = (CCString*)text->objectForKey("shua");
	msgLabel = CCLabelTTF::create(msg->getCString(), "Arial", 18,CCSizeMake(DESIGN_WIDTH - 40, 0),kCCTextAlignmentLeft);
	msgLabel->setColor(ccc3(0,0,0));
	msgLabel->setPosition(ccp(paintSp->getPositionX() + paintSp->getContentSize().width / 2 + msgLabel->getContentSize().width / 2 + 5,
		paintSp->getPositionY() + 13));
	addChild(msgLabel);
//.........这里部分代码省略.........
开发者ID:SeedAsh,项目名称:CoolStars,代码行数:101,代码来源:HelpLayer.cpp

示例7: getItemContentByIndex


//.........这里部分代码省略.........
            }
        }
        //junshang
        CCLabelTTF* label_junshang = LF::lable(bg,LFStrings::getValue("junshang"),ccp(0,0),20,fontStr_kaiti);
        label_junshang->setAnchorPoint(ccp(0, 0.5));
        label_junshang->setPosition(
            ccp(label_baizhi->getPositionX()+label_baizhi->getContentSize().width+10, 116));
        label_junshang->setTag(TAG_BaseBody_LABLE_JUNSHANG_TXT);
        if(hasBaiZhi)
        {
            label_junshang->setVisible(true);
            if(mEquipmentVec[index]->getEquipType() == EquipType_FangJu)
                label_junshang->setString(LFStrings::getValue("huJia").c_str());
        }
        else
        {
            label_junshang->setVisible(false);
        }
    }

    //伤害详细
    if (mEquipmentVec[index]->getEquipType() == EquipType_WuQi)
    {
        CCLabelTTF* label;
        char str[64];
        sprintf(str, "%u-%u ", mEquipmentVec[index]->getEquipData().gongji_min
                , mEquipmentVec[index]->getEquipData().gongji_max);

        label = LF::lable(bg,str,ccp(left_x_start,87),20,fontStr_BookAntiqua);
        label->setTag(TAG_BaseBody_LABLE_SHANGHAIXIANGXI_NUM);
        label->setColor(fonColor_CiYao);
        CCLabelTTF* label2;
        label2 = LF::lable(bg,LFStrings::getValue("dianShangHai")
                           ,ccp(label->getPosition().x + label->getContentSize().width, label->getPositionY()),20,fontStr_kaiti);
        label2->setTag(TAG_BaseBody_LABLE_SHANGHAIXIANGXI_TXT);
        label2->setColor(fonColor_CiYao);
    }
    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,"");
开发者ID:longguai,项目名称:game-DarkWar,代码行数:67,代码来源:MainLayerZhuangBeiBaseBody.cpp

示例8: initScrollView

void SGAnnouncementLayer::initScrollView()
{
	//ResourceManager::sharedInstance()->bindTexture("sgannouncementlayer/sgannouncementlayer2.plist", RES_TYPE_LAYER_UI, sg_announcementLayer);
    m_scrollview->getContainer()->removeAllChildrenWithCleanup(true);
    int positionY = 0;// Y轴纵向偏移,
	int border_shift = 20;//内容窗口偏移
	
    int text_wid_expand = 40;//文本区宽度扩展
	if (CCEGLView::sharedOpenGLView()->getFrameSize().width == ipadResource.size.width
        ||CCEGLView::sharedOpenGLView()->getFrameSize().width == ipadhdResource.size.width)
	{
		text_wid_expand = 28;
	}
	
	//记录上一个内容窗口的底线位置
	float lastWindowBorderPos = 0.0f;
    for(int i = 0; i < m_arrayAnn->count(); i++)
	//for (int i = 0; i < 6; i++)
    {
		
		//=======================获取数据================================
		SGAnnouncementDataModel *ann = (SGAnnouncementDataModel *)m_arrayAnn->objectAtIndex(i);
		CCString *title = ann->getTitle();
		CCString *content = ann->getContent();

		int viewId = ann->getViewId();//跳转至哪个页面
		//=======================获取数据================================
		
        CCLayer *layer = (CCLayer*)m_scrollview->getContainer();//获取scrollview的容器

        CCLayerColor* contentWindow = initContentWindow(content, viewId > 0);
        contentWindow->setAnchorPoint(ccp(0.5, 0));
        contentWindow->ignoreAnchorPointForPosition(false);
        
        CCSize cwSize = contentWindow->getContentSize();
        
        CCSprite * sprite = CCSprite::createWithSpriteFrameName("Tips.png");
        sprite->setScaleX(cwSize.width / 584.0);
        sprite->setScaleY(cwSize.height / 522.0);
        sprite->setPosition(ccp(cwSize.width * 0.5, cwSize.height * 0.5));
        contentWindow->addChild(sprite, 2);
        
		//根据上一个内容窗口的位置计算下一个窗口的位置
		contentWindow->setPosition(ccp(layer->getContentSize().width * 0.5,
									   lastWindowBorderPos + border_shift));
		
        /* tips.png图片拉长的倍数 */
        float pngScale = cwSize.height / 522 ;
//        CCLOG("*******************>>>");
//        CCLOG("i = %d" , i);
//        CCLOG("title = %s" , title->getCString());
//        CCLOG("content = %s" , content->getCString());
//        CCLOG("pos: x=%f , y = %f" , contentWindow->getPositionX() , contentWindow->getPositionY());
//        CCLOG("cwSize: width=%f, height=%f", cwSize.width, cwSize.height);
//        CCLOG("lastWindowBorderPos = %f" , lastWindowBorderPos);
//        CCLOG("<<<********************");
        lastWindowBorderPos = contentWindow->getPositionY() + cwSize.height;

		//公告title
        CCLabelTTF *label = CCLabelTTF::create(title->getCString(), FONT_PANGWA, 35);
        label->setColor(COLOR_RED);
        label->setAnchorPoint(ccp(0.5 , 1));
		label->setPosition(ccp(cwSize.width *0.5f, cwSize.height - pngScale * 20));
		contentWindow->addChild(label, 100);
		//公告内容
//        CCSize maybeTextSize = stringInLabelRect(content->getCString());
//		CCLabelTTF *label_content=CCLabelTTF::create(content->getCString(), FONT_PENGYOU, 24,CCSizeMake(maybeTextSize.width + text_wid_expand * 4,maybeTextSize.height + text_hei_expand),kCCTextAlignmentLeft);
        CCLabelTTF *label_content=CCLabelTTF::create(content->getCString(), FONT_PENGYOU, 24,CCSizeMake(cwSize.width - 40 * widthFactor, cwSize.height - label->getContentSize().height),kCCTextAlignmentLeft);
		label_content->setAnchorPoint(ccp(0.5, 1));//内容顶线对齐
        label_content->setColor(ccBLACK);
		label_content->setPosition(ccp(label->getPositionX(), label->getPositionY() - label->getContentSize().height));
		label_content->setZOrder(102);
        contentWindow->addChild(label_content);
		
		//点击前往按钮
        if (viewId > 0) {
            SGButton *goButton = SGButton::create("box_btnbg.png", NULL, this, menu_selector(SGAnnouncementLayer::AnnounceButton),CCPointZero,false,true);
            
            CCString *go = CCString::createWithFormat(str_Hit_goto);
            SGCCLabelTTF *go_label = SGCCLabelTTF::create(go->getCString(), FONT_PANGWA, 30);
            
            goButton->addChild(go_label);
            goButton->setTag(viewId);//跳转到某个视图界面
            go_label->setPosition(ccp(goButton->getContentSize().width / 2, goButton->getContentSize().height / 2));
            
            //立即前往Button
            CCMenu *menu = CCMenu::create(goButton, NULL);
            menu->setTouchPriority(0);
            menu->setPosition(CCPointZero);
            goButton->setScale(0.7);
            goButton->setZOrder(200);
            //goButton->setPosition(ccp(label->getPositionX(), goButton->getContentSize().height / 1.5));
            goButton->setAnchorPoint(ccp(0.5, 0));
            goButton->setPosition(ccp(label->getPositionX(), pngScale * 18));
            menu->setZOrder(200);
            contentWindow->addChild(menu);
        }

		layer->addChild(contentWindow);
        //每次加对应的contentWindow的大小,为之后计算scrollview的内容体偏移
//.........这里部分代码省略.........
开发者ID:caoguoping,项目名称:warCraft,代码行数:101,代码来源:SGAnnouncementLayer.cpp

示例9: buildHeader

void BaseScene::buildHeader(int highlightIndex, const char* title, const char* description)
{
    _currentMenuIndex = highlightIndex;
    
    CCMenuItemImage* homeButton = CCMenuItemImage::create();
    homeButton->setNormalSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_home_nrl"));
    homeButton->setSelectedSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_home_prd"));
    homeButton->setDisabledSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_home_prd"));
    homeButton->setTarget(this, menu_selector(BaseScene::loadHomeScene));
    homeButton->setAnchorPoint(ccp(1.0f, 1.0f));
    
    CCMenuItemImage* fbActionButton = CCMenuItemImage::create();
    fbActionButton->setNormalSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_fb_action_nrl"));
    fbActionButton->setSelectedSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_fb_action_prd"));
    fbActionButton->setDisabledSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_fb_action_dis"));
    fbActionButton->setTarget(this, menu_selector(BaseScene::loadFBActionScene));
    fbActionButton->setAnchorPoint(ccp(1.0f, 1.0f));
    
    if (EziSocialObject::sharedObject()->isFacebookSessionActive() == false)
    {
        fbActionButton->setEnabled(false);
    }
    
    CCMenuItemImage* helpButton = CCMenuItemImage::create();
    helpButton->setNormalSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_help_nrl"));
    helpButton->setSelectedSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_help_prd"));
    helpButton->setDisabledSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("btn_help_prd"));
    helpButton->setTarget(this, menu_selector(BaseScene::loadHelpScene));
    
    helpButton->setAnchorPoint(ccp(1.0f, 1.0f));
    
    switch (highlightIndex)
    {
        case 0:
            homeButton->setEnabled(false);
            break;
            
        case 1:
            fbActionButton->setEnabled(false);
            break;
            
        case 2:
            helpButton->setEnabled(false);
            break;
            
        default:
            break;
    }
    
    
    CCMenu* homeMenu = CCMenu::create(homeButton, fbActionButton, helpButton, NULL);
    homeMenu->alignItemsHorizontally();
    
    this->addChild(homeMenu);
    PlaceNode(homeMenu, 0.88, 0.98);
    
    // Add a line.
    CCLayerColor* lineLayer = CCLayerColor::create(ccc4(204, 204, 204, 204),
                                                   CCDirector::sharedDirector()->getVisibleSize().width,
                                                   1.0 * AppDelegate::SCREEN_SCALE_FACTOR);
    
    this->addChild(lineLayer);
    PlaceNode(lineLayer, 0.0, 0.8);
    lineLayer->setPositionY(homeMenu->getPositionY() - homeButton->getContentSize().height - (7 * AppDelegate::SCREEN_SCALE_FACTOR));
    
    // Add Title
    CCLabelTTF* titleLabel = CCLabelTTF::create(title, "Arial", 50.0 * AppDelegate::SCREEN_SCALE_FACTOR);
    this->addChild(titleLabel);
    titleLabel->setAnchorPoint(ccp(0.0f, 0.0f));
    //PlaceNode(titleLabel, 0.02, 0.98);
    
    CCLabelTTF* descriptionLabel = CCLabelTTF::create(description,
                                                      "Arial", SCALED_VALUE(22.0f));
    this->addChild(descriptionLabel);
    descriptionLabel->setAnchorPoint(ccp(0.0f, 0.0f));
    PlaceNode(descriptionLabel, 0.02, 0.98);
    descriptionLabel->setPositionY(homeMenu->getPositionY() - homeButton->getContentSize().height);
    descriptionLabel->setColor(ccc3(204, 204, 204));
    
    titleLabel->cocos2d::CCNode::setPosition(descriptionLabel->getPositionX(),
                                             descriptionLabel->getPositionY() + descriptionLabel->getContentSize().height - 2.0f);
    
}
开发者ID:ezibyte,项目名称:EziSocialDemo,代码行数:83,代码来源:BaseScene.cpp

示例10: setSystemMail

void MailInfoListLayer::setSystemMail(Email mail)
{
	
	//CCDirector::sharedDirector()->getTouchDispatcher()->addTargetedDelegate(this,-132,true);
	ListMenu *menu = ListMenu::create();
	menu->setPosition(CCPointZero);
	menu->setAnchorPoint(CCPointZero);
	menu->setContentSize(this->getContentSize());
	addChild(menu);
	m_mMenu = menu;
	//m_mMenu->runAction(CCCallFuncND::create(this, callfuncND_selector(MailInfoListLayer::changeMenuPriority_callfuncND), (void*)(-133)));
	m_eEmail = mail;
	sortMail(mail);
	int count = 0;
	int height = m_nHeight;
	int width = count * 100;
	m_nWidth = width;
	count = 0;
	int side = 50;
	int bWidth = 0;

	int _width = 0;

	int pos_x = 0;
	for (map<string,string>::iterator iter = m_lThingsList.begin(); iter != m_lThingsList.end() ; iter ++)
	{
		CCSprite *cailiaoSpr = CCSprite::create("daoju_kuang_bg.png");
		cailiaoSpr->setScale(0.7f);
		bWidth = cailiaoSpr->getContentSize().width * cailiaoSpr->getScaleX();
		cailiaoSpr->setPosition(ccp(count * bWidth + ( side * ( count * 2 + 1 ) ) + bWidth / 2 ,height - cailiaoSpr->getContentSize().height * cailiaoSpr->getScaleY() / 2 - 5));
		addChild(cailiaoSpr);

		CCSprite *daojuSpr = CCSprite::create(iter->first.c_str());
		daojuSpr->setScale(0.7f);
		bWidth = daojuSpr->getContentSize().width * cailiaoSpr->getScaleX();
		daojuSpr->setPosition(ccp(cailiaoSpr->getContentSize().width / 2, cailiaoSpr->getContentSize().height / 2));
		cailiaoSpr->addChild(daojuSpr);

		CCLabelTTF *nameTTF = CCLabelTTF::create(iter->second.c_str(),fontStr_kaiti,25.0f);
		nameTTF->setPosition(ccp(cailiaoSpr->getPositionX(),nameTTF->getContentSize().height / 2 + 5));
		addChild(nameTTF);
		nameTTF->setColor(ccWHITE);

		_width += cailiaoSpr->getPositionX() - pos_x;
		pos_x = cailiaoSpr->getPositionX();
		count ++;
	}
	_width += bWidth / 2 + side;
	for (vector<Flat_DuanzaoGroupZBInfo>::iterator iter = mail.equipVec.begin(); iter != mail.equipVec.end() ; iter ++)
	{
		
		CCLabelTTF *nameTTF = CCLabelTTF::create(iter->zhuangbei_name.c_str(),fontStr_kaiti,25.0f);
		nameTTF->setPosition(ccp(count * bWidth + ( side * ( count * 2 + 1 ) ) + bWidth / 2 + nameTTF->getContentSize().height / 2 ,nameTTF->getContentSize().height / 2 + 20));
		addChild(nameTTF);
		nameTTF->setColor(ccWHITE);


		//string nameTemp = CS::getItemName(iter->zb_group_id) + LFStrings::getValue("zhi") + LFStrings::getValue("suipian") + getStrByInt(iter->suipian_id);
		string equipfile = iter->zhuangbei_pic;
		equipfile = "minute_" + equipfile + ".png";
		m_lThingsList.insert(map<string,string>::value_type(equipfile,iter->zhuangbei_name));

		string diwenStr = ImageManager::getManager()->getImageData_DiWen_WithBianKuang(iter->zhuangbei_colour);
		CCMenuItemImage *eqDiwenImg = CCMenuItemImage::create(diwenStr.c_str(), diwenStr.c_str(), this,
			menu_selector(MailInfoListLayer::menuItemClicked_Equip));
		m_mMenu->addChild(eqDiwenImg);
		eqDiwenImg->setTag(iter->zb_group_id);
		eqDiwenImg->setScale(0.8f);
		bWidth = eqDiwenImg->getContentSize().width * eqDiwenImg->getScaleX();
		eqDiwenImg->setPosition(ccp( nameTTF->getPositionX(),nameTTF->getPositionY() + nameTTF->getContentSize().height / 2 + eqDiwenImg->getContentSize().height / 2 + 5));
		
		CCSprite *daojuSpr = CCSprite::create(equipfile.c_str());
		daojuSpr->setScale(0.24f);
		bWidth = daojuSpr->getContentSize().width * eqDiwenImg->getScaleX();
		daojuSpr->setPosition(ccp(eqDiwenImg->getContentSize().width / 2, eqDiwenImg->getContentSize().height / 2));
		eqDiwenImg->addChild(daojuSpr);
		/*CCSprite *cailiaoSpr = CCSprite::create("daoju_kuang_bg.png");
		cailiaoSpr->setScale(0.7f);
		bWidth = cailiaoSpr->getContentSize().width * cailiaoSpr->getScaleX();
		cailiaoSpr->setPosition(ccp(count * bWidth + ( side * ( count * 2 + 1 ) ) + bWidth / 2 ,height - cailiaoSpr->getContentSize().height * cailiaoSpr->getScaleY() / 2 - 5));
		addChild(cailiaoSpr);*/

		

		_width += eqDiwenImg->getPositionX() - pos_x;
		pos_x = eqDiwenImg->getPositionX();
		count ++;
	}
	_width += bWidth / 2 + side;
	m_nWidth = _width;
	this->setContentSize(CCSizeMake(m_nWidth,m_nHeight));
}
开发者ID:longguai,项目名称:game-DarkWar,代码行数:92,代码来源:MailInfoListLayer.cpp

示例11: initUI

void IOSStoreLayer::initUI()
{
	//初始化背景
	m_pBg = CCSprite::create(ResManager::getManager()->getFilePathByLanguageType(g_storelayerPath+"main_shangdian_bg.png").c_str());
	this->addChild(m_pBg, 1, bg_tag);
	m_pBg->setPosition(ccp(this->getContentSize().width/2, this->getContentSize().height/2));

	m_pKaibaoxiangNode = CCScale9Sprite::create(ResManager::getManager()->getSharedFilePath(g_seasonlayerPath+"nodebg.png").c_str());
	m_pKaibaoxiangNode->ignoreAnchorPointForPosition(false);
	m_pKaibaoxiangNode->setAnchorPoint(ccp(0.5f, 0.5f));
	m_pKaibaoxiangNode->setContentSize(m_pBg->getContentSize());
	m_pKaibaoxiangNode->setPosition(ccp(m_pBg->getContentSize().width/2, m_pBg->getContentSize().height/2));
	m_pBuyStarNode = CCScale9Sprite::create(ResManager::getManager()->getSharedFilePath(g_seasonlayerPath+"nodebg.png").c_str());
	m_pBuyStarNode->ignoreAnchorPointForPosition(false);
	m_pBuyStarNode->setAnchorPoint(ccp(0.5f, 0.5f));
	m_pBuyStarNode->setPosition(ccp(m_pBg->getContentSize().width/2, m_pBg->getContentSize().height/2));
	m_pBuyStarNode->setContentSize(m_pBg->getContentSize());

	m_pBg->addChild(m_pKaibaoxiangNode, 3, kaibaoxiang_node_tag);
	m_pBg->addChild(m_pBuyStarNode, 3, buystar_node_tag);

	m_pBgMenu = CCMenu::create();
	m_pBgMenu->setPosition(CCPointZero);
	m_pBg->addChild(m_pBgMenu, 2);

	//左上角提示背景
	CCSprite* pTip = CCSprite::create(ResManager::getManager()->getSharedFilePath(g_storelayerPath+"main_shangdian_tishi.png").c_str());
	m_pBg->addChild(pTip, 0, tip_bg_tag);
	pTip->setPosition(ccp(pTip->getContentSize().width/2 - 25,
		m_pBg->getContentSize().height-pTip->getContentSize().height/2 - 30));

	//左上角提示字符串
	CCLabelTTF* pTipStr = CCLabelTTF::create(LFStrings::getValue("ShangdiangTipStr_lefttop_juqing").c_str(), fontStr_katong, 24, CCSizeMake(210, 80), kCCTextAlignmentLeft);
	m_pBg->addChild(pTipStr, 1, lefttop_tip_str_tag);
	pTipStr->setPosition(ccp(pTip->getPositionX() + 20, pTip->getPositionY() - 25));
	pTipStr->setString("");

	//中间提示字符
	CCLabelTTF* pTipCenterStr = CCLabelTTF::create(LFStrings::getValue("ShangdiangTipStr_center_01").c_str(), fontStr_katong, 24);
	m_pBg->addChild(pTipCenterStr, 1, center_tip_str_tag);
	pTipCenterStr->setColor(ccc3(150, 60, 20));
	pTipCenterStr->setPosition(ccp(m_pBg->getContentSize().width/2,  m_pBg->getContentSize().height - 160));
	pTipCenterStr->setString("");
	
	//右边星星数
	CCLabelAtlas* lable = CCLabelAtlas::create(
		"0123456789",
		ResManager::getManager()->getSharedFilePath(g_seasonlayerPath+"season_star_amount.png").c_str(),
		30, 47,//24
		'0');
	m_pBg->addChild(lable, 1, star_count_str_tag);
	lable->setScale(0.6f);
	char charStarCount[10] = {}; 
	int iStarCount = GameInforEditer::getGameInfor()->getTotalFreeScore();
	sprintf(charStarCount, "%d", iStarCount);
	lable->setString(charStarCount);
	lable->setPosition(ccp(m_pBg->getContentSize().width - 120, m_pBg->getContentSize().height - 175));

	//右边字符
	CCSprite* pShuzi = CCSprite::create(ResManager::getManager()->getFilePathByLanguageType(g_seasonlayerPath+"season_amount.png").c_str());
	m_pBg->addChild(pShuzi, 1);
	pShuzi->setScale(0.6f);
	pShuzi->setPosition(ccp(lable->getPositionX() - 50, pTipCenterStr->getPositionY()));

	//右边星星图标
	CCSprite* pXingxing = CCSprite::create(ResManager::getManager()->getSharedFilePath(g_xiaogk+"YX_start.png").c_str());
	m_pBg->addChild(pXingxing, 1);
	pXingxing->setPosition(ccp(pShuzi->getPositionX() - 50, pShuzi->getPositionY()));
}
开发者ID:SongCF,项目名称:game-LostStar,代码行数:69,代码来源:IOSStoreLayer.cpp


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