3using System.Collections.Generic;
11 public class Player : IEnumerable<KeyValuePair<string, string>>
13 private int index = -1;
14 private Guid playerId;
15 private IPEndPoint publicEndpoint;
16 private IPEndPoint localEndpoint;
17 private readonly Dictionary<string, string> playerMetaInfo;
25 this.playerMetaInfo =
new Dictionary<string, string>();
27 foreach (KeyValuePair<string, string> P
in PlayerMetaInfo)
28 this.playerMetaInfo[P.Key] = P.Value;
37 internal set => this.index = value;
63 if (IPAddress.Equals(
this.publicEndpoint.Address, Network.
ExternalAddress))
64 return this.localEndpoint;
66 return this.publicEndpoint;
74 get {
return this.playerMetaInfo.Count; }
83 return this.playerMetaInfo.GetEnumerator();
90 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
92 return this.playerMetaInfo.GetEnumerator();
100 public string this[
string Key]
104 if (this.playerMetaInfo.TryGetValue(Key, out
string Value))
116 get => this.connection;
117 internal set => this.connection = value;
123 StringBuilder sb =
null;
125 foreach (KeyValuePair<string, string> P
in this.playerMetaInfo)
129 sb =
new StringBuilder(this.publicEndpoint.ToString());
141 return base.ToString();
143 return sb.ToString();
IPAddress ExternalAddress
External IP Address.
Maintains a peer connection
Manages a peer-to-peer network that can receive connections from outside of a NAT-enabled firewall.
Class containing information about a player.
int Count
Number of meta information tags.
override string ToString()
PeerConnection Connection
Peer connection, if any.
IPEndPoint LocalEndpoint
Local Endpoint
IPEndPoint PublicEndpoint
Public Endpoint
IEnumerator< KeyValuePair< string, string > > GetEnumerator()
Gets an enumerator for player meta information.