|
|
@ -5,29 +5,29 @@ import com.badlogic.gdx.scenes.scene2d.ui.Label;
|
|
|
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
|
|
|
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
|
|
|
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup;
|
|
|
|
import com.badlogic.gdx.scenes.scene2d.ui.VerticalGroup;
|
|
|
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
|
|
|
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
|
|
|
|
|
|
|
|
import eu.jonahbauer.wizard.client.libgdx.Client;
|
|
|
|
import eu.jonahbauer.wizard.client.libgdx.WizardGame;
|
|
|
|
import eu.jonahbauer.wizard.client.libgdx.WizardGame;
|
|
|
|
import eu.jonahbauer.wizard.client.libgdx.listeners.KeyboardFocusManager;
|
|
|
|
import eu.jonahbauer.wizard.client.libgdx.listeners.KeyboardFocusManager;
|
|
|
|
|
|
|
|
import eu.jonahbauer.wizard.client.libgdx.state.BaseState;
|
|
|
|
|
|
|
|
import eu.jonahbauer.wizard.client.libgdx.state.Lobby;
|
|
|
|
import eu.jonahbauer.wizard.client.libgdx.state.Session;
|
|
|
|
import eu.jonahbauer.wizard.client.libgdx.state.Session;
|
|
|
|
import eu.jonahbauer.wizard.common.messages.server.NackMessage;
|
|
|
|
import eu.jonahbauer.wizard.common.messages.server.NackMessage;
|
|
|
|
|
|
|
|
|
|
|
|
public class ErrorScreen extends MenuScreen {
|
|
|
|
public class ErrorScreen extends MenuScreen {
|
|
|
|
private final String labelText;
|
|
|
|
private final String labelText;
|
|
|
|
private TextButton buttonBack;
|
|
|
|
private TextButton buttonBack;
|
|
|
|
private final MenuScreen prevScreen;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final ChangeListener listener = new ChangeListener() {
|
|
|
|
private final ChangeListener listener = new ChangeListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void changed(ChangeEvent event, Actor actor) {
|
|
|
|
public void changed(ChangeEvent event, Actor actor) {
|
|
|
|
if (actor == buttonBack) {
|
|
|
|
if (actor == buttonBack) {
|
|
|
|
game.setScreen(prevScreen);
|
|
|
|
|
|
|
|
sfxClick();
|
|
|
|
sfxClick();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
public ErrorScreen(WizardGame game, MenuScreen prevScreen, NackMessage message) {
|
|
|
|
public ErrorScreen(WizardGame game, Client client, NackMessage message) {
|
|
|
|
super(game);
|
|
|
|
super(game);
|
|
|
|
this.prevScreen = prevScreen;
|
|
|
|
|
|
|
|
labelText = switch (message.getCode()) {
|
|
|
|
labelText = switch (message.getCode()) {
|
|
|
|
case NackMessage.GAME_ALREADY_STARTED -> messages.get("menu.error.game_already_started");
|
|
|
|
case NackMessage.GAME_ALREADY_STARTED -> messages.get("menu.error.game_already_started");
|
|
|
|
case NackMessage.SESSION_FULL -> messages.get("menu.error.session_full");
|
|
|
|
case NackMessage.SESSION_FULL -> messages.get("menu.error.session_full");
|
|
|
@ -61,6 +61,8 @@ public class ErrorScreen extends MenuScreen {
|
|
|
|
content.addActor(label);
|
|
|
|
content.addActor(label);
|
|
|
|
content.addActor(buttonBack);
|
|
|
|
content.addActor(buttonBack);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
buttonBack.addListener(listener);
|
|
|
|
|
|
|
|
|
|
|
|
stage.addActor(content);
|
|
|
|
stage.addActor(content);
|
|
|
|
stage.addCaptureListener(new KeyboardFocusManager(buttonBack));
|
|
|
|
stage.addCaptureListener(new KeyboardFocusManager(buttonBack));
|
|
|
|
}
|
|
|
|
}
|
|
|
|