mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-27 07:05:50 +03:00
Name fixes
This commit is contained in:
parent
fa69dbda01
commit
3bfc441355
@ -60,14 +60,14 @@ internal bool SetStat( [MarshalAs( UnmanagedType.CustomMarshaler, MarshalTypeRef
|
||||
}
|
||||
|
||||
#region FunctionMeta
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUserStats_SetStat")]
|
||||
[DllImport( Platform.LibraryName, EntryPoint = "SteamAPI_ISteamUserStats_SetStat0")]
|
||||
[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
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -10,26 +10,18 @@ namespace Steamworks
|
||||
/// <summary>
|
||||
/// Provides the core of the Steam Game Servers API
|
||||
/// </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 static ISteamGameServer Internal
|
||||
internal override void InitializeInterface()
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _internal == null )
|
||||
{
|
||||
_internal = new ISteamGameServer( );
|
||||
_internal.InitServer();
|
||||
}
|
||||
|
||||
return _internal;
|
||||
}
|
||||
Internal = new ISteamGameServer();
|
||||
InstallEvents();
|
||||
}
|
||||
|
||||
public static bool IsValid => initialized;
|
||||
public static bool IsValid => Internal != null && Internal.IsValid;
|
||||
|
||||
|
||||
public static Action<Exception> OnCallbackException;
|
||||
@ -93,8 +85,6 @@ public static void Init( AppId appid, SteamServerInit init, bool asyncCallbacks
|
||||
throw new System.Exception( $"InitGameServer returned false ({ipaddress},{init.SteamPort},{init.GamePort},{init.QueryPort},{secure},\"{init.VersionString}\")" );
|
||||
}
|
||||
|
||||
initialized = true;
|
||||
|
||||
//
|
||||
// Initial settings
|
||||
//
|
||||
@ -129,7 +119,7 @@ internal static void ShutdownInterfaces()
|
||||
{
|
||||
foreach ( var e in openIterfaces )
|
||||
{
|
||||
e.Shutdown();
|
||||
e.ShutdownInterface();
|
||||
}
|
||||
|
||||
openIterfaces.Clear();
|
||||
@ -139,9 +129,7 @@ public static void Shutdown()
|
||||
{
|
||||
Event.DisposeAllServer();
|
||||
|
||||
initialized = false;
|
||||
|
||||
_internal = null;
|
||||
Internal = null;
|
||||
|
||||
ShutdownInterfaces();
|
||||
SteamGameServer.Shutdown();
|
||||
|
@ -197,7 +197,7 @@ public static bool AddStat( string name, float amount = 1.0f )
|
||||
/// </summary>
|
||||
public static bool SetStat( string name, int value )
|
||||
{
|
||||
return Internal.SetStat1( name, value );
|
||||
return Internal.SetStat( name, value );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -206,7 +206,7 @@ public static bool SetStat( string name, int value )
|
||||
/// </summary>
|
||||
public static bool SetStat( string name, float value )
|
||||
{
|
||||
return Internal.SetStat2( name, value );
|
||||
return Internal.SetStat0( name, value );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -215,7 +215,7 @@ public static bool SetStat( string name, float value )
|
||||
public static int GetStatInt( string name )
|
||||
{
|
||||
int data = 0;
|
||||
Internal.GetStat1( name, ref data );
|
||||
Internal.GetStat( name, ref data );
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -225,7 +225,7 @@ public static int GetStatInt( string name )
|
||||
public static float GetStatFloat( string name )
|
||||
{
|
||||
float data = 0;
|
||||
Internal.GetStat2( name, ref data );
|
||||
Internal.GetStat0( name, ref data );
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ public double GetGlobalFloat()
|
||||
{
|
||||
double val = 0.0;
|
||||
|
||||
if ( SteamUserStats.Internal.GetGlobalStat2( Name, ref val ) )
|
||||
if ( SteamUserStats.Internal.GetGlobalStat0( Name, ref val ) )
|
||||
return val;
|
||||
|
||||
return 0;
|
||||
@ -45,18 +45,18 @@ public double GetGlobalFloat()
|
||||
public long GetGlobalInt()
|
||||
{
|
||||
long val = 0;
|
||||
SteamUserStats.Internal.GetGlobalStat1( Name, ref val );
|
||||
SteamUserStats.Internal.GetGlobalStat( Name, ref val );
|
||||
return val;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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 )
|
||||
r = r.Take( rows ).ToArray();
|
||||
@ -66,12 +66,12 @@ public async Task<long[]> GetGlobalIntDaysAsync( 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;
|
||||
|
||||
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 )
|
||||
r = r.Take( rows ).ToArray();
|
||||
@ -85,11 +85,11 @@ public float GetFloat()
|
||||
|
||||
if ( UserId > 0 )
|
||||
{
|
||||
SteamUserStats.Internal.GetUserStat2( UserId, Name, ref val );
|
||||
SteamUserStats.Internal.GetUserStat0( UserId, Name, ref val );
|
||||
}
|
||||
else
|
||||
{
|
||||
SteamUserStats.Internal.GetStat2( Name, ref val );
|
||||
SteamUserStats.Internal.GetStat0( Name, ref val );
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -101,11 +101,11 @@ public int GetInt()
|
||||
|
||||
if ( UserId > 0 )
|
||||
{
|
||||
SteamUserStats.Internal.GetUserStat1( UserId, Name, ref val );
|
||||
SteamUserStats.Internal.GetUserStat( UserId, Name, ref val );
|
||||
}
|
||||
else
|
||||
{
|
||||
SteamUserStats.Internal.GetStat1( Name, ref val );
|
||||
SteamUserStats.Internal.GetStat( Name, ref val );
|
||||
}
|
||||
|
||||
return val;
|
||||
@ -114,13 +114,13 @@ public int GetInt()
|
||||
public bool Set( int val )
|
||||
{
|
||||
LocalUserOnly();
|
||||
return SteamUserStats.Internal.SetStat1( Name, val );
|
||||
return SteamUserStats.Internal.SetStat( Name, val );
|
||||
}
|
||||
|
||||
public bool Set( float val )
|
||||
{
|
||||
LocalUserOnly();
|
||||
return SteamUserStats.Internal.SetStat2( Name, val );
|
||||
return SteamUserStats.Internal.SetStat0( Name, val );
|
||||
}
|
||||
|
||||
public bool Add( int val )
|
||||
|
@ -124,7 +124,7 @@ public Query WithFileId( params PublishedFileId[] files )
|
||||
}
|
||||
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);
|
||||
@ -136,7 +136,7 @@ public Query WithFileId( params PublishedFileId[] files )
|
||||
|
||||
ApplyConstraints( handle );
|
||||
|
||||
var result = await SteamUGC.Internal.SendQueryUGCRequest( handle );
|
||||
var result = await SteamUGC.Internal.SendQueryUGCRequest( handle ).GetAsync<SteamUGCQueryCompleted_t>();
|
||||
if ( !result.HasValue )
|
||||
return null;
|
||||
|
||||
|
@ -5346,7 +5346,7 @@
|
||||
}
|
||||
,{
|
||||
"classname": "ISteamUserStats",
|
||||
"methodname": "SetStat",
|
||||
"methodname": "SetStat0",
|
||||
"returntype": "bool",
|
||||
"params": [
|
||||
{ "paramname": "pchName" ,"paramtype": "const char *"},
|
||||
|
Loading…
Reference in New Issue
Block a user