Пример #1
0
        public static void FindSessionsThread()
        {
            NetworkSessionProperties networkSessionProperties = new NetworkSessionProperties();
            UI main = UI.main;

            if (main.HasOnline())
            {
                SignedInGamer signedInGamer = main.signedInGamer;
                if (signedInGamer != null)
                {
                    try
                    {
                        List <SignedInGamer> list = new List <SignedInGamer>(1);
                        list.Add(signedInGamer);
                        FriendCollection friends = signedInGamer.GetFriends();
                        int num = friends.Count - 1;
                        while (num >= 0 && !stopSessionFinderThread)
                        {
                            FriendGamer friendGamer = friends[num];
                            if (friendGamer.IsJoinable)
                            {
                                ulong xuid = friendGamer.GetXuid();
                                networkSessionProperties[0] = (int)xuid;
                                networkSessionProperties[1] = (int)(xuid >> 32);
                                AvailableNetworkSessionCollection availableNetworkSessionCollection = NetworkSession.Find(NetworkSessionType.PlayerMatch, list, networkSessionProperties);
                                if (availableNetworkSessionCollection.Count > 0)
                                {
                                    lock (availableSessions)
                                    {
                                        availableSessions.Add(new JoinableSession(availableNetworkSessionCollection[0]));
                                    }
                                }
                                if (stopSessionFinderThread)
                                {
                                    break;
                                }
                                Thread.Sleep(5000);
                            }
                            num--;
                        }
                    }
                    catch (Exception)
                    {
                    }
                }
            }
            stopSessionFinderThread = false;
            sessionFinderThread     = null;
        }
Пример #2
0
        private void LoadLeaderboard()
        {
            switch (mode)
            {
            case LeaderboardMode.MyScore:
                Data.LoadLeaderboard(SelectedLeaderboard, parentUI.signedInGamer);
                break;

            case LeaderboardMode.Friends:
            {
                SignedInGamer    signedInGamer = parentUI.signedInGamer;
                FriendCollection friends       = signedInGamer.GetFriends();
                Data.LoadLeaderboard(SelectedLeaderboard, friends, signedInGamer);
                break;
            }

            default:
                Data.LoadLeaderboard(SelectedLeaderboard);
                break;
            }
            CalculateStatisticPositions();
        }