Launcher now disappears when game starts and reappears when game ends.
This commit is contained in:
parent
a4484404cd
commit
87c1ff3af1
@ -2,6 +2,7 @@ package launcher;
|
||||
|
||||
import gameplay.match.*;
|
||||
import javafx.application.Application;
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.scene.Parent;
|
||||
@ -9,10 +10,12 @@ import javafx.scene.Scene;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.stage.StageStyle;
|
||||
import javafx.stage.Window;
|
||||
import javafx.fxml.*;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -166,9 +169,22 @@ public class Launcher extends Application {
|
||||
try {
|
||||
fillArraySettings();
|
||||
setter.setSettings();
|
||||
match.main(null);
|
||||
hideWindow();
|
||||
Thread t = new Thread() {
|
||||
public void run() {
|
||||
try {
|
||||
match.main(null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
};
|
||||
t.start();
|
||||
t.join();
|
||||
showWindow();
|
||||
} catch (Exception e) {
|
||||
System.out.println("Fill all boxes to launch the game");
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
}
|
||||
@ -245,6 +261,28 @@ public class Launcher extends Application {
|
||||
arraysettings.put("stage", "default");
|
||||
}
|
||||
|
||||
/**
|
||||
* hides the launcher
|
||||
*/
|
||||
@FXML
|
||||
private void hideWindow() {
|
||||
HBox hb = (HBox) namespace.get("window");
|
||||
Scene sc = hb.getScene();
|
||||
Window win = sc.getWindow();
|
||||
win.hide();
|
||||
}
|
||||
|
||||
/**
|
||||
* shows the launcher
|
||||
* @throws Exception
|
||||
*/
|
||||
@FXML
|
||||
private void showWindow() throws Exception {
|
||||
setter.parse();
|
||||
Stage st = new Stage();
|
||||
start(st);
|
||||
}
|
||||
|
||||
/**
|
||||
* quits the launcher and the game
|
||||
*/
|
||||
|
@ -41,7 +41,7 @@ public class Settings {
|
||||
* @author François Autin
|
||||
* @author Indy Boyeau
|
||||
*/
|
||||
private void parse() throws Exception {
|
||||
protected void parse() throws Exception {
|
||||
|
||||
// Initializing the parser
|
||||
JSONParser jsonP = new JSONParser();
|
||||
@ -93,7 +93,7 @@ public class Settings {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
} catch (ParseException e) {
|
||||
} catch (Exception e) {
|
||||
rounds = 3;
|
||||
p1 = "default";
|
||||
p2 = "default";
|
||||
|
Loading…
x
Reference in New Issue
Block a user