Пример #1
0
        void MostWinsGetEntriesCallback(Message <LeaderboardEntryList> msg)
        {
            if (!msg.IsError)
            {
                foreach (LeaderboardEntry entry in msg.Data)
                {
                    m_mostWins[entry.Rank] = entry;

                    if (entry.User.ID == PlatformManager.MyID)
                    {
                        m_foundLocalUserMostWinsEntry = true;
                        m_numWins = entry.Score;
                    }
                }

                // results might be paged for large requests
                if (msg.Data.HasNextPage)
                {
                    Leaderboards.GetNextEntries(msg.Data).OnComplete(MostWinsGetEntriesCallback);
                    return;
                }

                // if local user not in the top, get their position specifically
                if (!m_foundLocalUserMostWinsEntry)
                {
                    Leaderboards.GetEntries(MOST_MATCHES_WON, 1, LeaderboardFilterType.None,
                                            LeaderboardStartAt.CenteredOnViewer).OnComplete(MostWinsGetEntriesCallback);
                    return;
                }
            }
            // else an error is returned if the local player isn't ranked - we can ignore that

            if (m_mostWinsCallback != null)
            {
                m_mostWinsCallback(m_mostWins);
            }
            m_mostWins = null;
        }