public static IAsyncResult BeginRead( LeaderboardIdentity leaderboardId, IEnumerable <Gamer> gamers, Gamer pivotGamer, int pageSize, AsyncCallback callback, object asyncState ) { readAction = new LeaderboardReaderAction( asyncState, callback, leaderboardId, 0, pageSize, pivotGamer, gamers ); if (readAction.Leaderboard.m_SteamLeaderboard == 0) { FindLeaderboard(leaderboardId.Key); } else { DownloadEntries(); } return(readAction); }
public static IAsyncResult BeginRead( LeaderboardIdentity leaderboardId, int pageStart, int pageSize, AsyncCallback callback, object asyncState ) { readAction = new LeaderboardReaderAction( asyncState, callback, leaderboardId, pageStart, pageSize, null, null ); if (readAction.Leaderboard.m_SteamLeaderboard == 0) { FindLeaderboard(leaderboardId.Key); } else { DownloadEntries(); } return(readAction); }
public IAsyncResult BeginPageDown( AsyncCallback callback, object asyncState ) { readAction = new LeaderboardReaderAction( asyncState, callback, LeaderboardIdentity, PageStart, pageSize, null, null ); if (PageStart + pageSize * 2 <= entryCache.Count) { readAction.IsCompleted = true; } else if (!CanPageDown) { readAction.IsCompleted = true; // Cannot increment page start, bail immediately return(readAction); } else if (isFriendBoard) { // Friend max is 100, no need to download ever readAction.IsCompleted = true; } else { SteamAPICall_t call = SteamUserStats.DownloadLeaderboardEntries( Leaderboards[LeaderboardIdentity.Key], ELeaderboardDataRequest.k_ELeaderboardDataRequestGlobal, entryCache[entryCache.Count - 1].RankingEXT + 1, entryCache[entryCache.Count - 1].RankingEXT + pageSize ); if (call.m_SteamAPICall != 0) { CallResult <LeaderboardScoresDownloaded_t> scoresDownloaded; scoresDownloaded = new CallResult <LeaderboardScoresDownloaded_t>(); scoresDownloaded.Set( call, DoPageDown ); } } readAction.PageStart += pageSize; return(readAction); }
public static LeaderboardReader EndRead(IAsyncResult result) { LeaderboardReader reader = new LeaderboardReader( readAction.ID, readAction.PageStart, readAction.PageSize, readAction.Leaderboard, readAction.Entries, readAction.Gamers != null // FIXME ); readAction = null; return(reader); }
public IAsyncResult BeginPageUp( AsyncCallback callback, object asyncState ) { readAction = new LeaderboardReaderAction( asyncState, callback, LeaderboardIdentity, PageStart, pageSize, null, null ); if (PageStart >= pageSize) { readAction.PageStart -= pageSize; readAction.IsCompleted = true; } else if (!CanPageUp) { readAction.IsCompleted = true; } else { SteamAPICall_t call = SteamUserStats.DownloadLeaderboardEntries( Leaderboards[LeaderboardIdentity.Key], ELeaderboardDataRequest.k_ELeaderboardDataRequestGlobal, entryCache[0].RankingEXT - pageSize, entryCache[0].RankingEXT - 1 ); if (call.m_SteamAPICall != 0) { CallResult <LeaderboardScoresDownloaded_t> scoresDownloaded; scoresDownloaded = new CallResult <LeaderboardScoresDownloaded_t>(); scoresDownloaded.Set( call, DoPageUp ); } } return(readAction); }