fizzy OnTransportError

This commit is contained in:
JohnCorby 2022-01-24 02:14:53 -08:00
parent b0047c9047
commit 791e76601b
4 changed files with 10 additions and 2 deletions

View File

@ -34,6 +34,8 @@ namespace Mirror.FizzySteam
[Tooltip("This will display your Steam User ID when you start or connect to a server.")]
public ulong SteamUserID;
public Action<string> OnTransportError;
private void Awake()
{
const string fileName = "steam_appid.txt";

View File

@ -18,6 +18,7 @@ namespace Mirror.FizzySteam
private event Action<byte[], int> OnReceivedData;
private event Action OnConnected;
private event Action OnDisconnected;
private event Action<string> OnTransportError;
private CancellationTokenSource cancelToken;
private TaskCompletionSource<Task> connectedComplete;
@ -39,6 +40,7 @@ namespace Mirror.FizzySteam
c.OnConnected += () => transport.OnClientConnected.Invoke();
c.OnDisconnected += () => transport.OnClientDisconnected.Invoke();
c.OnReceivedData += (data, ch) => transport.OnClientDataReceived.Invoke(new ArraySegment<byte>(data), ch);
c.OnTransportError = transport.OnTransportError;
if (SteamClient.IsValid)
{

View File

@ -11,6 +11,7 @@ namespace Mirror.FizzySteam
private event Action<int, byte[], int> OnReceivedData;
private event Action<int> OnDisconnected;
private event Action<int, Exception> OnReceivedError;
private event Action<string> OnTransportError;
private BidirectionalDictionary<Connection, int> connToMirrorID;
private BidirectionalDictionary<SteamId, int> steamIDToMirrorID;
@ -36,6 +37,7 @@ namespace Mirror.FizzySteam
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);
s.OnTransportError = transport.OnTransportError;
if (!SteamClient.IsValid)
{

View File

@ -51,6 +51,7 @@ namespace QSB
private string _lastTransportError;
internal bool _intentionalDisconnect;
private const string _kcpDisconnectMessage = "KCP: received disconnect message";
private const int _defaultSteamAppID = 753640;
public override void Awake()
{
@ -72,8 +73,9 @@ namespace QSB
{
var fizzy = gameObject.AddComponent<FizzyFacepunch>();
fizzy.SteamAppID = QSBCore.OverrideAppId == -1
? "753640"
: $"{QSBCore.OverrideAppId}";
? _defaultSteamAppID.ToString()
: QSBCore.OverrideAppId.ToString();
fizzy.OnTransportError = error => _lastTransportError = error;
transport = fizzy;
}