bool StatusWnd::create(HWND imeUIWnd) { HIMC hIMC = (HIMC)GetWindowLong( imeUIWnd, IMMGWL_IMC ); if ( g_isWinLogon ) return false; IMCLock imc(hIMC); hwnd = CreateWindowEx(0, g_statusWndClass, NULL, WS_POPUP|WS_CLIPCHILDREN, 0, 0, 0, 0, imeUIWnd, NULL, g_dllInst, NULL); if( !hwnd ) return false; TCHAR bmppath[MAX_PATH]; GetSystemDirectory( bmppath, MAX_PATH ); _tcscat( bmppath, _T("\\IME\\Chewing\\statuswnd.bmp") ); HBITMAP tbbmp = (HBITMAP)LoadImage( NULL, bmppath, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR|LR_LOADFROMFILE); this->setTheme(tbbmp); iconChi = (HICON)LoadImage( g_dllInst, LPCTSTR (IDI_CHI), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ); iconEng = (HICON)LoadImage( g_dllInst, LPCTSTR (IDI_ENG), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ); iconFull = (HICON)LoadImage( g_dllInst, LPCTSTR (IDI_FULL), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ); iconHalf = (HICON)LoadImage( g_dllInst, LPCTSTR (IDI_HALF), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ); iconConfig = (HICON)LoadImage( g_dllInst, LPCTSTR (IDI_CONFIG), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ); TCHAR tip[128]; LoadString(g_dllInst, ID_CHI_ENG, tip, sizeof(tip) ); addBtn( ID_CHI_ENG, imc.isChinese() ? iconChi : iconEng, tip ); LoadString(g_dllInst, ID_FULL_HALF, tip, sizeof(tip) ); addBtn( ID_FULL_HALF, imc.isFullShape() ? iconFull : iconHalf, tip ); // This should be disabled in WinLogon for security reason. if( ! g_isWinLogon ) { LoadString(g_dllInst, ID_MENU, tip, sizeof(tip) ); addBtn( ID_MENU, iconConfig, tip ); } IMEUILock ui(GetParent(hwnd)); setTooltip( &ui.getIMEUI()->tooltip ); setCmdTarget(hwnd); int w, h; XPToolbar::getSize(&w, &h); SetWindowPos( hwnd, NULL, 0, 0, w, h, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER ); return true; }
void SGBindSuccessBox::viewDidLoad() { ResourceManager::sharedInstance()->bindTexture("sgloginingbox/sgloginingbox.plist", RES_TYPE_LAYER_UI, sg_bindSuccessBox); CCPoint center = SGLayout::getPoint(kMiddleCenter); //标题 CCSprite *sprite_title = CCSprite::createWithSpriteFrameName("login_bind_success.png"); sprite_title->setPosition(biao->getPosition()); addChild(sprite_title); //内容1 SGCCLabelTTF *label_content = SGCCLabelTTF::create(str_TTMainLayer_str7,FONT_BOXINFO, 32); label_content->setAnchorPoint(ccp(0, 0.5)); label_content->setPosition(ccpAdd(center, ccp(-230, 73))); addChild(label_content); //内容2 SGCCLabelTTF *label_content_2 = SGCCLabelTTF::create(str_TTMainLayer_str8, FONT_BOXINFO, 32); label_content_2->setAnchorPoint(ccp(0, 0.5)); label_content_2->setPosition(ccpAdd(label_content->getPosition(), ccp(0, -55))); addChild(label_content_2); SGCCLabelTTF *label_content_3 = SGCCLabelTTF::create(str_TTMainLayer_str9, FONT_BOXINFO, 32); label_content_3->setAnchorPoint(ccp(0, 0.5)); label_content_3->setPosition(ccpAdd(label_content_2->getPosition(), ccp(0, -55))); addChild(label_content_3); //确定按钮 SGButton *buttonOK = SGButton::create("box_btnbg.png", "public_font_queding.png", this, menu_selector(SGBindSuccessBox::buttonClickOK),CCPointZero,false,true); buttonOK->setPosition(ccpAdd(center, ccp(0, -324/2 +5 -40))); addBtn(buttonOK); }
bool HelpLabelItem::initWithSize() { if (!SNSTableViewCellItem::init()) { return false; } // CCSprite *item = CCSprite::createWithSpriteFrameName("item_bigbg.png"); // this->addChild(item,-1); // bgbgbg = item; bgbgbg = NULL; ////////// SGButton*btn=SGButton::create("item_bigbg.png", NULL, this, menu_selector(HelpLabelItem::buttonClick),CCPointZero,false,true); this->addChild(btn); addBtn(btn); // menu=CCMenu::create(btn, NULL); // menu -> setPosition(CCPointZero); // // //menu->addChild(btn); // // // // this->addChild(menu); // addBtn(btn); SGCCLabelTTF *title = SGCCLabelTTF::create("", FONT_PANGWA, 36 , ccWHITE); //modify by:zyc . merge into create. //title->setColor(ccWHITE); this->addChild(title,10,137); return true; }
SettingsDialog::SettingsDialog(Settings *settings, QWidget *parent) : QDialog(parent) { setAttribute(Qt::WA_DeleteOnClose); setWindowFlags(windowFlags() ^ Qt::WindowContextHelpButtonHint); setWindowTitle(SCHAT_NAME); setMinimumWidth(320); QFrame *topFrame = new QFrame(this); topFrame->setObjectName(LS("TopFrame")); topFrame->setStyleSheet(LS("#TopFrame{background-color:#fff;}")); m_settingsBtn = addBtn(QIcon(LS(":/images/32/gear.png")), tr("Settings")); m_settingsBtn->setChecked(true); m_aboutBtn = new QToolButton(this); m_aboutBtn->setText(QApplication::applicationVersion()); m_aboutBtn->setAutoRaise(true); m_aboutBtn->setCheckable(true); m_aboutBtn->setToolButtonStyle(Qt::ToolButtonTextOnly); connect(m_aboutBtn, SIGNAL(clicked()), SLOT(tooglePage())); m_pages = new QStackedWidget(this); m_pages->addWidget(new SettingsPage(settings, this)); m_pages->addWidget(new AboutPage(settings, this)); QFrame *line = new QFrame(this); line->setFrameStyle(QFrame::HLine | QFrame::Sunken); QHBoxLayout *btnLay = new QHBoxLayout(topFrame); btnLay->addWidget(m_settingsBtn); btnLay->addStretch(); btnLay->addWidget(m_aboutBtn, 0, Qt::AlignTop); btnLay->setMargin(4); QVBoxLayout *layout = new QVBoxLayout(this); layout->addWidget(topFrame); layout->addWidget(line); layout->addWidget(m_pages); layout->setMargin(0); layout->setSpacing(0); }
void SGSystemMailContent::viewDidLoad() { //如果邮件现在处于未读状态 if(!m_pSystemMail->getIsRead()) { main::ShowSystemMailRequest *mail = new main::ShowSystemMailRequest(); mail->set_mailid(m_pSystemMail->getSsid()); SGSocketClient::sharedSocketClient()->send(MSG_MAIL_READSYSTEMMAIL, mail); } //------------------------------------------------------------------------------------- //界面布局 //------------------------------------------------------------------------------------- ResourceManager::sharedInstance()->bindTexture("sgsystemmaillayer/sgsystemmaillayer.plist", RES_TYPE_LAYER_UI, sg_systemMailContent); ResourceManager::sharedInstance()->bindTexture("sgserverlistlayer/sgserverlistlayer.plist", RES_TYPE_LAYER_UI, sg_systemMailContent); float headhgt = SGMainManager::shareMain()->getTotleHdHgt(); CCSize s = CCDirector::sharedDirector()->getWinSize(); CCSprite *titlecenter = CCSprite::createWithSpriteFrameName("title_bg_2.png"); titlecenter->setAnchorPoint(ccp(0.5, 0)); titlecenter->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(0, -headhgt- 10))); this->addChild(titlecenter,10); titlecenter->setScaleX(4); CCSprite *title_bg_l = CCSprite::createWithSpriteFrameName("title_bg_LR.png"); title_bg_l->setAnchorPoint(ccp(0, 0)); title_bg_l->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(-s.width/2, -headhgt- 10))); this->addChild(title_bg_l,10); CCSprite *title_bg_r = CCSprite::createWithSpriteFrameName("title_bg_LR.png"); title_bg_r->setFlipX(true); title_bg_r->setAnchorPoint(ccp(1, 0)); title_bg_r->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(s.width/2, -headhgt- 10))); this->addChild(title_bg_r,10); CCPoint upLeft = SGLayout::getPoint(kUpLeft); CCPoint upCenter = SGLayout::getPoint(kUpCenter); CCPoint center = SGLayout::getPoint(kMiddleCenter); CCPoint bottomCenter = SGLayout::getPoint(kBottomCenter); //星形背景 ResourceManager::sharedInstance()->bindTexture("sanguobigpic/barrack_bg.plist", RES_TYPE_LAYER_UI, sg_systemMailContent); CCSprite *spriteBackground = CCSprite::createWithSpriteFrameName("barrack_bg.png"); CCRect r = CCRectMake(0, 30+150+72,spriteBackground->getContentSize().width, SGLayout::getSkewingY(480)-47-150-72-61-101); //spriteBackground->cocos2d::CCNode::setScale(r.size.width / spriteBackground->getContentSize().width, r.size.height / spriteBackground->getContentSize().height); spriteBackground->setTextureRect(r); spriteBackground->setScaleX(s.width/spriteBackground->getContentSize().width * 1.01); spriteBackground->setScaleX(CCDirector::sharedDirector()->getWinSize().width / spriteBackground->getContentSize().width); spriteBackground->setAnchorPoint(ccp(0.5, 1)); spriteBackground->setPosition(ccpAdd(upCenter, ccp(0, -47-150-72))); this->addChild(spriteBackground); //标题 CCSprite *spriteTitle = CCSprite::createWithSpriteFrameName("mail_title_1.png"); spriteTitle->setPosition(ccpAdd(upCenter, ccp(0, -47-150-72/2))); this->addChild(spriteTitle); //返回按钮 //五张图片的尺寸 -47-150-72-56-101-30 // SGButton *buttonBack = SGButton::create("chatbtn.png", "public_font_fanhui.png", this, menu_selector(SGSystemMailContent::buttonClickGoBack),CCPointZero,false,true); SGButton *buttonBack = SGButton::createFromLocal("store_exchangebtnbg.png", str_back, this, menu_selector(SGSystemMailContent::buttonClickGoBack),CCPointZero,FONT_PANGWA,ccWHITE,32); buttonBack->setScale(1.05); buttonBack->setAnchorPoint(ccp(0, 0.5)); buttonBack->setPosition(ccpAdd(upLeft, ccp(0, -47-150-72/2))); addBtn(buttonBack); //收取附件 // buttonReceiveAcc = SGButton::create("public_btn_1.png", "mail_button_accessory.png", this, menu_selector(SGSystemMailContent::buttonClickAccessory),CCPointZero,false,true); ResourceManager::sharedInstance()->bindTexture("sanguobigpic/battle_btn_sbg_n.plist", RES_TYPE_LAYER_UI, sg_systemMailContent); buttonReceiveAcc=SGButton::createFromLocal("battle_btn_sbg_n.png", str_FriendMailLayer_str13, this, menu_selector(SGSystemMailContent::buttonClickAccessory) ,CCPointZero,FONT_BOXINFO,ccWHITE,23); buttonReceiveAcc->setPosition(ccpAdd(bottomCenter, ccp(0, 101+56+20))); addBtn(buttonReceiveAcc); float hight=buttonBack->getPosition().y-buttonReceiveAcc->getPosition().y; float fixHeight=0; float fixHeight2=0; if (s.height==1136) { fixHeight=30; fixHeight2=-15; } float svHigh = skewingY(170/2); int count=m_pSystemMail->getAccessoryArray()->count(); //附件标题 CCString *labelAccessoryStr = CCString::createWithFormat(str_FriendMailLayer_str14,count); labelAccessory = SGCCLabelTTF::create(labelAccessoryStr->getCString(), FONT_BOXINFO, 30 ,ccWHITE); labelAccessory->setAnchorPoint(ccp(0, 0.5)); labelAccessory->setPosition(ccp(50, buttonReceiveAcc->getPositionY()+skewingY(100)+10+fixHeight)); // labelAccessory->setOutSideColor(ccWHITE); //modify by:zyc. merge into create. //labelAccessory->setColor(ccWHITE); addChild(labelAccessory); //scrollview sprite_scrollview_angle = CCScale9Sprite::createWithSpriteFrameName("public_jiao.png"); sprite_scrollview_bg = CCScale9Sprite::createWithSpriteFrameName("server_BlueBG.png"); // sprite_scrollview_angle->setPreferredSize(CCSizeMake(SGLayout::getSkewing(310), svHigh)); // sprite_scrollview_bg->setPreferredSize(CCSizeMake(SGLayout::getSkewing(310), svHigh)); sprite_scrollview_angle->setPosition(ccpAdd(buttonReceiveAcc->getPosition(),ccp(0, sprite_scrollview_angle->getContentSize().height/2+buttonReceiveAcc->getContentSize().height/2+fixHeight))); sprite_scrollview_bg->setPosition(sprite_scrollview_angle->getPosition()); addChild(sprite_scrollview_bg); addChild(sprite_scrollview_angle); showHeadIconlayer=SGShowHeadIconLayer::create(m_pSystemMail->getAccessoryArray(), 4,CCSizeMake(295, 85)); addChild(showHeadIconlayer); showHeadIconlayer->setPosition(ccpAdd(buttonReceiveAcc->getPosition(), ccp(-skewing(160) + 27, sprite_scrollview_bg->getContentSize().height/2-buttonReceiveAcc->getContentSize().height+fixHeight+fixHeight2))); // //删除按钮 // buttonDelete = SGButton::create("friend_redButton.png","friend_delete.png", this, menu_selector(SGSystemMailContent::buttonClickDelete),CCPointZero,false,true); // buttonDelete->setPosition(ccpAdd(bottomCenter, ccp(100, 101+56+40))); // addBtn(buttonDelete); /* scrollview = CCScrollView::create(CCSizeMake(SGLayout::getSkewing(280), svHigh)); CCLayer *container = CCLayer::create(); scrollview->setContainer(container); CCArray *arraySprite = getSpriteByType(); int spriteCount = arraySprite->count(); int width = 54; for(int i=0;i<spriteCount;i++) { CCSprite *sprite = (CCSprite*)arraySprite->objectAtIndex(i); container->addChild(sprite); sprite->setPosition(ccp(width, 50)); width += 108; } //如果width很短,那么我们就把它设成scrollview的宽度 if(width < scrollview->cocos2d::CCNode::getContentSize().width) { width = scrollview->cocos2d::CCNode::getContentSize().width; } scrollview->setContentSize(CCSizeMake(width, svHigh)); container->setContentSize(CCSizeMake(width, svHigh)); scrollview->setDirection(kCCScrollViewDirectionHorizontal); scrollview->setPosition(ccp(SGLayout::getSkewing(20), bottomCenter.y+240)); addChild(scrollview); */ //邮件内容 sprite_content_bg_angle = CCScale9Sprite::createWithSpriteFrameName("public_jiao.png"); sprite_content_bg_angle->setPreferredSize(CCSizeMake(SGLayout::getSkewing(300),hight-SGLayout::getSkewingY(85)-80)); sprite_content_bg_bg = CCScale9Sprite::createWithSpriteFrameName("server_BlueBG.png"); sprite_content_bg_bg->setPreferredSize(CCSizeMake(SGLayout::getSkewing(300), hight-SGLayout::getSkewingY(85)-80)); sprite_content_bg_angle->setAnchorPoint(ccp(0.5, 1)); sprite_content_bg_bg->setAnchorPoint(ccp(0.5, 1)); sprite_content_bg_angle->setPosition(ccpAdd(upCenter, ccp(0, -330))); sprite_content_bg_bg->setPosition(sprite_content_bg_angle->getPosition()); addChild(sprite_content_bg_bg); addChild(sprite_content_bg_angle); sprite_scrollview_angle->setPreferredSize(CCSize(sprite_content_bg_angle->getContentSize().width ,svHigh ) ); sprite_scrollview_bg->setPreferredSize(CCSize( sprite_content_bg_angle->getContentSize().width ,svHigh ) ); //BYMM: 设置内容文本,并提前获得将要显示内容文本的区域。 CCSize cttSize = m_bIsReceived ? CCSizeMake(SGLayout::getSkewing(260), 240) : CCSizeMake(SGLayout::getSkewing(260), 460); labelContent = SGCCLabelTTF::create(m_pSystemMail->getcontent()->getCString(), FONT_BOXINFO, 24, cttSize); //这里原来使用的是测试文字,str_FriendMailLayer_str15。 labelContent->setAnchorPoint(ccp(0.5, 1)); labelContent->setPosition(ccp(center.x, sprite_content_bg_angle->getPosition().y-20)); addChild(labelContent); //-------------------------------------------------------------------------------------------- //发件人 CCScale9Sprite *sprite_reciever_bg = CCScale9Sprite::createWithSpriteFrameName("public_kuang_input.png"); sprite_reciever_bg->setPosition(ccpAdd(upCenter, ccp(0, -47-150-72-30))); sprite_reciever_bg->setPreferredSize(CCSizeMake(SGLayout::getSkewing(290) , 40)); addChild(sprite_reciever_bg); CCSprite *sprite_sender_sender = CCSprite::createWithSpriteFrameName("mail_sender.png"); sprite_sender_sender->setAnchorPoint(ccp(0, 0.5)); sprite_sender_sender->setPosition(ccpAdd(sprite_reciever_bg->getPosition(), ccp(-sprite_reciever_bg->getContentSize().width/2, 0))); addChild(sprite_sender_sender); labelSender = CCLabelTTF::create(str_FriendMailLayer_str11, FONT_BOXINFO, 24); labelSender->setAnchorPoint(ccp(0, 0.5)); labelSender->setPosition(ccpAdd(sprite_sender_sender->getPosition(), ccp(sprite_sender_sender->getContentSize().width*1.5, 0))); labelSender->setColor(ccWHITE); addChild(labelSender); //发件时间 labelSendTime = CCLabelTTF::create(SGTools::getTimeDistanceNow(m_pSystemMail->getSendTime()).c_str(), FONT_BOXINFO, 24); labelSendTime->setAnchorPoint(ccp(0, 0.5)); labelSendTime->setPosition(ccpAdd(sprite_reciever_bg->getPosition(), ccp(100, 0))); labelSendTime->setColor(ccWHITE); addChild(labelSendTime); //发件人 //-------------------------------------------------------------------------------------------- receiveAccessory(); buttonReceiveAcc->setPosition(ccpAdd(buttonReceiveAcc->getPosition(), ccp(0, -5))); }
void SGRankDetailLayer::initView(SGGamePlayerInfo*player,int type) { SGMainScene *mainScene = SGMainManager::shareMain()->getMainScene(); SGMainLayer* mainLayer = (SGMainLayer *)mainScene->getChildByTag(sg_mainLayer); SGMyFriend* myLayer = (SGMyFriend *)mainScene->getChildByTag(sg_myFriend); if(myLayer) { myLayer->tableView->setIsTouchEnabled(false); } mainLayer->setIsCanTouch(false); mainLayer->setPortraitMenuCanTouch(false); SGBaseLayer *layer = (SGBaseLayer *)mainScene->getChildByTag(mainScene->nowLayerTag); if (layer != NULL) { layer->setIsCanTouch(false); } ResourceManager::sharedInstance()->bindTexture("sgchat/sgchat.plist", RES_TYPE_LAYER_UI, sg_box_rankDetailLayer); ResourceManager::sharedInstance()->bindTexture("sgembattlelayer/sgembattlelayer.plist", RES_TYPE_LAYER_UI, sg_box_rankDetailLayer, LIM_PNG_AS_PNG); ResourceManager::sharedInstance()->bindTexture("soldier/soldier3101-1-3303-3.plist" , RES_TYPE_LAYER_UI, sg_box_rankDetailLayer); ResourceManager::sharedInstance()->bindTexture("soldier/soldier3101-3303.plist" , RES_TYPE_LAYER_UI, sg_box_rankDetailLayer); ResourceManager::sharedInstance()->bindTexture("sggeneralinfolayer/ofcNewUi.plist" , RES_TYPE_LAYER_UI, sg_box_rankDetailLayer); ResourceManager::sharedInstance()->bindTexture("sgfirstlayer/sgfirstlayer.plist", RES_TYPE_LAYER_UI, sg_box_rankDetailLayer, LIM_PNG_AS_PNG); ResourceManager::sharedInstance()->bindTexture("headIcon/headCountry.plist", RES_TYPE_LAYER_UI, sg_box_rankDetailLayer); CCSize s=CCDirector::sharedDirector()->getWinSize(); CCPoint center= SGLayout::getPoint(kMiddleCenter); fontbg->setPreferredSize(CCSizeMake(592, 270)); fontbg->setPosition(ccpAdd(center, ccp(0, -90))); // //_player=new SGGamePlayerInfo(); _player=player; _player->retain(); SGButton *ok = SGButton::create("box_btn_newbg.png", "public_font_queding.png", this, menu_selector(SGRankDetailLayer::boxClose), ccp(0, 0), false, true); this->addBtn(ok); ok->setPosition(ccpAdd(SGLayout::getPoint(kMiddleCenter), ccp(0, -270)));////根据框的大小设置位置 ///////////玩家国家头像 SGButton* portrait_bg = SGButton::create("player_portrait.png", CCString::createWithFormat( "countryIconbig_%d.png",_player->getCountry()>0?_player->getCountry():1)->getCString(), this, NULL,ccp(0.5, -6),false,true); // portrait_bg->setAnchorPoint(ccp(0, 0)); float wid = s.width - 115*4 ; portrait_bg->setPosition(ccp(wid/2, 245+center.y)); this->addChild(portrait_bg); //人名 SGCCLabelTTF* nickname = SGCCLabelTTF::create(_player->getNickName()->getCString(),FONT_BOXINFO,FONTSIZE(16) ); nickname->setAnchorPoint(ccp(0, 0.5)); nickname->setPosition(ccpAdd(portrait_bg->getPosition(), ccp(portrait_bg->getContentSize().width*0.7, portrait_bg->getContentSize().height*0.25))); //modify by:zyc. merge into create. //nickname->setColor(ccRED); this->addChild(nickname); ///等级 SGCCLabelTTF* levellabel = SGCCLabelTTF::create(CCString::create("Lv")->getCString(),FONT_PANGWA,FONTSIZE(12) , ccc3(0xff, 0xc0, 0x00)); //modify by:zyc. merge into create. //levellabel->setColor(ccc3(0xff, 0xc0, 0x00)); levellabel->setAnchorPoint(ccp(0, 0.5)); levellabel->setPosition(ccpAdd(nickname->getPosition(), ccp(0, -nickname->getContentSize().height*1.1))); this->addChild(levellabel); ///等级数值 SGCCLabelTTF* levelnum = SGCCLabelTTF::create(CCString::createWithFormat("%d", _player->getLevel())->getCString(),FONT_PANGWA,FONTSIZE(12)); levelnum->setAnchorPoint(ccp(0, 0.5)); levelnum->setPosition(ccpAdd(levellabel->getPosition(), ccp(levellabel->getContentSize().height*1.5, 0))); this->addChild(levelnum); //军衔 SGCCLabelTTF* junxian = SGCCLabelTTF::create( _player->getpvpRankName()->getCString(),FONT_PANGWA,FONTSIZE(12)); junxian->setAnchorPoint(ccp(0, 0.5)); junxian->setPosition(ccpAdd(levellabel->getPosition(), ccp(150, -0))); this->addChild(junxian); //战斗力 SGCCLabelTTF* zhandouli = SGCCLabelTTF::create(CCString::create(str_EmbattleLayer_str4)->getCString(),FONT_PANGWA,FONTSIZE(12) , ccc3(0xff, 0xc0, 0x00)); zhandouli->setAnchorPoint(ccp(0, 0.5)); zhandouli->setPosition(ccpAdd(levellabel->getPosition(), ccp(0, -levellabel->getContentSize().height*1.1))); //modify by:zyc. merge into create. //zhandouli->setColor(ccc3(0xff, 0xc0, 0x00)); this->addChild(zhandouli); ///战斗力数值 SGCCLabelTTF* num = SGCCLabelTTF::create(CCString::createWithFormat("%d", _player->getCombatValue())->getCString(),FONT_PANGWA,FONTSIZE(12)); num->setAnchorPoint(ccp(0, 0.5)); num->setPosition(ccpAdd(zhandouli->getPosition(), ccp(zhandouli->getContentSize().width*1.2,0 ))); this->addChild(num); const char aa[][100]={str_wujiang,str_soldiers,str_MainTaskLayer_str9,str_other}; for (int j=0;j<4;++j) { SGButton *btn = SGButton::createFromLocal("store_exchangebtnbg.png", aa[j], this, menu_selector(SGRankDetailLayer::showinfo),CCPointZero,FONT_PANGWA,ccWHITE,25); btn->setPosition(ccp(0+btn->getContentSize().width*j, center.y+100)); float tt= s.width-( btn->getContentSize().width*4.8); btn->setPosition(ccp(btn->getContentSize().width*j*1.26+tt*0.5, center.y+110)); btn->setAnchorPoint(ccp(0, 1)); btn->setTag(j+100);//防止和下面tag重了 addBtn(btn); if( type==0 ) { if(j==0) { btn->setEnabled(false); } else { btn->setEnabled(false); btn->setImage("barrack_anniu_hui.png"); } // btn->setFontColor(ccc3(70, 70, 70)); } } ///////////////////////////////////////////////////////////////////////////////////////////////////武将 tag为0到10系列 officedarray=CCArray::create(); officedarray= _player->getOfficerCardItemArray(); officedarray->retain(); soldierarray=CCArray::create(); soldierarray= _player->getembattlesoldierArray(); soldierarray->retain(); int maxnum=-10; _player->getePVPOfficerArray()->count(); if(type==0) { maxnum=_player->getePVPOfficerArray()->count()-1; } else { maxnum=officedarray->count()-1; } int lordid=_player->getLordid(); SGPlayerDataModel *playerdata = SGStaticDataManager::shareStatic()->getPlayerByLevel(_player->getLevel()); int embattlemax=playerdata->getPlayerOfficerMax(); for(int i=0;i<10;++i) { SGButton*btn; if(i<=maxnum) { SGOfficerCard *card=NULL; SGOfficerDataModel* obj ; pvpInfo*info = NULL; if(type==0) ///////跨服的 { info = (pvpInfo*)_player->getePVPOfficerArray()->objectAtIndex(i); obj = SGStaticDataManager::shareStatic()->getOfficerById(info->getitmeId()); } else ///////本服的 { card = (SGOfficerCard*)_player->getOfficerCardItemArray()->objectAtIndex(i); obj = SGStaticDataManager::shareStatic()->getOfficerById(card->getItemId()); } int starlvl =obj->getOfficerCurrStarLevel(); if(starlvl==1||starlvl==2) { starlvl=1; } else { starlvl=starlvl-1; } ///////////////////////// CCString*headicon=CCString::createWithFormat("head%d.png",obj->getIconId()); CCString*kuang=CCString::createWithFormat("officerPinzhi_%d_0.png",starlvl); CCString*country= CCString::createWithFormat("countryName%d.png",obj->getOfficerRace()); SGMainManager::shareMain()->addHeadIconPlistByNum(obj->getIconId(),sg_rank); btn=SGButton::create(headicon->getCString(), kuang->getCString(), this, menu_selector(SGRankDetailLayer::showgeneralinfo), ccp(0, 0), false, true); CCSprite*coun=CCSprite::createWithSpriteFrameName(country->getCString()); coun->setPosition(ccp(12, btn->getContentSize().height*0.85)); btn->addChild(coun); addBtn(btn); /////////////////武将等级 if(type==0) ///////跨服的 { //MMDEBUG:: IMPROVE 貌似需要显示武将等级,但是card解析不出来武将,暂时用pvpinfo代替。 SGCCLabelTTF* levellabel = SGCCLabelTTF::create(CCString::createWithFormat("Lv%d", info->getlevel())->getCString(),FONT_PANGWA,FONTSIZE(12)); levellabel->setPosition(ccp(btn->getContentSize().width*0.5, levellabel->getContentSize().height*0.5)); btn->addChild(levellabel); } else ///////本服的 { SGCCLabelTTF* levellabel = SGCCLabelTTF::create(CCString::createWithFormat("Lv%d", card->getCurrLevel())->getCString(),FONT_PANGWA,FONTSIZE(12)); levellabel->setPosition(ccp(btn->getContentSize().width*0.5, levellabel->getContentSize().height*0.5)); btn->addChild(levellabel); ///////////////转生次数 if(card->getAdNum()>0) { SGCCLabelTTF *advancenumber = SGCCLabelTTF::create(CCString::createWithFormat("+%d",card->getAdNum())->getCString(), FONT_PANGWA, 24); advancenumber->setInsideColor(ccGREEN); advancenumber->setAnchorPoint(ccp(1, 1)); advancenumber->setPosition(ccp(btn->getContentSize().width, btn->getContentSize().height)); btn->addChild(advancenumber); } //////////////////////////////////////////// if(lordid==card->getSsid())/////主将图片组合体 { CCSprite *lord = CCSprite::createWithSpriteFrameName("font_zj_bg.png"); lord->setPosition(ccp(btn->getContentSize().width*0.5, lord->getContentSize().height*0.5)); btn->addChild(lord); CCSprite *font = CCSprite::createWithSpriteFrameName("font_zj.png"); font->setPosition(ccp(btn->getContentSize().width*0.5, font->getContentSize().height*0.5)); btn->addChild(font); } } } else if(i<embattlemax) { btn=SGButton::create("embattle_huilan.png", "embattle_font_kong.png", this, NULL, ccp(0, 0), false, true); btn->setEnabled(false); addBtn(btn); } else { CCString *num = CCString::createWithFormat("embattle_num%d.png",i+1); btn=SGButton::create("embattle_lan.png", num->getCString(), this, NULL, ccp(0, 0), false, true); CCSprite *suo = CCSprite::createWithSpriteFrameName(CCString::create("embattle_suo.png")->getCString()); suo->setAnchorPoint(ccp(1, 1)); suo->setPosition(ccp(btn->getContentSize().width, btn->getContentSize().height)); btn->addChild(suo); addBtn(btn); } btn->setPosition(ccpAdd(ccp(0, SGLayout::getPoint(kMiddleCenter).y-215),(ccp(wid/2 + (i%5) *115,-(i/5)*115 + 187)))); btn->setTag(i); } /////////////////////////////////////////////////////////////////////////////////////////////////////士兵 tag为10系列 int redId=_player->getRedSoldierId(); int greenId=_player->getGreenSoldierId(); int blueId=_player->getBlueSoldierId(); int soldier[]={redId,greenId,blueId}; int color[]={3,1,2}; if(type==0) { } //else if (0)//此处只能看武将,不允许看小兵。 else { for (int i = 0; i< 3; i++) { CCSprite*jingkuang=CCSprite::createWithSpriteFrameName("equipPinzhi_1_0.png"); CCString*icon=CCString::createWithFormat("%d-%d.png",soldier[i],color[i]); CCString*kuang=CCString::create("equipPinzhi_1_0.png"); SGButton*soldierbtn=SGButton::create(icon->getCString(), kuang->getCString(), this, menu_selector(SGRankDetailLayer::showSoldierinfo),CCPointZero,false,true); soldierbtn->setPosition(ccp(s.width/2 +15 +(i-1)*(jingkuang->getContentSize().width + 60) ,center.y-70)); soldierbtn->setTag(10+i); // soldierbtn->setZOrder(soldier[i]); addBtn(soldierbtn); ////////////士兵等级 SGSoldierCard*card=(SGSoldierCard*)soldierarray->objectAtIndex(i); SGCCLabelTTF* levellabel = SGCCLabelTTF::create(CCString::createWithFormat("Lv%d", card->getCurrLevel())->getCString(),FONT_PANGWA,FONTSIZE(12)); levellabel->setAnchorPoint(ccp(0.5, 0.5)); levellabel->setPosition(ccp(soldierbtn->getContentSize().width*0.5, levellabel->getContentSize().height*0.35)); soldierbtn->addChild(levellabel); SGSoldierDataModel* soldierData = SGStaticDataManager::shareStatic()->getSoliderById(soldier[i]); if (soldierData) { SGCCLabelTTF * soldierName = SGCCLabelTTF::create(soldierData->getSoldierName()->getCString(), FONT_PANGWA,FONTSIZE(12)); soldierName->setPosition(ccp(soldierbtn->getContentSize().width/2, -soldierbtn->getContentSize().height*0.3)); soldierbtn->addChild(soldierName); } } } ///////////////////////////////////////////////////////////////////////////////////////////////////属性 tag为20系列 ////统御力 if(type==0) { } else { SGCCLabelTTF* tongyuli = SGCCLabelTTF::create(CCString::createWithFormat(str_MainTaskLayer_str10, _player->getGoverning(),_player->getGoverningLimit() )->getCString(),FONT_BOXINFO,FONTSIZE(14)); tongyuli->setAnchorPoint(ccp(0, 0.5)); tongyuli->setPosition(ccpAdd(portrait_bg->getPosition(), ccp(-portrait_bg->getContentSize().width*0.0,-portrait_bg->getContentSize().height*1.8))); // shengwang->setColor(ccBLACK); this->addChild(tongyuli); tongyuli->setTag(21); ///总血量 SGCCLabelTTF* blood = SGCCLabelTTF::create(CCString::createWithFormat(str_MainTaskLayer_str11, _player->getHp())->getCString(),FONT_BOXINFO,FONTSIZE(14)); blood->setAnchorPoint(ccp(0, 0.5)); blood->setPosition(ccpAdd(tongyuli->getPosition(), ccp(0,-tongyuli->getContentSize().height*1.5 ))); // zhanji->setColor(ccBLACK); this->addChild(blood); blood->setTag(22); ///总速度 SGCCLabelTTF* speed = SGCCLabelTTF::create(CCString::createWithFormat(str_MainTaskLayer_str12, _player->getSpeed())->getCString(),FONT_BOXINFO,FONTSIZE(14)); speed->setAnchorPoint(ccp(0, 0.5)); speed->setPosition(ccpAdd(blood->getPosition(), ccp(0,-blood->getContentSize().height*1.5))); // sheng->setColor(ccBLACK); this->addChild(speed); speed->setTag(23); ///国家 countrymm=_player->getCountry(); CCString*string; if (_player->getCountry() == 1) { string=CCString::create(str_MainTaskLayer_str13); } if (_player->getCountry() == 2) { string=CCString::create(str_MainTaskLayer_str14); } if (_player->getCountry() == 3) { string=CCString::create(str_MainTaskLayer_str15); } SGCCLabelTTF* country = SGCCLabelTTF::create(string->getCString(),FONT_BOXINFO,FONTSIZE(14)); country->setAnchorPoint(ccp(0, 0.5)); country->setPosition(ccpAdd(speed->getPosition(), ccp(0,-speed->getContentSize().height*1.5 ))); // rank->setColor(ccBLACK); this->addChild(country); country->setTag(24); //2014-10-29 zyc modify. 禁用该功能。 // SGButton *counbtn = SGButton::createFromLocal("ofc_moreinfo.png", NULL, this, menu_selector(SGRankDetailLayer::showcountryinfo),CCPointZero,FONT_PANGWA,ccWHITE,25); // counbtn->setVisible(false); // counbtn->setAnchorPoint(ccp(0, 0.5)); // counbtn->setPosition(ccpAdd(country->getPosition(), ccp(country->getContentSize().width+20, 0))); // addBtn(counbtn); // counbtn->setTag(25); } ////////////////////////////////////////////////////////////////////////////////////////////其他 tag为30系列 ////天梯声望 if(type==0) { } else { SGCCLabelTTF* shengwang = SGCCLabelTTF::create(CCString::createWithFormat(str_MainTaskLayer_str16,_player->getpresTige())->getCString(),FONT_BOXINFO,FONTSIZE(14)); shengwang->setAnchorPoint(ccp(0, 0.5)); shengwang->setPosition(ccpAdd(portrait_bg->getPosition(), ccp(-portrait_bg->getContentSize().width*0.0,-portrait_bg->getContentSize().height*1.8))); // shengwang->setColor(ccBLACK); this->addChild(shengwang); shengwang->setTag(31); ///天梯战绩 SGCCLabelTTF* zhanji = SGCCLabelTTF::create(CCString::createWithFormat(str_MainTaskLayer_str17, _player->getpvpWinCount(),_player->getenterPVPCount()-_player->getpvpWinCount())->getCString(),FONT_BOXINFO,FONTSIZE(14)); zhanji->setAnchorPoint(ccp(0, 0.5)); zhanji->setPosition(ccpAdd(shengwang->getPosition(), ccp(0,-shengwang->getContentSize().height*1.5 ))); // zhanji->setColor(ccBLACK); this->addChild(zhanji); zhanji->setTag(32); ///天梯胜率 CCString*str; if(_player->getpvpWinCount()==0) str= CCString::create(str_MainTaskLayer_str20); else str= CCString::createWithFormat(str_MainTaskLayer_str21,100*_player->getpvpWinCount()/(float)_player->getenterPVPCount()); SGCCLabelTTF* sheng = SGCCLabelTTF::create(str->getCString(),FONT_BOXINFO,FONTSIZE(14)); sheng->setAnchorPoint(ccp(0, 0.5)); sheng->setPosition(ccpAdd(zhanji->getPosition(), ccp(0,-zhanji->getContentSize().height*1.5))); // sheng->setColor(ccBLACK); this->addChild(sheng); sheng->setTag(33); ///天梯排名 SGPlayerInfo* playInfo = SGPlayerInfo::sharePlayerInfo(); CCString*f**k; // CCLOG("%d",_player->getpvpTop()); if(_player->getpvpTop()<=0) { f**k=CCString::create(str_MainTaskLayer_str18); } else { f**k=CCString::createWithFormat(str_MainTaskLayer_str19, _player->getpvpTop()); } SGCCLabelTTF* rank = SGCCLabelTTF::create(f**k->getCString(),FONT_BOXINFO,FONTSIZE(14)); rank->setAnchorPoint(ccp(0, 0.5)); rank->setPosition(ccpAdd(sheng->getPosition(), ccp(0,-sheng->getContentSize().height*1.5 ))); // rank->setColor(ccBLACK); this->addChild(rank); rank->setTag(34); } if(type==0) { } else { setCanSee(0); setCanNotSee(1); setCanNotSee(2); setCanNotSee(3); } }
void SGBattleFieldItem::initItem() { const char *fontName = FONT_BOXINFO; CCMenu *menu=CCMenu::create(); menu->setPosition(CCPointZero); this->addChild(menu); SGButton *backBtn = SGButton::create("mainBtnZhan_bg.png", NULL, this, menu_selector(SGBattleFieldItem::entrySectionHandler), ccp(0, 0), false, true); backBtn->setAnchorPoint(ccp(0.5, 0.5f)); backBtn->setPosition(ccp(bgSize.width/2-20-backBtn->getContentSize().width/2, 0)); SGButton *bigBGBtn = SGButton::create("upwar_cell_bg.png", NULL, this, menu_selector(SGBattleFieldItem::showSectionInfoHandler), ccp(0, 0), false, true); bigBGBtn->setAnchorPoint(ccp(0.5,0.5)); bigBGBtn->setPosition(CCPointZero); if (data->getBattleFieldType() == 2 && SGPlayerInfo::sharePlayerInfo()->getPvpWinPvp() < SGPlayerInfo::sharePlayerInfo()->getWinPvp()) { CCSprite *lock = CCSprite::createWithSpriteFrameName("card_suo.png"); lock->setScale(1.2f); float cellW = bigBGBtn->getContentSize().width; lock->setPosition(ccpAdd(bigBGBtn->getPosition(), ccp(-cellW/2+35, 0))); this->addChild(lock); } if (data->getBattleFieldType() == 1 && SGPlayerInfo::sharePlayerInfo()->getPvpWinPvp() > SGPlayerInfo::sharePlayerInfo()->getWinPvp()) { CCSprite *lock = CCSprite::createWithSpriteFrameName("card_suo.png"); lock->setScale(1.2f); float cellW = bigBGBtn->getContentSize().width; lock->setPosition(ccpAdd(bigBGBtn->getPosition(), ccp(-cellW/2+35, 0))); // lock->setVisible(false); this->addChild(lock); } SGCCLabelTTF *nameLabel = SGCCLabelTTF::create(data->getBattleFieldName()->getCString(), fontName, 36 , ccYELLOW); //modify by:zyc. merge into create. //nameLabel->setColor(ccYELLOW); nameLabel->setPosition(ccp(-50, 0)); nameLabel->setAnchorPoint(ccp(0.5, 0.5)); this->addChild(bigBGBtn,-5); addBtn(bigBGBtn); menu->addChild(backBtn); this->addChild(nameLabel); }
inline Combo(const std::initializer_list<KKey>& mKeys, const std::initializer_list<MBtn>& mBtns = {}) { for(const auto& k : mKeys) addKey(k); for(const auto& b : mBtns) addBtn(b); }
void SGMail::viewDidLoad() { //界面布局 CCPoint upLeft = SGLayout::getPoint(kUpLeft); CCPoint upCenter = SGLayout::getPoint(kUpCenter); CCSize s=CCDirector::sharedDirector()->getWinSize(); float h = SGMainManager::shareMain()->getTotleHdHgt(); //星形背景 ResourceManager::sharedInstance()->bindTexture("sanguobigpic/barrack_bg.plist", RES_TYPE_LAYER_UI, sg_mailLayer); CCSprite *spriteBackground = CCSprite::createWithSpriteFrameName("barrack_bg.png"); CCRect r = CCRectMake(0, 30+150+72, spriteBackground->getContentSize().width, SGLayout::getSkewingY(480)-47-150-72-61-101); //spriteBackground->setScaleY(r.size.height / spriteBackground->getContentSize().height); spriteBackground->setTextureRect(r); spriteBackground->setScaleX(s.width/spriteBackground->getContentSize().width * 1.01); spriteBackground->setAnchorPoint(ccp(0.5, 1)); spriteBackground->setPosition(ccpAdd(upCenter, ccp(0, -47-150-72))); this->addChild(spriteBackground); spriteBackground->setVisible(false); CCSprite *title_bg = CCSprite::createWithSpriteFrameName("title_bg.png"); title_bg->setAnchorPoint(ccp(0.5, 1)); title_bg->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(0, -h + title_bg->getContentSize().height-2))); this->addChild(title_bg,-1); //标题 SGCCLabelTTF *spriteTitle = SGCCLabelTTF::create(str_SystemMailLayer_str4, FONT_XINGKAI, 36 , COLOR_UNKNOW_TAN); //modify by:zyc. merge into create. //spriteTitle->setColor(ccc3(0xff, 0x95, 0x0c)); // spriteTitle->setPosition(ccpAdd(upCenter, ccp(0, -s.height*0.23))); spriteTitle->setPosition(ccpAdd(upCenter, ccp(0, -h+65/2))); this->addChild(spriteTitle); //五张图片的尺寸 -47-150-72-56-101 // SGButton *buttonBack = SGButton::create("chatbtn.png", "public_font_fanhui.png", this, menu_selector(SGMail::buttonClickGoBack),CCPointZero,false,true); SGButton *buttonBack = SGButton::createFromLocal("store_exchangebtnbg.png", str_back, this, menu_selector(SGMail::buttonClickGoBack),CCPointZero,FONT_PANGWA,ccWHITE,32); buttonBack->setScale(1.05); buttonBack->setAnchorPoint(ccp(0, 0.5)); buttonBack->setPosition(ccpAdd(upLeft, ccp(0, -h+65/2))); addBtn(buttonBack); float headhgt = SGMainManager::shareMain()->getTotleHdHgt(); float btmhgt = SGMainManager::shareMain()->getBottomHeight(); //tableview // this->tableView->setFrame(CCRectMake(0,101+61, SGLayout::getSkewing(320), SGLayout::getSkewingY(480)-47-150-72-63-101)); tableView->setFrame(CCRectMake(0, 0, s.width, s.height - headhgt - btmhgt)); tableView->setPosition(ccpAdd(SGLayout::getPoint(kUpLeft), ccp(0, -tableView->getContentSize().height - headhgt))); this->tableView->setZOrder(999); this->tableViewHeight = 110; tableView->setDown(-25); tableView -> setPageNEnable(true); // float headhgt = SGMainManager::shareMain()->getTotleHdHgt(); CCSprite *titlecenter = CCSprite::createWithSpriteFrameName("title_bg_2.png"); titlecenter->setAnchorPoint(ccp(0.5, 0)); titlecenter->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(0, -headhgt- 10))); this->addChild(titlecenter,10); titlecenter->setScaleX(4); CCSprite *title_bg_l = CCSprite::createWithSpriteFrameName("title_bg_LR.png"); title_bg_l->setAnchorPoint(ccp(0, 0)); title_bg_l->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(-s.width/2, -headhgt- 10))); this->addChild(title_bg_l,10); CCSprite *title_bg_r = CCSprite::createWithSpriteFrameName("title_bg_LR.png"); title_bg_r->setFlipX(true); title_bg_r->setAnchorPoint(ccp(1, 0)); title_bg_r->setPosition(ccpAdd(SGLayout::getPoint(kUpCenter), ccp(s.width/2, -headhgt- 10))); this->addChild(title_bg_r,10); }
bool SGSkillItem::initWithSize() { if (!SNSTableViewCellItem::init()) { return false; } arrayStar = CCArray::create(); arrayStar->retain(); SGButton*item=SGButton::create("item_smallbg.png", NULL, this, menu_selector(SGSkillItem::buttonClick),CCPointZero,false,true); spritePlayerHead = CCSprite::createWithSpriteFrameName("jinkuang.png"); item->setPosition(ccpAdd(item->getPosition(), ccp(47, 0))); this->addChild(item); addBtn(item); addChild(spritePlayerHead); spritePlayerHead->setPosition(ccpAdd(item->getPosition(), ccp(- item->getContentSize().width/2 - 47, 2))); CCSprite* spriteIsUseBG = CCSprite::createWithSpriteFrameName("carditem_infobg.png"); spriteIsUseBG->setPosition(ccpAdd(item->getPosition(), ccp(item->getContentSize().width*.3 - 15,-15))); this->addChild(spriteIsUseBG,1); CCSprite*kuang = CCSprite::createWithSpriteFrameName("jinengkuang.png"); this->addChild(kuang,1); kuang->setPosition(spritePlayerHead->getPosition()); CCSprite *background = CCSprite::createWithSpriteFrameName("card_bj.png"); this->addChild(background,-1); background->setPosition(spritePlayerHead->getPosition()); CCSprite *namebg = CCSprite::createWithSpriteFrameName("name_bg.png"); this->addChild(namebg); namebg->setPosition(ccpAdd(spritePlayerHead->getPosition(), ccp(spritePlayerHead->getContentSize().width*.5f +namebg->getContentSize().width*.5f, 22))); labelName = SGCCLabelTTF::create("", FONT_BOXINFO, 20); labelName->setAnchorPoint(ccp(0, 0.5)); labelName->setPosition(ccpAdd(spriteIsUseBG->getPosition(), ccp(-73, 0))); this->addChild(labelName,2); labelLevel = SGCCLabelTTF::create("", FONT_BOXINFO, 20); this->addChild(labelLevel,2); labelLevel->setAnchorPoint(ccp(0, 0.5f)); labelLevel->setPosition(ccpAdd(spriteIsUseBG->getPosition(), ccp(15,0))); lab_skill = SGCCLabelTTF::create("", FONT_BOXINFO, 26 , COLOR_RED); lab_skill->setAnchorPoint(ccp(0, 0.5f)); lab_skill->setPosition(ccpAdd(namebg->getPosition(), ccp(-73, 0))); this->addChild(lab_skill); //modify by:zyc. merge into create. //lab_skill->setColor(COLOR_RED); lab_skillLvl = SGCCLabelTTF::create("", FONT_PANGWA, 24); lab_skillLvl->setPosition(ccpAdd(spritePlayerHead->getPosition(), ccp(0,-35))); this->addChild(lab_skillLvl); return true; }
void SGBossBattleRankListLayer::selfRank(int value ,int ranking) { CCSprite*sp=(CCSprite*) getChildByTag(100001); SGPlayerInfo *playerInfo = SGPlayerInfo::sharePlayerInfo(); CCSize size = CCDirector::sharedDirector()->getWinSize(); ResourceManager::sharedInstance()->bindTexture("headIcon/headCountry.plist", RES_TYPE_LAYER_UI, sg_sjzrank); CCSprite*icon=CCSprite::createWithSpriteFrameName(CCString::createWithFormat( "countryIcon_%d.png",playerInfo->getPlayerCountry())->getCString()); this->addChild(icon,2); icon->setPosition(ccpAdd(sp->getPosition(), ccp(icon->getContentSize().width*1.1,sp->getContentSize().height*0.5))); //spr->setPosition(ccpAdd(sp->getPosition(), ccp(itemHeadPic->getContentSize().width*1.0,-sp->getContentSize().height*0.5))); CCSprite*kuang=CCSprite::createWithSpriteFrameName(CCString::createWithFormat( "country_%d.png",playerInfo->getPlayerCountry())->getCString()); kuang->setPosition(ccpAdd(icon->getPosition(), ccp(-2, -5)) ); this->addChild(kuang,2); SGButton *btn = SGButton::createFromLocal("unhot.png", str_BossBattleRankListLayer_str4, this, menu_selector(SGMainLayer::onEmbattleBtnClicked),CCPointZero,FONT_BOXINFO,ccWHITE,32); // SGButton *btn = SGButton::createFromLocal("unhot.png", str_BossBattleRankListLayer_str4, this, menu_selector(SGFirstLayer::gotoEmbattleLayer),CCPointZero,FONT_BOXINFO,ccWHITE,32); btn->setAnchorPoint(ccp(1, 0.5)); btn->setPosition(ccp(size.width*0.95, kuang->getPositionY()-kuang->getContentSize().height*0.2)); btn->setFontColor(ccc3(0xf3,0x89,00)); addBtn(btn); name = SGCCLabelTTF::create(playerInfo->getNickName()->getCString(), FONT_BOXINFO, 32); name->setPosition(ccpAdd(kuang->getPosition(), ccp(kuang->getContentSize().width*0.7, kuang->getContentSize().height*0.3))); name->setAnchorPoint(ccp(0, 0.5)); this->addChild(name,20); rank = SGCCLabelTTF::create(CCString::createWithFormat(str_BossBattleRankListLayer_str5, SGPlayerInfo::sharePlayerInfo()->getPlayerLevel())->getCString(), FONT_BOXINFO, 32 , ccc3(0xff, 0xc0, 0x00)); rank->setAnchorPoint(ccp(1, 0.5)); rank->setPosition(ccpAdd(name->getPosition(), ccp(name->getContentSize().width + rank->getContentSize().width * 1.5, rank->getContentSize().height / 2))); this->addChild(rank,20); //modify by:zyc. merge into create. //rank->setColor(ccc3(0xff, 0xc0, 0x00)); CCString *ranktypestring=CCString::create(str_BossBattleRankListLayer_str6); shengwang = SGCCLabelTTF::create(ranktypestring->getCString(), FONT_BOXINFO, 32); shengwang->setPosition(ccpAdd(name->getPosition(), ccp(kuang->getContentSize().width*0.0, -kuang->getContentSize().height*0.5))); this->addChild(shengwang,20); shengwang->setAnchorPoint(ccp(0, 0.5)); CCString*mmm; if(ranking==0) { mmm= CCString::create(str_BossBattleRankListLayer_str7); } else if (ranking>0) { mmm=CCString::createWithFormat("%d",selfDamage); } else { mmm=CCString::create(str_BossBattleRankListLayer_str7); } ranklabel = SGCCLabelTTF::create(mmm->getCString(), FONT_BOXINFO, 32); ranklabel->setAnchorPoint(ccp(0, 0.5)); ranklabel->setPosition(ccpAdd(shengwang->getPosition(), ccp(shengwang->getContentSize().width+10, 0))); this->addChild(ranklabel,20); }