Exemplo n.º 1
0
        // Token: 0x06000067 RID: 103 RVA: 0x0000C050 File Offset: 0x0000A250
        public void LoadLeaderboardEntries()
        {
            SignedInGamer signedInGamer = Gamer.SignedInGamers[PlayerIndex.One];
            int           num           = ObjectSystem.globalVariables[114];

            try
            {
                LeaderboardIdentity leaderboardId;
                if (num == 0)
                {
                    leaderboardId = LeaderboardIdentity.Create(LeaderboardKey.BestScoreLifeTime, num);
                }
                else
                {
                    leaderboardId = LeaderboardIdentity.Create(LeaderboardKey.BestTimeLifeTime, num + 1);
                }
                GlobalAppDefinitions.gameMode = 7;
                LeaderboardReader.BeginRead(leaderboardId, signedInGamer, 100, new AsyncCallback(this.LeaderboardReadCallback), signedInGamer);
            }
            catch (GameUpdateRequiredException e)
            {
                this.ReadNullLeaderboardEntries();
                this.HandleGameUpdateRequired(e);
            }
            catch (Exception)
            {
                this.ReadNullLeaderboardEntries();
                Guide.BeginShowMessageBox("Xbox LIVE", EngineCallbacks.liveErrorMessage[(int)GlobalAppDefinitions.gameLanguage], new string[]
                {
                    "OK"
                }, 0, MessageBoxIcon.Alert, new AsyncCallback(EngineCallbacks.LiveErrorMessage), null);
            }
        }
Exemplo n.º 2
0
        public void LoadLeaderboard(Leaderboard board, FriendCollection friends, Gamer gamer)
        {
            LeaderboardIdentity identity = LeaderboardInfo.GetIdentity(board);

            Request    = LeaderboardReader.BeginRead(identity, friends, gamer, friends.Count + 1, null, gamer);
            Reader     = null;
            ReadState  = AsyncRequest.FullRead;
            NumEntries = 0;
            ResetCaches();
            Columns         = LeaderboardInfo.GetColumns(board);
            LeaderboardName = LeaderboardInfo.GetName(board);
        }
Exemplo n.º 3
0
        public void LoadLeaderboard(Leaderboard board)
        {
            LeaderboardIdentity identity = LeaderboardInfo.GetIdentity(board);

            Request    = LeaderboardReader.BeginRead(identity, 0, 50, null, null);
            Reader     = null;
            ReadState  = AsyncRequest.FullRead;
            NumEntries = 0;
            ResetCaches();
            Columns         = LeaderboardInfo.GetColumns(board);
            LeaderboardName = LeaderboardInfo.GetName(board);
        }
Exemplo n.º 4
0
        // Token: 0x06000069 RID: 105 RVA: 0x0000C1B0 File Offset: 0x0000A3B0
        protected void ReadLeaderboardEntries()
        {
            int num = ObjectSystem.globalVariables[114];

            TextSystem.SetupTextMenu(StageSystem.gameMenu[0], 0);
            LeaderboardReader leaderboardReader = this.leaderboardReader;

            if (num == 0)
            {
                for (int i = 0; i < this.leaderboardReader.Entries.Count; i++)
                {
                    LeaderboardEntry leaderboardEntry = leaderboardReader.Entries[i];
                    string           text             = string.Format("{0,4}{1,-15}{2,1}{3,8}", new object[]
                    {
                        (i + 1).ToString() + ".",
                        leaderboardEntry.Gamer.Gamertag,
                        " ",
                        leaderboardEntry.Columns.GetValueInt32("BestScore").ToString()
                    });
                    TextSystem.AddTextMenuEntry(StageSystem.gameMenu[0], text.ToCharArray());
                }
            }
            else
            {
                for (int i = 0; i < this.leaderboardReader.Entries.Count; i++)
                {
                    LeaderboardEntry leaderboardEntry2 = leaderboardReader.Entries[i];
                    int num2 = leaderboardEntry2.Columns.GetValueInt32("BestTime");
                    int num3 = num2 / 6000;
                    int num4 = num2 / 100 % 60;
                    num2 %= 100;
                    string text = string.Format("{0,4}{1,-15}{2,2}{3,1}{4,1}{5,2}{6,1}{7,2}", new object[]
                    {
                        (i + 1).ToString() + ".",
                        leaderboardEntry2.Gamer.Gamertag,
                        "  ",
                        num3.ToString(),
                        "'",
                        num4.ToString(),
                        "\"",
                        num2.ToString()
                    });
                    TextSystem.AddTextMenuEntry(StageSystem.gameMenu[0], text.ToCharArray());
                }
            }
            for (int i = this.leaderboardReader.Entries.Count; i < 100; i++)
            {
                string text = string.Format("{0,4}{1,-15}", (i + 1).ToString() + ".", "---------------");
                TextSystem.AddTextMenuEntry(StageSystem.gameMenu[0], text.ToCharArray());
            }
        }
Exemplo n.º 5
0
        private static void ProcessEntries(LeaderboardReader reader, Column[] columns, ref Cache cache)
        {
            ReadOnlyCollection <LeaderboardEntry> entries = reader.Entries;
            int num  = entries.Count;
            int num2 = 0;
            int num3 = columns.Length;

            string[] array = new string[num3];
            for (int num4 = num3 - 1; num4 > -1; num4--)
            {
                array[num4] = columns[num4].ToString();
            }
            for (int i = 0; i < entries.Count; i++)
            {
                LeaderboardEntry leaderboardEntry = entries[i];
                if (leaderboardEntry.GetRank() == 0)
                {
                    num--;
                    continue;
                }
                Row row = cache.Entries[num2];
                row.Rank       = leaderboardEntry.GetRank();
                row.Gamer      = leaderboardEntry.Gamer;
                row.Statistics = new uint[num3];
                for (int num5 = num3 - 1; num5 > -1; num5--)
                {
                    string key  = array[num5];
                    int    num6 = (int)leaderboardEntry.Columns[key];
                    uint   num7 = 0u;
                    num7 = (uint)num6;
                    row.Statistics[num5] = num7;
                }
                row.Available = true;
                num2++;
            }
            cache.StartIndex = reader.PageStart;
            cache.NumEntries = num;
        }
Exemplo n.º 6
0
        // Token: 0x06000068 RID: 104 RVA: 0x0000C118 File Offset: 0x0000A318
        protected void LeaderboardReadCallback(IAsyncResult result)
        {
            object asyncState = result.AsyncState;

            try
            {
                this.leaderboardReader = LeaderboardReader.EndRead(result);
                this.ReadLeaderboardEntries();
            }
            catch (GameUpdateRequiredException e)
            {
                this.ReadNullLeaderboardEntries();
                this.HandleGameUpdateRequired(e);
            }
            catch (Exception)
            {
                this.ReadNullLeaderboardEntries();
                Guide.BeginShowMessageBox("Xbox LIVE", EngineCallbacks.liveErrorMessage[(int)GlobalAppDefinitions.gameLanguage], new string[]
                {
                    "OK"
                }, 0, MessageBoxIcon.Alert, new AsyncCallback(EngineCallbacks.LiveErrorMessage), null);
            }
            GlobalAppDefinitions.gameMode = 1;
        }
Exemplo n.º 7
0
 public bool Update()
 {
     if (ReadState == AsyncRequest.None || !Request.IsCompleted)
     {
         return(true);
     }
     if (ReadState == AsyncRequest.FullRead)
     {
         try
         {
             Reader = LeaderboardReader.EndRead(Request);
         }
         catch
         {
             return(false);
         }
         BatchStart = Reader.PageStart;
         Selected   = 0;
         if (Request.AsyncState != null)
         {
             Gamer gamer = (Gamer)Request.AsyncState;
             int   num   = BatchStart;
             foreach (LeaderboardEntry entry in Reader.Entries)
             {
                 if (entry.Gamer.Gamertag == gamer.Gamertag)
                 {
                     Selected   = num;
                     BatchStart = num;
                     break;
                 }
                 num++;
             }
         }
     }
     else if (ReadState == AsyncRequest.NextPage)
     {
         Reader.EndPageDown(Request);
     }
     else if (ReadState == AsyncRequest.PreviousPage)
     {
         Reader.EndPageUp(Request);
     }
     ProcessEntries(Reader, Columns, ref Current);
     if (Stale.StartIndex <= Current.StartIndex)
     {
         CreateMergedCache(Stale, Current);
     }
     else
     {
         CreateMergedCache(Current, Stale);
     }
     if (ReadState == AsyncRequest.FullRead)
     {
         BatchSize = Math.Min(Current.NumEntries, DefaultBatchSize);
         if (Current.NumEntries > 0 && (Reader.CanPageDown || Reader.CanPageUp))
         {
             NumEntries = Reader.TotalLeaderboardSize;
         }
         else
         {
             NumEntries = Current.NumEntries;
         }
         if (BatchStart > NumEntries - BatchSize)
         {
             BatchStart = NumEntries - BatchSize;
         }
     }
     ReadState = AsyncRequest.None;
     Request   = null;
     return(true);
 }