mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-27 14:08:06 +03:00
Include "Success" field in LeaderboardUpdate struct
This commit is contained in:
parent
9f0de903d4
commit
12902b416e
@ -32,7 +32,7 @@ namespace Steamworks.Data
|
||||
var r = await SteamUserStats.Internal.UploadLeaderboardScore( Id, LeaderboardUploadScoreMethod.ForceUpdate, score, details, details.Length );
|
||||
if ( !r.HasValue ) return null;
|
||||
|
||||
return LeaderboardUpdate.From( r.Value );
|
||||
return new LeaderboardUpdate( r.Value );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -45,7 +45,7 @@ namespace Steamworks.Data
|
||||
var r = await SteamUserStats.Internal.UploadLeaderboardScore( Id, LeaderboardUploadScoreMethod.KeepBest, score, details, details.Length );
|
||||
if ( !r.HasValue ) return null;
|
||||
|
||||
return LeaderboardUpdate.From( r.Value );
|
||||
return new LeaderboardUpdate( r.Value );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -4,19 +4,18 @@ namespace Steamworks.Data
|
||||
{
|
||||
public struct LeaderboardUpdate
|
||||
{
|
||||
public int Score;
|
||||
public bool Changed;
|
||||
public int NewGlobalRank;
|
||||
public int OldGlobalRank;
|
||||
private readonly LeaderboardScoreUploaded_t _internal;
|
||||
|
||||
public bool Success => _internal.Success != 0;
|
||||
public int Score => _internal.Score;
|
||||
public bool Changed => _internal.ScoreChanged != 0;
|
||||
public int NewGlobalRank => _internal.GlobalRankNew;
|
||||
public int OldGlobalRank => _internal.GlobalRankPrevious;
|
||||
public int RankChange => NewGlobalRank - OldGlobalRank;
|
||||
|
||||
internal static LeaderboardUpdate From( LeaderboardScoreUploaded_t e ) =>
|
||||
new LeaderboardUpdate
|
||||
{
|
||||
Score = e.Score,
|
||||
Changed = e.ScoreChanged == 1,
|
||||
NewGlobalRank = e.GlobalRankNew,
|
||||
OldGlobalRank = e.GlobalRankPrevious
|
||||
};
|
||||
internal LeaderboardUpdate( LeaderboardScoreUploaded_t result )
|
||||
{
|
||||
_internal = result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user