简体   繁体   English

如何将配对与光子配合使用?

[英]How To use Matchmaking with Photon?

i used this code to join a room in photon: 我使用此代码加入了光子中的一个房间:

TypedLobby sqlLobby = new TypedLobby(GAME_LOBBY_NAME, LobbyType.SqlLobby); 
string sqlLobbyFilter = string.Format("L = {0}" , 8); 
PhotonNetwork.JoinRandomRoom(null, 2, MatchmakingMode.FillRoom, sqlLobby, sqlLobbyFilter);

and this code to create a room : 和此代码创建一个房间:

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);

I get this code from Photon documentation https://doc.photonengine.com/en/pun/current/tutorials/matchmaking-and-lobby but this throws exceptions : 我从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

Thanks. 谢谢。

Use C0..C9 properties instead of L. 使用C0..C9属性而不是L。

from docs: Internally, SQL-lobbies list rooms in a SQLite table with up to 10 special "filtering-properties". 来自文档:在内部,SQL大厅在SQLite表中列出最多包含10个特殊“过滤属性”的房间。 Currently, the naming of those is fixed as: "C0", "C1" up to "C9". 当前,这些名称的固定为:“ C0”,“ C1”至“ C9”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM