use of games.strategy.engine.lobby.server.GameDescription in project triplea by triplea-game.
the class LobbyGameTableModelTest method updateGameAddsIfDoesNotExist.
@Test
public void updateGameAddsIfDoesNotExist() {
testObj.getLobbyGameBroadcaster().gameUpdated(new GUID(), new GameDescription());
TestUtil.waitForSwingThreads();
assertThat(testObj.getRowCount(), is(2));
}
use of games.strategy.engine.lobby.server.GameDescription in project triplea by triplea-game.
the class GameRunner method joinGame.
public static void joinGame(final GameDescription description, final Messengers messengers, final Container parent) {
final GameDescription.GameStatus status = description.getStatus();
if (GameDescription.GameStatus.LAUNCHING == status) {
return;
}
final Version engineVersionOfGameToJoin = new Version(description.getEngineVersion());
final String newClassPath = null;
if (!GameEngineVersion.of(ClientContext.engineVersion()).isCompatibleWithEngineVersion(engineVersionOfGameToJoin)) {
JOptionPane.showMessageDialog(parent, "Host is using version " + engineVersionOfGameToJoin.toStringFull() + ". You need to have a compatible engine version in order to join this game.", "Incompatible TripleA engine", JOptionPane.ERROR_MESSAGE);
return;
}
joinGame(description.getPort(), description.getHostedBy().getAddress().getHostAddress(), newClassPath, messengers);
}
use of games.strategy.engine.lobby.server.GameDescription in project triplea by triplea-game.
the class LobbyGamePanel method mouseOnGamesList.
private void mouseOnGamesList(final MouseEvent e) {
if (!e.isPopupTrigger()) {
return;
}
if (!SwingUtilities.isRightMouseButton(e)) {
return;
}
final int selectedIndex = gameTable.getSelectedRow();
if (selectedIndex == -1) {
return;
}
final JPopupMenu menu = new JPopupMenu();
getUserGamesListContextActions().forEach(menu::add);
if (isAdmin()) {
final Collection<Action> generalAdminActions = getGeneralAdminGamesListContextActions();
if (!generalAdminActions.isEmpty()) {
menu.addSeparator();
generalAdminActions.forEach(menu::add);
}
final GameDescription gameDescription = gameTableModel.get(gameTable.convertRowIndexToModel(selectedIndex));
if (gameDescription.isBot()) {
final Collection<Action> botAdminActions = getBotAdminGamesListContextActions(gameDescription);
if (!botAdminActions.isEmpty()) {
menu.addSeparator();
botAdminActions.forEach(menu::add);
}
}
}
if (menu.getComponentCount() > 0) {
menu.show(gameTable, e.getX(), e.getY());
}
}
use of games.strategy.engine.lobby.server.GameDescription in project triplea by triplea-game.
the class LobbyGamePanel method joinGame.
private void joinGame() {
final int selectedIndex = gameTable.getSelectedRow();
if (selectedIndex == -1) {
return;
}
// we sort the table, so get the correct index
final GameDescription description = gameTableModel.get(gameTable.convertRowIndexToModel(selectedIndex));
GameRunner.joinGame(description, messengers, getParent());
}
Aggregations