Indiefreaks.Xna.Sessions.Live.LiveSession.OnLivePlayerLeft C# (CSharp) Method

OnLivePlayerLeft() private method

Raised when a player leaves
private OnLivePlayerLeft ( object sender, Microsoft.Xna.Framework.Net.GamerLeftEventArgs e ) : void
sender object
e Microsoft.Xna.Framework.Net.GamerLeftEventArgs
return void
        private void OnLivePlayerLeft(object sender, GamerLeftEventArgs e)
        {
            IdentifiedPlayer identifiedPlayer = null;

            if (e.Gamer.IsLocal)
            {
                SignedInGamer signedInGamer = ((LocalNetworkGamer) e.Gamer).SignedInGamer;
                _localPlayers.ForEach(action =>
                                          {
                                              if (action.UniqueId == signedInGamer.Gamertag)
                                              {
                                                  identifiedPlayer = action;
                                                  _localPlayers.Remove(action);
                                                  _allPlayers.Remove(action);
                                              }
                                          });
            }
            else
            {
                _remotePlayers.ForEach(action =>
                                           {
                                               if (action.UniqueId == e.Gamer.Gamertag)
                                               {
                                                   identifiedPlayer = action;
                                                   _remotePlayers.Remove(action);
                                                   _allPlayers.Remove(action);
                                               }
                                           });
            }

            OnPlayerLeft(identifiedPlayer);
        }