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