mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-13 15:18:07 +03:00
Append Async to some async method names
This commit is contained in:
parent
c60612b8b0
commit
2ad31e1375
@ -61,7 +61,7 @@ namespace Steamworks
|
||||
[TestMethod]
|
||||
public async Task CreateLeaderboard()
|
||||
{
|
||||
var leaderboard = await SteamUserStats.FindOrCreateLeaderboard( "Testleaderboard", Data.LeaderboardSort.Ascending, Data.LeaderboardDisplay.Numeric );
|
||||
var leaderboard = await SteamUserStats.FindOrCreateLeaderboardAsync( "Testleaderboard", Data.LeaderboardSort.Ascending, Data.LeaderboardDisplay.Numeric );
|
||||
|
||||
Assert.IsTrue( leaderboard.HasValue );
|
||||
}
|
||||
@ -69,17 +69,17 @@ namespace Steamworks
|
||||
[TestMethod]
|
||||
public async Task FindLeaderboard()
|
||||
{
|
||||
var leaderboard = await SteamUserStats.FindLeaderboard( "Testleaderboard" );
|
||||
var leaderboard = await SteamUserStats.FindLeaderboardAsync( "Testleaderboard" );
|
||||
Assert.IsTrue( leaderboard.HasValue );
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public async Task SubmitScore()
|
||||
{
|
||||
var leaderboard = await SteamUserStats.FindLeaderboard( "Testleaderboard" );
|
||||
var leaderboard = await SteamUserStats.FindLeaderboardAsync( "Testleaderboard" );
|
||||
Assert.IsTrue( leaderboard.HasValue );
|
||||
|
||||
var result = await leaderboard.Value.SubmitScore( 576 );
|
||||
var result = await leaderboard.Value.SubmitScoreAsync( 576 );
|
||||
Assert.IsTrue( result.HasValue );
|
||||
|
||||
Console.WriteLine( $"result.Changed: {result?.Changed}" );
|
||||
@ -92,7 +92,7 @@ namespace Steamworks
|
||||
[TestMethod]
|
||||
public async Task ReplaceScore()
|
||||
{
|
||||
var leaderboard = await SteamUserStats.FindLeaderboard( "Testleaderboard" );
|
||||
var leaderboard = await SteamUserStats.FindLeaderboardAsync( "Testleaderboard" );
|
||||
Assert.IsTrue( leaderboard.HasValue );
|
||||
|
||||
var result = await leaderboard.Value.ReplaceScore( 576 );
|
||||
@ -108,15 +108,10 @@ namespace Steamworks
|
||||
[TestMethod]
|
||||
public async Task GetScoresFromFriends()
|
||||
{
|
||||
var leaderboard = await SteamUserStats.FindLeaderboard( "Testleaderboard" );
|
||||
Assert.IsTrue( leaderboard.HasValue );
|
||||
var leaderboard = await SteamUserStats.FindLeaderboardAsync( "Testleaderboard" );
|
||||
|
||||
// Get entries around user
|
||||
var friendScores = await leaderboard.Value.GetScoresFromFriends();
|
||||
Assert.IsNotNull( friendScores );
|
||||
var friendScores = await leaderboard.Value.GetScoresFromFriendsAsync();
|
||||
|
||||
Console.WriteLine( $"" );
|
||||
Console.WriteLine( $"Friend Scores:" );
|
||||
foreach ( var e in friendScores )
|
||||
{
|
||||
Console.WriteLine( $"{e.GlobalRank}: {e.Score} {e.User}" );
|
||||
@ -126,7 +121,7 @@ namespace Steamworks
|
||||
[TestMethod]
|
||||
public async Task GetScoresAroundUserAsync()
|
||||
{
|
||||
var leaderboard = await SteamUserStats.FindLeaderboard( "Testleaderboard" );
|
||||
var leaderboard = await SteamUserStats.FindLeaderboardAsync( "Testleaderboard" );
|
||||
Assert.IsTrue( leaderboard.HasValue );
|
||||
|
||||
for ( int i = 1; i < 10; i++ )
|
||||
@ -147,7 +142,7 @@ namespace Steamworks
|
||||
[TestMethod]
|
||||
public async Task GetScoresAsync()
|
||||
{
|
||||
var leaderboard = await SteamUserStats.FindLeaderboard( "Testleaderboard" );
|
||||
var leaderboard = await SteamUserStats.FindLeaderboardAsync( "Testleaderboard" );
|
||||
Assert.IsTrue( leaderboard.HasValue );
|
||||
|
||||
// Get top 20 global scores
|
||||
@ -176,7 +171,7 @@ namespace Steamworks
|
||||
public async Task GetStatGlobalInt()
|
||||
{
|
||||
var deaths = new Stat( "deaths" );
|
||||
await deaths.GetGlobalIntDays( 5 );
|
||||
await deaths.GetGlobalIntDaysAsync( 5 );
|
||||
|
||||
var totalStartups = deaths.GetGlobalInt();
|
||||
Assert.AreNotEqual( 0, totalStartups );
|
||||
@ -188,7 +183,7 @@ namespace Steamworks
|
||||
{
|
||||
var deaths = new Stat( "deaths" );
|
||||
|
||||
var history = await deaths.GetGlobalIntDays( 10 );
|
||||
var history = await deaths.GetGlobalIntDaysAsync( 10 );
|
||||
Assert.AreNotEqual( 0, history.Length );
|
||||
|
||||
for ( int i=0; i< history.Length; i++ )
|
||||
|
@ -139,7 +139,7 @@ namespace Steamworks
|
||||
/// the Steamworks website and using FindLeaderboard unless you're expected to have a large amount of
|
||||
/// dynamically created leaderboards.
|
||||
/// </summary>
|
||||
public static async Task<Leaderboard?> FindOrCreateLeaderboard( string name, LeaderboardSort sort, LeaderboardDisplay display )
|
||||
public static async Task<Leaderboard?> FindOrCreateLeaderboardAsync( string name, LeaderboardSort sort, LeaderboardDisplay display )
|
||||
{
|
||||
var result = await Internal.FindOrCreateLeaderboard( name, sort, display );
|
||||
if ( !result.HasValue || result.Value.LeaderboardFound == 0 )
|
||||
@ -149,7 +149,7 @@ namespace Steamworks
|
||||
}
|
||||
|
||||
|
||||
public static async Task<Leaderboard?> FindLeaderboard( string name )
|
||||
public static async Task<Leaderboard?> FindLeaderboardAsync( string name )
|
||||
{
|
||||
var result = await Internal.FindLeaderboard( name );
|
||||
if ( !result.HasValue || result.Value.LeaderboardFound == 0 )
|
||||
|
@ -37,7 +37,7 @@ namespace Steamworks.Data
|
||||
/// <summary>
|
||||
/// Submit your new score, but won't replace your high score if it's lower
|
||||
/// </summary>
|
||||
public async Task<LeaderboardUpdate?> SubmitScore( int score, int[] details = null )
|
||||
public async Task<LeaderboardUpdate?> SubmitScoreAsync( int score, int[] details = null )
|
||||
{
|
||||
if ( details == null ) details = noDetails;
|
||||
|
||||
@ -90,7 +90,7 @@ namespace Steamworks.Data
|
||||
/// <summary>
|
||||
/// Used to retrieve all leaderboard entries for friends of the current user
|
||||
/// </summary>
|
||||
public async Task<LeaderboardEntry[]> GetScoresFromFriends()
|
||||
public async Task<LeaderboardEntry[]> GetScoresFromFriendsAsync()
|
||||
{
|
||||
var r = await SteamUserStats.Internal.DownloadLeaderboardEntries( Id, LeaderboardDataRequest.Friends, 0, 0 );
|
||||
if ( !r.HasValue )
|
||||
|
@ -49,7 +49,7 @@ namespace Steamworks.Data
|
||||
return val;
|
||||
}
|
||||
|
||||
public async Task<long[]> GetGlobalIntDays( int days )
|
||||
public async Task<long[]> GetGlobalIntDaysAsync( int days )
|
||||
{
|
||||
var result = await SteamUserStats.Internal.RequestGlobalStats( days );
|
||||
if ( result?.Result != Result.OK ) return null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user