Skip to content

Commit

Permalink
added that you can change num rounds in lobby screen that host can ch…
Browse files Browse the repository at this point in the history
…ange
  • Loading branch information
mostafas committed Apr 10, 2026
1 parent 491a6e1 commit 4bdae46
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ public void onFailure(Exception exception) {
}

/** Called by the host when they press Start Game. */
public void onStartGame(String sessionId, List<Player> players) {
public void onStartGame(String sessionId, List<Player> players, int rounds) {
numRounds = rounds;
int tracksNeeded = numRounds * OPTIONS_PER_Q;
game.getMusicService().fetchTracks(tracksNeeded, new MusicServiceCallback() {
@Override
Expand Down
7 changes: 5 additions & 2 deletions core/src/main/java/group07/beatbattle/view/LobbyView.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import group07.beatbattle.model.Player;
import group07.beatbattle.model.services.LobbyService;
import group07.beatbattle.ui.components.BackButton;
import group07.beatbattle.ui.components.RoundSelector;
import group07.beatbattle.ui.components.SettingsButton;
import group07.beatbattle.ui.components.StartGameButton;
import group07.beatbattle.ui.dialog.AlertDialogs;
Expand Down Expand Up @@ -339,16 +340,18 @@ private Table createFooter() {
Table footer = new Table();

if (mode == GameMode.CREATE) {
StartGameButton startButton = new StartGameButton(game.getMontserratFont());
RoundSelector roundSelector = new RoundSelector(game.getMontserratFont());

StartGameButton startButton = new StartGameButton(game.getMontserratFont());
startButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
controller.onStartGame(sessionId, currentPlayers);
controller.onStartGame(sessionId, currentPlayers, roundSelector.getSelectedRounds());
}
});

float btnWidth = Math.min(800f, Gdx.graphics.getWidth() - 80f);
footer.add(roundSelector.getActor()).width(btnWidth).padBottom(20f).row();
footer.add(startButton).width(btnWidth).height(150);
}

Expand Down

0 comments on commit 4bdae46

Please sign in to comment.