public void LobbyReady(Guid scavengerId) { if (OnLobbyReady != null) { OnLobbyReady.Invoke(scavengerId); } }
public void Host(CSteamID selfSteamId, ELobbyType lobbyType, OnLobbyReady func = null) { if (Disposed) { throw new ObjectDisposedException("SteamP2PServer", "This object has been disposed and can not be used to connect, please use a new SteamP2PServer"); } try { Client = new CachedSteamP2PClient(selfSteamId); Me = new NetworkingPlayer(ServerPlayerCounter++, selfSteamId, true, this); Me.InstanceGuid = InstanceGuid.ToString(); m_CallbackLobbyCreated = Callback <LobbyCreated_t> .Create((LobbyCreated_t data) => { LobbyID = (CSteamID)data.m_ulSteamIDLobby; if (func != null) { func(); } }); m_CreateLobbyResult = SteamMatchmaking.CreateLobby(lobbyType, 5); // Do any generic initialization in result of the successful bind OnBindSuccessful(); // Create the thread that will be listening for new data from connected clients and start its execution Task.Queue(ReadClients); // Create the thread that will check for player timeouts Task.Queue(() => { commonServerLogic.CheckClientTimeout((player) => { Disconnect(player, true); OnPlayerTimeout(player); CleanupDisconnections(); }); }); //Let myself know I connected successfully OnPlayerConnected(Me); // Set myself as a connected client Me.Connected = true; StartAcceptingConnections(); } catch (Exception e) { Logging.BMSLog.LogException(e); // Do any generic initialization in result of the binding failure OnBindFailure(); throw new FailedBindingException("Failed to bind to host/port, see inner exception", e); } }
public void LobbyReady(Guid scavengerId) { OnLobbyReady?.Invoke(scavengerId); }