Added Friend.GetStatFloat

This commit is contained in:
Garry Newman 2020-02-24 12:00:26 +00:00
parent 18fbabaf2c
commit 7c20b57957

View File

@ -195,5 +195,21 @@ namespace Steamworks
return result.HasValue && result.Value.Result == Result.OK; return result.HasValue && result.Value.Result == Result.OK;
} }
/// <summary>
/// Gets a user stat. Must call RequestUserStats first.
/// </summary>
/// <param name="statName">The name of the stat you want to get</param>
/// <param name="defult">Will return this value if not available</param>
/// <returns>The value, or defult if not available</returns>
public float GetStatFloat( string statName, float defult = 0 )
{
var val = defult;
if ( !SteamUserStats.Internal.GetUserStat( Id, statName, ref val ) )
return defult;
return val;
}
} }
} }