From 3002419af006a3c091fc432e104b1b0c78252966 Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Sun, 25 Jun 2017 11:44:26 +0100 Subject: [PATCH] Added Stats.Set --- Facepunch.Steamworks/Client/Stats.cs | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/Facepunch.Steamworks/Client/Stats.cs b/Facepunch.Steamworks/Client/Stats.cs index be0a314..066918d 100644 --- a/Facepunch.Steamworks/Client/Stats.cs +++ b/Facepunch.Steamworks/Client/Stats.cs @@ -59,6 +59,38 @@ namespace Facepunch.Steamworks return data; } + /// + /// Set a stat value. This will automatically call StoreStats() after a successful call + /// unless you pass false as the last argument. + /// + public bool Set( string name, int value, bool store = true ) + { + var r = client.native.userstats.SetStat( name, value ); + + if ( store ) + { + return r && client.native.userstats.StoreStats(); + } + + return r; + } + + /// + /// Set a stat value. This will automatically call StoreStats() after a successful call + /// unless you pass false as the last argument. + /// + public bool Set( string name, float value, bool store = true ) + { + var r = client.native.userstats.SetStat0( name, value ); + + if ( store ) + { + return r && client.native.userstats.StoreStats(); + } + + return r; + } + public void Dispose() { client = null;