|
@ -1,13 +1,11 @@ |
|
|
package de.hsfulda.onses.controllers; |
|
|
package de.hsfulda.onses.controllers; |
|
|
|
|
|
|
|
|
|
|
|
import de.hsfulda.onses.App; |
|
|
import de.hsfulda.onses.Main; |
|
|
import de.hsfulda.onses.Main; |
|
|
import de.hsfulda.onses.models.Game; |
|
|
|
|
|
import de.hsfulda.onses.services.GameService; |
|
|
import de.hsfulda.onses.services.GameService; |
|
|
import javafx.fxml.FXMLLoader; |
|
|
import javafx.fxml.FXMLLoader; |
|
|
import javafx.scene.Parent; |
|
|
import javafx.scene.Parent; |
|
|
import javafx.scene.Scene; |
|
|
|
|
|
import javafx.scene.control.Button; |
|
|
import javafx.scene.control.Button; |
|
|
import javafx.stage.Stage; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
import java.io.IOException; |
|
|
import java.util.Objects; |
|
|
import java.util.Objects; |
|
@ -15,11 +13,11 @@ import java.util.Objects; |
|
|
public class AppController implements Controller { |
|
|
public class AppController implements Controller { |
|
|
|
|
|
|
|
|
private final GameService gameService; |
|
|
private final GameService gameService; |
|
|
private final Stage stage; |
|
|
|
|
|
|
|
|
private final App app; |
|
|
|
|
|
|
|
|
public AppController(GameService gameService, Stage stage) { |
|
|
|
|
|
|
|
|
public AppController(App app, GameService gameService) { |
|
|
|
|
|
this.app = app; |
|
|
this.gameService = gameService; |
|
|
this.gameService = gameService; |
|
|
this.stage = stage; |
|
|
|
|
|
} |
|
|
} |
|
|
@Override |
|
|
@Override |
|
|
public Parent render() throws IOException { |
|
|
public Parent render() throws IOException { |
|
@ -28,13 +26,18 @@ public class AppController implements Controller { |
|
|
Button button = (Button) parent.lookup("#startGameBtn"); |
|
|
Button button = (Button) parent.lookup("#startGameBtn"); |
|
|
|
|
|
|
|
|
button.setOnAction(e -> { |
|
|
button.setOnAction(e -> { |
|
|
try { |
|
|
|
|
|
stage.setScene(new Scene(gameController.render())); |
|
|
|
|
|
stage.setTitle("Onses - Uno Game"); |
|
|
|
|
|
} catch (IOException ex) { |
|
|
|
|
|
throw new RuntimeException(ex); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
app.show(gameController); |
|
|
}); |
|
|
}); |
|
|
return parent; |
|
|
return parent; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public String getTitle() { |
|
|
|
|
|
return "Onses - Uno"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public void destroy() { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |