visual improvements
This commit is contained in:
parent
10ca1ac9db
commit
991ae427da
@ -1,7 +1,6 @@
|
|||||||
package eu.jonahbauer.wizard.client.libgdx.actors.game;
|
package eu.jonahbauer.wizard.client.libgdx.actors.game;
|
||||||
|
|
||||||
import com.badlogic.gdx.scenes.scene2d.*;
|
import com.badlogic.gdx.scenes.scene2d.*;
|
||||||
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
|
|
||||||
import eu.jonahbauer.wizard.client.libgdx.WizardGame;
|
import eu.jonahbauer.wizard.client.libgdx.WizardGame;
|
||||||
import eu.jonahbauer.wizard.client.libgdx.screens.GameScreen;
|
import eu.jonahbauer.wizard.client.libgdx.screens.GameScreen;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -8,6 +8,7 @@ import com.badlogic.gdx.utils.Array;
|
|||||||
import eu.jonahbauer.wizard.client.libgdx.WizardGame;
|
import eu.jonahbauer.wizard.client.libgdx.WizardGame;
|
||||||
import eu.jonahbauer.wizard.client.libgdx.listeners.ResetErrorListener;
|
import eu.jonahbauer.wizard.client.libgdx.listeners.ResetErrorListener;
|
||||||
import eu.jonahbauer.wizard.client.libgdx.state.AwaitingJoinSession;
|
import eu.jonahbauer.wizard.client.libgdx.state.AwaitingJoinSession;
|
||||||
|
import eu.jonahbauer.wizard.client.libgdx.state.Lobby;
|
||||||
import eu.jonahbauer.wizard.common.messages.client.CreateSessionMessage;
|
import eu.jonahbauer.wizard.common.messages.client.CreateSessionMessage;
|
||||||
import eu.jonahbauer.wizard.common.model.Configuration;
|
import eu.jonahbauer.wizard.common.model.Configuration;
|
||||||
|
|
||||||
@ -21,6 +22,8 @@ public class CreateGameScreen extends MenuScreen {
|
|||||||
private TextField timeOut;
|
private TextField timeOut;
|
||||||
private SelectBox<String> configurations;
|
private SelectBox<String> configurations;
|
||||||
|
|
||||||
|
private final Lobby state;
|
||||||
|
|
||||||
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) {
|
||||||
@ -36,6 +39,7 @@ public class CreateGameScreen extends MenuScreen {
|
|||||||
|
|
||||||
public CreateGameScreen(WizardGame game) {
|
public CreateGameScreen(WizardGame game) {
|
||||||
super(game);
|
super(game);
|
||||||
|
this.state = (Lobby) game.getClient().getState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -55,31 +59,31 @@ public class CreateGameScreen extends MenuScreen {
|
|||||||
sessionName.addListener(errorListener);
|
sessionName.addListener(errorListener);
|
||||||
sessionName.setProgrammaticChangeEvents(true);
|
sessionName.setProgrammaticChangeEvents(true);
|
||||||
|
|
||||||
playerName = new TextField("", game.data.skin);
|
playerName = new TextField(state.getPlayerName(), game.data.skin);
|
||||||
playerName.setPosition(WizardGame.WIDTH * 0.3f, WizardGame.HEIGHT * 0.45f);
|
playerName.setPosition(WizardGame.WIDTH * 0.3f, WizardGame.HEIGHT * 0.45f);
|
||||||
playerName.setSize(0.4f * WizardGame.WIDTH, 64);
|
playerName.setSize(0.4f * WizardGame.WIDTH, 64);
|
||||||
playerName.addListener(errorListener);
|
playerName.addListener(errorListener);
|
||||||
playerName.setTextFieldListener(new TextField.TextFieldListener() {
|
var playerNameListener = new ChangeListener() {
|
||||||
private final String format = game.messages.get("menu.create_game.session_name.default");
|
private final String format = game.messages.get("menu.create_game.session_name.default");
|
||||||
private String oldName = "";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void keyTyped(TextField textField, char c) {
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
if (textField == playerName) {
|
var old = state.getPlayerName();
|
||||||
var player = playerName.getText();
|
state.setPlayerName(playerName.getText());
|
||||||
var session = sessionName.getText();
|
|
||||||
if (session.isEmpty() || session.equals(format.formatted(oldName))) {
|
|
||||||
if (player.isEmpty()) {
|
|
||||||
sessionName.setText("");
|
|
||||||
} else {
|
|
||||||
sessionName.setText(format.formatted(player));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
oldName = player;
|
var player = playerName.getText();
|
||||||
|
var session = sessionName.getText();
|
||||||
|
if (session.isEmpty() || session.equals(format.formatted(old))) {
|
||||||
|
if (player.isEmpty()) {
|
||||||
|
sessionName.setText("");
|
||||||
|
} else {
|
||||||
|
sessionName.setText(format.formatted(player));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
playerName.addListener(playerNameListener);
|
||||||
|
playerNameListener.changed(null, null);
|
||||||
|
|
||||||
timeOut = new TextField("", game.data.skin);
|
timeOut = new TextField("", game.data.skin);
|
||||||
timeOut.setPosition(WizardGame.WIDTH * 0.3f, WizardGame.HEIGHT * 0.4f);
|
timeOut.setPosition(WizardGame.WIDTH * 0.3f, WizardGame.HEIGHT * 0.4f);
|
||||||
|
@ -8,6 +8,7 @@ import eu.jonahbauer.wizard.client.libgdx.WizardGame;
|
|||||||
import eu.jonahbauer.wizard.client.libgdx.actors.AutoFocusScrollPane;
|
import eu.jonahbauer.wizard.client.libgdx.actors.AutoFocusScrollPane;
|
||||||
import eu.jonahbauer.wizard.client.libgdx.listeners.ResetErrorListener;
|
import eu.jonahbauer.wizard.client.libgdx.listeners.ResetErrorListener;
|
||||||
import eu.jonahbauer.wizard.client.libgdx.state.AwaitingJoinSession;
|
import eu.jonahbauer.wizard.client.libgdx.state.AwaitingJoinSession;
|
||||||
|
import eu.jonahbauer.wizard.client.libgdx.state.Lobby;
|
||||||
import eu.jonahbauer.wizard.client.libgdx.state.Menu;
|
import eu.jonahbauer.wizard.client.libgdx.state.Menu;
|
||||||
import eu.jonahbauer.wizard.common.messages.client.JoinSessionMessage;
|
import eu.jonahbauer.wizard.common.messages.client.JoinSessionMessage;
|
||||||
import eu.jonahbauer.wizard.common.messages.data.SessionData;
|
import eu.jonahbauer.wizard.common.messages.data.SessionData;
|
||||||
@ -34,6 +35,8 @@ public class LobbyScreen extends MenuScreen {
|
|||||||
private ScrollPane sessionListContainer;
|
private ScrollPane sessionListContainer;
|
||||||
private final Map<UUID, SessionData> sessionData = new HashMap<>();
|
private final Map<UUID, SessionData> sessionData = new HashMap<>();
|
||||||
|
|
||||||
|
private final Lobby state;
|
||||||
|
|
||||||
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) {
|
||||||
@ -52,6 +55,7 @@ public class LobbyScreen extends MenuScreen {
|
|||||||
|
|
||||||
public LobbyScreen(WizardGame game) {
|
public LobbyScreen(WizardGame game) {
|
||||||
super(game);
|
super(game);
|
||||||
|
this.state = (Lobby) game.getClient().getState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -60,7 +64,6 @@ public class LobbyScreen extends MenuScreen {
|
|||||||
|
|
||||||
buttonBack = new TextButton(game.messages.get("menu.lobby.back"), game.data.skin);
|
buttonBack = new TextButton(game.messages.get("menu.lobby.back"), game.data.skin);
|
||||||
buttonJoin = new TextButton(game.messages.get("menu.lobby.join"), game.data.skin);
|
buttonJoin = new TextButton(game.messages.get("menu.lobby.join"), game.data.skin);
|
||||||
buttonJoin.setDisabled(true);
|
|
||||||
buttonCreate = new TextButton(game.messages.get("menu.lobby.create"), game.data.skin);
|
buttonCreate = new TextButton(game.messages.get("menu.lobby.create"), game.data.skin);
|
||||||
|
|
||||||
sessions = new List<>(game.data.skin) {
|
sessions = new List<>(game.data.skin) {
|
||||||
@ -165,14 +168,19 @@ public class LobbyScreen extends MenuScreen {
|
|||||||
labelSessionConfiguration.setText("");
|
labelSessionConfiguration.setText("");
|
||||||
selectedSession = null;
|
selectedSession = null;
|
||||||
}
|
}
|
||||||
buttonJoin.setDisabled(data == null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Table createInfoTable() {
|
private Table createInfoTable() {
|
||||||
float infoTableWidth = 0.3f * WizardGame.WIDTH - 20;
|
float infoTableWidth = 0.3f * WizardGame.WIDTH - 20;
|
||||||
|
|
||||||
playerName = new TextField("", game.data.skin);
|
playerName = new TextField(state.getPlayerName(), game.data.skin);
|
||||||
playerName.addListener(new ResetErrorListener(game.data.skin));
|
playerName.addListener(new ResetErrorListener(game.data.skin));
|
||||||
|
playerName.addListener(new ChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void changed(ChangeEvent event, Actor actor) {
|
||||||
|
state.setPlayerName(playerName.getText());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
labelSessionName = new Label("", game.data.skin, "textfield");
|
labelSessionName = new Label("", game.data.skin, "textfield");
|
||||||
labelSessionConfiguration = new Label("", game.data.skin, "textfield");
|
labelSessionConfiguration = new Label("", game.data.skin, "textfield");
|
||||||
|
@ -29,7 +29,6 @@ public abstract class MenuScreen implements Screen {
|
|||||||
@Override
|
@Override
|
||||||
public final void render(float delta) {
|
public final void render(float delta) {
|
||||||
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT | (Gdx.graphics.getBufferFormat().coverageSampling?GL20.GL_COVERAGE_BUFFER_BIT_NV:0));
|
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT | (Gdx.graphics.getBufferFormat().coverageSampling?GL20.GL_COVERAGE_BUFFER_BIT_NV:0));
|
||||||
// Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
|
|
||||||
|
|
||||||
game.data.extendViewport.apply(true);
|
game.data.extendViewport.apply(true);
|
||||||
game.batch.setProjectionMatrix(game.data.extendViewport.getCamera().combined);
|
game.batch.setProjectionMatrix(game.data.extendViewport.getCamera().combined);
|
||||||
@ -48,6 +47,7 @@ public abstract class MenuScreen implements Screen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void renderBackground(float delta) {
|
protected void renderBackground(float delta) {
|
||||||
|
game.batch.setColor(1, 1, 1, 1);
|
||||||
float scale = Math.max(
|
float scale = Math.max(
|
||||||
game.data.extendViewport.getWorldWidth() / WizardGame.WIDTH,
|
game.data.extendViewport.getWorldWidth() / WizardGame.WIDTH,
|
||||||
game.data.extendViewport.getWorldHeight() / WizardGame.HEIGHT
|
game.data.extendViewport.getWorldHeight() / WizardGame.HEIGHT
|
||||||
@ -60,6 +60,7 @@ public abstract class MenuScreen implements Screen {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void renderForeground(float delta) {
|
protected void renderForeground(float delta) {
|
||||||
|
game.batch.setColor(1, 1, 1, 1);
|
||||||
game.batch.draw(game.data.title, 555, WizardGame.HEIGHT - 192 - 96, 810, 192);
|
game.batch.draw(game.data.title, 555, WizardGame.HEIGHT - 192 - 96, 810, 192);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package eu.jonahbauer.wizard.client.libgdx.state;
|
package eu.jonahbauer.wizard.client.libgdx.state;
|
||||||
|
|
||||||
import com.badlogic.gdx.utils.reflect.ClassReflection;
|
|
||||||
import eu.jonahbauer.wizard.client.libgdx.Client;
|
import eu.jonahbauer.wizard.client.libgdx.Client;
|
||||||
import eu.jonahbauer.wizard.client.libgdx.screens.CreateGameScreen;
|
|
||||||
import eu.jonahbauer.wizard.client.libgdx.screens.LobbyScreen;
|
import eu.jonahbauer.wizard.client.libgdx.screens.LobbyScreen;
|
||||||
import eu.jonahbauer.wizard.common.messages.data.SessionData;
|
import eu.jonahbauer.wizard.common.messages.data.SessionData;
|
||||||
import eu.jonahbauer.wizard.common.messages.server.*;
|
import eu.jonahbauer.wizard.common.messages.server.*;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@ -13,7 +13,10 @@ public final class Lobby extends BaseState {
|
|||||||
|
|
||||||
private SessionListMessage list;
|
private SessionListMessage list;
|
||||||
private LobbyScreen lobbyScreen;
|
private LobbyScreen lobbyScreen;
|
||||||
private CreateGameScreen createScreen;
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private String playerName = "";
|
||||||
|
|
||||||
public Lobby(SessionListMessage list) {
|
public Lobby(SessionListMessage list) {
|
||||||
this.list = list;
|
this.list = list;
|
||||||
@ -43,10 +46,6 @@ public final class Lobby extends BaseState {
|
|||||||
} else if (message instanceof SessionListMessage list) {
|
} else if (message instanceof SessionListMessage list) {
|
||||||
lobbyScreen.setSessions(list.getSessions().toArray(new SessionData[0]));
|
lobbyScreen.setSessions(list.getSessions().toArray(new SessionData[0]));
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
} else if (message instanceof SessionJoinedMessage joined) {
|
|
||||||
//TODO find solution
|
|
||||||
createScreen = new CreateGameScreen(client.getGame());
|
|
||||||
return Optional.empty();
|
|
||||||
} else {
|
} else {
|
||||||
return unexpectedMessage(client, message);
|
return unexpectedMessage(client, message);
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 104 KiB After Width: | Height: | Size: 153 KiB |
@ -16,6 +16,7 @@
|
|||||||
"red": { "a": 1.0, "b": 0.0, "g": 0.0, "r": 1.0 },
|
"red": { "a": 1.0, "b": 0.0, "g": 0.0, "r": 1.0 },
|
||||||
"black": { "a": 1.0, "b": 0.0, "g": 0.0, "r": 0.0 },
|
"black": { "a": 1.0, "b": 0.0, "g": 0.0, "r": 0.0 },
|
||||||
"gold": { "a": 1.0, "b": 0.318, "g": 0.753, "r": 0.89 },
|
"gold": { "a": 1.0, "b": 0.318, "g": 0.753, "r": 0.89 },
|
||||||
|
"darkened_gold": { "a": 1.0, "b": 0.176, "g": 0.659, "r": 0.845 },
|
||||||
"dark_gold": { "a": 1.0, "b": 0.034, "g": 0.565, "r": 0.80 },
|
"dark_gold": { "a": 1.0, "b": 0.034, "g": 0.565, "r": 0.80 },
|
||||||
"darker_gold": { "a": 1.0, "b": 0.191, "g": 0.452, "r": 0.534 },
|
"darker_gold": { "a": 1.0, "b": 0.191, "g": 0.452, "r": 0.534 },
|
||||||
"light_gray": { "a": 1.0, "b": 0.6, "g": 0.6, "r": 0.6}
|
"light_gray": { "a": 1.0, "b": 0.6, "g": 0.6, "r": 0.6}
|
||||||
@ -47,6 +48,7 @@
|
|||||||
"font": "enchanted",
|
"font": "enchanted",
|
||||||
"fontColor": "gold",
|
"fontColor": "gold",
|
||||||
"downFontColor": "dark_gold",
|
"downFontColor": "dark_gold",
|
||||||
|
"overFontColor": "darkened_gold",
|
||||||
"disabledFontColor" : "darker_gold"
|
"disabledFontColor" : "darker_gold"
|
||||||
},
|
},
|
||||||
"simple": {
|
"simple": {
|
||||||
@ -192,7 +194,7 @@
|
|||||||
"default": {
|
"default": {
|
||||||
"minus": "tree-minus",
|
"minus": "tree-minus",
|
||||||
"plus": "tree-plus",
|
"plus": "tree-plus",
|
||||||
"selection": "default-select-selection"
|
"selection": "selection"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"TextTooltipStyle": {
|
"TextTooltipStyle": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user