public static LegacyClient CreateClient(FizzySteamworks 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); try { #if UNITY_SERVER InteropHelp.TestIfAvailableGameServer(); #else InteropHelp.TestIfAvailableClient(); #endif c.Connect(host); } catch { Debug.LogError("SteamWorks not initialized."); c.OnConnectionFailed(CSteamID.Nil); } return(c); }
public static NextClient CreateClient(FizzySteamworks transport, string host) { NextClient c = new NextClient(transport); c.OnConnected += () => transport.OnClientConnected.Invoke(); c.OnDisconnected += () => transport.OnClientDisconnected.Invoke(); c.OnReceivedData += (data, ch) => transport.OnClientDataReceived.Invoke(new ArraySegment <byte>(data), ch); try { #if UNITY_SERVER SteamGameServerNetworkingUtils.InitRelayNetworkAccess(); #else SteamNetworkingUtils.InitRelayNetworkAccess(); #endif c.Connect(host); } catch (Exception ex) { Debug.LogException(ex); c.OnConnectionFailed(); } return(c); }
public static NextServer CreateServer(FizzySteamworks transport, int maxConnections) { NextServer s = new NextServer(maxConnections); s.OnConnected += (id) => transport.OnServerConnected.Invoke(id); s.OnDisconnected += (id) => transport.OnServerDisconnected.Invoke(id); s.OnReceivedData += (id, data, ch) => transport.OnServerDataReceived.Invoke(id, new ArraySegment <byte>(data), ch); s.OnReceivedError += (id, exception) => transport.OnServerError.Invoke(id, exception); try { #if UNITY_SERVER SteamGameServerNetworkingUtils.InitRelayNetworkAccess(); #else SteamNetworkingUtils.InitRelayNetworkAccess(); #endif } catch (Exception ex) { Debug.LogException(ex); } s.Host(); return(s); }
protected Common(FizzySteamworks transport) { channels = transport.Channels; callback_OnNewConnection = Callback <P2PSessionRequest_t> .Create(OnNewConnection); callback_OnConnectFail = Callback <P2PSessionConnectFail_t> .Create(OnConnectFail); this.transport = transport; }
public static LegacyServer CreateServer(FizzySteamworks 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); if (!SteamManager.Initialized) { Debug.LogError("SteamWorks not initialized."); } return(s); }
public static NextClient CreateClient(FizzySteamworks transport, string host) { NextClient c = new NextClient(transport); c.OnConnected += () => transport.OnClientConnected.Invoke(); c.OnDisconnected += () => transport.OnClientDisconnected.Invoke(); c.OnReceivedData += (data, ch) => transport.OnClientDataReceived.Invoke(new ArraySegment <byte>(data), ch); if (SteamManager.Initialized) { c.Connect(host); } else { Debug.LogError("SteamWorks not initialized"); c.OnConnectionFailed(); } return(c); }
public static LegacyServer CreateServer(FizzySteamworks 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); try { #if UNITY_SERVER InteropHelp.TestIfAvailableGameServer(); #else InteropHelp.TestIfAvailableClient(); #endif } catch { Debug.LogError("SteamWorks not initialized."); } return(s); }
private LegacyClient(FizzySteamworks transport) : base(transport) { ConnectionTimeout = TimeSpan.FromSeconds(Math.Max(1, transport.Timeout)); }
private NextClient(FizzySteamworks transport) { ConnectionTimeout = TimeSpan.FromSeconds(Math.Max(1, transport.Timeout)); BufferedData = new List <Action>(); }
private LegacyServer(FizzySteamworks transport, int maxConnections) : base(transport) { this.maxConnections = maxConnections; steamToMirrorIds = new BidirectionalDictionary <CSteamID, int>(); nextConnectionID = 1; }