use of com.lilithsthrone.game.character.CharacterChangeEventListener in project liliths-throne-public by Innoxia.
the class MainController method initialize.
@Override
public void initialize(URL location, ResourceBundle resources) {
allowInput = true;
lastKeys = new KeyCode[5];
actionToBind = null;
primaryBinding = true;
webviewTooltip = new WebView();
webviewTooltip.setMaxWidth(400);
webviewTooltip.setMaxHeight(400);
webviewTooltip.getEngine().getHistory().setMaxSize(0);
tooltip = new Tooltip();
tooltip.setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
tooltip.setGraphic(webviewTooltip);
tooltip.setMaxWidth(400);
tooltip.setMaxHeight(400);
vBoxLeft.getStyleClass().add("vbox");
// Set up controls and buttons:
setUpButtons();
// Set up webViews:
setUpWebViews();
GameCharacter.addPlayerLocationChangeEventListener(new CharacterChangeEventListener() {
@Override
public void onChange() {
if (Main.game.getPlayer() != null) {
Main.game.getActiveWorld().getCell(Main.game.getPlayer().getLocation()).setDiscovered(true);
if (Main.game.getPlayer().getLocation().getY() < Main.game.getActiveWorld().WORLD_HEIGHT - 1)
Main.game.getActiveWorld().getCell(Main.game.getPlayer().getLocation().getX(), Main.game.getPlayer().getLocation().getY() + 1).setDiscovered(true);
if (Main.game.getPlayer().getLocation().getY() != 0)
Main.game.getActiveWorld().getCell(Main.game.getPlayer().getLocation().getX(), Main.game.getPlayer().getLocation().getY() - 1).setDiscovered(true);
if (Main.game.getPlayer().getLocation().getX() < Main.game.getActiveWorld().WORLD_WIDTH - 1)
Main.game.getActiveWorld().getCell(Main.game.getPlayer().getLocation().getX() + 1, Main.game.getPlayer().getLocation().getY()).setDiscovered(true);
if (Main.game.getPlayer().getLocation().getX() != 0)
Main.game.getActiveWorld().getCell(Main.game.getPlayer().getLocation().getX() - 1, Main.game.getPlayer().getLocation().getY()).setDiscovered(true);
}
}
});
allowInput = true;
}
Aggregations