Пример #1
0
  public GameState(StateManager sm) {
    super(sm);
    shop = new Shop();
    game = new ShopSimulation(shop);
    gameClock = new GameClock();

    gameClock.setListener(
        new GameClock.GameClockListener() {
          @Override
          public void crappyHourBegins() {
            game.startCrappyHour();
            Platform.runLater(() -> shop.getLog().addLog("The chaos has begun.."));
          }

          @Override
          public void shopClosed() {

            Platform.runLater(() -> endGame());
          }
        });

    // Check if game closed
    sm.getStage().setOnCloseRequest(e -> stageClosed());

    statusLabel = new Label();
    shop.setListener(this);

    moneyFormat = NumberFormat.getCurrencyInstance();

    // Setup basic panes + contents
    BorderPane rootPane = new BorderPane();
    rootPane.setStyle("-fx-background-color: #474F53;");

    rootPane.setTop(new VBox(initMenu(), initStatusBar()));

    rootPane.setBottom(initGame());

    startGame();

    scene = new Scene(rootPane);
    setupStyle();
    setupSubWindow();
  }