internal override void HandleConnectedSetChanged(NativeRealTimeRoom room) { List <string> list = new List <string>(); List <string> list2 = new List <string>(); Dictionary <string, GooglePlayGames.Native.PInvoke.MultiplayerParticipant> dictionary = room.Participants().ToDictionary((GooglePlayGames.Native.PInvoke.MultiplayerParticipant p) => p.Id()); foreach (string key in mNativeParticipants.Keys) { GooglePlayGames.Native.PInvoke.MultiplayerParticipant multiplayerParticipant = dictionary[key]; GooglePlayGames.Native.PInvoke.MultiplayerParticipant multiplayerParticipant2 = mNativeParticipants[key]; if (!multiplayerParticipant.IsConnectedToRoom()) { list2.Add(key); } if (!multiplayerParticipant2.IsConnectedToRoom() && multiplayerParticipant.IsConnectedToRoom()) { list.Add(key); } } foreach (GooglePlayGames.Native.PInvoke.MultiplayerParticipant value in mNativeParticipants.Values) { value.Dispose(); } mNativeParticipants = dictionary; mParticipants = (from p in mNativeParticipants.Values select p.AsParticipant()).ToDictionary((Participant p) => p.ParticipantId); Logger.d("Updated participant statuses: " + string.Join(",", (from p in mParticipants.Values select p.ToString()).ToArray())); if (list2.Contains(GetSelf().ParticipantId)) { Logger.w("Player was disconnected from the multiplayer session."); } string selfId = GetSelf().ParticipantId; list = (from peerId in list where !peerId.Equals(selfId) select peerId).ToList(); list2 = (from peerId in list2 where !peerId.Equals(selfId) select peerId).ToList(); if (list.Count > 0) { list.Sort(); mSession.OnGameThreadListener().PeersConnected((from peer in list where !peer.Equals(selfId) select peer).ToArray()); } if (list2.Count > 0) { list2.Sort(); mSession.OnGameThreadListener().PeersDisconnected((from peer in list2 where !peer.Equals(selfId) select peer).ToArray()); } }