Awesome menu and saves

This commit is contained in:
2026-11-14 14:48:07 -03:00
parent a69db0cd2a
commit 95e058d659
11 changed files with 861 additions and 128 deletions
+16 -14
View File
@@ -27,7 +27,8 @@ import {
import { is_stopped, show_fatal_error } from "./fatal.ts";
import { download_mods, load_client_mods, set_mods_client } from "./mods.ts";
import type { GuiScreen } from "./gui/gui_screen.ts";
import { TitleScreen } from "./gui/title_screen.ts";
import { in_desktop_app, type JoinServer, TitleScreen } from "./gui/title_screen.ts";
import { MainMenuScreen } from "./gui/main_menu.ts";
import { DisconnectedScreen } from "./gui/disconnected_screen.ts";
import { profiler } from "./profiler.ts";
@@ -247,19 +248,20 @@ await AssetManager.instance.load_all();
init_font();
const loop = new ClientLoop();
loop.show_screen(
new TitleScreen(async (address, name, status) => {
let connection: Connection;
try {
connection = await join_server(address, name, status);
} catch (e) {
if (e instanceof FailedAfterLoadingMods) {
loop.show_screen(new DisconnectedScreen(e.message));
return;
}
throw e;
const join_game: JoinServer = async (address, name, status) => {
let connection: Connection;
try {
connection = await join_server(address, name, status);
} catch (e) {
if (e instanceof FailedAfterLoadingMods) {
loop.show_screen(new DisconnectedScreen(e.message));
return;
}
loop.play(connection);
}),
throw e;
}
loop.play(connection);
};
loop.show_screen(
in_desktop_app() ? new MainMenuScreen((screen) => loop.show_screen(screen), join_game) : new TitleScreen(join_game),
);
loop.start();