Skip to content

Commit

Permalink
1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
syd711 committed Sep 21, 2022
1 parent 39ede88 commit 7fde926
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
Binary file modified resources/overlay.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 10 additions & 4 deletions src/main/java/de/mephisto/vpin/extensions/ServiceRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import de.mephisto.vpin.GameInfo;
import de.mephisto.vpin.VPinService;
import de.mephisto.vpin.extensions.generator.HighscoreCardGenerator;
import de.mephisto.vpin.extensions.generator.OverlayGenerator;
import de.mephisto.vpin.extensions.util.Config;
import de.mephisto.vpin.popper.TableStatusChangeListener;
import de.mephisto.vpin.popper.TableStatusChangedEvent;
import de.mephisto.vpin.extensions.generator.HighscoreCardGenerator;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -19,15 +19,21 @@ public ServiceRunner() {
service = VPinService.create(true);
LOG.info("ServiceRunner started.");


LOG.info("Added VPin service listener for highscore changes.");
service.addTableStatusChangeListener(this);

String targetScreen = Config.getCardGeneratorConfig().get("popper.screen");
if(StringUtils.isEmpty(targetScreen)) {
if (StringUtils.isEmpty(targetScreen)) {
LOG.info("Skipped starting highscore card generator, no PinUP popper target screen configured.");
}

try {
LOG.info("Executing highscore overlay generation.");
OverlayGenerator.generateOverlay(service);
} catch (Exception e) {
LOG.error("Initial overlay generation failed: " + e.getMessage(), e);
}

LOG.info("Overlay window listener started.");
OverlayWindowFX.launch(OverlayWindowFX.class);
}
Expand All @@ -41,7 +47,7 @@ public void tableLaunched(TableStatusChangedEvent tableStatusChangedEvent) {
public void tableExited(TableStatusChangedEvent tableStatusChangedEvent) {
try {
String targetScreen = Config.getCardGeneratorConfig().get("popper.screen");
if(StringUtils.isEmpty(targetScreen)) {
if (StringUtils.isEmpty(targetScreen)) {
GameInfo gameInfo = tableStatusChangedEvent.getGameInfo();
LOG.info("Executing highscore card generation for '" + gameInfo + "'");
HighscoreCardGenerator.generateCard(gameInfo);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public class OverlayGenerator extends GraphicsGenerator {
public static void main(String[] args) throws Exception {
VPinService service = VPinService.create(false);
generateOverlay(service);
service.shutdown();
}

public static void generateOverlay(VPinService service) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private static void renderHighscoreList(BufferedImage image, GameInfo gameOfTheM
int yStart = highscoreListYOffset + ROW_SEPARATOR + TITLE_FONT_SIZE / 2;

List<GameInfo> gameInfos = service.getGameInfos();
gameInfos.sort((o1, o2) -> (int) (o2.getLastPlayed().getTime() - o1.getLastPlayed().getTime()));
gameInfos.sort((o1, o2) -> (int) (o2.getLastPlayedTime() - o1.getLastPlayedTime()));

for (GameInfo game : gameInfos) {
Highscore highscore = game.resolveHighscore();
Expand Down

0 comments on commit 7fde926

Please sign in to comment.