// ルームへ参加出来るか public bool CheckJoinTheRoom(string roomName) { m_LastErrorType = NetworkDefines.RoomErrorType.None; bool result = true; bool isExist = false; foreach (var roomData in MonobitEngine.MonobitNetwork.GetRoomData()) { if (roomData.name != roomName) { continue; } isExist = true; if (roomData.playerCount >= NetworkDefines.MaxNumRoomPlayers) { m_LastErrorType = NetworkDefines.RoomErrorType.Crowded_Room; result = false; } break; } if (isExist == false) { m_LastErrorType = NetworkDefines.RoomErrorType.Not_Exist_Room; } LogError(); return(result); }
// ルーム作成 public bool CreateRoom(string roomName) { bool result = true; m_LastErrorType = NetworkDefines.RoomErrorType.None; do { if (MonobitEngine.MonobitNetwork.inRoom) { result = false; m_LastErrorType = NetworkDefines.RoomErrorType.Already_Join_Room; break; } MonobitEngine.RoomSettings roomSettings = new MonobitEngine.RoomSettings { isVisible = true, isOpen = true, maxPlayers = NetworkDefines.MaxNumRoomPlayers, roomParameters = null, lobbyParameters = new string[] {} }; if (MonobitEngine.MonobitNetwork.CreateRoom(roomName, roomSettings, null) == false) { result = false; m_LastErrorType = NetworkDefines.RoomErrorType.Failed_Create_Room; break; } }while (false); LogError(); return(result); }