protected Common(FizzySteamyMirror transport) { Debug.Assert(transport.Channels.Length < 100, "FizzySteamyMirror does not support more than 99 channels."); this.channels = transport.Channels; callback_OnNewConnection = Callback <P2PSessionRequest_t> .Create(OnNewConnection); callback_OnConnectFail = Callback <P2PSessionConnectFail_t> .Create(OnConnectFail); }
protected Common(FizzySteamyMirror transport) { channels = transport.Channels; callback_OnNewConnection = Callback <P2PSessionRequest_t> .Create(OnNewConnection); callback_OnConnectFail = Callback <P2PSessionConnectFail_t> .Create(OnConnectFail); this.transport = transport; }
public static Server CreateServer(FizzySteamyMirror transport, int maxConnections) { Server s = new Server(transport, maxConnections); s.OnConnected += (id) => transport.OnServerConnected?.Invoke(id); s.OnDisconnected += (id) => transport.OnServerDisconnected?.Invoke(id); s.OnReceivedData += (id, data, channel) => transport.OnServerDataReceived?.Invoke(id, new ArraySegment <byte>(data), channel); s.OnReceivedError += (id, exception) => transport.OnServerError?.Invoke(id, exception); if (!SteamManager.Initialized) { Debug.LogError("SteamWorks not initialized"); } return(s); }
public static Client CreateClient(FizzySteamyMirror transport, string host) { Client c = new Client(transport); c.OnConnected += () => transport.OnClientConnected?.Invoke(); c.OnDisconnected += () => transport.OnClientDisconnected?.Invoke(); c.OnReceivedData += (data, channel) => transport.OnClientDataReceived?.Invoke(new ArraySegment <byte>(data), channel); c.OnReceivedError += (exception) => transport.OnClientError?.Invoke(exception); if (SteamManager.Initialized) { c.Connect(host); } else { Debug.LogError("SteamWorks not initialized"); } return(c); }
private Server(FizzySteamyMirror transport, int maxConnections) : base(transport) { this.maxConnections = maxConnections; steamToMirrorIds = new BidirectionalDictionary <CSteamID, int>(); nextConnectionID = 1; }
private Client(FizzySteamyMirror transport) : base(transport) { ConnectionTimeout = TimeSpan.FromSeconds(Math.Max(1, transport.Timeout)); }