Merge remote-tracking branch 'origin/Development' into Development

This commit is contained in:
Ticho Hidding
2025-10-29 14:06:23 +01:00
13 changed files with 48 additions and 19 deletions

View File

@@ -152,6 +152,7 @@ public final class Server {
information.players[0].name = user;
information.players[0].isHuman = false;
information.players[0].computerDifficulty = 5;
information.players[0].computerThinkTime = 1;
information.players[1].name = response.opponent();
Runnable onGameOverRunnable = isSingleGame.get()? null: this::gameOver;

View File

@@ -230,12 +230,7 @@ public final class TicTacToeGame {
} catch (InterruptedException _) {}
} else {
final Game.Move move;
if (information.players[1].name.equalsIgnoreCase("pism")) {
move = ai.findWorstMove(game,9);
}else{
move = ai.findBestMove(game, information.players[0].computerDifficulty);
}
move = ai.findBestMove(game, information.players[0].computerDifficulty);
assert move != null;
position = move.position();
}

View File

@@ -18,6 +18,7 @@ public class SongDisplay extends VBox {
private final Text songTitle;
private final ProgressBar progressBar;
private final Text progressText;
private boolean paused = false;
public SongDisplay() {
new EventFlow()
@@ -26,7 +27,6 @@ public class SongDisplay extends VBox {
setAlignment(Pos.CENTER);
getStyleClass().add("song-display");
// TODO ADD GOOD SONG TITLES WITH ARTISTS DISPLAYED
songTitle = new Text("song playing");
songTitle.getStyleClass().add("song-title");
@@ -36,8 +36,6 @@ public class SongDisplay extends VBox {
progressText = new Text("0:00/0:00");
progressText.getStyleClass().add("progress-text");
// TODO ADD BETTER CSS FOR THE SKIPBUTTON WHERE ITS AT A NICER POSITION
Button skipButton = new Button(">>");
Button pauseButton = new Button("");
Button previousButton = new Button("<<");
@@ -48,20 +46,20 @@ public class SongDisplay extends VBox {
skipButton.setOnAction( event -> {
GlobalEventBus.post(new AudioEvents.SkipMusic());
paused = false;
pauseButton.setText(getPlayString(paused));
});
pauseButton.setOnAction(event -> {
GlobalEventBus.post(new AudioEvents.PauseMusic());
if (pauseButton.getText().equals("")) {
pauseButton.setText("");
}
else if (pauseButton.getText().equals("")) {
pauseButton.setText("");
}
paused = !paused;
pauseButton.setText(getPlayString(paused));
});
previousButton.setOnAction( event -> {
GlobalEventBus.post(new AudioEvents.PreviousMusic());
paused = false;
pauseButton.setText(getPlayString(paused));
});
HBox control = new HBox(10, previousButton, pauseButton, skipButton);
@@ -107,6 +105,15 @@ public class SongDisplay extends VBox {
String time = positionMinutes + ":" + positionSecondsStr + " / " + durationMinutes + ":" + durationSecondsStr;
return time;
}
private String getPlayString(boolean paused) {
if (paused) {
return "";
}
else {
return "";
}
}
}

View File

@@ -1,6 +1,10 @@
package org.toop.local;
import java.util.Locale;
import java.util.MissingResourceException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.toop.framework.resource.ResourceManager;
import org.toop.framework.resource.resources.LocalizationAsset;
@@ -8,6 +12,8 @@ public class AppContext {
private static final LocalizationAsset localization = ResourceManager.get("localization");
private static Locale locale = Locale.forLanguageTag("en");
private static final Logger logger = LogManager.getLogger(AppContext.class);
public static LocalizationAsset getLocalization() {
return localization;
}
@@ -22,6 +28,24 @@ public class AppContext {
public static String getString(String key) {
assert localization != null;
return localization.getString(key, locale);
// TODO: Gebruik ResourceBundle.getBundle() zodat de fallback automatisch gaat.
// Hiervoor zou de assetManager aangepast moeten worden.
try{ // Main return
return localization.getString(key, locale);
}
catch (MissingResourceException e) {
logger.error("Missing resource key: {}, in bundle: {}. ", key, locale, e);
}
try{ // Fallback return
return localization.getString(key, localization.getFallback());
}
catch (MissingResourceException e) {
logger.error("Missing resource key: {}, in default bundle!", key, e);
}
// Default return
return "MISSING RESOURCE";
}
}