v1.0.13.1 (first post-1.0 patch)
This commit is contained in:
@@ -12,7 +12,7 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public class SteamNetworkingUtils : SteamSharedClass<SteamNetworkingUtils>
|
||||
{
|
||||
internal static ISteamNetworkingUtils Internal => Interface as ISteamNetworkingUtils;
|
||||
internal static ISteamNetworkingUtils? Internal => Interface as ISteamNetworkingUtils;
|
||||
|
||||
internal override void InitializeInterface( bool server )
|
||||
{
|
||||
@@ -43,7 +43,7 @@ namespace Steamworks
|
||||
/// and your frame rate will tank and you won't know why.
|
||||
/// </summary>
|
||||
|
||||
public static event Action<NetDebugOutput, string> OnDebugOutput;
|
||||
public static event Action<NetDebugOutput, string>? OnDebugOutput;
|
||||
|
||||
public struct SteamRelayNetworkStatus
|
||||
{
|
||||
@@ -82,7 +82,7 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public static void InitRelayNetworkAccess()
|
||||
{
|
||||
Internal.InitRelayNetworkAccess();
|
||||
Internal?.InitRelayNetworkAccess();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -98,6 +98,8 @@ namespace Steamworks
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Internal is null) { return null; }
|
||||
|
||||
NetPingLocation location = default;
|
||||
var age = Internal.GetLocalPingLocation( ref location );
|
||||
if ( age < 0 )
|
||||
@@ -114,7 +116,7 @@ namespace Steamworks
|
||||
/// </summary>
|
||||
public static int EstimatePingTo( NetPingLocation target )
|
||||
{
|
||||
return Internal.EstimatePingTimeFromLocalHost( ref target );
|
||||
return Internal?.EstimatePingTimeFromLocalHost( ref target ) ?? 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -124,7 +126,7 @@ namespace Steamworks
|
||||
public static async Task WaitForPingDataAsync( float maxAgeInSeconds = 60 * 5 )
|
||||
{
|
||||
await Task.Yield();
|
||||
if ( Internal.CheckPingDataUpToDate( maxAgeInSeconds ) )
|
||||
if ( Internal is null || Internal.CheckPingDataUpToDate( maxAgeInSeconds ) )
|
||||
return;
|
||||
|
||||
SteamRelayNetworkStatus_t status = default;
|
||||
@@ -135,7 +137,7 @@ namespace Steamworks
|
||||
}
|
||||
}
|
||||
|
||||
public static long LocalTimestamp => Internal.GetLocalTimestamp();
|
||||
public static long LocalTimestamp => Internal?.GetLocalTimestamp() ?? 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -223,7 +225,7 @@ namespace Steamworks
|
||||
_debugLevel = value;
|
||||
_debugFunc = new NetDebugFunc( OnDebugMessage );
|
||||
|
||||
Internal.SetDebugOutputFunction( value, _debugFunc );
|
||||
Internal?.SetDebugOutputFunction( value, _debugFunc );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,7 +237,7 @@ namespace Steamworks
|
||||
/// <summary>
|
||||
/// We need to keep the delegate around until it's not used anymore
|
||||
/// </summary>
|
||||
static NetDebugFunc _debugFunc;
|
||||
static NetDebugFunc? _debugFunc;
|
||||
|
||||
struct DebugMessage
|
||||
{
|
||||
@@ -274,7 +276,7 @@ namespace Steamworks
|
||||
internal unsafe static bool SetConfigInt( NetConfig type, int value )
|
||||
{
|
||||
int* ptr = &value;
|
||||
return Internal.SetConfigValue( type, NetConfigScope.Global, IntPtr.Zero, NetConfigType.Int32, (IntPtr)ptr );
|
||||
return Internal != null && Internal.SetConfigValue( type, NetConfigScope.Global, IntPtr.Zero, NetConfigType.Int32, (IntPtr)ptr );
|
||||
}
|
||||
|
||||
internal unsafe static int GetConfigInt( NetConfig type )
|
||||
@@ -283,7 +285,7 @@ namespace Steamworks
|
||||
NetConfigType dtype = NetConfigType.Int32;
|
||||
int* ptr = &value;
|
||||
UIntPtr size = new UIntPtr( sizeof( int ) );
|
||||
var result = Internal.GetConfigValue( type, NetConfigScope.Global, IntPtr.Zero, ref dtype, (IntPtr) ptr, ref size );
|
||||
var result = Internal?.GetConfigValue( type, NetConfigScope.Global, IntPtr.Zero, ref dtype, (IntPtr) ptr, ref size );
|
||||
if ( result != NetConfigResult.OK )
|
||||
return 0;
|
||||
|
||||
@@ -293,7 +295,7 @@ namespace Steamworks
|
||||
internal unsafe static bool SetConfigFloat( NetConfig type, float value )
|
||||
{
|
||||
float* ptr = &value;
|
||||
return Internal.SetConfigValue( type, NetConfigScope.Global, IntPtr.Zero, NetConfigType.Float, (IntPtr)ptr );
|
||||
return Internal != null && Internal.SetConfigValue( type, NetConfigScope.Global, IntPtr.Zero, NetConfigType.Float, (IntPtr)ptr );
|
||||
}
|
||||
|
||||
internal unsafe static float GetConfigFloat( NetConfig type )
|
||||
@@ -302,7 +304,7 @@ namespace Steamworks
|
||||
NetConfigType dtype = NetConfigType.Float;
|
||||
float* ptr = &value;
|
||||
UIntPtr size = new UIntPtr( sizeof( float ) );
|
||||
var result = Internal.GetConfigValue( type, NetConfigScope.Global, IntPtr.Zero, ref dtype, (IntPtr)ptr, ref size );
|
||||
var result = Internal?.GetConfigValue( type, NetConfigScope.Global, IntPtr.Zero, ref dtype, (IntPtr)ptr, ref size );
|
||||
if ( result != NetConfigResult.OK )
|
||||
return 0;
|
||||
|
||||
@@ -315,7 +317,7 @@ namespace Steamworks
|
||||
|
||||
fixed ( byte* ptr = bytes )
|
||||
{
|
||||
return Internal.SetConfigValue( type, NetConfigScope.Global, IntPtr.Zero, NetConfigType.String, (IntPtr)ptr );
|
||||
return Internal != null && Internal.SetConfigValue( type, NetConfigScope.Global, IntPtr.Zero, NetConfigType.String, (IntPtr)ptr );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user