void TaskChatLayer::processGuildChat(int type, bool visible) { UIButton* btnLeft = taskChatLayout->FindChildObjectByName<UIButton>("ItemExchangShopBtn"); UILabel* labelLeft = taskChatLayout->FindChildObjectByName<UILabel>("ItemExchangText"); btnLeft->setVisible(visible); labelLeft->setVisible(visible); // type 10 11 12 13 分别代表公会商人、祈福、活动、排行 if(type == 10) { labelLeft->setString(Localizatioin::getLocalization("G_SHOP_TITLE")); } else if(type == 11) { labelLeft->setString(Localizatioin::getLocalization("G_BENEDICTION_TITLE")); } else if(type == 12) { labelLeft->setString(Localizatioin::getLocalization("G_INSTANCE")); } else if(type == 13) { labelLeft->setString(Localizatioin::getLocalization("G_RANK")); } mShopType = type; }
void TaskChatLayer::processItemExchangeFunc(bool visible) { UIButton* btnLeft = taskChatLayout->FindChildObjectByName<UIButton>("ItemExchangShopBtn"); UILabel* labelLeft = taskChatLayout->FindChildObjectByName<UILabel>("ItemExchangText"); btnLeft->setVisible(visible); labelLeft->setVisible(visible); labelLeft->setString(Localizatioin::getLocalization("M_EXCHANGESHOP_TITLE")); UIButton* btnRight = taskChatLayout->FindChildObjectByName<UIButton>("CityDefendBtn"); UILabel* labelRight = taskChatLayout->FindChildObjectByName<UILabel>("CityDefendText"); btnRight->setVisible(visible); labelRight->setVisible(visible); labelRight->setString(Localizatioin::getLocalization("M_CITYDEFEND_TITLE")); mShopType = 8; }
void EquipmentUpgradeUILayer::showSecondNextLevelAttributionLabel(const char* text) { if(m_equipmentLayout) { UILabel* label = m_equipmentLayout->FindChildObjectByName<UILabel>("equipUpgradeChoosedAddNextLevel2"); if(label) { label->setString(text); } } }
void EquipmentUpgradeUILayer::showCurrentAttributeLabel(const char* text) { if(m_equipmentLayout) { UILabel* label = m_equipmentLayout->FindChildObjectByName<UILabel>("equipUpgradeChoosedAddSkill"); if(label) { label->setString(text); } } }
void EquipmentUpgradeUILayer::showCurrentName(const char* name,const ccColor3B& color) { if(m_equipmentLayout) { UILabel* label = m_equipmentLayout->FindChildObjectByName<UILabel>("equipUpgradeChoosedName"); if(label) { label->setString(name); label->setColor(color); } } }
void EquipmentUpgradeUILayer::unSelectChoosedEquip() { m_choosedEquipIndex = 0; if(m_choosedEquipmentPic) { m_choosedEquipmentPic->setSprite(NULL); } showCurrentLevel(0); showCurrentName(""); showCurrentAttributeLabel(""); showSecondAttributeLabel(""); showLevelUpCost(0); UILabel* label = m_equipmentLayout->FindChildObjectByName<UILabel>("equipUpgradeChoosedAddNextLevel"); if(label) { label->setString(""); } label = m_equipmentLayout->FindChildObjectByName<UILabel>("equipUpgradeChoosedAddNextLevel2"); if(label) { label->setString(""); } }
void EquipmentUpgradeUILayer::showEquipName(unsigned int index,const char* name,const ccColor3B& color) { if(m_equipmentLayout) { char lableName[30]; sprintf(lableName,"equipUpgradeLabel%d",index); UILabel* label = m_equipmentLayout->FindChildObjectByName<UILabel>(lableName); if(label) { label->setString(name); label->setColor(color); } } }
void EquipmentUpgradeUILayer::showEquipLevel(unsigned int index,unsigned int level) { if(m_equipmentLayout) { char lableName[30]; sprintf(lableName,"equipUpgradeLevelLabel%d",index); UILabel* label = m_equipmentLayout->FindChildObjectByName<UILabel>(lableName); if(label) { char text[10]; sprintf(text,"lv %d",level); label->setString(text); } } }
void FrontCoverLayer::setLastServerLabel() { if(m_layout) { UILabel* label = m_layout->FindChildObjectByName<UILabel>("serverLabel"); if(label) { const char* name = UserData::GetLastServerName(); if(*name != '\0') { label->setString(name); } } } }
void EquipmentUpgradeUILayer::updateBottomCoinLabel() { if(m_equipmentLayout) { UILabel* label = m_equipmentLayout->FindChildObjectByName<UILabel>("bottomCoinLable"); if(label) { unsigned int coin = UserData::GetGold(); const char* str = MainMenuLayer::GetNumByFormat(coin); if(str) { label->setString(str); } } } }
void EquipmentUpgradeUILayer::showSecondNextLevelAttribution(unsigned int key,unsigned int strenghValue) { const char* text = ItemManager::Get()->getAttributionText(key,strenghValue); if(text) { if(m_equipmentLayout) { UILabel* label = m_equipmentLayout->FindChildObjectByName<UILabel>("equipUpgradeChoosedAddNextLevel2"); if(label) { char nextAttr[80]; sprintf(nextAttr,"%s%s",Localizatioin::getLocalization("M_NEXTLEVEL"),text); label->setString(nextAttr); } } } }
void TaskChatLayer::ShowTaskItemWithFlagStateAndName(int itemIndex,eTaskState taskState,std::string content) { UIPicture* newTaskIcon = 0; UIPicture* runingTaskIcon = 0; UIPicture* waitRewardIcon = 0; UILabel* taskNameLabel = 0; std::string newTaskIconName = ""; std::string runingTaskIconName = ""; std::string waitRewardIconName = ""; std::string taskNameIconName = ""; switch (itemIndex) { case 0: { newTaskIconName = "TaskNewFlagPic_01"; runingTaskIconName = "TaskRuningFlagPic_01"; waitRewardIconName = "TaskCompleteFlagPic_01"; taskNameIconName = "HeroTaskTalkLabel_01"; } break; case 1: { newTaskIconName = "TaskNewFlagPic_02"; runingTaskIconName = "TaskRuningFlagPic_02"; waitRewardIconName = "TaskCompleteFlagPic_02"; taskNameIconName = "HeroTaskTalkLabel_02"; } break; case 2: { newTaskIconName = "TaskNewFlagPic_03"; runingTaskIconName = "TaskRuningFlagPic_03"; waitRewardIconName = "TaskCompleteFlagPic_03"; taskNameIconName = "HeroTaskTalkLabel_03"; } break; } newTaskIcon = taskChatLayout->FindChildObjectByName<UIPicture>(newTaskIconName.c_str()); runingTaskIcon = taskChatLayout->FindChildObjectByName<UIPicture>(runingTaskIconName.c_str()); waitRewardIcon = taskChatLayout->FindChildObjectByName<UIPicture>(waitRewardIconName.c_str()); taskNameLabel = taskChatLayout->FindChildObjectByName<UILabel>(taskNameIconName.c_str()); newTaskIcon->getCurrentNode()->setVisible(false); runingTaskIcon->getCurrentNode()->setVisible(false); waitRewardIcon->getCurrentNode()->setVisible(false); bool bUseSpecialColor = false; switch(taskState) { case kType_TASK_NOT_ACCEPT: { newTaskIcon->getCurrentNode()->setVisible(true); bUseSpecialColor = true; } break; case kType_TASK_RUNNING: { runingTaskIcon->getCurrentNode()->setVisible(true); } break; case kType_TASK_WAIT_REWARD: { waitRewardIcon->getCurrentNode()->setVisible(true); bUseSpecialColor = true; } break; } taskNameLabel->setString(content.c_str()); if (bUseSpecialColor) { taskNameLabel->setColor(ccc3(238,166,26)); } else { taskNameLabel->setColor(ccc3(255,255,255)); } }
void EquipmentUpgradeUILayer::setChoosedEquipment(unsigned int index) { if(m_choosedEquipIndex == index) { if(m_choosedEquipBt && m_choosedEquipBt->getMenuItemSprite()) { m_choosedEquipBt->getMenuItemSprite()->selected(); } return; } m_choosedEquipIndex = index; if(m_choosedEquipBt && m_choosedEquipBt->getMenuItemSprite()) { m_choosedEquipBt->getMenuItemSprite()->unselected(); } m_choosedEquipBt = getEquipmentButton(index); if(m_choosedEquipBt && m_choosedEquipBt->getMenuItemSprite()) { m_choosedEquipBt->getMenuItemSprite()->selected(); } if(m_choosedEquipmentPic) { unsigned int pos = index; if(m_equipLayoutIndex) { pos += kItemHeroEquip; } else { pos += kItemFairyEquip; } BackPackItem* item = ItemManager::Get()->findItemByPos(pos); if(item) { if(item->isEmpty) { m_choosedEquipmentPic->setSprite(NULL); showLevelUpCost(0); showCurrentLevel(0); showCurrentName(""); showCurrentAttributeLabel(""); showSecondAttributeLabel(""); UILabel* label = m_equipmentLayout->FindChildObjectByName<UILabel>("equipUpgradeChoosedAddNextLevel"); if(label) { label->setString(""); } label = m_equipmentLayout->FindChildObjectByName<UILabel>("equipUpgradeChoosedAddNextLevel2"); if(label) { label->setString(""); } return; } if(item->m_attribution) { std::list<ITEMATTR*>::iterator it = item->m_attribution->begin(); if(it != item->m_attribution->end()) { ITEMATTR* attr = *it; if(attr) { showCurrentAttribute(attr->attr_key,attr->attr_basic_value,attr->attr_intensify_value); } if(++it != item->m_attribution->end()) { attr = *it; showSecondAttribute(attr->attr_key,attr->attr_basic_value,attr->attr_intensify_value); } else { showSecondAttributeLabel(""); } } } if(item->m_equipInfo) { std::list<EQUIPNEXTATTR>::iterator it = item->m_equipInfo->m_nextAttribution.begin(); if(it != item->m_equipInfo->m_nextAttribution.end()) { EQUIPNEXTATTR attr = *it; showNextLevelAttribution(attr.key,attr.value); } if(++it != item->m_equipInfo->m_nextAttribution.end()) { EQUIPNEXTATTR attr = *it; showSecondNextLevelAttribution(attr.key,attr.value); } else { showSecondNextLevelAttributionLabel(""); } showLevelUpCost(item->m_equipInfo->levelUpCost); } CCSprite* equipPic = getIconSpriteById(item->getItemId()); if(equipPic) { showCurrentLevel(item->itemLevel); m_choosedEquipmentPic->setSprite(equipPic); ItemBase* itemInfo = item->getItemInfo(); if(itemInfo && itemInfo > 0) { showCurrentName(itemInfo->m_name,ItemManager::Get()->getLabelColorByQuality(itemInfo->m_quality)); if(itemInfo->m_quality > 0) { CCSprite* framePic = getIconFrame(itemInfo->m_quality); if(framePic) { m_choosedEquipmentPic->addExtraPic(framePic); } } } } } } }
void PvAIManager::refreshPvAILayer() { UIManager *manager = UIManager::sharedManager(); pvaiLayout = manager->getUILayout("PvAILayout"); if (pvaiLayout) { //玩家昵称 UILabel *heroNameLabel = pvaiLayout->FindChildObjectByName<UILabel>("pvaiMcName"); if (heroNameLabel) { string heroName = UserData::getUserName(); heroNameLabel->setString(heroName.c_str()); } //玩家排名 UILabel *heroRankLabel = pvaiLayout->FindChildObjectByName<UILabel>("pvaiMcRank"); if (heroRankLabel) { stringstream heroRankStream; heroRankStream << heroRank; string heroRankStr = heroRankStream.str(); string heroRankText = Localizatioin::getLocalization("M_PVAI_RANK"); heroRankText += heroRankStr; heroRankLabel->setString(heroRankText.c_str()); } //玩家声望 UILabel *heroReputationLabel = pvaiLayout->FindChildObjectByName<UILabel>("pvaiMcReputation"); if (heroReputationLabel) { int heroReputation = UserData::GetUserInfo().m_reputation; stringstream heroReputationStream; heroReputationStream << heroReputation; string heroReputationStr = heroReputationStream.str(); string heroReputationText = Localizatioin::getLocalization("M_PVAI_REPUTATION"); heroReputationText += heroReputationStr; heroReputationLabel->setString(heroReputationText.c_str()); } ////剩余挑战次数 //UILabel *lastTimeLabel = pvaiLayout->FindChildObjectByName<UILabel>("pvaiTodayLastTime"); //if (lastTimeLabel) //{ // stringstream herolastTimeStream; // herolastTimeStream << basicInfo.remainCount; // string herolastTimeStr = herolastTimeStream.str(); // lastTimeLabel->setString(herolastTimeStr.c_str()); //} ////奖励金币数 //UILabel *rewardCoinLabel = pvaiLayout->FindChildObjectByName<UILabel>("pvaiRewardCoin"); //if (rewardCoinLabel) //{ // stringstream herolastTimeStream; // herolastTimeStream << basicInfo.rewardCoin; // string herolastTimeStr = herolastTimeStream.str(); // rewardCoinLabel->setString(herolastTimeStr.c_str()); //} ////奖励声望 //UILabel *rewardReputationLabel = pvaiLayout->FindChildObjectByName<UILabel>("pvaiRewardReputation"); //if (rewardReputationLabel) //{ // stringstream herolastTimeStream; // herolastTimeStream << basicInfo.rewardReputation; // string herolastTimeStr = herolastTimeStream.str(); // rewardReputationLabel->setString(herolastTimeStr.c_str()); //} ////奖励领取时间 //TimeManager::Get()->renewTimer(TIMER_PVAI_REWARD, TimeManager::Get()->getCurServerTime() + basicInfo.rewardGetTime); ////冷却时间 //TimeManager::Get()->renewTimer(TIMER_PVAI_COOLDOWN, TimeManager::Get()->getCurServerTime() + basicInfo.coolDownTime); //挑战玩家列表 int playerCount = aiPlayerVec.size(); int minPlayerCount = min(playerCount, 5); for (int i = minPlayerCount; i < 5; i++) { stringstream iconOtherStream; iconOtherStream << "iconOther" << i+1; string iconOtherStr = iconOtherStream.str(); UIPicture *iconOtherPic= pvaiLayout->FindChildObjectByName<UIPicture>(iconOtherStr); iconOtherPic->setVisible(false); iconOtherStream.str(""); iconOtherStream << "gridOther" << i+1; iconOtherStr = iconOtherStream.str(); iconOtherPic= pvaiLayout->FindChildObjectByName<UIPicture>(iconOtherStr); iconOtherPic->setVisible(false); iconOtherStream.str(""); iconOtherStream << "pvaiOtherPlayerName" << i+1; iconOtherStr = iconOtherStream.str(); UILabel * iconOtherLabel= pvaiLayout->FindChildObjectByName<UILabel>(iconOtherStr); iconOtherLabel->setVisible(false); iconOtherStream.str(""); iconOtherStream << "pvaiOtherPlayerLevel" << i+1; iconOtherStr = iconOtherStream.str(); iconOtherLabel= pvaiLayout->FindChildObjectByName<UILabel>(iconOtherStr); iconOtherLabel->setVisible(false); iconOtherStream.str(""); iconOtherStream << "pvaiOtherPlayerRank" << i+1; iconOtherStr = iconOtherStream.str(); iconOtherLabel= pvaiLayout->FindChildObjectByName<UILabel>(iconOtherStr); iconOtherLabel->setVisible(false); iconOtherStream.str(""); iconOtherStream << "pvaiFightBtn" << i+1; iconOtherStr = iconOtherStream.str(); UIButton * iconOtherBtn= pvaiLayout->FindChildObjectByName<UIButton>(iconOtherStr); iconOtherBtn->setVisible(false); iconOtherStream.str(""); iconOtherStream << "pvaiFightText" << i+1; iconOtherStr = iconOtherStream.str(); iconOtherLabel= pvaiLayout->FindChildObjectByName<UILabel>(iconOtherStr); iconOtherLabel->setVisible(false); } for (int i = 0; i < minPlayerCount; i++) { //头像 stringstream iconOtherStream; iconOtherStream << "iconOther" << i+1; string iconOtherStr = iconOtherStream.str(); UIPicture *iconOtherPic= pvaiLayout->FindChildObjectByName<UIPicture>(iconOtherStr); int playerType = aiPlayerVec[i].type; const char * playerIconName = LuaTinkerManager::Get()->getLuaConfig<const char *>("characterString", "Characters", playerType, "HeadPicture"); int idx = getResourceIDByName(playerIconName); CCPoint pt; ASprite *as = AspriteManager::getInstance()->getAsprite(KICON_BIN); CCSprite * headPic = as->getSpriteFromFrame_Middle( idx, 0, pt); if(headPic) { iconOtherPic->addExtraPic(headPic); } //昵称 stringstream otherPlayerNameStream; otherPlayerNameStream << "pvaiOtherPlayerName" << i+1; string otherPlayerNameStr = otherPlayerNameStream.str(); UILabel *otherPlayerNameLabel = pvaiLayout->FindChildObjectByName<UILabel>(otherPlayerNameStr); otherPlayerNameLabel->setString(aiPlayerVec[i].name.c_str()); //等级 stringstream otherPlayerLevelStream; otherPlayerLevelStream << "pvaiOtherPlayerLevel" << i+1; string otherPlayerLevelStr = otherPlayerLevelStream.str(); UILabel *otherPlayerLevelLabel = pvaiLayout->FindChildObjectByName<UILabel>(otherPlayerLevelStr); int playerLevel = aiPlayerVec[i].level; stringstream levelStream; levelStream << "Lv" << playerLevel; string levelStr = levelStream.str(); otherPlayerLevelLabel->setString(levelStr.c_str()); //排名 stringstream otherPlayerRankStream; otherPlayerRankStream << "pvaiOtherPlayerRank" << i+1; string otherPlayerRankStr = otherPlayerRankStream.str(); UILabel *otherPlayerRankLabel = pvaiLayout->FindChildObjectByName<UILabel>(otherPlayerRankStr); int playerRank = aiPlayerVec[i].rank; string rankText = Localizatioin::getLocalization("M_PVAI_RANK2"); stringstream rankStream; rankStream << rankText << playerRank; string rankStr = rankStream.str(); otherPlayerRankLabel->setString(rankStr.c_str()); } //最近日志列表 float fontSize = GameFontManager::smallFontSize(); int logCount = aiLogInfoVec.size(); int minLogCount = min(logCount, 4); //隐藏多余项目 for (int i = minLogCount; i < 4; i++) { stringstream attackTextStream; attackTextStream << "pvaiChallenge" << i+1; string attackTextStr = attackTextStream.str(); UILabel *attackOrgLabel = pvaiLayout->FindChildObjectByName<UILabel>(attackTextStr); attackOrgLabel->setVisible(false); stringstream resultStream; resultStream << "pvaiChallengeResult" << i+1; string resultStr = resultStream.str(); UILabel *resultLabel = pvaiLayout->FindChildObjectByName<UILabel>(resultStr); resultLabel->setVisible(false); } for (int i = 0; i < minLogCount; i++) { float factor = UIManager::sharedManager()->getScaleFactor(); stringstream attackTextStream; attackTextStream << "pvaiChallenge" << i+1; string attackTextStr = attackTextStream.str(); UILabel *attackOrgLabel = pvaiLayout->FindChildObjectByName<UILabel>(attackTextStr); UIContainer * container = pvaiLayout->FindChildObjectByName<UIContainer>("pvaiLayerContainer"); attackOrgLabel->setVisible(false); CCPoint orgPos = attackOrgLabel->getPosition(); CCPoint orgLeftPos = ccp(orgPos.x - attackOrgLabel->getLabelTTF()->getContentSize().width * factor / 2, orgPos.y); //挑战方向 if (aiLogInfoVec[i].direct) { //主动攻击 string attackText = Localizatioin::getLocalization("M_PVAI_FIGHT1"); string attackName = aiLogInfoVec[i].name; UILabelTTF * attackTextLabel = UILabelTTF::create(attackText.c_str(), KJLinXin, fontSize * factor, CCSizeZero,kCCTextAlignmentLeft,kCCVerticalTextAlignmentBottom); UILabelTTF * attackNameLabel = UILabelTTF::create(attackName.c_str(), KJLinXin, fontSize * factor, CCSizeZero,kCCTextAlignmentLeft,kCCVerticalTextAlignmentBottom); attackTextLabel->setPosition(ccp(orgLeftPos.x + attackTextLabel->getContentSize().width / 2, orgLeftPos.y)); attackNameLabel->setPosition(ccp(orgLeftPos.x + attackTextLabel->getContentSize().width + attackNameLabel->getContentSize().width/ 2, orgLeftPos.y)); UILabel * aTextLabel = new UILabel(attackTextLabel, container->getCurrentNode()); UILabel * aNameLabel = new UILabel(attackNameLabel, container->getCurrentNode()); aNameLabel->setColor(KAILogNameColor); } else { //被攻击 string defenceName = aiLogInfoVec[i].name; string defenceText = Localizatioin::getLocalization("M_PVAI_FIGHT2"); UILabelTTF * defenceTextLabel = UILabelTTF::create(defenceText.c_str(), KJLinXin, fontSize, CCSizeZero,kCCTextAlignmentLeft,kCCVerticalTextAlignmentBottom); UILabelTTF * defenceNameLabel = UILabelTTF::create(defenceName.c_str(), KJLinXin, fontSize, CCSizeZero,kCCTextAlignmentLeft,kCCVerticalTextAlignmentBottom); defenceNameLabel->setPosition(ccp(orgLeftPos.x + defenceNameLabel->getContentSize().width / 2, orgLeftPos.y)); defenceTextLabel->setPosition(ccp(orgLeftPos.x + defenceNameLabel->getContentSize().width + defenceTextLabel->getContentSize().width / 2, orgLeftPos.y)); UILabel * aTextLabel = new UILabel(defenceTextLabel, container->getCurrentNode()); UILabel * aNameLabel = new UILabel(defenceNameLabel, container->getCurrentNode()); aNameLabel->setColor(KAILogNameColor); } //挑战结果 stringstream resultStream; resultStream << "pvaiChallengeResult" << i+1; string resultStr = resultStream.str(); UILabel *resultLabel = pvaiLayout->FindChildObjectByName<UILabel>(resultStr); if (aiLogInfoVec[i].win == aiLogInfoVec[i].direct) { string resultText = Localizatioin::getLocalization("M_PVAI_WIN"); resultLabel->setString(resultText.c_str()); resultLabel->setColor(ccYELLOW); } else { string resultText = Localizatioin::getLocalization("M_PVAI_LOST"); resultLabel->setString(resultText.c_str()); resultLabel->setColor(ccRED); } } } }