コード例 #1
0
std::vector<EziFacebookFriend*> buildFriendsArray(std::string data)
{
    std::vector<EziFacebookFriend*> resultArray;
    std::vector< std::string > strings = EziSocialObject::tokenizeStr( data, ";");
    EziFacebookFriend* fbFriend = NULL;//EziFacebookFriend::create();
    
    for (int i = 1; i < strings.size(); i += 2)
    {
        if ( i > 1 && strings[i-1] == strings[0] )
        {
            if (fbFriend)
                resultArray.push_back(fbFriend);
            fbFriend = NULL;
        }
        
        if ( fbFriend == NULL )
            fbFriend = EziFacebookFriend::create("");
        
        fbFriend->saveData(strings[i].c_str(), strings[i-1].c_str());
        //tempDictionary->setObject(cocos2d::CCString::createWithFormat("%s", strings[i].c_str(), NULL), strings[i-1].c_str());
    
    }
    
    if (fbFriend)
    {
        resultArray.push_back(fbFriend);
    }
    
    return resultArray;
}
コード例 #2
0
void FriendListScene::fbUserPhotoCallback(const char *userPhotoPath, const char* fbID)
{
    if (_friendDictionary.size() == 0)
    {
        return;
    }
    
    EziFacebookFriend* myFriend = _friendDictionary.at(fbID);
    
    if (myFriend)
    {
        myFriend->saveData(userPhotoPath, "photo");        
        CCLOG("Downloaded photo for = %s", myFriend->getName().c_str());
    }
    else
    {
        CCLOG("Friend with ID = %s not found.", fbID);
    }
    
    _downloadCount++;
    if (_downloadCount == _friendList.size())
    {
        // this is the last we fetched. We can refresh the table view now.
        CCLOG("Download completed...");
        _tableView->reloadData();
    }
    
}