internal GooglePlayGames.BasicApi.Multiplayer.TurnBasedMatch AsTurnBasedMatch(string selfPlayerId) { List <Participant> participants = new List <Participant>(); string selfParticipantId = (string)null; string pendingParticipantId = (string)null; using (MultiplayerParticipant multiplayerParticipant = this.PendingParticipant()) { if (multiplayerParticipant != null) { pendingParticipantId = multiplayerParticipant.Id(); } } foreach (MultiplayerParticipant participant in this.Participants()) { using (participant) { using (NativePlayer nativePlayer = participant.Player()) { if (nativePlayer != null) { if (nativePlayer.Id().Equals(selfPlayerId)) { selfParticipantId = participant.Id(); } } } participants.Add(participant.AsParticipant()); } } return(new GooglePlayGames.BasicApi.Multiplayer.TurnBasedMatch(this.Id(), this.Data(), this.MatchStatus() == Types.MatchStatus.COMPLETED && !this.HasRematchId(), selfParticipantId, participants, this.AvailableAutomatchSlots(), pendingParticipantId, NativeTurnBasedMatch.ToTurnStatus(this.MatchStatus()), NativeTurnBasedMatch.ToMatchStatus(pendingParticipantId, this.MatchStatus()), this.Variant(), this.Version())); }
internal GooglePlayGames.BasicApi.Multiplayer.TurnBasedMatch AsTurnBasedMatch(string selfPlayerId) { List <Participant> list = new List <Participant>(); string selfParticipantId = null; string pendingParticipantId = null; using (MultiplayerParticipant multiplayerParticipant = PendingParticipant()) { if (multiplayerParticipant != null) { pendingParticipantId = multiplayerParticipant.Id(); } } foreach (MultiplayerParticipant item in Participants()) { using (item) { using (NativePlayer nativePlayer = item.Player()) { if (nativePlayer != null && nativePlayer.Id().Equals(selfPlayerId)) { selfParticipantId = item.Id(); } } list.Add(item.AsParticipant()); } } bool canRematch = MatchStatus() == Types.MatchStatus.COMPLETED && !HasRematchId(); return(new GooglePlayGames.BasicApi.Multiplayer.TurnBasedMatch(Id(), Data(), canRematch, selfParticipantId, list, AvailableAutomatchSlots(), pendingParticipantId, ToTurnStatus(MatchStatus()), ToMatchStatus(pendingParticipantId, MatchStatus()), Variant(), Version())); }
internal TurnBasedMatch AsTurnBasedMatch(string selfPlayerId) { List <Participant> participants = new List <Participant>(); string selfParticipantId = null; string pendingParticipantId = null; using (MultiplayerParticipant participant = this.PendingParticipant()) { if (participant != null) { pendingParticipantId = participant.Id(); } } foreach (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 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 override void OnDataReceived(NativeRealTimeRoom room, GooglePlayGames.Native.PInvoke.MultiplayerParticipant sender, byte[] data, bool isReliable) { mSession.OnGameThreadListener().RealTimeMessageReceived(isReliable, sender.Id(), data); }