public static MyMultiplayerHostResult HostLobby(LobbyTypeEnum lobbyType, int maxPlayers, MySyncLayer syncLayer) { System.Diagnostics.Debug.Assert(syncLayer != null); MyTrace.Send(TraceWindow.Multiplayer, "Host game"); MyMultiplayerHostResult ret = new MyMultiplayerHostResult(); #if !XB1 SteamSDK.Lobby.Create(lobbyType, maxPlayers, (lobby, result) => { if (!ret.Cancelled) { if (result == Result.OK && lobby.GetOwner() != Sync.MyId) { result = Result.Fail; lobby.Leave(); } MyTrace.Send(TraceWindow.Multiplayer, "Lobby created"); lobby.SetLobbyType(lobbyType); ret.RaiseDone(result, result == Result.OK ? MyMultiplayer.Static = new MyMultiplayerLobby(lobby, syncLayer) : null); } }); #endif return(ret); }
public static MyMultiplayerHostResult HostLobby(MyLobbyType lobbyType, int maxPlayers, MySyncLayer syncLayer) { MyMultiplayerHostResult ret = new MyMultiplayerHostResult(); MyGameService.CreateLobby(lobbyType, (uint)maxPlayers, delegate(IMyLobby lobby, bool succes, string msg) { if (!ret.Cancelled) { if (succes && (lobby.OwnerId != Sync.MyId)) { succes = false; lobby.Leave(); } lobby.LobbyType = lobbyType; MyMultiplayerBase multiplayer = null; if (succes) { MyMultiplayerLobby lobby1 = new MyMultiplayerLobby(lobby, syncLayer); Static = lobby1; multiplayer = lobby1; multiplayer.ExperimentalMode = true; } ret.RaiseDone(succes, msg, multiplayer); } }); return(ret); }
public static MyMultiplayerHostResult HostLobby(LobbyTypeEnum lobbyType, int maxPlayers, MySyncLayer syncLayer) { System.Diagnostics.Debug.Assert(syncLayer != null); MyTrace.Send(TraceWindow.Multiplayer, "Host game"); MyMultiplayerHostResult ret = new MyMultiplayerHostResult(); SteamSDK.Lobby.Create(lobbyType, maxPlayers, (lobby, result) => { if (!ret.Cancelled) { if (result == Result.OK && lobby.GetOwner() != MySteam.UserId) { result = Result.Fail; lobby.Leave(); } MyTrace.Send(TraceWindow.Multiplayer, "Lobby created"); lobby.SetLobbyType(lobbyType); ret.RaiseDone(result, result == Result.OK ? MyMultiplayer.Static = new MyMultiplayerLobby(lobby, syncLayer) : null); } }); return ret; }