Commit 44b76b29 authored by Anders H. Rebner's avatar Anders H. Rebner
Browse files

Asterisk indicating which user is the client

parent 148a9d8d
......@@ -23,7 +23,7 @@ public class NetworkController {
this.client = new Client();
client.start();
try {
String IP4_LAN_ADDRESS = "192.168.0.136";
String IP4_LAN_ADDRESS = "192.168.1.167"; //"192.168.0.136";
client.connect(10000, IP4_LAN_ADDRESS, 54555);
} catch (IOException e) {
e.printStackTrace();
......
......@@ -38,6 +38,7 @@ public class cLobbyLeave extends Command{
if (playerId == playerController.getPlayer().getID()) {
System.out.println("Request to leave lobby successful");
playerController.setLobby(new Lobby(-1));
playerController.getPlayer().setIsPlayerReady(false);
} else {
System.out.println("Player with id " + playerId + " left");
......
......@@ -191,7 +191,14 @@ public class PlayView extends AbstractView {
playerNameFields = new ArrayList<>();
for (int i = 0; i < players.size(); i++) {
TextField textField = new TextField(players.get(i).getPlayerName(), skin);
TextField textField;
// Place asterisk in front of client's playername
if (players.get(i).getID() == playerController.getPlayer().getID()) {
textField = new TextField("*" + playerController.getPlayer().getPlayerName(), skin);
} else {
textField = new TextField(players.get(i).getPlayerName(), skin);
}
textField.setColor(PIECE_COLORS.get(i));
textField.setSize(Constants.PLAYER_NAME_TEXT_FIELD_WIDTH, Constants.PLAYER_NAME_TEXT_FIELD_HEIGHT);
textField.setPosition(coordinateList.get(usedBoardSlots.get(i)).get(0), coordinateList.get(usedBoardSlots.get(i)).get(1));
......@@ -274,7 +281,7 @@ public class PlayView extends AbstractView {
homeButton.addListener(new InputListener(){
@Override
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
playerController.setLobbyPlayerReady(false);
playerController.getPlayer().setIsPlayerReady(false);
playerController.leaveLobby(playerController.getLobby().getID());
startFadeout = true;
return true;
......@@ -286,12 +293,13 @@ public class PlayView extends AbstractView {
public void placeLeaveButton() {
TextButton leaveButton = new TextButton("Leave", skin, "small");
leaveButton.setPosition(Gdx.graphics.getWidth() / 2F + (boardImage.getWidth() * boardImage.getScaleX()) / 2F, Gdx.graphics.getHeight() - 3F * hex_side_length - leaveButton.getHeight() / 2F);
leaveButton.setSize(col_width, (float)(row_height*0.75));
leaveButton.setPosition(Gdx.graphics.getWidth() / 2 + (boardImage.getWidth() * boardImage.getScaleX()) / 3 - leaveButton.getWidth() / 2, Gdx.graphics.getHeight() - 3F * hex_side_length - leaveButton.getHeight() / 2F);
leaveButton.addListener(new InputListener(){
@Override
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
playerController.setLobbyPlayerReady(false);
playerController.getPlayer().setIsPlayerReady(false);
playerController.leaveLobby(playerController.getLobby().getID());
startFadeout = true;
return true;
......
<component name="libraryTable">
<library name="Gradle: CheckersServer.core.core-1.0">
<CLASSES>
<root url="jar://$PROJECT_DIR$/core/build/libs/core-1.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
\ No newline at end of file
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