Merge remote-tracking branch 'origin/main'

This commit is contained in:
2026-06-14 17:52:22 +02:00
3 changed files with 14 additions and 10 deletions
@@ -18,7 +18,7 @@ public class ClientLauncherGUI {
System.setProperty("glass.win.uiScale", "1.0"); System.setProperty("glass.win.uiScale", "1.0");
Application.launch(GUIApp.class, args); Application.launch(GUIApp.class, args);
} }
//TODO
public static class GUIApp extends Application { public static class GUIApp extends Application {
@Override @Override
public void start(Stage stage) throws Exception { public void start(Stage stage) throws Exception {
@@ -25,10 +25,13 @@ import static org.jline.builtins.Completers.TreeCompleter.node;
* Handles login, connects to the server, and drives the JLine-powered command loop. * Handles login, connects to the server, and drives the JLine-powered command loop.
*/ */
public class ClientLauncherTUI { public class ClientLauncherTUI {
//TODO
private TUI view; private TUI view;
//TODO
private Terminal terminal; private Terminal terminal;
//TODO
private LineReader gameReader; private LineReader gameReader;
//TODO
private String currentUsername = ""; private String currentUsername = "";
private static final String BUILDING_DETAILS = private static final String BUILDING_DETAILS =
@@ -78,7 +81,7 @@ public class ClientLauncherTUI {
"HUNTERS — Adding a Hunter without the \uD83C\uDF56 icon: nothing. Adding a Hunter WITH the \uD83C\uDF56 icon:\n" + "HUNTERS — Adding a Hunter without the \uD83C\uDF56 icon: nothing. Adding a Hunter WITH the \uD83C\uDF56 icon:\n" +
" immediately take 1 \uD83C\uDF56 for each Hunter in your tribe (with or without the icon).\n" + " immediately take 1 \uD83C\uDF56 for each Hunter in your tribe (with or without the icon).\n" +
" During Hunt Event, take \uD83C\uDF56 and gain PP based on your Hunter count (see 'details events')."; " During Hunt Event, take \uD83C\uDF56 and gain PP based on your Hunter count (see 'details events').";
//TODO
public static void main(String[] args) throws InterruptedException { public static void main(String[] args) throws InterruptedException {
new ClientLauncherTUI().start(); new ClientLauncherTUI().start();
} }
@@ -129,7 +132,7 @@ public class ClientLauncherTUI {
} }
} }
} }
//TODO
private boolean doLogin(ClientController controller) { private boolean doLogin(ClientController controller) {
LineReader loginReader = LineReaderBuilder.builder() LineReader loginReader = LineReaderBuilder.builder()
.terminal(terminal) .terminal(terminal)
@@ -199,7 +202,7 @@ public class ClientLauncherTUI {
} }
return true; return true;
} }
//TODO
private LineReader buildGameReader() { private LineReader buildGameReader() {
Completer completer = new TreeCompleter( Completer completer = new TreeCompleter(
node("slot"), node("slot"),
@@ -224,7 +227,7 @@ public class ClientLauncherTUI {
.option(LineReader.Option.DISABLE_EVENT_EXPANSION, true) .option(LineReader.Option.DISABLE_EVENT_EXPANSION, true)
.build(); .build();
} }
//TODO
private String buildPrompt(ClientController controller) { private String buildPrompt(ClientController controller) {
return currentUsername.isEmpty() ? "> " : currentUsername + "> "; return currentUsername.isEmpty() ? "> " : currentUsername + "> ";
} }
@@ -276,7 +279,7 @@ public class ClientLauncherTUI {
} }
return false; return false;
} }
//TODO
private void handleDraw(String[] parts, ClientController controller) { private void handleDraw(String[] parts, ClientController controller) {
if (parts.length < 4) { if (parts.length < 4) {
view.showError(ErrorType.GENERIC_ERROR, "Usage: draw upper|lower tribe|building <pos>"); view.showError(ErrorType.GENERIC_ERROR, "Usage: draw upper|lower tribe|building <pos>");
@@ -292,11 +295,11 @@ public class ClientLauncherTUI {
else if (tribe) controller.drawLowerTribeCard(pos); else if (tribe) controller.drawLowerTribeCard(pos);
else controller.drawLowerBuildingCard(pos); else controller.drawLowerBuildingCard(pos);
} }
//TODO
private void handleRender(String[] parts) { private void handleRender(String[] parts) {
view.renderBoard(); view.renderBoard();
} }
//TODO
private int parsePos(String[] parts, int idx) { private int parsePos(String[] parts, int idx) {
if (parts.length <= idx) { if (parts.length <= idx) {
view.showError(ErrorType.GENERIC_ERROR, "Missing position argument."); view.showError(ErrorType.GENERIC_ERROR, "Missing position argument.");
@@ -310,7 +313,7 @@ public class ClientLauncherTUI {
return -1; return -1;
} }
} }
//TODO
private void safeQuit(ClientController controller) { private void safeQuit(ClientController controller) {
if (controller.getClient() != null) controller.disconnect(); if (controller.getClient() != null) controller.disconnect();
} }
@@ -10,6 +10,7 @@ public enum ErrorType {
GENERIC_ERROR("Generic error"), GENERIC_ERROR("Generic error"),
GAME_ALREADY_STARTED("Game already started"), GAME_ALREADY_STARTED("Game already started"),
WRONG_ACTION("Wrong action"); WRONG_ACTION("Wrong action");
//TODO
private final String description; private final String description;
ErrorType(String description) { ErrorType(String description) {
this.description = description; this.description = description;