public void PlayerQuitGame(string player, int gameId) { Dispatcher.CurrentDispatcher.InvokeAsync(() => { GameFrame gameFrame = findGameFrame(gameId); ClientGame cg = findGame(gameId); gameFrame.RemovePlayer(player); cg.RemovePlayer(player); }); }
public void RemovePlayer(int gameID, string username) { Dispatcher.CurrentDispatcher.InvokeAsync(() => { GameFrame gameFrame = findGameFrame(gameID); gameFrame.RemovePlayer(username); ClientGame game = findGame(gameID); foreach (ClientUserProfile prof in game.players) { if (prof.username.Equals(username)) { game.players.Remove(prof); } } }); }