Name fixes

This commit is contained in:
Garry Newman 2020-02-10 20:32:32 +00:00
parent fa69dbda01
commit 3bfc441355
6 changed files with 32 additions and 44 deletions

View File

@ -60,14 +60,14 @@ namespace Steamworks
} }
#region FunctionMeta #region FunctionMeta
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUserStats_SetStat")] [DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUserStats_SetStat0")]
[return: MarshalAs( UnmanagedType.I1 )] [return: MarshalAs( UnmanagedType.I1 )]
private static extern bool _SetStat( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, float fData ); private static extern bool _SetStat0( IntPtr self, [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, float fData );
#endregion #endregion
internal bool SetStat( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, float fData ) internal bool SetStat0( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof( Utf8StringToNative ) )] string pchName, float fData )
{ {
var returnValue = _SetStat( Self, pchName, fData ); var returnValue = _SetStat0( Self, pchName, fData );
return returnValue; return returnValue;
} }

View File

@ -10,26 +10,18 @@ namespace Steamworks
/// <summary> /// <summary>
/// Provides the core of the Steam Game Servers API /// Provides the core of the Steam Game Servers API
/// </summary> /// </summary>
public static partial class SteamServer public partial class SteamServer : SteamClass
{ {
static bool initialized; internal static ISteamGameServer Internal;
internal override SteamInterface Interface => Internal;
static ISteamGameServer _internal; internal override void InitializeInterface()
internal static ISteamGameServer Internal
{ {
get Internal = new ISteamGameServer();
{ InstallEvents();
if ( _internal == null )
{
_internal = new ISteamGameServer( );
_internal.InitServer();
} }
return _internal; public static bool IsValid => Internal != null && Internal.IsValid;
}
}
public static bool IsValid => initialized;
public static Action<Exception> OnCallbackException; public static Action<Exception> OnCallbackException;
@ -93,8 +85,6 @@ namespace Steamworks
throw new System.Exception( $"InitGameServer returned false ({ipaddress},{init.SteamPort},{init.GamePort},{init.QueryPort},{secure},\"{init.VersionString}\")" ); throw new System.Exception( $"InitGameServer returned false ({ipaddress},{init.SteamPort},{init.GamePort},{init.QueryPort},{secure},\"{init.VersionString}\")" );
} }
initialized = true;
// //
// Initial settings // Initial settings
// //
@ -129,7 +119,7 @@ namespace Steamworks
{ {
foreach ( var e in openIterfaces ) foreach ( var e in openIterfaces )
{ {
e.Shutdown(); e.ShutdownInterface();
} }
openIterfaces.Clear(); openIterfaces.Clear();
@ -139,9 +129,7 @@ namespace Steamworks
{ {
Event.DisposeAllServer(); Event.DisposeAllServer();
initialized = false; Internal = null;
_internal = null;
ShutdownInterfaces(); ShutdownInterfaces();
SteamGameServer.Shutdown(); SteamGameServer.Shutdown();

View File

@ -197,7 +197,7 @@ namespace Steamworks
/// </summary> /// </summary>
public static bool SetStat( string name, int value ) public static bool SetStat( string name, int value )
{ {
return Internal.SetStat1( name, value ); return Internal.SetStat( name, value );
} }
/// <summary> /// <summary>
@ -206,7 +206,7 @@ namespace Steamworks
/// </summary> /// </summary>
public static bool SetStat( string name, float value ) public static bool SetStat( string name, float value )
{ {
return Internal.SetStat2( name, value ); return Internal.SetStat0( name, value );
} }
/// <summary> /// <summary>
@ -215,7 +215,7 @@ namespace Steamworks
public static int GetStatInt( string name ) public static int GetStatInt( string name )
{ {
int data = 0; int data = 0;
Internal.GetStat1( name, ref data ); Internal.GetStat( name, ref data );
return data; return data;
} }
@ -225,7 +225,7 @@ namespace Steamworks
public static float GetStatFloat( string name ) public static float GetStatFloat( string name )
{ {
float data = 0; float data = 0;
Internal.GetStat2( name, ref data ); Internal.GetStat0( name, ref data );
return data; return data;
} }

View File

@ -36,7 +36,7 @@ namespace Steamworks.Data
{ {
double val = 0.0; double val = 0.0;
if ( SteamUserStats.Internal.GetGlobalStat2( Name, ref val ) ) if ( SteamUserStats.Internal.GetGlobalStat0( Name, ref val ) )
return val; return val;
return 0; return 0;
@ -45,18 +45,18 @@ namespace Steamworks.Data
public long GetGlobalInt() public long GetGlobalInt()
{ {
long val = 0; long val = 0;
SteamUserStats.Internal.GetGlobalStat1( Name, ref val ); SteamUserStats.Internal.GetGlobalStat( Name, ref val );
return val; return val;
} }
public async Task<long[]> GetGlobalIntDaysAsync( int days ) public async Task<long[]> GetGlobalIntDaysAsync( int days )
{ {
var result = await SteamUserStats.Internal.RequestGlobalStats( days ); var result = await SteamUserStats.Internal.RequestGlobalStats( days ).GetAsync<GlobalStatsReceived_t>();
if ( result?.Result != Result.OK ) return null; if ( result?.Result != Result.OK ) return null;
var r = new long[days]; var r = new long[days];
var rows = SteamUserStats.Internal.GetGlobalStatHistory1( Name, r, (uint) r.Length * sizeof(long) ); var rows = SteamUserStats.Internal.GetGlobalStatHistory( Name, r, (uint) r.Length * sizeof(long) );
if ( days != rows ) if ( days != rows )
r = r.Take( rows ).ToArray(); r = r.Take( rows ).ToArray();
@ -66,12 +66,12 @@ namespace Steamworks.Data
public async Task<double[]> GetGlobalFloatDays( int days ) public async Task<double[]> GetGlobalFloatDays( int days )
{ {
var result = await SteamUserStats.Internal.RequestGlobalStats( days ); var result = await SteamUserStats.Internal.RequestGlobalStats( days ).GetAsync<GlobalStatsReceived_t>();
if ( result?.Result != Result.OK ) return null; if ( result?.Result != Result.OK ) return null;
var r = new double[days]; var r = new double[days];
var rows = SteamUserStats.Internal.GetGlobalStatHistory2( Name, r, (uint)r.Length * sizeof( double ) ); var rows = SteamUserStats.Internal.GetGlobalStatHistory0( Name, r, (uint)r.Length * sizeof( double ) );
if ( days != rows ) if ( days != rows )
r = r.Take( rows ).ToArray(); r = r.Take( rows ).ToArray();
@ -85,11 +85,11 @@ namespace Steamworks.Data
if ( UserId > 0 ) if ( UserId > 0 )
{ {
SteamUserStats.Internal.GetUserStat2( UserId, Name, ref val ); SteamUserStats.Internal.GetUserStat0( UserId, Name, ref val );
} }
else else
{ {
SteamUserStats.Internal.GetStat2( Name, ref val ); SteamUserStats.Internal.GetStat0( Name, ref val );
} }
return 0; return 0;
@ -101,11 +101,11 @@ namespace Steamworks.Data
if ( UserId > 0 ) if ( UserId > 0 )
{ {
SteamUserStats.Internal.GetUserStat1( UserId, Name, ref val ); SteamUserStats.Internal.GetUserStat( UserId, Name, ref val );
} }
else else
{ {
SteamUserStats.Internal.GetStat1( Name, ref val ); SteamUserStats.Internal.GetStat( Name, ref val );
} }
return val; return val;
@ -114,13 +114,13 @@ namespace Steamworks.Data
public bool Set( int val ) public bool Set( int val )
{ {
LocalUserOnly(); LocalUserOnly();
return SteamUserStats.Internal.SetStat1( Name, val ); return SteamUserStats.Internal.SetStat( Name, val );
} }
public bool Set( float val ) public bool Set( float val )
{ {
LocalUserOnly(); LocalUserOnly();
return SteamUserStats.Internal.SetStat2( Name, val ); return SteamUserStats.Internal.SetStat0( Name, val );
} }
public bool Add( int val ) public bool Add( int val )

View File

@ -124,7 +124,7 @@ namespace Steamworks.Ugc
} }
else else
{ {
handle = SteamUGC.Internal.CreateQueryAllUGCRequest1( queryType, matchingType, creatorApp.Value, consumerApp.Value, (uint)page ); handle = SteamUGC.Internal.CreateQueryAllUGCRequest( queryType, matchingType, creatorApp.Value, consumerApp.Value, (uint)page );
} }
ApplyReturns(handle); ApplyReturns(handle);
@ -136,7 +136,7 @@ namespace Steamworks.Ugc
ApplyConstraints( handle ); ApplyConstraints( handle );
var result = await SteamUGC.Internal.SendQueryUGCRequest( handle ); var result = await SteamUGC.Internal.SendQueryUGCRequest( handle ).GetAsync<SteamUGCQueryCompleted_t>();
if ( !result.HasValue ) if ( !result.HasValue )
return null; return null;

View File

@ -5346,7 +5346,7 @@
} }
,{ ,{
"classname": "ISteamUserStats", "classname": "ISteamUserStats",
"methodname": "SetStat", "methodname": "SetStat0",
"returntype": "bool", "returntype": "bool",
"params": [ "params": [
{ "paramname": "pchName" ,"paramtype": "const char *"}, { "paramname": "pchName" ,"paramtype": "const char *"},