mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-24 13:45:37 +03:00
Merge pull request #151 from alevastor/master
Improvements for rich presence
This commit is contained in:
commit
24df7fb6ad
@ -26,7 +26,8 @@ public void ReadBackSetKey()
|
|||||||
{
|
{
|
||||||
using ( var client = new Steamworks.Client( 252490 ) )
|
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" );
|
var value = client.User.GetRichPresence( "One" );
|
||||||
Assert.IsNotNull( value );
|
Assert.IsNotNull( value );
|
||||||
@ -39,7 +40,8 @@ public void ClearingKeys()
|
|||||||
{
|
{
|
||||||
using ( var client = new Steamworks.Client( 252490 ) )
|
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" );
|
var value = client.User.GetRichPresence( "One" );
|
||||||
Assert.IsNotNull( value );
|
Assert.IsNotNull( value );
|
||||||
|
@ -25,22 +25,29 @@ public void Dispose()
|
|||||||
client = null;
|
client = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Find a rich presence value by key for current user. Will be null if not found.
|
||||||
|
/// </summary>
|
||||||
public string GetRichPresence( string key )
|
public string GetRichPresence( string key )
|
||||||
{
|
{
|
||||||
string val = null;
|
if ( richPresence.TryGetValue( key, out var val ) )
|
||||||
|
|
||||||
if ( richPresence.TryGetValue( key, out val ) )
|
|
||||||
return val;
|
return val;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetRichPresence( string key, string value )
|
/// <summary>
|
||||||
|
/// Sets a rich presence value by key for current user.
|
||||||
|
/// </summary>
|
||||||
|
public bool SetRichPresence( string key, string value )
|
||||||
{
|
{
|
||||||
richPresence[key] = 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()
|
public void ClearRichPresence()
|
||||||
{
|
{
|
||||||
richPresence.Clear();
|
richPresence.Clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user