mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-06 09:39:52 +00:00
fizzy OnTransportError
This commit is contained in:
parent
b0047c9047
commit
791e76601b
@ -34,6 +34,8 @@ namespace Mirror.FizzySteam
|
|||||||
[Tooltip("This will display your Steam User ID when you start or connect to a server.")]
|
[Tooltip("This will display your Steam User ID when you start or connect to a server.")]
|
||||||
public ulong SteamUserID;
|
public ulong SteamUserID;
|
||||||
|
|
||||||
|
public Action<string> OnTransportError;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
const string fileName = "steam_appid.txt";
|
const string fileName = "steam_appid.txt";
|
||||||
|
@ -18,6 +18,7 @@ namespace Mirror.FizzySteam
|
|||||||
private event Action<byte[], int> OnReceivedData;
|
private event Action<byte[], int> OnReceivedData;
|
||||||
private event Action OnConnected;
|
private event Action OnConnected;
|
||||||
private event Action OnDisconnected;
|
private event Action OnDisconnected;
|
||||||
|
private event Action<string> OnTransportError;
|
||||||
|
|
||||||
private CancellationTokenSource cancelToken;
|
private CancellationTokenSource cancelToken;
|
||||||
private TaskCompletionSource<Task> connectedComplete;
|
private TaskCompletionSource<Task> connectedComplete;
|
||||||
@ -39,6 +40,7 @@ namespace Mirror.FizzySteam
|
|||||||
c.OnConnected += () => transport.OnClientConnected.Invoke();
|
c.OnConnected += () => transport.OnClientConnected.Invoke();
|
||||||
c.OnDisconnected += () => transport.OnClientDisconnected.Invoke();
|
c.OnDisconnected += () => transport.OnClientDisconnected.Invoke();
|
||||||
c.OnReceivedData += (data, ch) => transport.OnClientDataReceived.Invoke(new ArraySegment<byte>(data), ch);
|
c.OnReceivedData += (data, ch) => transport.OnClientDataReceived.Invoke(new ArraySegment<byte>(data), ch);
|
||||||
|
c.OnTransportError = transport.OnTransportError;
|
||||||
|
|
||||||
if (SteamClient.IsValid)
|
if (SteamClient.IsValid)
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,7 @@ namespace Mirror.FizzySteam
|
|||||||
private event Action<int, byte[], int> OnReceivedData;
|
private event Action<int, byte[], int> OnReceivedData;
|
||||||
private event Action<int> OnDisconnected;
|
private event Action<int> OnDisconnected;
|
||||||
private event Action<int, Exception> OnReceivedError;
|
private event Action<int, Exception> OnReceivedError;
|
||||||
|
private event Action<string> OnTransportError;
|
||||||
|
|
||||||
private BidirectionalDictionary<Connection, int> connToMirrorID;
|
private BidirectionalDictionary<Connection, int> connToMirrorID;
|
||||||
private BidirectionalDictionary<SteamId, int> steamIDToMirrorID;
|
private BidirectionalDictionary<SteamId, int> steamIDToMirrorID;
|
||||||
@ -36,6 +37,7 @@ namespace Mirror.FizzySteam
|
|||||||
s.OnDisconnected += (id) => transport.OnServerDisconnected.Invoke(id);
|
s.OnDisconnected += (id) => transport.OnServerDisconnected.Invoke(id);
|
||||||
s.OnReceivedData += (id, data, ch) => transport.OnServerDataReceived.Invoke(id, new ArraySegment<byte>(data), ch);
|
s.OnReceivedData += (id, data, ch) => transport.OnServerDataReceived.Invoke(id, new ArraySegment<byte>(data), ch);
|
||||||
s.OnReceivedError += (id, exception) => transport.OnServerError.Invoke(id, exception);
|
s.OnReceivedError += (id, exception) => transport.OnServerError.Invoke(id, exception);
|
||||||
|
s.OnTransportError = transport.OnTransportError;
|
||||||
|
|
||||||
if (!SteamClient.IsValid)
|
if (!SteamClient.IsValid)
|
||||||
{
|
{
|
||||||
|
@ -51,6 +51,7 @@ namespace QSB
|
|||||||
private string _lastTransportError;
|
private string _lastTransportError;
|
||||||
internal bool _intentionalDisconnect;
|
internal bool _intentionalDisconnect;
|
||||||
private const string _kcpDisconnectMessage = "KCP: received disconnect message";
|
private const string _kcpDisconnectMessage = "KCP: received disconnect message";
|
||||||
|
private const int _defaultSteamAppID = 753640;
|
||||||
|
|
||||||
public override void Awake()
|
public override void Awake()
|
||||||
{
|
{
|
||||||
@ -72,8 +73,9 @@ namespace QSB
|
|||||||
{
|
{
|
||||||
var fizzy = gameObject.AddComponent<FizzyFacepunch>();
|
var fizzy = gameObject.AddComponent<FizzyFacepunch>();
|
||||||
fizzy.SteamAppID = QSBCore.OverrideAppId == -1
|
fizzy.SteamAppID = QSBCore.OverrideAppId == -1
|
||||||
? "753640"
|
? _defaultSteamAppID.ToString()
|
||||||
: $"{QSBCore.OverrideAppId}";
|
: QSBCore.OverrideAppId.ToString();
|
||||||
|
fizzy.OnTransportError = error => _lastTransportError = error;
|
||||||
transport = fizzy;
|
transport = fizzy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user