Commit 178dbc82 authored by Petter Selfors Rølvåg's avatar Petter Selfors Rølvåg
Browse files

Lobby UI improvements

parent cf67d51e
......@@ -194,13 +194,13 @@ public class LobbyView extends AbstractView {
lobbyCreateTextField = new TextField("", skin);
lobbyCreateTextField.setMessageText("Enter lobby name.");
lobbyCreateTextField.setSize(col_width*1f,row_height*1f);
lobbyCreateTextField.setSize(col_width*2.5f,row_height*1f);
lobbyCreateTextField.setPosition(lobbyListRefreshButton.getX(), lobbyListRefreshButton.getY()+row_height*1.25f);
lobbyCreateSizeSelectBox =new SelectBox<>(skin);
lobbyCreateSizeSelectBox.setItems(2, 4, 6);
lobbyCreateSizeSelectBox.setPosition(lobbyListBackButton.getX(), lobbyCreateTextField.getY());
lobbyCreateSizeSelectBox.setSize(lobbyListBackButton.getWidth(), lobbyListBackButton.getHeight());
lobbyCreateSizeSelectBox.setPosition(lobbyListBackButton.getX(), lobbyCreateTextField.getY()+lobbyCreateTextField.getHeight()/2-lobbyCreateSizeSelectBox.getHeight()/2);
backgroundImage.setZIndex(1);
backgroundImage.setOrigin(0,0);
......@@ -443,34 +443,36 @@ public class LobbyView extends AbstractView {
lobbyListStrings = new List(skin, "plain");
lobbyListStrings.setColor(Color.BLACK);
ArrayList<Lobby> currentLobbyList = playerController.getLobbyList();
String[] strings;
if(getLobbyByStringHashMap == null) getLobbyByStringHashMap = new HashMap<>();
else getLobbyByStringHashMap.clear();
if(currentLobbyList.size() > 0){
strings = new String[currentLobbyList.size()];
for (int i = 0; i < currentLobbyList.size(); i++) {
strings[i] = currentLobbyList.get(i).getName() + "\t" + currentLobbyList.get(i).getPlayers().size()+ "/" + currentLobbyList.get(i).getMaxPlayers();
getLobbyByStringHashMap.put(strings[i], currentLobbyList.get(i).getID());
if(lobbyList.size() > 0){
strings = new String[lobbyList.size()];
for (int i = 0; i < lobbyList.size(); i++) {
strings[i] = lobbyList.get(i).getName() + "\t" + lobbyList.get(i).getPlayers().size()+ "/" + lobbyList.get(i).getMaxPlayers();
getLobbyByStringHashMap.put(strings[i], lobbyList.get(i).getID());
}
}
else{
strings = new String[1];
strings[0] = "No lobbies currently available.";
strings[0] = "No lobbies found.";
}
if(scrollPane != null) scrollPane.remove();
playerUIWidgets.remove(scrollPane);
lobbyListStrings.setItems(strings);
scrollPane = new ScrollPane(lobbyListStrings);
scrollPane.setBounds(0, 0, col_width*4f, row_height*4);
scrollPane.setPosition(col_width*0.25f, row_height*6);
scrollPane.setBounds(0, 0, col_width*4f-xpad, row_height*4);
scrollPane.setPosition(col_width*0.52f, row_height*5.5f);
scrollPane.setSmoothScrolling(false);
scrollPane.setTransform(true);
playerUIWidgets.add(scrollPane);
for (Actor actor: playerUIWidgets){
stage.addActor(actor);
}
......@@ -501,23 +503,9 @@ public class LobbyView extends AbstractView {
lobbyListRefresh();
}
float[] player1Pos = {col_width*3.75f, row_height*2};
float[] player2Pos = {col_width*3.5f, row_height*1.5f};
float[] player3Pos = {col_width*4.3f, row_height*2};
float[] player4Pos = {col_width*4.1f, row_height*1.5f};
float[] player5Pos = {col_width*5, row_height*2};
float[] player6Pos = {col_width*4.8f, row_height*1.5f};
float[] player7Pos = {col_width*5.7f, row_height*2};
float[] player8Pos = {col_width*5.5f, row_height*1.5f};
ArrayList<float[]> playerPositions= new ArrayList<>(Arrays.asList(player1Pos, player2Pos, player3Pos, player4Pos, player5Pos, player6Pos, player7Pos, player8Pos));;
private void lobbyRefresh(){
if(playerController.getLobby().getID() == -1) {
System.out.println("Player currently not in lobby.");
// Player is currently not in a lobby.
}
else{
lobbyAvatars.clear();
......@@ -564,7 +552,7 @@ public class LobbyView extends AbstractView {
playerReadyImages.add(image);
}
else{
System.out.println("Player is not ready..");
// Player is not ready
}
}
for (Image image : playerReadyImages){
......@@ -651,8 +639,7 @@ public class LobbyView extends AbstractView {
updateAvatarTimer+= dt;
refreshLobbyTimer += dt;
float updateAvatarFrequency = 0.120f;
if(updateAvatarTimer-1F/Gdx.graphics.getFramesPerSecond()/2F>= updateAvatarFrequency){
if(updateAvatarTimer >= 0.115f){ //Update avatar dance animation.
for(AnimatedSprite animatedSprite : lobbyAvatars){
animatedSprite.updateTexture();
}
......
......@@ -81,7 +81,7 @@ public class MenuView extends AbstractView {
outputLabel = new Label("", skin,"black");
outputLabel.setSize(Gdx.graphics.getWidth(),row_height);
outputLabel.setPosition(col_width*0.5f,row_height*9);
outputLabel.setPosition(col_width*0.5f,row_height*11);
outputLabel.setFontScale(2);
usernameTextField = new TextField("", skin);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment