Beispiel #1
0
 /*********
 ** Public methods
 *********/
 /// <summary>Construct an instance.</summary>
 /// <param name="playerID">The player's unique ID.</param>
 /// <param name="model">The metadata to copy.</param>
 /// <param name="server">The server through which to send messages.</param>
 /// <param name="serverConnection">The server connection through which to send messages.</param>
 /// <param name="client">The client through which to send messages.</param>
 /// <param name="isHost">Whether this is a connection to the host player.</param>
 public MultiplayerPeer(long playerID, RemoteContextModel model, SLidgrenServer server, NetConnection serverConnection, SLidgrenClient client, bool isHost)
 {
     this.PlayerID = playerID;
     this.IsHost   = isHost;
     if (model != null)
     {
         this.Platform    = model.Platform;
         this.GameVersion = model.GameVersion;
         this.ApiVersion  = model.ApiVersion;
         this.Mods        = model.Mods.Select(mod => new MultiplayerPeerMod(mod)).ToArray();
     }
     this.Server           = server;
     this.ServerConnection = serverConnection;
     this.Client           = client;
 }
Beispiel #2
0
 /// <summary>Construct an instance for a connection to an incoming farmhand.</summary>
 /// <param name="playerID">The player's unique ID.</param>
 /// <param name="model">The metadata to copy, if available.</param>
 /// <param name="server">The server through which to send messages.</param>
 /// <param name="serverConnection">The server connection through which to send messages.</param>
 public static MultiplayerPeer ForConnectionToFarmhand(long playerID, RemoteContextModel model, SLidgrenServer server, NetConnection serverConnection)
 {
     return(new MultiplayerPeer(
                playerID: playerID,
                model: model,
                server: server,
                serverConnection: serverConnection,
                client: null,
                isHost: false
                ));
 }