Skip to content

Commit

Permalink
Merge pull request #44 from milospi/feature/add-numrounds-lobbyscreen
Browse files Browse the repository at this point in the history
added that you can change num rounds in lobby screen that host can ch…
  • Loading branch information
mostafas authored Apr 10, 2026
2 parents 491a6e1 + 4bdae46 commit a224f32
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 a224f32

Please sign in to comment.