OpJoinRandomRoom & room properties
Hi,
OpJoinRandomRoom does not work When I add room properties.I think I do not have to do something right, but I do not know what. If I don't add properties on OpJoinRandomRoom everything is working, but I want properties to filter relative to the level of the player ...
I use Unity
Here is the code to join
public void JoinRandomGame(int maxPlayer, int level)
{
roomMaxPlayer = maxPlayer;
roomLevel = level;
Hashtable props = new Hashtable();
props["level"] = roomLevel;
OpJoinRandomRoom(props ,(byte)maxPlayer);
// OpJoinRandomRoom(null,0); work well
}
Here is the code when no room found
public void CreateRoom()
{
string newRoomName = this.NickName + "-" + Random.Range(0, 1000).ToString("D4"); // for int, Random.Range is max-exclusive!
Debug.Log("Game will create: " + newRoomName);
Hashtable props = new Hashtable();
props["level"] = roomLevel;
RoomOptions roomOptions = new RoomOptions()
{
MaxPlayers = (byte)roomMaxPlayer,
CustomRoomProperties = props,
EmptyRoomTtl = 5000,
PlayerTtl = int.MaxValue
};
OpCreateRoom(newRoomName, roomOptions, TypedLobby.Default);
}
Thank you
OpJoinRandomRoom does not work When I add room properties.I think I do not have to do something right, but I do not know what. If I don't add properties on OpJoinRandomRoom everything is working, but I want properties to filter relative to the level of the player ...
I use Unity
Here is the code to join
public void JoinRandomGame(int maxPlayer, int level)
{
roomMaxPlayer = maxPlayer;
roomLevel = level;
Hashtable props = new Hashtable();
props["level"] = roomLevel;
OpJoinRandomRoom(props ,(byte)maxPlayer);
// OpJoinRandomRoom(null,0); work well
}
Here is the code when no room found
public void CreateRoom()
{
string newRoomName = this.NickName + "-" + Random.Range(0, 1000).ToString("D4"); // for int, Random.Range is max-exclusive!
Debug.Log("Game will create: " + newRoomName);
Hashtable props = new Hashtable();
props["level"] = roomLevel;
RoomOptions roomOptions = new RoomOptions()
{
MaxPlayers = (byte)roomMaxPlayer,
CustomRoomProperties = props,
EmptyRoomTtl = 5000,
PlayerTtl = int.MaxValue
};
OpCreateRoom(newRoomName, roomOptions, TypedLobby.Default);
}
Thank you
0
Comments
-
Ok, fixed.
0
This discussion has been closed.