c# - 无法连接到一个房间
问题描述
房间设置都是一样的,为什么每次已经创建了房间,玩家却没有连接,而是创建了一个新房间?我收到此警告:操作失败:OperationResponse 225:ReturnCode:32760(未找到匹配项)。参数: {}
public void StartMatchMaking(){
Debug.LogError(CreateRoomProperties());
PhotonNetwork.JoinRandomRoom(CreateRoomProperties(), 4);
}
ExitGames.Client.Photon.Hashtable CreateRoomProperties()
{
return new ExitGames.Client.Photon.Hashtable
{
{"bet", bet}
};
}
private void OnPhotonRandomJoinFailed(object[] codeAndMsg)
{
CreateRoom();
}
public void CreateRoom(){
ExitGames.Client.Photon.Hashtable ht = new ExitGames.Client.Photon.Hashtable();
RoomOptions ro = new RoomOptions();
ht.Add("bet", bet);
ro.CustomRoomProperties = ht;
Debug.LogError(ro.CustomRoomProperties);
PhotonNetwork.CreateRoom(""+PhotonNetwork.player.NickName, ro, TypedLobby.Default);
}
void OnPhotonPlayerConnected(PhotonPlayer otherPlayer)
{
Debug.Log("New player: " + otherPlayer.NickName);
}
解决方案
需要将属性添加到房间设置
customRoomPropertiesForLobby = CreateRoomPropertiesForLobby();
string[] CreateRoomPropertiesForLobby()
{
return new string[]
{
"bet"
};
}
推荐阅读
- anylogic - AnyLogic中“代理”类型参数的访问值
- git - 有没有办法使用逻辑 AND 在 GitHub 操作中组合推送标准?
- r - R - 根据条件启动和重置 R 中的计数列
- python - Jupyter 不会从 Windows10 上的 Anaconda3 启动
- python - Anaconda 应用程序未在我的 PC 中打开
- c - 如何用 C 制作交互式菜单?
- javascript - 来自 momentjs 的函数 fromNow() 和 toNow() 无法按预期工作
- python - 在时间戳边界之间填充 Pandas 列
- react-native - React Native(Android):找不到屏幕“Home”的“component”、“getComponent”或“children”道具
- javascript - 我不断收到关于 discord.js 中 .position 的错误