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;
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) {

@ -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
));

@ -433,7 +433,7 @@ public final class Game extends BaseState {
private Optional<ClientState> 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(),

@ -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<PlayerData> players, UUID self) {
this(session, players, self, false);
public Session(UUID session, String name, Configuration configuration, Collection<PlayerData> players, UUID self) {
this(session, name, configuration, players, self, false);
}
public Session(SessionData session, Collection<PlayerData> 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<PlayerData> 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<ClientState> 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());

@ -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

@ -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

Loading…
Cancel
Save