From cf98745cedd2828bccc734660bb6352ee9ba968b Mon Sep 17 00:00:00 2001 From: Mostafa Date: Fri, 10 Apr 2026 14:56:51 +0200 Subject: [PATCH 1/2] add play again button and fixed layout in leaderboard --- .../java/group07/beatbattle/BeatBattle.java | 3 + .../controller/LeaderboardController.java | 29 ++++++++ .../controller/LobbyController.java | 2 + .../java/group07/beatbattle/i18n/Strings.java | 1 + .../group07/beatbattle/view/GameOverView.java | 12 ++++ .../beatbattle/view/LeaderboardView.java | 68 +++++++++++-------- 6 files changed, 88 insertions(+), 27 deletions(-) diff --git a/core/src/main/java/group07/beatbattle/BeatBattle.java b/core/src/main/java/group07/beatbattle/BeatBattle.java index 9f2eb24..558fc5c 100644 --- a/core/src/main/java/group07/beatbattle/BeatBattle.java +++ b/core/src/main/java/group07/beatbattle/BeatBattle.java @@ -37,6 +37,7 @@ public BeatBattle(FirebaseGateway firebaseGateway) { private String localPlayerId; private String localPlayerName; private String localSessionId; + private String localGamePin; private boolean localIsHost; public void setServices(MusicService musicService, AudioPlayer audioPlayer) { @@ -60,6 +61,8 @@ public void setLocalSession(String sessionId, boolean isHost) { this.localIsHost = isHost; } + public void setLocalGamePin(String gamePin) { this.localGamePin = gamePin; } + public String getLocalGamePin() { return localGamePin; } public String getLocalSessionId() { return localSessionId; } public boolean isLocalHost() { return localIsHost; } diff --git a/core/src/main/java/group07/beatbattle/controller/LeaderboardController.java b/core/src/main/java/group07/beatbattle/controller/LeaderboardController.java index 74a3607..58e541d 100644 --- a/core/src/main/java/group07/beatbattle/controller/LeaderboardController.java +++ b/core/src/main/java/group07/beatbattle/controller/LeaderboardController.java @@ -7,8 +7,10 @@ import group07.beatbattle.model.GameSession; import group07.beatbattle.model.Leaderboard; import group07.beatbattle.model.LeaderboardEntry; +import group07.beatbattle.model.GameMode; import group07.beatbattle.states.GameOverState; import group07.beatbattle.states.InRoundState; +import group07.beatbattle.states.LobbyState; import group07.beatbattle.states.StartState; import group07.beatbattle.states.StateManager; @@ -93,6 +95,33 @@ public void onBackToMenu() { StateManager.getInstance().setState(new StartState(game, new LobbyController(game))); } + public void onPlayAgain() { + String sessionId = game.getLocalSessionId(); + game.getFirebaseGateway().updateSessionState( + sessionId, + "lobby", + new FirebaseGateway.SimpleCallback() { + @Override public void onSuccess() { goToLobby(); } + @Override public void onFailure(Exception e) { goToLobby(); } + } + ); + } + + private void goToLobby() { + Gdx.app.postRunnable(() -> + StateManager.getInstance().setState(new LobbyState( + game, + GameMode.CREATE, + game.getLocalSessionId(), + game.getLocalGamePin(), + game.getLocalPlayerId(), + game.getLocalPlayerName(), + true, + new LobbyController(game) + )) + ); + } + public void onGameOver() { String sessionId = game.getLocalSessionId(); if (game.isLocalHost() && sessionId != null && !sessionId.isBlank()) { diff --git a/core/src/main/java/group07/beatbattle/controller/LobbyController.java b/core/src/main/java/group07/beatbattle/controller/LobbyController.java index 6986237..efeca35 100644 --- a/core/src/main/java/group07/beatbattle/controller/LobbyController.java +++ b/core/src/main/java/group07/beatbattle/controller/LobbyController.java @@ -70,6 +70,7 @@ public void onSuccess(SessionCreationResult result) { Gdx.app.postRunnable(() -> { game.setLocalPlayer(result.getHostId(), result.getHostName()); game.setLocalSession(result.getSessionId(), true); + game.setLocalGamePin(result.getGamePin()); view.setLoadingState(false); view.setStatusMessage(""); StateManager.getInstance().setState( @@ -114,6 +115,7 @@ public void onSuccess(SessionJoinResult result) { Gdx.app.postRunnable(() -> { game.setLocalPlayer(result.getPlayerId(), result.getPlayerName()); game.setLocalSession(result.getSessionId(), false); + game.setLocalGamePin(result.getGamePin()); view.setLoadingState(false); view.setStatusMessage(""); StateManager.getInstance().setState( diff --git a/core/src/main/java/group07/beatbattle/i18n/Strings.java b/core/src/main/java/group07/beatbattle/i18n/Strings.java index 33534cf..2deddbd 100644 --- a/core/src/main/java/group07/beatbattle/i18n/Strings.java +++ b/core/src/main/java/group07/beatbattle/i18n/Strings.java @@ -65,6 +65,7 @@ public static String leavePlayerMsg() { public static String gameOver() { return no ? "SPILLET ER OVER" : "GAME OVER"; } public static String finalStandings(){ return no ? "Sluttresultater" : "Final Standings"; } public static String backToMenu() { return no ? "Tilbake til menyen" : "Back to Menu"; } + public static String playAgain() { return no ? "Spill igjen" : "Play Again"; } // --- Settings --- public static String settings() { return no ? "Innstillinger" : "Settings"; } diff --git a/core/src/main/java/group07/beatbattle/view/GameOverView.java b/core/src/main/java/group07/beatbattle/view/GameOverView.java index eef29cd..2494c23 100644 --- a/core/src/main/java/group07/beatbattle/view/GameOverView.java +++ b/core/src/main/java/group07/beatbattle/view/GameOverView.java @@ -81,6 +81,18 @@ public GameOverView(BeatBattle game, LeaderboardController controller) { root.add().expandY().row(); + // Play Again button (host only) + if (controller.isHost()) { + BackButton playAgainButton = new BackButton(Strings.playAgain(), game.getMontserratFont()); + playAgainButton.addListener(new ChangeListener() { + @Override + public void changed(ChangeEvent event, Actor actor) { + controller.onPlayAgain(); + } + }); + root.add(playAgainButton).width(600f).height(130f).padBottom(20f).row(); + } + // Back to menu button BackButton backButton = new BackButton(Strings.backToMenu(), game.getMontserratFont()); backButton.addListener(new ChangeListener() { diff --git a/core/src/main/java/group07/beatbattle/view/LeaderboardView.java b/core/src/main/java/group07/beatbattle/view/LeaderboardView.java index adc3e6f..5bce939 100644 --- a/core/src/main/java/group07/beatbattle/view/LeaderboardView.java +++ b/core/src/main/java/group07/beatbattle/view/LeaderboardView.java @@ -9,6 +9,7 @@ import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.ui.Image; import com.badlogic.gdx.scenes.scene2d.ui.Label; +import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener; import com.badlogic.gdx.utils.Scaling; @@ -19,11 +20,10 @@ import group07.beatbattle.i18n.Strings; import group07.beatbattle.model.LeaderboardEntry; import group07.beatbattle.ui.components.BackButton; -import group07.beatbattle.ui.components.JoinCreateButton; public class LeaderboardView extends ScreenAdapter { - private static final float AUTO_ADVANCE_DELAY = 3f; + private static final float AUTO_ADVANCE_DELAY = 5f; private final BeatBattle game; private final LeaderboardController controller; @@ -72,24 +72,24 @@ public LeaderboardView(BeatBattle game, LeaderboardController controller) { Table header = new Table(); header.add(styledLabel("#", Color.LIGHT_GRAY)).width(80f).left(); header.add(styledLabel(Strings.playerCol(), Color.LIGHT_GRAY)).expandX().left(); - header.add(styledLabel(Strings.scoreCol(), Color.LIGHT_GRAY)).width(200f).right(); - root.add(header).fillX().padBottom(20f).row(); + header.add(styledLabel(Strings.scoreCol(), Color.LIGHT_GRAY)).width(240f).right(); + root.add(header).fillX().padBottom(16f).row(); - // --- Top 3 rows --- + // --- All players in a scroll pane --- + String localId = game.getLocalPlayerId(); java.util.List entries = controller.getLeaderboard().getEntries(); - int topCount = Math.min(3, entries.size()); - for (int i = 0; i < topCount; i++) { - root.add(buildPlayerRow(entries.get(i))).fillX().padBottom(16f).row(); - } - // --- Local player row (if outside top 3) --- - LeaderboardEntry local = controller.getLocalPlayerEntry(); - if (local != null && local.getRank() > 3) { - root.add(styledLabel("· · ·", Color.DARK_GRAY)).padTop(8f).padBottom(8f).row(); - root.add(buildPlayerRow(local)).fillX().padBottom(16f).row(); + Table playerList = new Table(); + playerList.top(); + for (LeaderboardEntry entry : entries) { + boolean isLocal = entry.getPlayerId() != null && entry.getPlayerId().equals(localId); + playerList.add(buildPlayerRow(entry, isLocal)).fillX().padBottom(24f).row(); } - root.add().expandY().row(); + ScrollPane scroll = new ScrollPane(playerList); + scroll.setScrollingDisabled(true, false); + scroll.setFadeScrollBars(false); + root.add(scroll).fillX().expandY().row(); // --- Countdown label (only shown to host) --- String countdownPrefix = controller.hasMoreRounds() ? Strings.nextRoundIn() : Strings.finalResultsIn(); @@ -150,19 +150,27 @@ public void dispose() { logoTexture.dispose(); } - private Table buildPlayerRow(LeaderboardEntry entry) { + private Table buildPlayerRow(LeaderboardEntry entry, boolean isLocal) { + Color nameColor = isLocal ? new Color(0.4f, 1f, 0.5f, 1f) : Color.WHITE; + Table row = new Table(); - row.add(styledLabel(entry.getRank() + ".", Color.WHITE)).width(80f).left(); - row.add(styledLabel(entry.getPlayerName(), Color.WHITE)).expandX().left(); - - Table scoreCell = new Table(); - scoreCell.add(styledLabel(String.valueOf(entry.getScore()), Color.YELLOW)).right(); - if (entry.getRoundScore() > 0) { - scoreCell.add(styledLabel(" +" + entry.getRoundScore(), new Color(0.4f, 1f, 0.5f, 1f))).right().padLeft(12f); - } else { - scoreCell.add(styledLabel(" +0", Color.GRAY)).right().padLeft(12f); - } - row.add(scoreCell).width(280f).right(); + + // Rank + row.add(styledLabel(entry.getRank() + ".", nameColor)).width(80f).left().top(); + + // Player name + row.add(styledLabel(entry.getPlayerName(), nameColor)).expandX().left().top(); + + // Score column: total on top, round gain below + Table scoreCol = new Table(); + scoreCol.add(styledLabel(String.valueOf(entry.getScore()), Color.YELLOW)).right().row(); + Color gainColor = entry.getRoundScore() > 0 + ? new Color(0.4f, 1f, 0.5f, 1f) + : Color.GRAY; + String gainText = "+" + entry.getRoundScore(); + scoreCol.add(styledSmallLabel(gainText, gainColor)).right(); + + row.add(scoreCol).width(240f).right().top(); return row; } @@ -173,6 +181,12 @@ private Label styledLabel(String text, Color color) { return new Label(text, style); } + private Label styledSmallLabel(String text, Color color) { + Label label = styledLabel(text, color); + label.setFontScale(0.75f); + return label; + } + private Label.LabelStyle titleStyle() { Label.LabelStyle style = new Label.LabelStyle(); style.font = game.getOrbitronFont(); From e308844dc063d1f5d5aa8198135457608cc876c6 Mon Sep 17 00:00:00 2001 From: Mostafa Date: Fri, 10 Apr 2026 15:09:23 +0200 Subject: [PATCH 2/2] fixed play again button --- .../firebase/AndroidFirebaseGateway.java | 9 ++- .../firebase/FirestoreSessionRepository.java | 56 +++++++++++++++++++ .../controller/LeaderboardController.java | 4 +- .../controller/LobbyController.java | 21 ++++++- .../controller/RoundController.java | 8 ++- .../beatbattle/firebase/FirebaseGateway.java | 5 +- .../firebase/NoOpFirebaseGateway.java | 7 ++- .../java/group07/beatbattle/model/Player.java | 4 ++ .../beatbattle/view/JoinCreateView.java | 1 + 9 files changed, 105 insertions(+), 10 deletions(-) diff --git a/android/src/main/java/group07/beatbattle/android/firebase/AndroidFirebaseGateway.java b/android/src/main/java/group07/beatbattle/android/firebase/AndroidFirebaseGateway.java index c6fe312..6195f73 100644 --- a/android/src/main/java/group07/beatbattle/android/firebase/AndroidFirebaseGateway.java +++ b/android/src/main/java/group07/beatbattle/android/firebase/AndroidFirebaseGateway.java @@ -99,8 +99,8 @@ public void listenToSessionState(String sessionId, SessionStateListener listener } @Override - public void updatePlayerScore(String sessionId, String playerId, int score, SimpleCallback callback) { - sessionRepository.updatePlayerScore(sessionId, playerId, score, callback); + public void updatePlayerScore(String sessionId, String playerId, int score, int roundScore, SimpleCallback callback) { + sessionRepository.updatePlayerScore(sessionId, playerId, score, roundScore, callback); } @Override @@ -117,4 +117,9 @@ public void submitAnswer(String sessionId, int roundIndex, String playerId, Simp public void listenToRoundAnswerCount(String sessionId, int roundIndex, AnswerCountCallback callback) { sessionRepository.listenToRoundAnswerCount(sessionId, roundIndex, callback); } + + @Override + public void resetSessionForNewGame(String sessionId, SimpleCallback callback) { + sessionRepository.resetSessionForNewGame(sessionId, callback); + } } diff --git a/android/src/main/java/group07/beatbattle/android/firebase/FirestoreSessionRepository.java b/android/src/main/java/group07/beatbattle/android/firebase/FirestoreSessionRepository.java index d3554d2..5478049 100644 --- a/android/src/main/java/group07/beatbattle/android/firebase/FirestoreSessionRepository.java +++ b/android/src/main/java/group07/beatbattle/android/firebase/FirestoreSessionRepository.java @@ -159,6 +159,11 @@ public ListenerRegistration listenToPlayers( player.setScore(scoreValue.intValue()); } + Long roundScoreValue = document.getLong("roundScore"); + if (roundScoreValue != null) { + player.setLastRoundScore(roundScoreValue.intValue()); + } + players.add(player); }); @@ -184,6 +189,8 @@ public void fetchPlayers( Player player = new Player(playerId, name, isHost); Long scoreValue = document.getLong("score"); if (scoreValue != null) player.setScore(scoreValue.intValue()); + Long roundScoreValue = document.getLong("roundScore"); + if (roundScoreValue != null) player.setLastRoundScore(roundScoreValue.intValue()); players.add(player); } callback.onPlayersChanged(players); @@ -412,10 +419,12 @@ public void updatePlayerScore( String sessionId, String playerId, int score, + int roundScore, FirebaseGateway.SimpleCallback callback ) { Map update = new HashMap<>(); update.put("score", score); + update.put("roundScore", roundScore); firestore.collection(SESSIONS) .document(sessionId) @@ -425,4 +434,51 @@ public void updatePlayerScore( .addOnSuccessListener(unused -> callback.onSuccess()) .addOnFailureListener(callback::onFailure); } + + public void resetSessionForNewGame( + String sessionId, + FirebaseGateway.SimpleCallback callback + ) { + // Delete all Answers first + firestore.collection(SESSIONS) + .document(sessionId) + .collection("Answers") + .get() + .addOnSuccessListener(answersSnap -> { + WriteBatch batch = firestore.batch(); + + for (DocumentSnapshot doc : answersSnap.getDocuments()) { + batch.delete(doc.getReference()); + } + + // Reset all player scores to 0 in the same batch + firestore.collection(SESSIONS) + .document(sessionId) + .collection(PLAYERS) + .get() + .addOnSuccessListener(playersSnap -> { + Map scoreReset = new HashMap<>(); + scoreReset.put("score", 0); + scoreReset.put("roundScore", 0); + for (DocumentSnapshot p : playersSnap.getDocuments()) { + batch.update(p.getReference(), scoreReset); + } + + // Reset session state + currentRound + Map sessionReset = new HashMap<>(); + sessionReset.put("state", "lobby"); + sessionReset.put("currentRound", 0); + batch.update( + firestore.collection(SESSIONS).document(sessionId), + sessionReset + ); + + batch.commit() + .addOnSuccessListener(u -> callback.onSuccess()) + .addOnFailureListener(callback::onFailure); + }) + .addOnFailureListener(callback::onFailure); + }) + .addOnFailureListener(callback::onFailure); + } } diff --git a/core/src/main/java/group07/beatbattle/controller/LeaderboardController.java b/core/src/main/java/group07/beatbattle/controller/LeaderboardController.java index 58e541d..d2e3be4 100644 --- a/core/src/main/java/group07/beatbattle/controller/LeaderboardController.java +++ b/core/src/main/java/group07/beatbattle/controller/LeaderboardController.java @@ -97,9 +97,9 @@ public void onBackToMenu() { public void onPlayAgain() { String sessionId = game.getLocalSessionId(); - game.getFirebaseGateway().updateSessionState( + // Reset answers, scores, and state in Firebase, then go to lobby + game.getFirebaseGateway().resetSessionForNewGame( sessionId, - "lobby", new FirebaseGateway.SimpleCallback() { @Override public void onSuccess() { goToLobby(); } @Override public void onFailure(Exception e) { goToLobby(); } diff --git a/core/src/main/java/group07/beatbattle/controller/LobbyController.java b/core/src/main/java/group07/beatbattle/controller/LobbyController.java index efeca35..91c73e2 100644 --- a/core/src/main/java/group07/beatbattle/controller/LobbyController.java +++ b/core/src/main/java/group07/beatbattle/controller/LobbyController.java @@ -274,6 +274,7 @@ private void startJoinerSyncListener(String sessionId, GameSession session) { new FirebaseGateway.SessionStateListener() { @Override public void onStateChanged(String state, int currentRound) { + if ("STOPPED".equals(lastHandled[0])) return; String key = state + ":" + currentRound; if (key.equals(lastHandled[0])) return; lastHandled[0] = key; @@ -288,6 +289,21 @@ public void onStateChanged(String state, int currentRound) { LeaderboardController lc = new LeaderboardController(game, session, lb); StateManager.getInstance().setState(new GameOverState(game, lc)); }); + } else if ("lobby".equals(state)) { + // Host pressed Play Again — kill this listener and return to lobby + lastHandled[0] = "STOPPED"; + Gdx.app.postRunnable(() -> + StateManager.getInstance().setState(new LobbyState( + game, + GameMode.JOIN, + sessionId, + game.getLocalGamePin(), + game.getLocalPlayerId(), + game.getLocalPlayerName(), + false, + new LobbyController(game) + )) + ); } } @@ -309,7 +325,10 @@ public void onPlayersChanged(List updated) { Gdx.app.postRunnable(() -> { for (Player u : updated) { for (Player local : session.getPlayers()) { - if (local.getId().equals(u.getId())) local.setScore(u.getScore()); + if (local.getId().equals(u.getId())) { + local.setScore(u.getScore()); + local.setLastRoundScore(u.getLastRoundScore()); + } } } Leaderboard lb = new Leaderboard(session.getPlayers()); diff --git a/core/src/main/java/group07/beatbattle/controller/RoundController.java b/core/src/main/java/group07/beatbattle/controller/RoundController.java index 2614fc3..045e815 100644 --- a/core/src/main/java/group07/beatbattle/controller/RoundController.java +++ b/core/src/main/java/group07/beatbattle/controller/RoundController.java @@ -67,7 +67,7 @@ public void onAnswerSubmitted(String answer) { Player localPlayer = findLocalPlayer(); if (localPlayer != null) { localPlayer.addScore(points); - submitScoreToFirebase(localPlayer.getId(), localPlayer.getScore()); + submitScoreToFirebase(localPlayer.getId(), localPlayer.getScore(), localPlayer.getLastRoundScore()); } playerAnswered = true; @@ -79,7 +79,7 @@ public void onRoundExpired() { if (!playerAnswered) { Player localPlayer = findLocalPlayer(); if (localPlayer != null) { - submitScoreToFirebase(localPlayer.getId(), localPlayer.getScore()); + submitScoreToFirebase(localPlayer.getId(), localPlayer.getScore(), localPlayer.getLastRoundScore()); } recordAnswerInFirebase(); // count as answered so listener is consistent } @@ -156,7 +156,7 @@ private Player findLocalPlayer() { return null; } - private void submitScoreToFirebase(String playerId, int score) { + private void submitScoreToFirebase(String playerId, int score, int roundScore) { String sessionId = game.getLocalSessionId(); if (sessionId == null || sessionId.isBlank()) return; @@ -164,6 +164,7 @@ private void submitScoreToFirebase(String playerId, int score) { sessionId, playerId, score, + roundScore, new FirebaseGateway.SimpleCallback() { @Override public void onSuccess() {} @Override public void onFailure(Exception exception) { @@ -206,6 +207,7 @@ public void onPlayersChanged(List updatedPlayers) { for (Player local : session.getPlayers()) { if (local.getId().equals(updated.getId())) { local.setScore(updated.getScore()); + local.setLastRoundScore(updated.getLastRoundScore()); } } } diff --git a/core/src/main/java/group07/beatbattle/firebase/FirebaseGateway.java b/core/src/main/java/group07/beatbattle/firebase/FirebaseGateway.java index d539696..572c7d0 100644 --- a/core/src/main/java/group07/beatbattle/firebase/FirebaseGateway.java +++ b/core/src/main/java/group07/beatbattle/firebase/FirebaseGateway.java @@ -67,7 +67,7 @@ void deleteSession( void listenToSessionState(String sessionId, SessionStateListener listener); - void updatePlayerScore(String sessionId, String playerId, int score, SimpleCallback callback); + void updatePlayerScore(String sessionId, String playerId, int score, int roundScore, SimpleCallback callback); /** Records that a player has submitted an answer for the given round. */ void submitAnswer(String sessionId, int roundIndex, String playerId, SimpleCallback callback); @@ -75,6 +75,9 @@ void deleteSession( /** Fires with the current answer count whenever a new answer is submitted for a round. */ void listenToRoundAnswerCount(String sessionId, int roundIndex, AnswerCountCallback callback); + /** Clears Answers, resets all player scores to 0, and sets currentRound=0. Use before Play Again. */ + void resetSessionForNewGame(String sessionId, SimpleCallback callback); + // --- Callbacks --- interface GamePinExistsCallback { diff --git a/core/src/main/java/group07/beatbattle/firebase/NoOpFirebaseGateway.java b/core/src/main/java/group07/beatbattle/firebase/NoOpFirebaseGateway.java index aee9965..21f1803 100644 --- a/core/src/main/java/group07/beatbattle/firebase/NoOpFirebaseGateway.java +++ b/core/src/main/java/group07/beatbattle/firebase/NoOpFirebaseGateway.java @@ -94,7 +94,7 @@ public void listenToSessionState(String sessionId, SessionStateListener listener } @Override - public void updatePlayerScore(String sessionId, String playerId, int score, SimpleCallback callback) { + public void updatePlayerScore(String sessionId, String playerId, int score, int roundScore, SimpleCallback callback) { callback.onFailure(new UnsupportedOperationException("Firebase is not available on this platform")); } @@ -112,4 +112,9 @@ public void submitAnswer(String sessionId, int roundIndex, String playerId, Simp public void listenToRoundAnswerCount(String sessionId, int roundIndex, AnswerCountCallback callback) { callback.onFailure(new UnsupportedOperationException("Firebase is not available on this platform")); } + + @Override + public void resetSessionForNewGame(String sessionId, SimpleCallback callback) { + callback.onFailure(new UnsupportedOperationException("Firebase is not available on this platform")); + } } diff --git a/core/src/main/java/group07/beatbattle/model/Player.java b/core/src/main/java/group07/beatbattle/model/Player.java index 3df88f7..7af6767 100644 --- a/core/src/main/java/group07/beatbattle/model/Player.java +++ b/core/src/main/java/group07/beatbattle/model/Player.java @@ -33,4 +33,8 @@ public void addScore(int points) { public void setScore(int score) { this.score = score; } + + public void setLastRoundScore(int roundScore) { + this.lastRoundScore = roundScore; + } } diff --git a/core/src/main/java/group07/beatbattle/view/JoinCreateView.java b/core/src/main/java/group07/beatbattle/view/JoinCreateView.java index 15c480e..2c74ac9 100644 --- a/core/src/main/java/group07/beatbattle/view/JoinCreateView.java +++ b/core/src/main/java/group07/beatbattle/view/JoinCreateView.java @@ -157,6 +157,7 @@ private Label createTitleLabel() { private TextField createPlayerNameField() { TextField textField = new TextField("", InputFieldStyles.createDefault(game.getMontserratFont())); textField.setMessageText(Strings.enterName()); + textField.setMaxLength(12); return textField; }