Skip to content

Refactor Game UI - #29

Closed
tasneem-hakeem wants to merge 5 commits into
developfrom
refactor/game-video
Closed

Refactor Game UI#29
tasneem-hakeem wants to merge 5 commits into
developfrom
refactor/game-video

Conversation

@tasneem-hakeem

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the game UI by removing difficulty-related UI elements, updating player labels to use actual player names, and adding video playback for win/loss scenarios. The changes simplify the UI by removing the "Change Difficulty" button and associated labels while enhancing the game-over modal experience with animated videos.

Changes:

  • Removed difficulty display and change difficulty button from the UI
  • Updated game-over modal to display player names instead of generic labels
  • Added video playback functionality for victory and defeat scenarios
  • Made trophy container background transparent to better display videos

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/main/resources/fxml/game_screen.fxml Removed difficulty label/icon and change difficulty button; updated trophy container to display videos
src/main/resources/css/features/game_screen.css Changed trophy container styling to transparent background
src/main/resources/assets/videos/loser.mp4 Added new defeat animation video (binary file)
src/main/java/com/boredxgames/tictactoeclient/presentation/GameController.java Removed difficulty button references; updated labels to use player names; implemented video playback with looping
Comments suppressed due to low confidence (2)

src/main/java/com/boredxgames/tictactoeclient/presentation/GameController.java:412

  • The video player is not properly stopped or cleaned up when resetGame is called. This creates a resource leak where the video continues playing indefinitely even after the modal is closed and a new game starts. You should stop the media player in the resetGame method.
    private void playVictoryVideo(String videoName) {
        try {
            String videoPath = Objects.requireNonNull(
                    getClass().getResource("/assets/videos/" + videoName + ".mp4")
            ).toExternalForm();

            Media media = new Media(videoPath);
            MediaPlayer player = new MediaPlayer(media);
            victoryVideo.setMediaPlayer(player);

            player.setCycleCount(MediaPlayer.INDEFINITE); // loop forever
            player.play();
            player.setAutoPlay(true);
            victoryVideo.setPreserveRatio(true);
            victoryVideo.setVisible(true);

            /*victoryVideo.setVisible(true);
            player.setAutoPlay(true);

            player.setOnEndOfMedia(() -> {
                victoryVideo.setVisible(false);
            });*/

        } catch (Exception e) {
            System.out.println("Error getting the video: " + e);
        }
    }

src/main/java/com/boredxgames/tictactoeclient/presentation/GameController.java:411

  • The error message is not helpful for debugging. Instead of printing a generic message to stdout, consider using a proper logging framework and include more specific information about what went wrong (e.g., which video file was not found, the full exception message).
        } catch (Exception e) {
            System.out.println("Error getting the video: " + e);
        }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/java/com/boredxgames/tictactoeclient/presentation/GameController.java Outdated
Comment thread src/main/java/com/boredxgames/tictactoeclient/presentation/GameController.java Outdated
Comment thread src/main/java/com/boredxgames/tictactoeclient/presentation/GameController.java Outdated
Comment thread src/main/resources/fxml/game_screen.fxml
Copilot AI review requested due to automatic review settings January 13, 2026 18:44

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants