Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -18,7 +18,7 @@ public class ClientLauncherGUI {
|
||||
System.setProperty("glass.win.uiScale", "1.0");
|
||||
Application.launch(GUIApp.class, args);
|
||||
}
|
||||
|
||||
//TODO
|
||||
public static class GUIApp extends Application {
|
||||
@Override
|
||||
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.
|
||||
*/
|
||||
public class ClientLauncherTUI {
|
||||
|
||||
//TODO
|
||||
private TUI view;
|
||||
//TODO
|
||||
private Terminal terminal;
|
||||
//TODO
|
||||
private LineReader gameReader;
|
||||
//TODO
|
||||
private String currentUsername = "";
|
||||
|
||||
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" +
|
||||
" 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').";
|
||||
|
||||
//TODO
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
new ClientLauncherTUI().start();
|
||||
}
|
||||
@@ -129,7 +132,7 @@ public class ClientLauncherTUI {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO
|
||||
private boolean doLogin(ClientController controller) {
|
||||
LineReader loginReader = LineReaderBuilder.builder()
|
||||
.terminal(terminal)
|
||||
@@ -199,7 +202,7 @@ public class ClientLauncherTUI {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//TODO
|
||||
private LineReader buildGameReader() {
|
||||
Completer completer = new TreeCompleter(
|
||||
node("slot"),
|
||||
@@ -224,7 +227,7 @@ public class ClientLauncherTUI {
|
||||
.option(LineReader.Option.DISABLE_EVENT_EXPANSION, true)
|
||||
.build();
|
||||
}
|
||||
|
||||
//TODO
|
||||
private String buildPrompt(ClientController controller) {
|
||||
return currentUsername.isEmpty() ? "> " : currentUsername + "> ";
|
||||
}
|
||||
@@ -276,7 +279,7 @@ public class ClientLauncherTUI {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO
|
||||
private void handleDraw(String[] parts, ClientController controller) {
|
||||
if (parts.length < 4) {
|
||||
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 controller.drawLowerBuildingCard(pos);
|
||||
}
|
||||
|
||||
//TODO
|
||||
private void handleRender(String[] parts) {
|
||||
view.renderBoard();
|
||||
}
|
||||
|
||||
//TODO
|
||||
private int parsePos(String[] parts, int idx) {
|
||||
if (parts.length <= idx) {
|
||||
view.showError(ErrorType.GENERIC_ERROR, "Missing position argument.");
|
||||
@@ -310,7 +313,7 @@ public class ClientLauncherTUI {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO
|
||||
private void safeQuit(ClientController controller) {
|
||||
if (controller.getClient() != null) controller.disconnect();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ public enum ErrorType {
|
||||
GENERIC_ERROR("Generic error"),
|
||||
GAME_ALREADY_STARTED("Game already started"),
|
||||
WRONG_ACTION("Wrong action");
|
||||
//TODO
|
||||
private final String description;
|
||||
ErrorType(String description) {
|
||||
this.description = description;
|
||||
|
||||
Reference in New Issue
Block a user