Skip to content

Commit

Permalink
87
Browse files Browse the repository at this point in the history
  • Loading branch information
youssefouru committed May 31, 2021
1 parent 0094c07 commit 215e2c5
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Test/ch/epfl/tchu/gui/Client2.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public void start(Stage primaryStage) throws Exception {
String instructionSocketName = (parameters.isEmpty() || parameters.size() == 1) ?DEFAULT_HOST_NAME: parameters.get(i++);
int instructionSocketPort = parameters.isEmpty() ? DEFAULT_PORT : Integer.parseInt(parameters.get(i));
Socket messageSocket = new Socket(instructionSocketName,instructionSocketPort);
//AdvancedPlayer graphicalPlayer =new GraphicalPlayerAdapter(messageSocket);
RemotePlayerClient client = new RemotePlayerClient(new GameTest2.TestPlayer(5108, ChMap.routes()), instructionSocketName, instructionSocketPort,messageSocket);
AdvancedPlayer graphicalPlayer =new GraphicalPlayerAdapter(messageSocket);
RemotePlayerClient client = new RemotePlayerClient(graphicalPlayer, instructionSocketName, instructionSocketPort,messageSocket);
new Thread(client::run).start();
new Thread(client::manageMessages).start();
}
Expand Down
Binary file modified out/artifacts/tCHu_jar/tCHu.jar
Binary file not shown.
Binary file modified out/production/tCHu/ch/epfl/tchu/gui/ClientMain.class
Binary file not shown.
Binary file modified out/production/tCHu/ch/epfl/tchu/gui/GraphicalPlayer.class
Binary file not shown.
Binary file modified out/production/tCHu/ch/epfl/tchu/gui/MenuController.class
Binary file not shown.
Binary file modified out/production/tCHu/ch/epfl/tchu/gui/MenuMain.class
Binary file not shown.
Binary file modified out/test/tCHu/ch/epfl/tchu/gui/Client2.class
Binary file not shown.
2 changes: 1 addition & 1 deletion src/ch/epfl/tchu/gui/ClientMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public final class ClientMain {
*
* @param args (String[]) : the arguments of the programme
*/
public void main(String[] args) throws IOException {
public static void main(String[] args) throws IOException {

List<String> parameters = Arrays.stream(args).collect(Collectors.toList());
int i = 0;
Expand Down
1 change: 0 additions & 1 deletion src/ch/epfl/tchu/gui/GraphicalPlayer.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ public GraphicalPlayer(PlayerId playerId, Map<PlayerId, String> playerNames, Act
DecksViewCreator.createHandView(gameState),
InfoViewCreator.createInfoView(playerId, playerNames, gameState, messages));
mainStage.setScene(new Scene(mainPain));

mainStage.show();
}

Expand Down
11 changes: 9 additions & 2 deletions src/ch/epfl/tchu/gui/MenuController.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package ch.epfl.tchu.gui;

import ch.epfl.tchu.game.AdvancedPlayer;
import ch.epfl.tchu.net.RemotePlayerClient;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ReadOnlyBooleanProperty;
import javafx.beans.property.SimpleBooleanProperty;
Expand All @@ -14,11 +16,16 @@

import java.io.IOException;
import java.io.UncheckedIOException;
import java.net.Socket;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Pattern;
import java.util.stream.Collectors;


public final class MenuController {

private final static String DEFAULT_HOST_NAME = "localhost";
private final static int DEFAULT_PORT = 5108;
private final static int portNumber = 5108;

private static BooleanProperty hide = new SimpleBooleanProperty();
Expand Down Expand Up @@ -98,7 +105,7 @@ public void connectClient() {
}
new Thread(()-> {
try {
clientMain.main(args);
ClientMain.main(args);
} catch (IOException ioException) {
throw new UncheckedIOException(ioException);
}
Expand Down
5 changes: 0 additions & 5 deletions src/ch/epfl/tchu/gui/MenuMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@ public void start(Stage primaryStage) throws Exception {
Parent root = FXMLLoader.load(Objects.requireNonNull(getClass().getResource("MenuMain.fxml")));
primaryStage.setScene(new Scene(root));
primaryStage.show();
hide().addListener((o,oV,nV)->{
if(nV) {
primaryStage.hide();
}
});
}
}

0 comments on commit 215e2c5

Please sign in to comment.