Created
August 27, 2013 11:35
-
-
Save TokyoDan/6352445 to your computer and use it in GitHub Desktop.
onGetAllRoomsDone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onGetAllRoomsDone (AllRoomsEvent eventObj) | |
{ | |
//Log ("onGetAllRoomsDone : " + eventObj.getResult()); | |
byte rslt = eventObj.getResult(); | |
if(rslt == 0) | |
{ | |
string[] roomIds = eventObj.getRoomIds(); | |
if( roomIds.Length == 1 ) | |
{ | |
TOTlog("2 onGetAllRoomsDone because you called GetAllRooms(): Only default room so we are creating a new one"); | |
Dictionary<string, object> roomProps = new Dictionary<string, object>(); | |
roomProps.Add("Blue", "empty"); | |
roomProps.Add("Red", "empty"); | |
roomProps.Add("Green", "empty"); | |
roomProps.Add("Orange", "empty"); | |
int reqNumOfPlyrs = TOTmatch.reqNumberOfPlayers; | |
// int reqNumOfPlyrs = GameObject.Find("StartupTOT").GetComponent<TOTmatch>().reqNumberOfPlayers; | |
TOTlog("2 onGetAllRoomsDone: creating a room with " + reqNumOfPlyrs + " players"); | |
// CreateRoom() will cause onCreateRoomDone() to be called in which we will | |
// SubscribeRoom() which will cause onSubscribeRoomDone() to be called in which we will JoinRoom().. | |
WarpClient.GetInstance().CreateRoom(TOTmatchMaker.aRoomRandomName, TOTmatchMaker.myUserName, reqNumOfPlyrs, roomProps); | |
} | |
else | |
{ | |
// Don't subscribe to default static romm = roomIds[0]. Join the 2nd room. | |
TOTlog("2 onGetAllRoomsDone because you called GetAllRooms(): Got not-default room ID " + roomIds[1] + " so we are subscribing to it"); | |
// SubscribeRoom() will cause onSubscribeRoomDone() to be called in which we will JoinRoom(). | |
WarpClient.GetInstance().SubscribeRoom(roomIds[1]); | |
} | |
} | |
else | |
{ | |
TOTlog("2 onGetAllRoomsDone (because you called GetAllRooms). Request Failure: " + rslt); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onGetMatchedRoomsDone(MatchedRoomsEvent eventObj) | |
{ | |
byte rslt = eventObj.getResult(); | |
if (rslt == WarpResponseResultCode.SUCCESS) | |
{ | |
TOTlog("GetMatchedRooms event received with success status"); | |
foreach (var roomData in eventObj.getRoomsData()) | |
{ | |
TOTlog("Room ID:" + roomData.getId()); | |
} | |
} | |
else | |
{ | |
TOTlog("GetMatchedRooms event received with failed status: " + rslt); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment