use of com.gianlu.pyxreborn.client.UI.ListCells.UserCell in project PretendYoureXyzzyReborn by devgianlu.
the class MainUI method initialize.
@FXML
public void initialize() {
gamesList.setCellFactory(param -> new GameCell(stage, client, me));
usersList.setCellFactory(param -> new UserCell());
refreshGamesList();
refreshUsersList();
}
use of com.gianlu.pyxreborn.client.UI.ListCells.UserCell in project PretendYoureXyzzyReborn by devgianlu.
the class GameUI method initialize.
@FXML
public void initialize() {
JsonObject obj = client.createRequest(Operations.GET_GAME);
obj.addProperty(Fields.GID.toString(), game.gid);
try {
game = new CGame(client.sendMessageBlocking(obj).getAsJsonObject(Fields.GAME.toString()));
} catch (InterruptedException | PyxException ex) {
UIClient.notifyException(ex);
return;
}
if (Objects.equals(me.nickname, game.host.nickname)) {
// I am the host
if (game.status == Game.Status.LOBBY)
startGame.setVisible(true);
else
startGame.setVisible(false);
} else {
// I am not the host
startGame.setVisible(false);
}
spectators.setCellFactory(param -> new UserCell());
spectators.setItems(spectatorsList);
players.setCellFactory(param -> new PlayerCell());
players.setItems(playersList);
client.addListener((event, request) -> true, this);
if (isSpectating())
instructions.setText("You're a spectator!");
}
Aggregations