LabelBMFontChinese::LabelBMFontChinese() { CCSize size = CCDirector::sharedDirector()->getWinSize(); CCLabelBMFont* pLable = CCLabelBMFont::labelWithString("abc中国中国efghi中国中国JKLMn中国", "fonts/bitmapFontChinese.fnt", CCTextAlignmentRight, 300); pLable->setLineBreakWithoutSpace(true); pLable->setPosition(ccp(size.width / 2, size.height /2)); this->addChild(pLable); }
FMUIWorldMap::FMUIWorldMap() : m_parentNode(NULL), // m_rewardParent(NULL), m_giftButton(NULL), m_facebookButton(NULL), m_rewardAnim(NULL), m_isShown(false), m_isExpand(false), m_isBonusExpand(false), m_wxNode(NULL), m_dailyAnim(NULL), m_friendsAnim(NULL), m_inviteAnim(NULL), m_hasNewQuest(false), m_bookBtn(NULL), m_spinTimesLabel(NULL), m_spinButton(NULL), m_unlimitLifeAnim(NULL), m_iapGoldBonusAni(NULL), m_starRewardAni(NULL), m_bonusNode(NULL) { m_ccbNode = FMDataManager::sharedManager()->createNode("UI/FMUIWorldMap.ccbi", this); addChild(m_ccbNode); CCBAnimationManager * manager = (CCBAnimationManager *)m_ccbNode->getUserObject(); manager->setDelegate(this); // NEAnimNode * facebook = NEAnimNode::createNodeFromFile("FMUIButtonList.ani"); // m_rewardParent->addChild(facebook, 1, 1); //init button list #ifdef BRANCH_CN // CCControlButton * arrowButton = CCControlButton::create(CCScale9Sprite::create("transparent.png")); // arrowButton->setPreferredSize(CCSize(40, 21)); // arrowButton->setAnchorPoint(CCPointZero); // arrowButton->addTargetWithActionForControlEvents(this, cccontrol_selector(FMUIWorldMap::clickMenuButton), CCControlEventTouchUpInside); // // p = facebook->getNodeByName("ButtonArrow"); // p->addChild(arrowButton, 0, 1); // // CCControlButton * button1 = CCControlButton::create(CCScale9Sprite::create("transparent.png")); // button1->setPreferredSize(CCSize(37, 37)); // button1->setAnchorPoint(CCPointZero); // button1->addTargetWithActionForControlEvents(this, cccontrol_selector(FMUIWorldMap::clickMenuButton), CCControlEventTouchDown); // // p = facebook->getNodeByName("Button1"); // p->addChild(button1, 0, 3); // // CCControlButton * button2 = CCControlButton::create(CCScale9Sprite::create("transparent.png")); // button2->setPreferredSize(CCSize(37, 37)); // button2->setAnchorPoint(CCPointZero); // button2->addTargetWithActionForControlEvents(this, cccontrol_selector(FMUIWorldMap::clickMenuButton), CCControlEventTouchDown); // // p = facebook->getNodeByName("Button2"); // p->addChild(button2, 0, 4); CCLabelBMFont* label = (CCLabelBMFont*)m_friendsAnim->getNodeByName("Label"); label->setWidth(m_widthForThreeCN); label->setAlignment(kCCTextAlignmentCenter); label->setLineBreakWithoutSpace(FMDataManager::sharedManager()->isCharacterType()); label = (CCLabelBMFont*)m_rewardAnim->getNodeByName("Label"); label->setWidth(m_widthForTwoCN); label->setAlignment(kCCTextAlignmentCenter); label->setLineBreakWithoutSpace(FMDataManager::sharedManager()->isCharacterType()); #ifdef BRANCH_CN m_rewardAnim->setVisible(!FMDataManager::sharedManager()->hasPurchasedUnlimitLife()); #endif label = (CCLabelBMFont*)m_dailyAnim->getNodeByName("Label"); label->setWidth(m_widthForTwoCN); label->setAlignment(kCCTextAlignmentCenter); label->setLineBreakWithoutSpace(FMDataManager::sharedManager()->isCharacterType()); label = (CCLabelBMFont*)m_inviteAnim->getNodeByName("Label"); label->setWidth(m_widthForTwoCN); label->setAlignment(kCCTextAlignmentCenter); label->setLineBreakWithoutSpace(FMDataManager::sharedManager()->isCharacterType()); #endif CCSprite * tbg = CCSprite::createWithSpriteFrameName("UnreadMessage.png"); tbg->setAnchorPoint(ccp(1, 1)); tbg->setPosition(ccp(m_spinButton->getContentSize().width, m_spinButton->getContentSize().height)); tbg->setScale(1.2f); m_spinButton->addChild(tbg); m_spinTimesLabel = CCLabelBMFont::create("", "font_7.fnt", 50, kCCTextAlignmentCenter); tbg->addChild(m_spinTimesLabel); m_spinTimesLabel->setPosition(ccp(tbg->getContentSize().width/2 - 0.5f , tbg->getContentSize().height/2 - 0.5f )); scheduleUpdate(); }