How do I Rejoin a Lobby after joining room (Cocos2d-x)?

0 votes

I feel like this should be a fairly straight forward process, but I must be missing something.  When I try to look up the available rooms after joining one, onGetMatchedRoomsDone is never called. 

In my appwarpdelegate, I call

void CCAppwarpDelegate::onConnectDone(int res)
{
    boo_isconnected=true;
    if (res==AppWarp::ResultCode::success)
    {
        CCLog("\nonConnectDone .. SUCCESS..session=%d\n",AppWarp::AppWarpSessionID);
        onConnected();
        joinLobby();
    }

}

void CCAppwarpDelegate::joinLobby()
{
    
    CCLog("in joinlobby");
    std::map<std::string,std::string> properties;
    properties["closed"]="false";

    AppWarp::Client::getInstance()->joinLobby();
    AppWarp::Client::getInstance()->subscribeLobby();
    AppWarp::Client::getInstance()->getRoomWithProperties(properties);
}

This code works fine when I'm first connecting, but if I actually join a room with

void HelloWorld::onJoinRoomClicked(cocos2d::CCObject *pObj)
{   
    roomId = roomIds.at(tag).c_str();
    joinRoom(roomId);
    roomIds.clear();
}

and leave the room with:

void HelloWorld::QuitGame()
{
    joinLobby();

}

onGetMatchedRoomsDone never gets called and my list of available rooms is never populated.  What am I doing wrong?

asked Feb 22, 2014 in AppWarp by PhilipJFry (36 points)
edited Feb 22, 2014 by PhilipJFry

2 Answers

+1 vote
 
Best answer

Finally figured out what was going on.  When I call the popup menu that allows the user to enter the lobby, I have

CCDirector::sharedDirector()->pause();

This was a left over artifact from single player mode and is responsible for why the match making code never fired. 

answered Feb 22, 2014 by PhilipJFry (36 points)
Great! good to know your issue is resolved :)
0 votes
We tested this scenario and it works fine. Can you check if

your zoneRequestListener is getting reset somewhere?
answered Feb 22, 2014 by dhruvc (1,099 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...