Пример #1
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;
        }
Пример #2
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);
 }