コード例 #1
0
ファイル: NetworkEngine.cs プロジェクト: vvnurmi/assaultwing
 private void RemoveClosedConnections()
 {
     foreach (var connection in _removedClientConnections)
     {
         connection.Dispose();
         GameClientConnections.Remove(connection);
     }
     _removedClientConnections.Clear();
     if (_managementServerConnection != null && _managementServerConnection.IsDisposed)
         _managementServerConnection = null;
     if (GameServerConnection != null && GameServerConnection.IsDisposed)
         GameServerConnection = null;
     if (Game.DataEngine.Arena != null)
     {
         foreach (var conn in GameClientConnections)
             if (conn.IsDisposed)
                 foreach (var gob in Game.DataEngine.Arena.GobsInRelevantLayers)
                     gob.ClientStatus[1 << conn.ID] = false;
     }
     GameClientConnections.RemoveAll(c => c.IsDisposed);
 }
コード例 #2
0
ファイル: NetworkEngine.cs プロジェクト: vvnurmi/assaultwing
 /// <summary>
 /// Does nothing if a connection to the management server already exists.
 /// Otherwise, finds a management server and initialises <see cref="ManagementServerConnection"/>.
 /// May use DNS and take some time to finish. May throw <see cref="ArgumentException"/>.
 /// </summary>
 public void EnsureConnectionToManagementServer()
 {
     if (_managementServerConnection != null) return;
     var managementServerEndPoint = MiscHelper.ParseIPEndPoint(Game.Settings.Net.ManagementServerAddress);
     if (managementServerEndPoint.Port == 0)
         managementServerEndPoint.Port = MANAGEMENT_SERVER_PORT_DEFAULT;
     _managementServerConnection = new ManagementServerConnection(_game, managementServerEndPoint);
 }