mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-27 14:08:06 +03:00
Added SteamClient.OnCallbackException
This commit is contained in:
parent
4ed8a4250b
commit
5fdbf02b29
@ -14,6 +14,13 @@ namespace Steamworks
|
||||
[AssemblyInitialize]
|
||||
public static void AssemblyInit( TestContext context )
|
||||
{
|
||||
Steamworks.SteamClient.OnCallbackException = ( e ) =>
|
||||
{
|
||||
Console.Error.WriteLine( e.Message );
|
||||
Console.Error.WriteLine( e.StackTrace );
|
||||
Assert.Fail( e.Message );
|
||||
};
|
||||
|
||||
//
|
||||
// Init Client
|
||||
//
|
||||
|
@ -48,6 +48,8 @@ namespace Steamworks
|
||||
RunCallbacksAsync();
|
||||
}
|
||||
|
||||
public static Action<Exception> OnCallbackException;
|
||||
|
||||
public static bool IsValid => initialized;
|
||||
|
||||
internal static async void RunCallbacksAsync()
|
||||
@ -55,14 +57,7 @@ namespace Steamworks
|
||||
while ( IsValid )
|
||||
{
|
||||
await Task.Delay( 16 );
|
||||
try
|
||||
{
|
||||
SteamAPI.RunCallbacks();
|
||||
}
|
||||
catch ( System.Exception )
|
||||
{
|
||||
// TODO - error outputs
|
||||
}
|
||||
RunCallbacks();
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,9 +92,16 @@ namespace Steamworks
|
||||
}
|
||||
|
||||
public static void RunCallbacks()
|
||||
{
|
||||
try
|
||||
{
|
||||
SteamAPI.RunCallbacks();
|
||||
}
|
||||
catch ( System.Exception e )
|
||||
{
|
||||
OnCallbackException?.Invoke( e );
|
||||
}
|
||||
}
|
||||
|
||||
internal static void UnregisterCallback( IntPtr intPtr )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user