我用这段代码加入了光子中的一个房间:
TypedLobby sqlLobby = new TypedLobby(GAME_LOBBY_NAME, LobbyType.SqlLobby);
string sqlLobbyFilter = string.Format("L = {0}" , 8);
PhotonNetwork.JoinRandomRoom(null, 2, MatchmakingMode.FillRoom, sqlLobby, sqlLobbyFilter);
和这个代码来创建一个房间:
RoomOptions newRoomOptions = new RoomOptions();
newRoomOptions.isOpen = true;
newRoomOptions.isVisible = true;
newRoomOptions.maxPlayers = 2;
// L is League
newRoomOptions.customRoomPropertiesForLobby = new string[] { "L" };
newRoomOptions.customRoomProperties = new ExitGames.Client.Photon.Hashtable() { { "L", 8 } };
TypedLobby sqlLobby = new TypedLobby(GAME_LOBBY_NAME, LobbyType.SqlLobby);
PhotonNetwork.CreateRoom(null, newRoomOptions, sqlLobby);
我从 Photon 文档https://doc.photonengine.com/en/pun/current/tutorials/matchmaking-and-lobby中获得此代码, 但这会引发异常:
Operation failed: OperationResponse 225: ReturnCode: -2 (SQL logic error or missing database
no such column: L). Parameters: {} Server: MasterServer
谢谢。