SteamServer.Update becomes RunCallbacks, has OnCallbackException

This commit is contained in:
Garry Newman 2019-05-08 20:49:33 +01:00
parent 9339477c89
commit 85c55a5bb1

View File

@ -31,6 +31,9 @@ internal static ISteamGameServer Internal
public static bool IsValid => initialized; public static bool IsValid => initialized;
public static Action<Exception> OnCallbackException;
internal static void InstallEvents() internal static void InstallEvents()
{ {
ValidateAuthTicketResponse_t.Install( x => OnValidateAuthTicketResponse?.Invoke( x.SteamID, x.OwnerSteamID, x.AuthSessionResponse ), true ); ValidateAuthTicketResponse_t.Install( x => OnValidateAuthTicketResponse?.Invoke( x.SteamID, x.OwnerSteamID, x.AuthSessionResponse ), true );
@ -98,18 +101,22 @@ internal static async void RunCallbacksAsync()
while ( IsValid ) while ( IsValid )
{ {
await Task.Delay( 16 ); await Task.Delay( 16 );
Update(); RunCallbacks();
} }
} }
public static void Update()
/// <summary>
/// Run the callbacks. This is also called in Async callbacks.
/// </summary>
public static void RunCallbacks()
{ {
try try
{ {
SteamGameServer.RunCallbacks(); SteamGameServer.RunCallbacks();
} }
catch ( System.Exception ) catch ( System.Exception e )
{ {
// TODO - error outputs OnCallbackException?.Invoke( e );
} }
} }