public void handleJoinTournament(IIncommingMessage rawMsg) { PreGameJoinRequest msg = rawMsg.Deserialize <PreGameJoinRequest>(); if (currentPreTournaments.ContainsKey(msg.roomID) == false) { Debug.LogError("Tried to join tournament " + msg.roomID + ", but no such tournament exist"); rawMsg.Respond("Game does not exist", ResponseStatus.Error); return; } PreTournamentGame tournament = currentPreTournaments[msg.roomID]; if (tournament.addPlayer(rawMsg.Peer, msg.joiningPlayer)) { rawMsg.Respond(msg.roomID, ResponseStatus.Success); addPlayerToPeerToTournaments(rawMsg.Peer, tournament); //Debug.LogError("Adding player: " + rawMsg.Peer.Id + " to tournament: " + tournament.getRoomID()); } else { rawMsg.Respond("Could not join game", ResponseStatus.Failed); } }
public void joinPreGame(GameInfoType roomType, string roomID) { PreGameJoinRequest joinRequest = getJoinRequest(roomType, roomID); if (roomType == GameInfoType.PreGame) { Msf.Connection.SendMessage((short)ServerCommProtocl.RequestJoinPreGame, joinRequest, handleJoinPreGameMsg); } else if (roomType == GameInfoType.PreTournament) { Msf.Connection.SendMessage((short)CustomMasterServerMSG.joinTournament, joinRequest, CurrentTournament.handleJoinedTournament); } }