public static IEnumerator Run(Connection connection) { if (connection.active && !connection.rejected) { connection.authStatus = string.Empty; EACServer.OnJoinGame(connection); while (connection.active && !connection.rejected && connection.authStatus == string.Empty) { yield return(null); } } }
public static IEnumerator Run(Connection connection) { if (connection.active != null && connection.rejected == null) { connection.authStatus = (__Null)string.Empty; EACServer.OnJoinGame(connection); while (connection.active != null && connection.rejected == null && (string)connection.authStatus == string.Empty) { yield return((object)null); } } }
public void OnNewConnection(Connection connection) { try { if (BaseServer.connections.Count <= 1) { ConsoleSystem.Log($"[VirtualServer]: Есть новое подключение [{BaseServer.connections[0].ipaddress}]"); ConsoleSystem.Log($"[VirtualServer]: Подключаемся к игровому серверу [{Settings.TargetServer_IP}:{Settings.TargetServer_Port}]"); if (BaseClient.Connect(Settings.TargetServer_IP, Settings.TargetServer_Port)) { BaseClient.Connection.ipaddress = "127.0.0.1"; BaseClient.Connection.userid = Settings.Connection1_SteamID; BaseClient.Connection.ownerid = Settings.Connection1_SteamID; BaseClient.Connection.username = Settings.Connection1_Username; BaseClient.Connection.authLevel = 1; EACServer.OnJoinGame(BaseClient.Connection); //EACServer.OnStartLoading(BaseClient.Connection); //EACServer.OnFinishLoading(BaseClient.Connection); BaseServer.connections[0].ipaddress = "127.0.0.1"; BaseServer.connections[0].userid = Settings.Connection2_SteamID; BaseServer.connections[0].ownerid = Settings.Connection2_SteamID; BaseServer.connections[0].username = Settings.Connection2_Username; BaseServer.connections[0].authLevel = 1; EACServer.OnJoinGame(BaseServer.connections[0]); //EACServer.OnStartLoading(BaseServer.connections[0]); //EACServer.OnFinishLoading(BaseServer.connections[0]); ConsoleSystem.Log("[VirtualServer]: Инициализация подключения успешно завершена!"); } else { ConsoleSystem.LogError($"[VirtualServer]: В попытке подключения отказано!"); } } else { ConsoleSystem.LogError($"[VirtualServer]: Уже есть одно подключение, больше подключений не может быть!"); } } catch (Exception ex) { ConsoleSystem.LogError("[VirtualServer]: Исключение в OnNewConnection(): " + ex.Message); } }