Search in sources :

Example 1 with PlayerCharacter

use of com.lilithsthrone.game.character.PlayerCharacter in project liliths-throne-public by Innoxia.

the class Main method startNewGame.

/**
 * Starts a completely new game. Runs a new World Generation.
 */
public static void startNewGame(DialogueNodeOld startingDialogueNode) {
    Main.game = new Game();
    // Generate world:
    if (!(gen == null))
        if (gen.isRunning()) {
            gen.cancel();
        }
    gen = new Generation();
    gen.setOnSucceeded(new EventHandler<WorkerStateEvent>() {

        @Override
        public void handle(WorkerStateEvent t) {
            FXMLLoader loader = new FXMLLoader(getClass().getResource("/com/lilithsthrone/res/fxml/main.fxml"));
            Pane pane;
            try {
                if (Main.mainScene == null) {
                    pane = loader.load();
                    Main.mainController = loader.getController();
                    Main.mainScene = new Scene(pane);
                    if (Main.getProperties().lightTheme)
                        Main.mainScene.getStylesheets().add("/com/lilithsthrone/res/css/stylesheet_light.css");
                    else
                        Main.mainScene.getStylesheets().add("/com/lilithsthrone/res/css/stylesheet.css");
                }
                Main.primaryStage.setScene(Main.mainScene);
            } catch (Exception e) {
                e.printStackTrace();
            }
            Main.game.setPlayer(new PlayerCharacter(new NameTriplet("Player"), "", 1, Gender.M_P_MALE, RacialBody.HUMAN, RaceStage.HUMAN, null, WorldType.EMPTY, PlaceType.GENERIC_MUSEUM));
            Main.game.initNewGame(startingDialogueNode);
            Main.game.endTurn(0);
        // Main.mainController.processNewDialogue();
        }
    });
    new Thread(gen).start();
}
Also used : Generation(com.lilithsthrone.world.Generation) Game(com.lilithsthrone.game.Game) PlayerCharacter(com.lilithsthrone.game.character.PlayerCharacter) NameTriplet(com.lilithsthrone.game.character.NameTriplet) WorkerStateEvent(javafx.concurrent.WorkerStateEvent) Scene(javafx.scene.Scene) FXMLLoader(javafx.fxml.FXMLLoader) Pane(javafx.scene.layout.Pane) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

Game (com.lilithsthrone.game.Game)1 NameTriplet (com.lilithsthrone.game.character.NameTriplet)1 PlayerCharacter (com.lilithsthrone.game.character.PlayerCharacter)1 Generation (com.lilithsthrone.world.Generation)1 FileNotFoundException (java.io.FileNotFoundException)1 WorkerStateEvent (javafx.concurrent.WorkerStateEvent)1 FXMLLoader (javafx.fxml.FXMLLoader)1 Scene (javafx.scene.Scene)1 Pane (javafx.scene.layout.Pane)1