renamed WaitingScreen to SessionScreen

dev
Jonah Bauer 3 years ago
parent bd7588c0d8
commit 34695f1132

@ -17,7 +17,7 @@ import eu.jonahbauer.wizard.common.model.Configuration;
import java.util.UUID; import java.util.UUID;
public class WaitingScreen extends MenuScreen { public class SessionScreen extends MenuScreen {
private TextButton buttonLeave; private TextButton buttonLeave;
private TextButton buttonReady; private TextButton buttonReady;
@ -42,7 +42,7 @@ public class WaitingScreen extends MenuScreen {
} }
}; };
public WaitingScreen(WizardGame game) { public SessionScreen(WizardGame game) {
super(game); super(game);
} }
@ -50,11 +50,11 @@ public class WaitingScreen extends MenuScreen {
public void show() { public void show() {
super.show(); super.show();
buttonLeave = new TextButton(messages.get("menu.waiting.leave"), skin); buttonLeave = new TextButton(messages.get("menu.session.leave"), skin);
buttonLeave.addListener(listener); buttonLeave.addListener(listener);
getButtonGroup().addActor(buttonLeave); getButtonGroup().addActor(buttonLeave);
buttonReady = new TextButton(messages.get("menu.waiting.ready"), skin); buttonReady = new TextButton(messages.get("menu.session.ready"), skin);
buttonReady.addListener(listener); buttonReady.addListener(listener);
getButtonGroup().addActor(buttonReady); getButtonGroup().addActor(buttonReady);
@ -121,13 +121,13 @@ public class WaitingScreen extends MenuScreen {
infoTable.columnDefaults(0).growX().width(infoTableWidth); infoTable.columnDefaults(0).growX().width(infoTableWidth);
infoTable.setSize(infoTableWidth, 400); 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(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(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(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(); infoTable.add(labelPlayerName).row();
return infoTable; return infoTable;
@ -138,7 +138,7 @@ public class WaitingScreen extends MenuScreen {
} }
public void setReady(boolean ready) { 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) { public void addPlayer(PlayerData player) {

@ -68,7 +68,7 @@ public final class AwaitingJoinSession extends Awaiting {
)); ));
} else { } else {
return Optional.of(new Session( return Optional.of(new Session(
new SessionData(session, sessionName, -1, configuration), session, sessionName, configuration,
players, players,
player player
)); ));

@ -433,7 +433,7 @@ public final class Game extends BaseState {
private Optional<ClientState> returnToSession() { private Optional<ClientState> returnToSession() {
return Optional.of(new Session( return Optional.of(new Session(
new SessionData(session, sessionName, -1, configuration), session, sessionName, configuration,
players.entrySet().stream() players.entrySet().stream()
.map(entry -> new PlayerData(entry.getKey(), entry.getValue(), false)) .map(entry -> new PlayerData(entry.getKey(), entry.getValue(), false))
.toList(), .toList(),

@ -1,11 +1,10 @@
package eu.jonahbauer.wizard.client.libgdx.state; package eu.jonahbauer.wizard.client.libgdx.state;
import eu.jonahbauer.wizard.client.libgdx.Client; 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.LeaveSessionMessage;
import eu.jonahbauer.wizard.common.messages.client.ReadyMessage; import eu.jonahbauer.wizard.common.messages.client.ReadyMessage;
import eu.jonahbauer.wizard.common.messages.data.PlayerData; 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.messages.server.*;
import eu.jonahbauer.wizard.common.model.Configuration; import eu.jonahbauer.wizard.common.model.Configuration;
import lombok.Getter; import lombok.Getter;
@ -16,7 +15,7 @@ import java.util.*;
@Log4j2 @Log4j2
@Getter @Getter
public final class Session extends BaseState { public final class Session extends BaseState {
private WaitingScreen sessionScreen; private SessionScreen sessionScreen;
private final UUID self; private final UUID self;
@ -28,14 +27,14 @@ public final class Session extends BaseState {
private boolean sending; private boolean sending;
public Session(SessionData session, Collection<PlayerData> players, UUID self) { public Session(UUID session, String name, Configuration configuration, Collection<PlayerData> players, UUID self) {
this(session, players, self, false); this(session, name, configuration, players, self, false);
} }
public Session(SessionData session, Collection<PlayerData> players, UUID self, boolean dontSwitchScreen) { public Session(UUID session, String name, Configuration configuration, Collection<PlayerData> players, UUID self, boolean dontSwitchScreen) {
this.session = session.getUuid(); this.session = session;
this.sessionName = session.getName(); this.sessionName = name;
this.configuration = session.getConfiguration(); this.configuration = configuration;
players.forEach(p -> this.players.put(p.getUuid(), p)); players.forEach(p -> this.players.put(p.getUuid(), p));
this.dontSwitchScreen = dontSwitchScreen; this.dontSwitchScreen = dontSwitchScreen;
@ -122,7 +121,7 @@ public final class Session extends BaseState {
} }
public Optional<ClientState> showInfoScreen(Client client) { public Optional<ClientState> showInfoScreen(Client client) {
sessionScreen = new WaitingScreen(client.getGame()); sessionScreen = new SessionScreen(client.getGame());
client.getGame().setScreen(sessionScreen); client.getGame().setScreen(sessionScreen);
sessionScreen.setPlayers(players.values().toArray(new PlayerData[0])); sessionScreen.setPlayers(players.values().toArray(new PlayerData[0]));
sessionScreen.setReady(players.get(self).isReady()); sessionScreen.setReady(players.get(self).isReady());

@ -150,14 +150,14 @@ menu.loading.joining_session=Joining session...
menu.loading.joining_lobby=Joining lobby... menu.loading.joining_lobby=Joining lobby...
menu.loading.back=Return To Main Menu menu.loading.back=Return To Main Menu
menu.waiting.ready=Ready menu.session.ready=Ready
menu.waiting.not_ready=Not Ready menu.session.not_ready=Not Ready
menu.waiting.leave=Leave menu.session.leave=Leave
menu.waiting.player_name.label=Own Name menu.session.player_name.label=Own Name
menu.waiting.session_name.label=Session Name menu.session.session_name.label=Session Name
menu.waiting.session_uuid.label=Session UUID menu.session.session_uuid.label=Session UUID
menu.waiting.session_configuration.label=Configuration menu.session.session_configuration.label=Configuration
menu.error.malformed_message=Error: Malformed Message menu.error.malformed_message=Error: Malformed Message
menu.error.unexpected_message=Error: Unexpected Message menu.error.unexpected_message=Error: Unexpected Message

@ -143,14 +143,14 @@ menu.loading.joining_session=Trete Sitzung bei...
menu.loading.joining_lobby=Trete Warteraum bei... menu.loading.joining_lobby=Trete Warteraum bei...
menu.loading.back=Zurück zum Hauptmenü menu.loading.back=Zurück zum Hauptmenü
menu.waiting.ready=Bereit menu.session.ready=Bereit
menu.waiting.not_ready=Nicht Bereit menu.session.not_ready=Nicht Bereit
menu.waiting.leave=Verlassen menu.session.leave=Verlassen
menu.waiting.player_name.label=Eigener Name menu.session.player_name.label=Eigener Name
menu.waiting.session_name.label=Sitzungsname menu.session.session_name.label=Sitzungsname
menu.waiting.session_uuid.label=Sitzungs-ID menu.session.session_uuid.label=Sitzungs-ID
menu.waiting.session_configuration.label=Spielvariante menu.session.session_configuration.label=Spielvariante
menu.error.malformed_message=Fehler: Missgebildete Nachricht menu.error.malformed_message=Fehler: Missgebildete Nachricht
menu.error.unexpected_message=Fehler: Unerwartete Nachricht menu.error.unexpected_message=Fehler: Unerwartete Nachricht

Loading…
Cancel
Save