mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-24 05:35:35 +03:00
Added documentation for rich presence. Changed SetRichPresence return type to bool. Updated rich presence test.
This commit is contained in:
parent
46f56c24f3
commit
072ef291a0
@ -26,7 +26,8 @@ public void ReadBackSetKey()
|
||||
{
|
||||
using ( var client = new Steamworks.Client( 252490 ) )
|
||||
{
|
||||
client.User.SetRichPresence( "One", "Two" );
|
||||
var success = client.User.SetRichPresence( "One", "Two" );
|
||||
Assert.IsTrue( success );
|
||||
|
||||
var value = client.User.GetRichPresence( "One" );
|
||||
Assert.IsNotNull( value );
|
||||
@ -39,7 +40,8 @@ public void ClearingKeys()
|
||||
{
|
||||
using ( var client = new Steamworks.Client( 252490 ) )
|
||||
{
|
||||
client.User.SetRichPresence( "One", "Two" );
|
||||
var success = client.User.SetRichPresence( "One", "Two" );
|
||||
Assert.IsTrue( success );
|
||||
|
||||
var value = client.User.GetRichPresence( "One" );
|
||||
Assert.IsNotNull( value );
|
||||
|
@ -25,22 +25,29 @@ public void Dispose()
|
||||
client = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find a rich presence data by key for current user. Will be null if not found.
|
||||
/// </summary>
|
||||
public string GetRichPresence( string key )
|
||||
{
|
||||
string val = null;
|
||||
|
||||
if ( richPresence.TryGetValue( key, out val ) )
|
||||
if ( richPresence.TryGetValue( key, out var val ) )
|
||||
return val;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void SetRichPresence( string key, string value )
|
||||
/// <summary>
|
||||
/// Sets rich presence value by key for current user.
|
||||
/// </summary>
|
||||
public bool SetRichPresence( string key, string value )
|
||||
{
|
||||
richPresence[key] = value;
|
||||
client.native.friends.SetRichPresence( key, value );
|
||||
return client.native.friends.SetRichPresence( key, value );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears all of the current user's rich presence data.
|
||||
/// </summary>
|
||||
public void ClearRichPresence()
|
||||
{
|
||||
richPresence.Clear();
|
||||
|
Loading…
Reference in New Issue
Block a user