mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-12 06:38:01 +03:00
Achievement callback
This commit is contained in:
parent
3a8ed89583
commit
01cf0f4cec
@ -84,6 +84,8 @@ namespace Facepunch.Steamworks
|
||||
|
||||
Workshop.friends = Friends;
|
||||
|
||||
Stats.UpdateStats();
|
||||
|
||||
//
|
||||
// Cache common, unchanging info
|
||||
//
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using SteamNative;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
@ -11,10 +12,15 @@ namespace Facepunch.Steamworks
|
||||
|
||||
public Achievement[] All { get; private set; }
|
||||
|
||||
public event Action OnUpdated;
|
||||
|
||||
internal Achievements( Client c )
|
||||
{
|
||||
client = c;
|
||||
Refresh();
|
||||
|
||||
All = new Achievement[0];
|
||||
|
||||
SteamNative.UserStatsReceived_t.RegisterCallback( c, UserStatsReceived );
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
@ -29,6 +35,14 @@ namespace Facepunch.Steamworks
|
||||
client = null;
|
||||
}
|
||||
|
||||
private void UserStatsReceived( UserStatsReceived_t stats, bool isError )
|
||||
{
|
||||
if ( isError ) return;
|
||||
|
||||
Refresh();
|
||||
|
||||
OnUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
public class Achievement
|
||||
|
@ -12,8 +12,6 @@ namespace Facepunch.Steamworks
|
||||
internal Stats( Client c )
|
||||
{
|
||||
client = c;
|
||||
|
||||
UpdateStats();
|
||||
}
|
||||
|
||||
public void UpdateStats()
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -112,7 +112,8 @@ namespace Generator
|
||||
{
|
||||
CallResult( c );
|
||||
}
|
||||
else if ( !string.IsNullOrEmpty( c.CallbackId ) )
|
||||
|
||||
if ( !string.IsNullOrEmpty( c.CallbackId ) )
|
||||
{
|
||||
Callback( c );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user