internal GooglePlayGames.Native.PInvoke.MultiplayerParticipant ParticipantWithId(string participantId)
        {
            IEnumerator <GooglePlayGames.Native.PInvoke.MultiplayerParticipant> enumerator = this.Participants().GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    GooglePlayGames.Native.PInvoke.MultiplayerParticipant current = enumerator.Current;
                    if (current.Id().Equals(participantId))
                    {
                        return(current);
                    }
                    current.Dispose();
                }
            }
            finally
            {
                if (enumerator == null)
                {
                }
                enumerator.Dispose();
            }
            return(null);
        }
Exemplo n.º 2
0
        internal GooglePlayGames.BasicApi.Multiplayer.TurnBasedMatch AsTurnBasedMatch(string selfPlayerId)
        {
            List <Participant> participants         = new List <Participant>();
            string             selfParticipantId    = null;
            string             pendingParticipantId = null;

            using (GooglePlayGames.Native.PInvoke.MultiplayerParticipant participant = this.PendingParticipant())
            {
                if (participant != null)
                {
                    pendingParticipantId = participant.Id();
                }
            }
            foreach (GooglePlayGames.Native.PInvoke.MultiplayerParticipant participant2 in this.Participants())
            {
                using (participant2)
                {
                    using (NativePlayer player = participant2.Player())
                    {
                        if ((player != null) && player.Id().Equals(selfPlayerId))
                        {
                            selfParticipantId = participant2.Id();
                        }
                    }
                    participants.Add(participant2.AsParticipant());
                }
            }
            return(new GooglePlayGames.BasicApi.Multiplayer.TurnBasedMatch(this.Id(), this.Data(), (this.MatchStatus() == GooglePlayGames.Native.Cwrapper.Types.MatchStatus.COMPLETED) && !this.HasRematchId(), selfParticipantId, participants, this.AvailableAutomatchSlots(), pendingParticipantId, ToTurnStatus(this.MatchStatus()), ToMatchStatus(pendingParticipantId, this.MatchStatus()), this.Variant(), this.Version()));
        }
        internal GooglePlayGames.BasicApi.Multiplayer.TurnBasedMatch AsTurnBasedMatch(string selfPlayerId)
        {
            List <Participant> participants         = new List <Participant>();
            string             selfParticipantId    = null;
            string             pendingParticipantId = null;

            using (GooglePlayGames.Native.PInvoke.MultiplayerParticipant participant = this.PendingParticipant())
            {
                if (participant != null)
                {
                    pendingParticipantId = participant.Id();
                }
            }
            IEnumerator <GooglePlayGames.Native.PInvoke.MultiplayerParticipant> enumerator = this.Participants().GetEnumerator();

            try
            {
                while (enumerator.MoveNext())
                {
                    GooglePlayGames.Native.PInvoke.MultiplayerParticipant current = enumerator.Current;
                    using (current)
                    {
                        using (NativePlayer player = current.Player())
                        {
                            if ((player != null) && player.Id().Equals(selfPlayerId))
                            {
                                selfParticipantId = current.Id();
                            }
                        }
                        participants.Add(current.AsParticipant());
                        continue;
                    }
                }
            }
            finally
            {
                if (enumerator == null)
                {
                }
                enumerator.Dispose();
            }
            return(new GooglePlayGames.BasicApi.Multiplayer.TurnBasedMatch(this.Id(), this.Data(), (this.MatchStatus() == GooglePlayGames.Native.Cwrapper.Types.MatchStatus.COMPLETED) && !this.HasRematchId(), selfParticipantId, participants, this.AvailableAutomatchSlots(), pendingParticipantId, ToTurnStatus(this.MatchStatus()), ToMatchStatus(pendingParticipantId, this.MatchStatus()), this.Variant(), this.Version()));
        }