void LeaderBoardtNode::addItemToSlide(const int& iScore, const char* sName, const char* sFacebookId, const int& iRank, const int& iIndex) { Node* pNodeItem = Node::create(); Sprite* pLoadAvatar = Sprite::create("Target-End-Game/border_avatar.png"); pLoadAvatar->setPosition(Point(50.0f, 95.0f)); pNodeItem->addChild(pLoadAvatar); std::string urlAvatar = "https://graph.facebook.com/"; urlAvatar.append(sFacebookId); urlAvatar.append("/picture"); LoadingImagetNode* avatar = LoadingImagetNode::createLayout(urlAvatar.c_str()); avatar->setPosition(Point(50.0f, 95.0f)); pNodeItem->addChild(avatar); LabelBMFont *pLabelScore = LabelBMFont::create(formatNumber(iScore).getCString(), "fonts/font_small_alert.fnt"); pLabelScore->setAnchorPoint(Point(0.0f, 0.5f)); pLabelScore->setPosition(Point(57.0f, 8.0f)); pLabelScore->setScale(0.8); pNodeItem->addChild(pLabelScore); LabelTTF *pLabelName = LabelTTF::create(sName, "Arial", 20.0f); pLabelName->setColor(ccc3(0.0f, 0.0f, 0.0f)); //pLabelName->setScale(0.85f); pLabelName->setAnchorPoint(Point(0.0f, 0.5f)); pLabelName->setPosition(Point(57.0f, 45.0f)); pNodeItem->addChild(pLabelName); char sRank[10]; sprintf(sRank, "%d", iRank); LabelBMFont *pLabelRank = LabelBMFont::create(sRank, "fonts/font-bechic.fnt"); pLabelRank->setAnchorPoint(Point(0.0f, 0.5f)); pLabelRank->setPosition(Point(25.0f, 23.0f)); pNodeItem->addChild(pLabelRank); Sprite* pLineImage = Sprite::create("Target-End-Game/line.png"); pLineImage->setPosition(Point(160.0f, 55.0f)); pNodeItem->addChild(pLineImage); pNodeItem->setContentSize(Size(160.0f, 160.0f)); pNodeItem->setPosition(Point(-320.0f + iIndex*160, -100.0f)); pNodeItem->setTag(iIndex); m_pSlideShow->addChild(pNodeItem); Sprite* pIconAskLife = Sprite::create("Target-End-Game/btn_ask_life.png"); ButtonNode* pButtonAskLife = ButtonNode::createButtonSprite(pIconAskLife, CC_CALLBACK_1(LeaderBoardtNode::clickAskLife, this)); pButtonAskLife->setPosition(Point(-205.0f + iIndex*160, -5.0f)); m_pButtonManagerNode->addButtonNode(pButtonAskLife); }
void LeaderBoardAdvanceModeNode::addItemToSlide(const int& iStage, const char* sName, const char* sFacebookId, const int& iRank) { Node* pNodeItem = Node::create(); Sprite* pLoadAvatar = Sprite::create("Target-End-Game/border_avatar.png"); pLoadAvatar->setPosition(Point(55.0f, 65.0f)); pNodeItem->addChild(pLoadAvatar); std::string urlAvatar = "https://graph.facebook.com/"; urlAvatar.append(sFacebookId); urlAvatar.append("/picture"); LoadingImagetNode* avatar = LoadingImagetNode::createLayout(urlAvatar.c_str()); avatar->setPosition(Point(56.0f, 65.0f)); pNodeItem->addChild(avatar); LabelTTF *pLabelName = LabelTTF::create(sName, "Arial", 20.0f); pLabelName->setColor(ccc3(0.0f, 0.0f, 0.0f)); //pLabelName->setScale(0.80f); pLabelName->setAnchorPoint(Point(0.0f, 0.5f)); pLabelName->setPosition(Point(26.0f, 17.0f)); pNodeItem->addChild(pLabelName); char sStage[5]; sprintf(sStage, "%d", iStage); LabelBMFont *pLabelNumberStage = LabelBMFont::create(sStage, "fonts/font-bechic.fnt"); pLabelNumberStage->setAnchorPoint(Point(0.5f, 0.5f)); pLabelNumberStage->setPosition(Point(130.0f, 85.0f)); pLabelNumberStage->setScale(0.90); pNodeItem->addChild(pLabelNumberStage); LabelBMFont *pLabelStage = LabelBMFont::create("Stage", "fonts/font_small_alert.fnt"); pLabelStage->setAnchorPoint(Point(0.5f, 0.5f)); pLabelStage->setPosition(Point(130.0f, 50.0f)); pLabelStage->setScale(0.8f); pNodeItem->addChild(pLabelStage); Sprite* pLineImage = Sprite::create("Target-End-Game/line.png"); pLineImage->setPosition(Point(160.0f, 55.0f)); pNodeItem->addChild(pLineImage); pNodeItem->setContentSize(Size(160.0f, 160.0f)); pNodeItem->setPosition(Point(-320.0f + (iRank-1)*160, -100.0f)); m_pSlideShow->addChild(pNodeItem); }