From d12f94339bb23c629ca1d8435f06b7f5576ada31 Mon Sep 17 00:00:00 2001 From: samanthasmalley Date: Sat, 7 Dec 2024 23:45:10 -0800 Subject: [PATCH] Added JavaDocs and TODOS --- src/main/java/event/Event01.java | 3 +++ src/main/java/event/Event02.java | 1 + src/main/java/main/ActionHandler.java | 16 ++++++++++++++++ src/main/java/main/GameManager.java | 6 ++++++ src/main/java/main/Player.java | 5 +++++ src/main/java/main/TimeManager.java | 2 ++ 6 files changed, 33 insertions(+) diff --git a/src/main/java/event/Event01.java b/src/main/java/event/Event01.java index bf4147d..6fed282 100644 --- a/src/main/java/event/Event01.java +++ b/src/main/java/event/Event01.java @@ -15,9 +15,11 @@ public Event01(GameManager gm) { } public void lookJeramiah() { + // TODO: Add error handling to check if gm or gm.ui is null before using it. gm.ui.messageText.setText("This is your tall handsome roommate Jeramiah. (He works on cars. Specifically Hondas)"); } public void talkJeramiah() { + // TODO: Add a try/catch block to handle any potential errors during sound playback. gm.ui.messageText.setText("Did you hear that noise outside son?"); gm.playSE(gm.engineNoise); } @@ -55,6 +57,7 @@ public void grabFlashlight() { } public void restFlashlight() { + // TODO: Display a confirmation dialog before dropping the flashlight. if(gm.player.hasFlashlight == 1) { gm.player.hasFlashlight = 0; gm.ui.messageText.setText("*You rest the flashlight back on the bed*"); diff --git a/src/main/java/event/Event02.java b/src/main/java/event/Event02.java index ae445fb..37eecf5 100644 --- a/src/main/java/event/Event02.java +++ b/src/main/java/event/Event02.java @@ -13,6 +13,7 @@ public Event02(GameManager gm) { public void search1Honda() { gm.ui.messageText.setText("Nothing sus here"); } + // TODO: Log the search action for debugging or saving player actions. public void search2Honda() { gm.ui.messageText.setText("OH MY GYAT MY ENGINE IS MISSING"); } diff --git a/src/main/java/main/ActionHandler.java b/src/main/java/main/ActionHandler.java index 2716af9..1739a41 100644 --- a/src/main/java/main/ActionHandler.java +++ b/src/main/java/main/ActionHandler.java @@ -14,15 +14,30 @@ public ActionHandler(GameManager gm) { this.gm = gm; } + /** + * Handles the action event triggered by a button press. This method identifies + * which button was clicked and passes the information to the appropriate game method. + * + * @param e The ActionEvent triggered by the button click. + */ + @Override public void handle(ActionEvent e) { String yourChoice = ((javafx.scene.control.Button) e.getSource()).getText(); handleAction(yourChoice); } + /** + * Executes a specific game action based on the user's choice from the button click. + * This method will change scenes, invoke event logic, or provide feedback based on the action. + * + * @param yourChoice The label text of the clicked button that corresponds to a game action. + */ + // handles the action commands public void handleAction(String yourChoice) { switch (yourChoice) { + // TODO: Add more actions as new game features are implemented. // SCENE 1 case "lookJeramiah": gm.ev1.lookJeramiah(); @@ -30,6 +45,7 @@ public void handleAction(String yourChoice) { case "talkJeramiah": gm.ev1.talkJeramiah(); break; + // TODO: Document each action method to explain its purpose in the game. case "restJeramiah": gm.ev1.restJeramiah(); break; diff --git a/src/main/java/main/GameManager.java b/src/main/java/main/GameManager.java index cd88b9e..c87ca66 100644 --- a/src/main/java/main/GameManager.java +++ b/src/main/java/main/GameManager.java @@ -65,6 +65,12 @@ public static void main(String[] args) { launch(args); } + /** + * Starts the game by setting up the game scene and initializing the timer. + * + * @param primaryStage The primary stage for the JavaFX application. + */ + @Override public void start(Stage primaryStage) { diff --git a/src/main/java/main/Player.java b/src/main/java/main/Player.java index cd20c21..8f6caa9 100644 --- a/src/main/java/main/Player.java +++ b/src/main/java/main/Player.java @@ -30,6 +30,11 @@ public void setPlayerDefaultStatus() { updatePlayerStatus(); } + + /** + * Updates the player's status by adjusting the UI elements, such as life icons and item labels, + * based on the player's current attributes. + */ public void updatePlayerStatus() { int i = 0; diff --git a/src/main/java/main/TimeManager.java b/src/main/java/main/TimeManager.java index 25d9b19..1b5550a 100644 --- a/src/main/java/main/TimeManager.java +++ b/src/main/java/main/TimeManager.java @@ -46,6 +46,7 @@ void saveTimes() { oos.writeObject(fastestTimes); } catch (IOException e) { System.err.println("Error saving times: " + e.getMessage()); + // TODO: Add error recovery mechanism (e.g., alert the user). } } @@ -70,6 +71,7 @@ void saveLeaderboard() { } } catch (IOException e) { System.err.println("Error saving leaderboard: " + e.getMessage()); + // TODO: Add a feature to alert the user if the leaderboard fails to save. } }