From 34695f11329846b12b065cd8d9ba0288ab323029 Mon Sep 17 00:00:00 2001 From: Jonah Bauer Date: Tue, 1 Feb 2022 01:54:45 +0100 Subject: [PATCH] renamed WaitingScreen to SessionScreen --- ...{WaitingScreen.java => SessionScreen.java} | 18 +++++++++--------- .../libgdx/state/AwaitingJoinSession.java | 2 +- .../wizard/client/libgdx/state/Game.java | 2 +- .../wizard/client/libgdx/state/Session.java | 19 +++++++++---------- .../main/resources/i18n/messages.properties | 16 ++++++++-------- .../resources/i18n/messages_de.properties | 16 ++++++++-------- 6 files changed, 36 insertions(+), 37 deletions(-) rename wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/screens/{WaitingScreen.java => SessionScreen.java} (91%) diff --git a/wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/screens/WaitingScreen.java b/wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/screens/SessionScreen.java similarity index 91% rename from wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/screens/WaitingScreen.java rename to wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/screens/SessionScreen.java index 9d77c24..ca0814d 100644 --- a/wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/screens/WaitingScreen.java +++ b/wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/screens/SessionScreen.java @@ -17,7 +17,7 @@ import eu.jonahbauer.wizard.common.model.Configuration; import java.util.UUID; -public class WaitingScreen extends MenuScreen { +public class SessionScreen extends MenuScreen { private TextButton buttonLeave; private TextButton buttonReady; @@ -42,7 +42,7 @@ public class WaitingScreen extends MenuScreen { } }; - public WaitingScreen(WizardGame game) { + public SessionScreen(WizardGame game) { super(game); } @@ -50,11 +50,11 @@ public class WaitingScreen extends MenuScreen { public void show() { super.show(); - buttonLeave = new TextButton(messages.get("menu.waiting.leave"), skin); + buttonLeave = new TextButton(messages.get("menu.session.leave"), skin); buttonLeave.addListener(listener); getButtonGroup().addActor(buttonLeave); - buttonReady = new TextButton(messages.get("menu.waiting.ready"), skin); + buttonReady = new TextButton(messages.get("menu.session.ready"), skin); buttonReady.addListener(listener); getButtonGroup().addActor(buttonReady); @@ -121,13 +121,13 @@ public class WaitingScreen extends MenuScreen { infoTable.columnDefaults(0).growX().width(infoTableWidth); infoTable.setSize(infoTableWidth, 400); - infoTable.add(messages.get("menu.waiting.session_name.label")).row(); + infoTable.add(messages.get("menu.session.session_name.label")).row(); infoTable.add(labelSessionName).row(); - infoTable.add(messages.get("menu.waiting.session_uuid.label")).row(); + infoTable.add(messages.get("menu.session.session_uuid.label")).row(); infoTable.add(labelSessionUUID).row(); - infoTable.add(messages.get("menu.waiting.session_configuration.label")).row(); + infoTable.add(messages.get("menu.session.session_configuration.label")).row(); infoTable.add(labelSessionConfiguration).row(); - infoTable.add(messages.get("menu.waiting.player_name.label")).row(); + infoTable.add(messages.get("menu.session.player_name.label")).row(); infoTable.add(labelPlayerName).row(); return infoTable; @@ -138,7 +138,7 @@ public class WaitingScreen extends MenuScreen { } public void setReady(boolean ready) { - buttonReady.setText(messages.get(ready ? "menu.waiting.not_ready" : "menu.waiting.ready")); + buttonReady.setText(messages.get(ready ? "menu.session.not_ready" : "menu.session.ready")); } public void addPlayer(PlayerData player) { diff --git a/wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/state/AwaitingJoinSession.java b/wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/state/AwaitingJoinSession.java index a66dfdb..1411a08 100644 --- a/wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/state/AwaitingJoinSession.java +++ b/wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/state/AwaitingJoinSession.java @@ -68,7 +68,7 @@ public final class AwaitingJoinSession extends Awaiting { )); } else { return Optional.of(new Session( - new SessionData(session, sessionName, -1, configuration), + session, sessionName, configuration, players, player )); diff --git a/wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/state/Game.java b/wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/state/Game.java index 180e6d2..b43041e 100644 --- a/wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/state/Game.java +++ b/wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/state/Game.java @@ -433,7 +433,7 @@ public final class Game extends BaseState { private Optional returnToSession() { return Optional.of(new Session( - new SessionData(session, sessionName, -1, configuration), + session, sessionName, configuration, players.entrySet().stream() .map(entry -> new PlayerData(entry.getKey(), entry.getValue(), false)) .toList(), diff --git a/wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/state/Session.java b/wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/state/Session.java index f805e11..fb8659c 100644 --- a/wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/state/Session.java +++ b/wizard-client/wizard-client-libgdx/core/src/main/java/eu/jonahbauer/wizard/client/libgdx/state/Session.java @@ -1,11 +1,10 @@ package eu.jonahbauer.wizard.client.libgdx.state; import eu.jonahbauer.wizard.client.libgdx.Client; -import eu.jonahbauer.wizard.client.libgdx.screens.WaitingScreen; +import eu.jonahbauer.wizard.client.libgdx.screens.SessionScreen; import eu.jonahbauer.wizard.common.messages.client.LeaveSessionMessage; import eu.jonahbauer.wizard.common.messages.client.ReadyMessage; import eu.jonahbauer.wizard.common.messages.data.PlayerData; -import eu.jonahbauer.wizard.common.messages.data.SessionData; import eu.jonahbauer.wizard.common.messages.server.*; import eu.jonahbauer.wizard.common.model.Configuration; import lombok.Getter; @@ -16,7 +15,7 @@ import java.util.*; @Log4j2 @Getter public final class Session extends BaseState { - private WaitingScreen sessionScreen; + private SessionScreen sessionScreen; private final UUID self; @@ -28,14 +27,14 @@ public final class Session extends BaseState { private boolean sending; - public Session(SessionData session, Collection players, UUID self) { - this(session, players, self, false); + public Session(UUID session, String name, Configuration configuration, Collection players, UUID self) { + this(session, name, configuration, players, self, false); } - public Session(SessionData session, Collection players, UUID self, boolean dontSwitchScreen) { - this.session = session.getUuid(); - this.sessionName = session.getName(); - this.configuration = session.getConfiguration(); + public Session(UUID session, String name, Configuration configuration, Collection players, UUID self, boolean dontSwitchScreen) { + this.session = session; + this.sessionName = name; + this.configuration = configuration; players.forEach(p -> this.players.put(p.getUuid(), p)); this.dontSwitchScreen = dontSwitchScreen; @@ -122,7 +121,7 @@ public final class Session extends BaseState { } public Optional showInfoScreen(Client client) { - sessionScreen = new WaitingScreen(client.getGame()); + sessionScreen = new SessionScreen(client.getGame()); client.getGame().setScreen(sessionScreen); sessionScreen.setPlayers(players.values().toArray(new PlayerData[0])); sessionScreen.setReady(players.get(self).isReady()); diff --git a/wizard-client/wizard-client-libgdx/core/src/main/resources/i18n/messages.properties b/wizard-client/wizard-client-libgdx/core/src/main/resources/i18n/messages.properties index 3f879c9..073b332 100644 --- a/wizard-client/wizard-client-libgdx/core/src/main/resources/i18n/messages.properties +++ b/wizard-client/wizard-client-libgdx/core/src/main/resources/i18n/messages.properties @@ -150,14 +150,14 @@ menu.loading.joining_session=Joining session... menu.loading.joining_lobby=Joining lobby... menu.loading.back=Return To Main Menu -menu.waiting.ready=Ready -menu.waiting.not_ready=Not Ready -menu.waiting.leave=Leave - -menu.waiting.player_name.label=Own Name -menu.waiting.session_name.label=Session Name -menu.waiting.session_uuid.label=Session UUID -menu.waiting.session_configuration.label=Configuration +menu.session.ready=Ready +menu.session.not_ready=Not Ready +menu.session.leave=Leave + +menu.session.player_name.label=Own Name +menu.session.session_name.label=Session Name +menu.session.session_uuid.label=Session UUID +menu.session.session_configuration.label=Configuration menu.error.malformed_message=Error: Malformed Message menu.error.unexpected_message=Error: Unexpected Message diff --git a/wizard-client/wizard-client-libgdx/core/src/main/resources/i18n/messages_de.properties b/wizard-client/wizard-client-libgdx/core/src/main/resources/i18n/messages_de.properties index 176f33b..808d558 100644 --- a/wizard-client/wizard-client-libgdx/core/src/main/resources/i18n/messages_de.properties +++ b/wizard-client/wizard-client-libgdx/core/src/main/resources/i18n/messages_de.properties @@ -143,14 +143,14 @@ menu.loading.joining_session=Trete Sitzung bei... menu.loading.joining_lobby=Trete Warteraum bei... menu.loading.back=Zurück zum Hauptmenü -menu.waiting.ready=Bereit -menu.waiting.not_ready=Nicht Bereit -menu.waiting.leave=Verlassen - -menu.waiting.player_name.label=Eigener Name -menu.waiting.session_name.label=Sitzungsname -menu.waiting.session_uuid.label=Sitzungs-ID -menu.waiting.session_configuration.label=Spielvariante +menu.session.ready=Bereit +menu.session.not_ready=Nicht Bereit +menu.session.leave=Verlassen + +menu.session.player_name.label=Eigener Name +menu.session.session_name.label=Sitzungsname +menu.session.session_uuid.label=Sitzungs-ID +menu.session.session_configuration.label=Spielvariante menu.error.malformed_message=Fehler: Missgebildete Nachricht menu.error.unexpected_message=Fehler: Unerwartete Nachricht