private NetGame(NetRole role, NetPeerConfiguration config, INetDataMessageHandler handler, Action <NetPeer> connect) { Role = role; _handler = handler; _connect = connect; Net = new NetServer(config); }
public static NetGame CreateClient(string appId, string host, int port, INetDataMessageHandler handler) { return(new NetGame(NetRole.Client, new NetPeerConfiguration(appId), handler, connect: net => { net.Start(); net.Connect(host, port); Event.Publish(new Connected(new Connection($"{host}:{port}", port))); })); }
public static NetGame CreateHost(string appId, int port, INetDataMessageHandler handler) { return(new NetGame(NetRole.Host, new NetPeerConfiguration(appId) { Port = port }, handler, connect: net => { net.Start(); })); }