protected Common(FizzyFacepunch transport) { channels = transport.Channels; SteamNetworking.OnP2PSessionRequest += OnNewConnection; SteamNetworking.OnP2PConnectionFailed += OnConnectFail; this.transport = transport; }
public static Server CreateServer(FizzyFacepunch 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 (!SteamClient.IsValid) { Debug.LogError("SteamWorks not initialized"); } return(s); }
public static Client CreateClient(FizzyFacepunch 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 (SteamClient.IsValid) { c.Connect(host); } else { Debug.LogError("SteamWorks not initialized"); } return(c); }
public static LegacyClient CreateClient(FizzyFacepunch transport, string host) { LegacyClient c = new LegacyClient(transport); c.OnConnected += () => transport.OnClientConnected.Invoke(); c.OnDisconnected += () => transport.OnClientDisconnected.Invoke(); c.OnReceivedData += (data, channel) => transport.OnClientDataReceived.Invoke(new ArraySegment <byte>(data), channel); if (SteamClient.IsValid) { c.Connect(host); } else { Debug.LogError("SteamWorks not initialized."); c.OnConnectionFailed(new SteamId()); } return(c); }
public static LegacyServer CreateServer(FizzyFacepunch transport, int maxConnections) { LegacyServer s = new LegacyServer(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); SteamNetworking.OnP2PSessionRequest = (steamid) => { Debug.Log($"Incoming request from SteamId {steamid}."); SteamNetworking.AcceptP2PSessionWithUser(steamid); }; if (!SteamClient.IsValid) { Debug.LogError("SteamWorks not initialized."); } return(s); }
private LegacyServer(FizzyFacepunch transport, int maxConnections) : base(transport) { this.maxConnections = maxConnections; steamToMirrorIds = new BidirectionalDictionary <SteamId, int>(); nextConnectionID = 1; }
private Client(FizzyFacepunch transport) : base(transport) { ConnectionTimeout = TimeSpan.FromSeconds(Math.Max(1, transport.Timeout)); }
private NextClient(FizzyFacepunch transport) { ConnectionTimeout = TimeSpan.FromSeconds(Math.Max(1, transport.Timeout)); BufferedData = new List <Action>(); }
void Awake() { FFP = GameObject.FindWithTag("Information").GetComponent <Mirror.FizzySteam.FizzyFacepunch>(); OM = FFP.gameObject.GetComponent <OnlineManager>(); MM = GameObject.FindWithTag("Camera").GetComponent <MenuManager>(); }