public void RemovePlayer(UserDTO user) { if (users.Where(u => u.username == user.username).Count() > 0) { users.Remove(users.Where(u => u.username == user.username).First()); IRCUtils.MakeQuit(user, code); } UpdateIds(); }
public void AddPlayer(UserDTO user) { users.RemoveAll(u => u.username == user.username); user.gameId = users.Count() + 1; users.Add(user); UDPSocket.SendTo(user.client, "SET seed " + seed); Thread.Sleep(25); UpdateIds(); Broadcast("SPAWN " + users.Count(), user); for (int i = 0; i < users.Count(); i++) { if (users[i].client != null) { UDPSocket.SendTo(user.client, "SPAWN " + (i + 1)); Thread.Sleep(25); } } IRCUtils.MakeJoin(user, code); }