Commit 678c2065 authored by Anders H. Rebner's avatar Anders H. Rebner
Browse files

Fixed lobby ready/not ready bugs, merged avatar fix

parents e4d4f025 154b1311
......@@ -4,21 +4,21 @@ size: 2048, 2048
format: RGBA8888
filter: Nearest, Nearest
repeat: none
RocketGuy1x
RocketGuy1
rotate: false
xy: 2, 1004
xy: 2, 2
size: 1000, 1000
orig: 1000, 1000
offset: 0, 0
index: -1
RocketGuy2x
RocketGuy2
rotate: false
xy: 2, 2
xy: 2, 1004
size: 1000, 1000
orig: 1000, 1000
offset: 0, 0
index: -1
RocketGuy3x
RocketGuy3
rotate: false
xy: 1004, 1004
size: 1000, 1000
......
......@@ -23,7 +23,7 @@ public class NetworkController {
this.client = new Client();
client.start();
try {
String IP4_LAN_ADDRESS = "192.168.10.154"; //122 //"192.168.87.20";
String IP4_LAN_ADDRESS = "192.168.0.136"; //122 //"192.168.87.20";
client.connect(10000, IP4_LAN_ADDRESS, 54555);
} catch (IOException e) {
e.printStackTrace();
......
......@@ -28,7 +28,7 @@ public class cSetPlayerReady extends Command{
boolean isPlayerReady = (Boolean) data;
if(playerID == playerController.getPlayer().getID()) playerController.getPlayer().setIsPlayerReady(isPlayerReady);
playerController.getLobby().getPlayerByID(playerID).setIsPlayerReady(isPlayerReady);
//System.out.println("value of playerID" + playerID);
System.out.printf("Player status updated. Is player %d currently ready? %b \n", playerID, isPlayerReady);
}
}
......
......@@ -341,16 +341,20 @@ public class LobbyView extends AbstractView {
if(lobby.getPlayers().size() == 1){
System.out.println("Deleting lobby " + lobby.getName());
playerController.setLobbyPlayerReady(false);
playerController.deleteLobby(lobby.getID());
playerController.getPlayer().setIsPlayerReady(false);
}
else{
System.out.println("Leaving lobby " + lobby.getName());
playerController.setLobbyPlayerReady(false);
playerController.leaveLobby(lobby.getID());
playerController.getPlayer().setIsPlayerReady(false);
}
for (Label label :lobbyLabels) label.remove();
for(Image image: playerReadyImages) image.remove();
playerReadyCheckButton.remove();
lobbyAvatars.clear();
showMainLobbyWindow();
......@@ -368,7 +372,6 @@ public class LobbyView extends AbstractView {
}
@Override
public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
//if(lobby != null) playerController.leaveLobby(lobby.getID());
if(getLobbyByStringHashMap.containsKey(lobbyListStrings.getSelected())){
Thread thread = new Thread(){
......@@ -578,12 +581,14 @@ public class LobbyView extends AbstractView {
for (Label label : lobbyLabels) label.remove();
for (Image image : playerReadyImages) image.remove();
playerReadyImages.clear();
for(int i = 0; i<lobby.getPlayers().size(); i++){
Player player = lobby.getPlayers().get(i);
//System.out.println("Finding avatar with index: " + player.getIndexAvatar());
//System.out.println("Name is: " + availableAvatarsHashMap.get(player.getIndexAvatar()));
System.out.println("Finding avatar with index: " + player.getIndexAvatar());
System.out.println("Name is: " + availableAvatarsHashMap.get(player.getIndexAvatar()));
System.out.println("PlayerIndexAvatar is: " + player.getIndexAvatar());
String path = Enum.valueOf(CharacterAssets.class, availableAvatarsHashMap.get(player.getIndexAvatar())+"Atlas").path;
Class classType = Enum.valueOf(CharacterAssets.class, availableAvatarsHashMap.get(player.getIndexAvatar())+"Atlas").classType;
......@@ -594,7 +599,6 @@ public class LobbyView extends AbstractView {
availableAvatarsHashMap.get(player.getIndexAvatar()),
3);
animatedSprite.setOrigin(0, 0);
int remX = i%4;
int remY = mod(2, i+2);
......@@ -746,7 +750,7 @@ public class LobbyView extends AbstractView {
updateAvatarTimer+= dt;
refreshLobbyTimer += dt;
if(updateAvatarTimer-1/Gdx.graphics.getFramesPerSecond()/2>= updateAvatarFrequency){
if(updateAvatarTimer-1F/Gdx.graphics.getFramesPerSecond()/2F>= updateAvatarFrequency){
for(AnimatedSprite animatedSprite : lobbyAvatars){
animatedSprite.updateTexture();
}
......
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