Hi guys!
Need help please. In my game I have two game modes Arcade and tournaments. I want to make JoinRandomRoom with criteria for Tournaments and Arcade. I have this code for Join a arcade mode.
private void DoMatchmake()
{
LogInfo(() => FormatLogMessage("JUMP.Matchmake"));
if (joinOrCreatingRoom)
{
LogInfo(() => FormatLogMessage("Already matchmaking, returning "));
return;
}
else
{
// Now ging straight to join a room, no more lobby
LogDebug(() => FormatLogMessage("Matchmaking trying to join a random room."));
joinOrCreatingRoom = true;
ExitGames.Client.Photon.Hashtable roomTournament = new ExitGames.Client.Photon.Hashtable() { { "Tournament", false } };
PhotonNetwork.JoinRandomRoom(roomTournament,0);
}
}
And this for Tournament:
private void DoTournament()
{
LogInfo(() => FormatLogMessage("JUMP.Matchmake"));
if (joinOrCreatingRoom)
{
LogInfo(() => FormatLogMessage("Already matchmaking, returning "));
return;
}
else
{
// Now ging straight to join a room, no more lobby
LogDebug(() => FormatLogMessage("Matchmaking trying to join a random room."));
joinOrCreatingRoom = true;
ExitGames.Client.Photon.Hashtable roomTournament = new ExitGames.Client.Photon.Hashtable() { { "level",levelToPlay}, { "Tournament", true } };
PhotonNetwork.JoinRandomRoom(roomTournament, 0);
}
}
Also have this for when failed:
public override void OnPhotonRandomJoinFailed(object[] codeAndMsg)
{
LogInfo(() => FormatLogMessage("Photon.OnPhotonRandomJoinFailed: {0}, {1}.", codeAndMsg[0], codeAndMsg[1]));
if (Stage == Stages.Master)
{
LogDebug(() => FormatLogMessage("We could not join a room, let's create one and wait for players."));
joinOrCreatingRoom = true;
if (!GlobalContext.PlayTournament)
{
ExitGames.Client.Photon.Hashtable tournamentPropierties = new ExitGames.Client.Photon.Hashtable() { { "level", GlobalContext.SelectedLevel() }, {"tournament",false } };
string[] lobbyProperties = { "level", "tournament" };
RoomOptions opt = new RoomOptions();
opt.MaxPlayers = JUMPOptions.NumPlayers;
opt.IsOpen = true;
opt.IsVisible = true;
opt.CustomRoomPropertiesForLobby = lobbyProperties;
opt.CustomRoomProperties = tournamentPropierties;
PhotonNetwork.CreateRoom(null, opt, null);
}else
{
ExitGames.Client.Photon.Hashtable tournamentPropierties = new ExitGames.Client.Photon.Hashtable() { { "level", levelToPlay }, { "tournament", true } };
string[] lobbyProperties = {"level","tournament"};
RoomOptions opt = new RoomOptions();
opt.MaxPlayers = JUMPOptions.NumPlayers;
opt.IsOpen = true;
opt.IsVisible = true;
opt.CustomRoomPropertiesForLobby = lobbyProperties;
opt.CustomRoomProperties = tournamentPropierties;
PhotonNetwork.CreateRoom(null, opt, null);
}
}
}
Any help this code not working?