From bfbf7890d37b3792da153caa08115cd0bb62d093 Mon Sep 17 00:00:00 2001 From: rubenpirreram Date: Tue, 26 May 2026 19:30:57 +0200 Subject: [PATCH] Added: EventType toString --- .../polimi/ingsw/gc14/Network/EventType.java | 33 ++++++++++++------- .../ingsw/gc14/Network/NetworkEvent.java | 4 +-- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/EventType.java b/src/main/java/it/polimi/ingsw/gc14/Network/EventType.java index 535e400..91e1174 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/EventType.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/EventType.java @@ -9,60 +9,69 @@ public enum EventType { /** * Event used to add a player to the game. */ - ADD_PLAYER, + ADD_PLAYER("Add Player Event"), /** * Event used to submit a player's totem choice. */ - TOTEM_CHOICE, + TOTEM_CHOICE("Totem Choice"), /** * Event used to submit a player's slot choice. */ - SLOT_CHOICE, + SLOT_CHOICE("Slot Choice"), /** * Event used to draw a tribe card from the upper card list. */ - DRAW_UPPER_TRIBE, + DRAW_UPPER_TRIBE("Drawing Upper Tribe"), /** * Event used to draw a tribe card from the lower card list. */ - DRAW_LOWER_TRIBE, + DRAW_LOWER_TRIBE("Drawing Lower Tribe"), /** * Event used to draw a building card from the upper card list. */ - DRAW_UPPER_BUILD, + DRAW_UPPER_BUILD("Drawing Upper Build"), /** * Event used to draw a building card from the lower card list. */ - DRAW_LOWER_BUILD, + DRAW_LOWER_BUILD("Drawing Lower Build"), /** * Event used to skip the current turn or optional action. */ - SKIP_TURN, + SKIP_TURN("Skip Turn"), /** * Event used to notify that a player has disconnected. */ - DISCONNECTED_PLAYER, + DISCONNECTED_PLAYER("Disconnected Player"), /** * Event used to notify that a player has reconnected. */ - RECONNECT_PLAYER, + RECONNECT_PLAYER("Reconnect Player"), /** * Event used to apply the transition to the next round. */ - NEXT_ROUND, + NEXT_ROUND("Next Round"), /** * Event used to notify that the game has ended. */ - ENDED_GAME + ENDED_GAME("Ended Game"); + + private String description; + private EventType(String description) { + this.description = description; + } + @Override + public String toString() { + return description; + } } diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvent.java b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvent.java index 8a3178c..54effb0 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvent.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvent.java @@ -141,9 +141,9 @@ public abstract class NetworkEvent implements Serializable { @Override public String toString() { if (isError) { - return "ERROR: action " + eventType; + return "ERROR: " + eventType; } else { - return "ACTION: action " + eventType; + return "ACTION: " + eventType; } }