Awesome menu and saves
This commit is contained in:
+16
-14
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user