Commit 39742e9e authored by Peining Li's avatar Peining Li

Merge branch 'ihm-main/develop' into 'develop'

Ihm main/develop

See merge request !185
parents 5711a8fc ea067936
......@@ -50,7 +50,9 @@ public class IHMMain {
this.facade = facade;
primaryStage = stage;
primaryStage.setWidth(1300);
primaryStage.setMinWidth(800);
primaryStage.setHeight(800);
primaryStage.setMinHeight(600);
// Load the font for the css
try {
......@@ -70,12 +72,6 @@ public class IHMMain {
toNetworkInterfaceChoice();
stage.show();
// Load the font for the css
try {
Font.loadFont(new FileInputStream(new File("./target/classes/styles/space_age.ttf")), 10);
} catch (FileNotFoundException ex) {
Logger.getLogger(PlayerListController.class.getName()).log(Level.SEVERE, null, ex);
}
//add onClose event handler which handle the event when user clicks X
stage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
......
......@@ -151,6 +151,10 @@ public class GameListController extends AbstractController{
modeColumn.setCellValueFactory(new PropertyValueFactory<>("type"));
modeColumn.getStyleClass().add(labelClass);
TableColumn aiColumn = new TableColumn("AI");
aiColumn.setCellValueFactory(new PropertyValueFactory<>("computerMode"));
aiColumn.getStyleClass().add(labelClass);
TableColumn chatColumn = new TableColumn("CHAT");
chatColumn.setCellValueFactory(new PropertyValueFactory<>("spectatorChat"));
chatColumn.getStyleClass().add(labelClass);
......@@ -179,7 +183,7 @@ public class GameListController extends AbstractController{
});
gameList = new TableView<>();
gameList.getColumns().addAll(nameColumn, creatorColumn, modeColumn, chatColumn, playerNumberColumn);
gameList.getColumns().addAll(nameColumn, creatorColumn, modeColumn, aiColumn, chatColumn, playerNumberColumn);
gameList.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
}
......@@ -216,8 +220,12 @@ public class GameListController extends AbstractController{
@FXML
private void joinSelectedGame(ActionEvent event){
if(selectedGame != null){
getFacade().iDataIHMMain.gameConnectionRequestGame(selectedGame.getId(), "player");
loadingScreen();
if(!selectedGame.isComputerMode()){
getFacade().iDataIHMMain.gameConnectionRequestGame(selectedGame.getId(), "player");
loadingScreen();
}else{
showSuccessPopup("You can't join a party VS AI","Click on watch if you want to watch it","Create a game by yourself if you want to play VS AI");
}
}else{
showSuccessPopup("Please select a game","Please select a game to join","Create a game or Find a friend and add his ip if you don't have any game in list");
}
......@@ -231,7 +239,6 @@ public class GameListController extends AbstractController{
@FXML
private void watchSelectedGame(ActionEvent event){
if(selectedGame != null){
System.out.println("ihm main watch request");
getFacade().iDataIHMMain.gameConnectionRequestGame(selectedGame.getId(), "spectator");
loadingScreen();
}else{
......
......@@ -8,10 +8,10 @@
<GridPane id="generalGrid" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="600" minWidth="800" prefHeight="768" prefWidth="1368" stylesheets="@../../styles/ihmmain.css" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.utclo23.ihmmain.controller.LoginController">
<columnConstraints>
<ColumnConstraints percentWidth="35.0" hgrow="SOMETIMES" />
<ColumnConstraints percentWidth="20.0" hgrow="SOMETIMES" />
<ColumnConstraints percentWidth="20.0" hgrow="SOMETIMES" />
<ColumnConstraints percentWidth="35.0" hgrow="SOMETIMES" />
<ColumnConstraints percentWidth="30.0" hgrow="SOMETIMES" minWidth="5.0"/>
<ColumnConstraints percentWidth="25.0" hgrow="SOMETIMES" minWidth="100.0"/>
<ColumnConstraints percentWidth="25.0" hgrow="SOMETIMES" minWidth="100.0"/>
<ColumnConstraints percentWidth="30.0" hgrow="SOMETIMES" minWidth="5.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints percentHeight="30.0" vgrow="SOMETIMES" />
......
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