public override NCError OnHostServer( string identifier, int port, NetworkLobbyType lobbyType, int maxConnections) { foreach (Lobby activeLobby in this._activeLobbies) { Steam.LeaveLobby(activeLobby); DevConsole.Log(DCSection.Steam, "|DGYELLOW|Leaving lobby to host new lobby."); } this._lobby = (Lobby)null; if (this._lobby != null) { return(new NCError("Server is already started...", NCErrorType.Error)); } this.HookUpDelegates(); this._initializedSettings = false; this._lobby = Steam.CreateLobby((SteamLobbyType)lobbyType, maxConnections); this._activeLobbies.Add(this._lobby); if (this._lobby == null) { return(new NCError("|DGORANGE|STEAM |DGRED|Steam is not running.", NCErrorType.Error)); } this._userChange = new Lobby.UserStatusChangeDelegate(this.OnUserStatusChange); this._lobby.UserStatusChange += this._userChange; this._serverIdentifier = identifier; this._port = port; this.StartServerThread(); return(new NCError("|DGORANGE|STEAM |DGYELLOW|Attempting to create server lobby...", NCErrorType.Message)); }
public override NCError OnJoinServer(string identifier, int port, string ip) { foreach (Lobby activeLobby in this._activeLobbies) { Steam.LeaveLobby(activeLobby); DevConsole.Log(DCSection.Steam, "|DGYELLOW|Leaving lobby to join."); } this._lobby = (Lobby)null; if (this._lobby != null) { return(new NCError("Client is already started...", NCErrorType.Error)); } this.HookUpDelegates(); this._serverIdentifier = identifier; this._lobby = Steam.JoinLobby(Convert.ToUInt64(identifier)); this._activeLobbies.Add(this._lobby); if (this._lobby == null) { return(new NCError("Steam is not running.", NCErrorType.Error)); } this._userChange = new Lobby.UserStatusChangeDelegate(this.OnUserStatusChange); this._lobby.UserStatusChange += this._userChange; this._port = port; this.StartClientThread(); return(new NCError("|DGORANGE|STEAM |DGGREEN|Connecting to lobbyID " + identifier + ".", NCErrorType.Message)); }