Client LuaCsForBarotrauma
NetworkConnection.cs
1 using System;
2 
3 namespace Barotrauma.Networking
4 {
6  {
7  Connected = 0x1,
8  Disconnected = 0x2
9  }
10 
11  abstract class NetworkConnection<T> : NetworkConnection where T : Endpoint
12  {
13  protected NetworkConnection(T endpoint) : base(endpoint) { }
14 
15  public new T Endpoint => (base.Endpoint as T)!;
16  }
17 
18  abstract class NetworkConnection
19  {
20  public const double TimeoutThreshold = 60.0; //full minute for timeout because loading screens can take quite a while
21  public const double TimeoutThresholdInGame = 10.0;
22 
23  public AccountInfo AccountInfo { get; private set; } = AccountInfo.None;
24 
25  public readonly Endpoint Endpoint;
26 
27  [Obsolete("TODO: this doesn't belong in layer 1")]
29  {
30  get; set;
31  }
32 
33  protected NetworkConnection(Endpoint endpoint)
34  {
35  Endpoint = endpoint;
36  }
37 
38  public bool EndpointMatches(Endpoint endPoint)
39  => Endpoint == endPoint;
40 
42 
43  public void SetAccountInfo(AccountInfo newInfo)
44  {
45  if (AccountInfo.IsNone) { AccountInfo = newInfo; }
46  }
47 
48  public sealed override string ToString()
50  }
51 }
abstract string StringRepresentation
Definition: Endpoint.cs:7
sealed override string ToString()
void SetAccountInfo(AccountInfo newInfo)
bool EndpointMatches(Endpoint endPoint)
static readonly AccountInfo None
Definition: AccountInfo.cs:10