Exemple #1
0
void TartarLayer::onEnter()
{
    CCLayer::onEnter();

    UiManager::Singleton().Init(this);
    UiManager::Singleton().SetupWidget("../UIProject/Json/Tartar.json");

    UIWidget* pUIWidget = UiManager::Singleton().GetChildByName("Panel1");
    pUIWidget->setVisible(true);
    pUIWidget = UiManager::Singleton().GetChildByName("Panel2");
    pUIWidget->setVisible(false);

    UILabel* pUILabel = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_Warning"));
    pUILabel->setVisible(false);
    
    pUILabel = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_DayDiff"));
    pUILabel->setVisible(false);

    pUILabel = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_PastDay"));
    pUILabel->setVisible(false);

    UITextField* pUITextField = DynamicCast<UITextField*>(UiManager::Singleton().GetChildByName("TextField_Year"));
    pUITextField->setMaxLengthEnable(true);
    pUITextField->setMaxLength(4);
    pUITextField->addInsertTextEvent(this, coco_TextFieldInsertTextSelector(TartarLayer::TextFieldInserted));
    
    pUITextField = DynamicCast<UITextField*>(UiManager::Singleton().GetChildByName("TextField_Mon"));
    pUITextField->setMaxLengthEnable(true);
    pUITextField->setMaxLength(2);
    pUITextField->addInsertTextEvent(this, coco_TextFieldInsertTextSelector(TartarLayer::TextFieldInserted));

    pUITextField = DynamicCast<UITextField*>(UiManager::Singleton().GetChildByName("TextField_Day"));
    pUITextField->setMaxLengthEnable(true);
    pUITextField->setMaxLength(2);
    pUITextField->addInsertTextEvent(this, coco_TextFieldInsertTextSelector(TartarLayer::TextFieldInserted));

    UIButton* pButton = DynamicCast<UIButton*>(UiManager::Singleton().GetChildByName("TextButton_Start"));
    pButton->addReleaseEvent(this, coco_releaseselector(TartarLayer::BottonOKClicked));

    pButton = DynamicCast<UIButton*>(UiManager::Singleton().GetChildByName("TextButton_Finish"));
    pButton->addReleaseEvent(this, coco_releaseselector(TartarLayer::BottonFinishClicked));

    pButton = DynamicCast<UIButton*>(UiManager::Singleton().GetChildByName("TextButton_Order"));
    pButton->addReleaseEvent(this, coco_releaseselector(TartarLayer::BottonOrderClicked));

    UILabel* pUILabelWarning = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_NeedCheck"));
    pUILabelWarning->setVisible(false);

    UIImageView* pImage = DynamicCast<UIImageView*>(UiManager::Singleton().GetChildByName("ImageView"));
    CCRect rect = pImage->getRect();
    float normalWidth = cocos2d::CCEGLView::sharedOpenGLView()->getDesignResolutionSize().width - 10.0f;
    float normalHeight = normalWidth * 0.6f;
    pImage->setScaleX(normalWidth / rect.size.width * pImage->getScaleX());
    pImage->setScaleY(normalHeight / rect.size.height * pImage->getScaleY());
}
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 KHeroLevUpResultPanel::Show(const KHeroDef& oldHero,const KHeroDef& newHero)
{
    m_bPlay = true;
    if(!m_Panel->getParent()) m_layer->addWidget(m_Panel);
    m_oldHero = oldHero;
    m_newHero = newHero;
    m_elapsed = 0.0f;
    CCDirector::sharedDirector()->getScheduler()->scheduleSelector(schedule_selector(KHeroLevUpResultPanel::DoClose),this,6,0,0.0f,false);

    char sz[64];
    UILabel* labelOldStrong = (UILabel*)m_Panel->getChildByName("old_strong_val");
    sprintf(sz,"%d",oldHero.GetStrong());
    labelOldStrong->setText(sz);
    UIWidget* strongTo = m_Panel->getChildByName("strong_to");
    UILabel* labelNewStrong = (UILabel*)m_Panel->getChildByName("new_strong_val");
    strongTo->setVisible(false);
    labelNewStrong->setVisible(false);
    sprintf(sz,"%d",newHero.GetStrong());
    labelNewStrong->setText(sz);


    UILabel* labelOldLucky = (UILabel*)m_Panel->getChildByName("old_lucky_val");
    sprintf(sz,"%d",oldHero.GetLucky());
    labelOldLucky->setText(sz);
    UIWidget* luckyTo = m_Panel->getChildByName("lucky_to");
    UILabel* labelNewLucky = (UILabel*)m_Panel->getChildByName("new_lucky_val");
    sprintf(sz,"%d",newHero.GetLucky());
    labelNewLucky->setText(sz);
    luckyTo->setVisible(false);
    labelNewLucky->setVisible(false);

    m_pNewSkill = NULL;
    for(int i=0; i<MAX_HERO_SKILL_NUM; i++) {
        if(newHero._skill[i]._id>0 &&
                oldHero._skill[i]._id==0) {
            m_pNewSkill = &newHero._skill[i];
            break;
        }
    }
    UILabel* lableSkill = (UILabel*)m_Panel->getChildByName("skill_name");
    lableSkill->setVisible(false);
    if(m_pNewSkill) {
        lableSkill->setText(m_pNewSkill->GetName());
    }

    for(int i=0; i<MAX_HERO_LEV_NUM; i++) {
        UIWidget* widgetStar = KUIAssist::GetIndexWidget(m_Panel,"star",i);
        widgetStar->setVisible(false);
    }
}
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 KHeroLevUpResultPanel::update(float dt)
{
    m_elapsed += dt;
    if(m_elapsed<4.0f && m_bPlay) {
        if(m_elapsed >0.6f) {
            UIWidget* strongTo = m_Panel->getChildByName("strong_to");
            if(m_newHero.GetStrong()>m_oldHero.GetStrong()) {
                strongTo->setVisible(true);
            }
            UIWidget* luckyTo = m_Panel->getChildByName("lucky_to");
            if(m_newHero.GetLucky()>m_oldHero.GetLucky()) {
                luckyTo->setVisible(true);
            }
        }
        if(m_elapsed >1.2f) {
            UILabel* labelNewStrong = (UILabel*)m_Panel->getChildByName("new_strong_val");
            if(m_newHero.GetStrong()>m_oldHero.GetStrong()) {
                labelNewStrong->setVisible(true);
            }
            UILabel* labelNewLucky = (UILabel*)m_Panel->getChildByName("new_lucky_val");
            if(m_newHero.GetLucky()>m_oldHero.GetLucky()) {
                labelNewLucky->setVisible(true);
            }
        }
        if(m_elapsed >1.8f) {
            if(m_pNewSkill) {
                UILabel* lableSkill = (UILabel*)m_Panel->getChildByName("skill_name");
                lableSkill->setVisible(true);
            }
        }

        int starNum = m_newHero.GetLev();
        float interval = 2.0f / (float)m_newHero.GetLev() ;
        int curStarNum = (m_elapsed>=2.0f)?m_newHero.GetLev(): m_elapsed/interval;
        for(int i=0; i<MAX_HERO_LEV_NUM; i++) {
            UIWidget* widgetStar = KUIAssist::GetIndexWidget(m_Panel,"star",i);
            if(i<curStarNum) {
                widgetStar->setVisible(true);
            } else {
                widgetStar->setVisible(false);
            }
        }

    }
}
Exemple #6
0
void TartarLayer::TextFieldInserted( CCObject* pSender )
{
    UILabel* pUILabel = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_Warning"));
    pUILabel->setVisible(false);

    UITextField* pUITextField = DynamicCast<UITextField*>(pSender);
    std::string str = pUITextField->getStringValue();
    if (str.size() > 0)
    {
        char lastLetter = str[str.size()-1];
        if (lastLetter < '0' || lastLetter > '9')
        {
            str.pop_back();
            pUITextField->setText(str.c_str());
        }
    }
}
Exemple #7
0
void LoginLayer::onEnter()
{
    TextFieldTTFLayer::onEnter();
    
    // UI setup
    UiManager::Singleton().Init(this);
    UiManager::Singleton().SetupWidget("../UIProject/Json/Login.json");

    UIButton* pButton = DynamicCast<UIButton*>(UiManager::Singleton().GetChildByName("TextButton_OK"));
    pButton->addReleaseEvent(this, coco_releaseselector(LoginLayer::BottonOKClicked));
    
    pButton = DynamicCast<UIButton*>(UiManager::Singleton().GetChildByName("TextButton_Yes"));
    pButton->addReleaseEvent(this, coco_releaseselector(LoginLayer::BottonYesClicked));
    
    pButton = DynamicCast<UIButton*>(UiManager::Singleton().GetChildByName("TextButton_No"));
    pButton->addReleaseEvent(this, coco_releaseselector(LoginLayer::BottonNoClicked));

    UILabel* pUILabel = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_Fail"));
    pUILabel->setVisible(false);
 
    UIWidget* pUIWidget = UiManager::Singleton().GetChildByName("Panel_LoginConfirm");
    pUIWidget->setVisible(false);
}
Exemple #8
0
void TartarLayer::BottonOKClicked( CCObject* pSender )
{
    // Check date Format is correct or not
    bool dateFormatIsValid = true;
    UITextField* pUITextField = DynamicCast<UITextField*>(UiManager::Singleton().GetChildByName("TextField_Year"));
    int year = atoi(pUITextField->getStringValue());
    int mon = 0;
    int day = 0;
    if (year != 2013)
    {
        dateFormatIsValid = false;
    }
    if (dateFormatIsValid)
    {
        pUITextField = DynamicCast<UITextField*>(UiManager::Singleton().GetChildByName("TextField_Mon"));
        mon = atoi(pUITextField->getStringValue());
        if (mon < 1 || mon > 12)
        {
            dateFormatIsValid = false;
        }
    }
    if (dateFormatIsValid)
    {
        pUITextField = DynamicCast<UITextField*>(UiManager::Singleton().GetChildByName("TextField_Day"));
        day = atoi(pUITextField->getStringValue());
        if (day < 1 || day > 31)
        {
            dateFormatIsValid = false;
        }
    }
    
    if (!dateFormatIsValid)
    {
        UILabel* pUILabel = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_Warning"));
        pUILabel->setVisible(true);
    }
    else
    {
        // Get Current Date
        tm curTime = GetDate();
        curTime.tm_hour = 0;
        curTime.tm_min = 0;
        curTime.tm_sec = 0;

        tm inputTime;
        inputTime.tm_year = year;
        inputTime.tm_mon = mon;
        inputTime.tm_mday = day;

        int dayDiff = GetElapseDayNum(curTime, inputTime);
        if (dayDiff < 0)
        {
            UILabel* pUILabel = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_Warning"));
            pUILabel->setVisible(true);
        }
        else
        {
            UIWidget* pUIWidget = UiManager::Singleton().GetChildByName("Panel1");
            pUIWidget->setVisible(false);
            pUIWidget = UiManager::Singleton().GetChildByName("Panel2");
            pUIWidget->setVisible(true);

            UILabel* pUILabelDayDiff = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_DayDiff"));
            char str[10];
            sprintf(str,"%d",dayDiff);
            pUILabelDayDiff->setText(str);
            pUILabelDayDiff->setVisible(true);

            pUILabelDayDiff = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_PastDay"));
            pUILabelDayDiff->setVisible(true);

            // Request info according the diffDay.
            CCHttpRequest* request = new CCHttpRequest();
            std::string url = "http://localhost:8000/plaque/" + std::string(str);
            request->setUrl(url.c_str());
            request->setRequestType(CCHttpRequest::kHttpGet);
            request->setResponseCallback(this, httpresponse_selector(TartarLayer::onHttpRequestCompleted));
            request->setTag("GET INFO");
            CCHttpClient::getInstance()->send(request);
            request->release();
        }
    }
}
Exemple #9
0
void TartarLayer::onHttpRequestCompleted(CCHttpClient *sender, CCHttpResponse *response)
{
    if (!response)
    {
        return;
    }
    
    int statusCode = response->getResponseCode();
    char statusString[64] = {};
    sprintf(statusString, "HTTP Status Code: %d, tag = %s", statusCode, response->getHttpRequest()->getTag());
    CCLog("response code: %d", statusCode);
    
    if (!response->isSucceed())
    {
        CCLog("response failed");
        CCLog("error buffer: %s", response->getErrorBuffer());
        return;
    }
    
    // dump data
    std::vector<char> *buffer = response->getResponseData();
    std::string bufferStr(buffer->begin(),buffer->end());

    if (std::string(response->getHttpRequest()->getTag()) == std::string("GET INFO"))
    {
        // Display the memberId and name.
        cJSON* json;
        json = cJSON_Parse(bufferStr.c_str());
        if (json) 
        {
            cJSON* messageJSON = cJSON_GetObjectItem(json, "message");
            if (messageJSON)
            {
                // Set NeedCheck label
                UILabel* pUILabelWarning = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_NeedCheck"));
                pUILabelWarning->setVisible(true);
                pUILabelWarning->setText(messageJSON->valuestring);
            }

            cJSON* imageJSON = cJSON_GetObjectItem(json, "image");
            if (imageJSON)
            {
                std::string imagePath = imageJSON->valuestring;
                CCHttpRequest* request = new CCHttpRequest();
                std::string url = "http://localhost:8000/media/" + imagePath;
                request->setUrl(url.c_str());
                request->setRequestType(CCHttpRequest::kHttpGet);
                request->setResponseCallback(this, httpresponse_selector(TartarLayer::onHttpRequestCompleted));
                request->setTag("GET IMAGE");
                CCHttpClient::getInstance()->send(request);
                request->release();

                int index = imagePath.find_last_of(".");
                if (index != -1)
                {
                    m_textureFormat = imagePath.substr(index);
                }
            }
        }
    }
    else
    {
        std::string path = CCFileUtils::sharedFileUtils()->getWritablePath();

        // Save it locally
        path += "currentTeeth";
        path += m_textureFormat;
        
        CCLOG("path: %s",path.c_str());
        FILE *fp = fopen(path.c_str(), "wb+");
        fwrite(bufferStr.c_str(), 1,buffer->size(), fp);
        fclose(fp);
    
        // Display
        UIImageView* pImage = DynamicCast<UIImageView*>(UiManager::Singleton().GetChildByName("ImageView"));
        pImage->setTexture(path.c_str());            
        CCRect rect = pImage->getRect();
        float normalWidth = cocos2d::CCEGLView::sharedOpenGLView()->getDesignResolutionSize().width - 10.0f;
        float normalHeight = normalWidth * 0.6f;
        pImage->setScaleX(normalWidth / rect.size.width * pImage->getScaleX());
        pImage->setScaleY(normalHeight / rect.size.height * pImage->getScaleY());
    }
    
}
Exemple #10
0
void LoginLayer::onHttpRequestCompleted(CCHttpClient *sender, CCHttpResponse *response)
{
    if (!response)
    {
        UILabel* pUILabel = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_Fail"));
        pUILabel->setVisible(true);
 
        return;
    }

    int statusCode = response->getResponseCode();
    char statusString[64] = {};
    sprintf(statusString, "HTTP Status Code: %d, tag = %s", statusCode, response->getHttpRequest()->getTag());
    CCLog("response code: %d", statusCode);
    
    if (!response->isSucceed()) 
    {
        UILabel* pUILabel = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_Fail"));
        pUILabel->setVisible(true);
 
        return;
    }
    
    // Success!

    // Enter next UI page
    UIWidget* pUIWidget = UiManager::Singleton().GetChildByName("Panel_Login");
    pUIWidget->setVisible(false);
    EnableTextField(false);
    pUIWidget = UiManager::Singleton().GetChildByName("Panel_LoginConfirm");
    pUIWidget->setVisible(true);
    UILabel* pUILabel = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_Fail"));
    pUILabel->setVisible(false);

    // Dump data
    std::vector<char> *buffer = response->getResponseData();
    std::string bufferStr(buffer->begin(),buffer->end());

    // Display the memberId and name.
    cJSON* json;
    json = cJSON_Parse(bufferStr.c_str());
    if (json) 
    {
        cJSON* memberIdJSON = cJSON_GetObjectItem(json, "member_id");
        if (memberIdJSON)
        {
            UILabel* pUILabel = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_NumberValue"));
            pUILabel->setText(memberIdJSON->valuestring);
        }
        cJSON* nameJSON = cJSON_GetObjectItem(json, "name");
        if (nameJSON)
        {
            UILabel* pUILabel = DynamicCast<UILabel*>(UiManager::Singleton().GetChildByName("Label_NameValue"));
            pUILabel->setText(nameJSON->valuestring);

            // Save clinic name
            GameData::Singleton().SetClinicName(std::string(nameJSON->valuestring));
        }
        cJSON* homePageJSON = cJSON_GetObjectItem(json, "homepage");
        if (homePageJSON)
        {
            // Save homepage Url
            GameData::Singleton().SetHomePageUrl(std::string(homePageJSON->valuestring));
        }
        cJSON* mapPathJSON = cJSON_GetObjectItem(json, "map");
        if (mapPathJSON)
        {
            // Save mapPath
            GameData::Singleton().SetMapPath(std::string(mapPathJSON->valuestring));
        }
    }

}
Exemple #11
0
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);
            }
        }
    }
}