mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
* Client - Added number of active games to the header of the games column of the user list.
This commit is contained in:
parent
30ea2188bf
commit
aad1a2da89
11 changed files with 100 additions and 30 deletions
|
|
@ -297,12 +297,11 @@ public class MageServerImpl implements MageServer {
|
|||
}
|
||||
|
||||
@Override
|
||||
//FIXME: why no sessionId here???
|
||||
public List<UsersView> getConnectedPlayers(UUID roomId) throws MageException {
|
||||
public List<RoomUsersView> getRoomUsers(UUID roomId) throws MageException {
|
||||
try {
|
||||
GamesRoom room = GamesRoomManager.getInstance().getRoom(roomId);
|
||||
if (room != null) {
|
||||
return room.getPlayers();
|
||||
return room.getRoomUsersInfo();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,4 +210,7 @@ public class GameManager {
|
|||
return null;
|
||||
}
|
||||
|
||||
public int getNumberActiveGames() {
|
||||
return gameControllers.size();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import mage.game.match.MatchOptions;
|
|||
import mage.game.tournament.TournamentOptions;
|
||||
import mage.server.Room;
|
||||
import mage.view.MatchView;
|
||||
import mage.view.RoomUsersView;
|
||||
import mage.view.TableView;
|
||||
import mage.view.UsersView;
|
||||
|
||||
|
|
@ -48,7 +49,7 @@ public interface GamesRoom extends Room {
|
|||
|
||||
List<TableView> getTables();
|
||||
List<MatchView> getFinished();
|
||||
List<UsersView> getPlayers();
|
||||
List<RoomUsersView> getRoomUsersInfo();
|
||||
boolean joinTable(UUID userId, UUID tableId, String name, String playerType, int skill, DeckCardLists deckList) throws MageException;
|
||||
boolean joinTournamentTable(UUID userId, UUID tableId, String name, String playerType, int skill) throws GameException;
|
||||
TableView createTable(UUID userId, MatchOptions options);
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ import mage.server.User;
|
|||
import mage.server.UserManager;
|
||||
import mage.server.tournament.TournamentManager;
|
||||
import mage.view.MatchView;
|
||||
import mage.view.RoomUsersView;
|
||||
import mage.view.TableView;
|
||||
import mage.view.UsersView;
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
@ -66,7 +67,7 @@ public class GamesRoomImpl extends RoomImpl implements GamesRoom, Serializable {
|
|||
private static final ScheduledExecutorService updateExecutor = Executors.newSingleThreadScheduledExecutor();
|
||||
private static List<TableView> tableView = new ArrayList<>();
|
||||
private static List<MatchView> matchView = new ArrayList<>();
|
||||
private static List<UsersView> usersView = new ArrayList<>();
|
||||
private static List<RoomUsersView> roomUsersView = new ArrayList<>();
|
||||
|
||||
private final ConcurrentHashMap<UUID, Table> tables = new ConcurrentHashMap<>();
|
||||
|
||||
|
|
@ -124,8 +125,10 @@ public class GamesRoomImpl extends RoomImpl implements GamesRoom, Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
Collections.sort(users, new UserNameSorter());
|
||||
usersView = users;
|
||||
Collections.sort(users, new UserNameSorter());
|
||||
List<RoomUsersView> roomUserInfo = new ArrayList<>();
|
||||
roomUserInfo.add(new RoomUsersView(users, GameManager.getInstance().getNumberActiveGames()));
|
||||
roomUsersView = roomUserInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -201,8 +204,8 @@ public class GamesRoomImpl extends RoomImpl implements GamesRoom, Serializable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<UsersView> getPlayers() {
|
||||
return usersView;
|
||||
public List<RoomUsersView> getRoomUsersInfo() {
|
||||
return roomUsersView;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue