public void Add(Socket socket, String userName, String roomName) { numActors++; num++; User newUser = new User(numActors, socket, userName, roomName); newUser.next = first; first = newUser; Debug.Log ("New user created!"); }
//Remove the user using their socket public void Remove(Socket soc) { User current = first; User previous = null; while (current.Soc != soc) { if (current.next == null) { return; } else { previous = current; current = current.next; } } if (current == first) { first = first.next; num--; } else { previous.next = current.next; } }
public UserList() { first = null; }
//Remove the user using their actor ID public void Remove(int actorId) { User current = first; User previous = first; while (current.actorId != actorId) { if (current.next == null) { return; } else { previous = current; current = current.next; } } if (current == first) { first = first.next; num--; } else { previous.next = current.next; } }