// request first block of entries private void RequestFirstBlockOfEntries() { // bail out if we are currently waiting for a page request to finish if (requestedPage != null) return; // reset the entry display index etc ready for drawing the new leaderboard entryDisplayIndex = 0; entriesDisplayed = 0; // ensure that entries recieved and entries are reset numEntriesReceived = 0; noMoreEntries = false; entries.Clear(); // request the first 20 entries currentLeaderboard = leaderboardManager.GetLeaderboardFromId(leaderboardUIDlist[currentLeaderboardIndex]); requestedPage = currentLeaderboard.GetGlobalPage(entriesPerBatch); }
public ICLeaderboardsBrowser(Game game, GraphicsDeviceManager graphicsDeviceManager, ICELandaLib.CoLeaderboardManager leaderboardManager, ICLeaderboardScale scale, int[] leaderboardUIDlist) { // create a content manager to handle loading the textures we need ContentManager content = new ContentManager(game.Services); // store the graphics device for future reference this.graphicsDevice = game.GraphicsDevice; // store a handle to the leaderboard manager this.leaderboardManager = leaderboardManager; // store the scale we are using if (scale == ICLeaderboardScale.normal) displayScale = 1.0f; else displayScale = 0.5f; // store the ordered list of leaderboard UID values this.leaderboardUIDlist = leaderboardUIDlist; // create a sprite batch for rendering spriteBatch = new SpriteBatch(graphicsDevice); // load the leaderboard display textures bannerTexture = content.Load<Texture2D>(@"Content\ICLeaderboards\Shadow"); // load the leaderboard fonts if (scale == ICLeaderboardScale.normal) { nameFont = content.Load<SpriteFont>(@"Content\ICLeaderboards\NameFont"); valueFont = content.Load<SpriteFont>(@"Content\ICLeaderboards\ValueFont"); } else { nameFont = content.Load<SpriteFont>(@"Content\ICLeaderboards\NameFontSmall"); valueFont = content.Load<SpriteFont>(@"Content\ICLeaderboards\ValueFontSmall"); } // by default we want to display the first leaderbaord in the list currentLeaderboardIndex = 0; // by default we want to display the leaderboard from the first entry onwards entryDisplayIndex = 0; // the number of leaderboard entries that were previously displayed entriesDisplayed = 0; // ensure leaderboard entries recieved, currentLeaderboard and requestedPage are all reset numEntriesReceived = 0; noMoreEntries = false; currentLeaderboard = null; requestedPage = null; lastRequestedPage = null; entries = new List<leaderboardEntry>(); }