forked from phenom/healer-man
77 lines
2.4 KiB
TypeScript
77 lines
2.4 KiB
TypeScript
let gameRuntimeModule: Promise<typeof import("../GameRuntime")> | null = null;
|
|
let loadedGameRuntime: typeof import("../GameRuntime")["default"] | null = null;
|
|
let partyManagementPanelModule: Promise<typeof import("./PartyManagementPanel")> | null = null;
|
|
let loadedPartyManagementPanel: typeof import("./PartyManagementPanel")["PartyManagementPanel"] | null = null;
|
|
let bossGuidePanelModule: Promise<typeof import("./BossGuidePanel")> | null = null;
|
|
let loadedBossGuidePanel: typeof import("./BossGuidePanel")["BossGuidePanel"] | null = null;
|
|
|
|
export function loadGameRuntime() {
|
|
if (!gameRuntimeModule) {
|
|
gameRuntimeModule = import("../GameRuntime")
|
|
.then((module) => {
|
|
loadedGameRuntime = module.default;
|
|
return module;
|
|
})
|
|
.catch((error: unknown) => {
|
|
gameRuntimeModule = null;
|
|
throw error;
|
|
});
|
|
}
|
|
return gameRuntimeModule;
|
|
}
|
|
|
|
export function getLoadedGameRuntime() {
|
|
return loadedGameRuntime;
|
|
}
|
|
|
|
export function loadPartyManagementPanel() {
|
|
if (!partyManagementPanelModule) {
|
|
partyManagementPanelModule = import("./PartyManagementPanel")
|
|
.then((module) => {
|
|
loadedPartyManagementPanel = module.PartyManagementPanel;
|
|
return module;
|
|
})
|
|
.catch((error: unknown) => {
|
|
partyManagementPanelModule = null;
|
|
throw error;
|
|
});
|
|
}
|
|
return partyManagementPanelModule;
|
|
}
|
|
|
|
export function getLoadedPartyManagementPanel() {
|
|
return loadedPartyManagementPanel;
|
|
}
|
|
|
|
export function loadBossGuidePanel() {
|
|
if (!bossGuidePanelModule) {
|
|
bossGuidePanelModule = import("./BossGuidePanel")
|
|
.then((module) => {
|
|
loadedBossGuidePanel = module.BossGuidePanel;
|
|
return module;
|
|
})
|
|
.catch((error: unknown) => {
|
|
bossGuidePanelModule = null;
|
|
throw error;
|
|
});
|
|
}
|
|
return bossGuidePanelModule;
|
|
}
|
|
|
|
export function getLoadedBossGuidePanel() {
|
|
return loadedBossGuidePanel;
|
|
}
|
|
|
|
export async function preloadSharedGameplayResources(originalMediaEnabled: boolean): Promise<void> {
|
|
await Promise.all([
|
|
loadGameRuntime(),
|
|
loadPartyManagementPanel(),
|
|
loadBossGuidePanel(),
|
|
]);
|
|
if (!originalMediaEnabled) return;
|
|
const { ensureCombatMediaPack } = await import("../game/combatMediaPack");
|
|
if (!await ensureCombatMediaPack()) return;
|
|
const { preloadCombatEffectManifest } = await import("../game/combatPresentation");
|
|
await preloadCombatEffectManifest();
|
|
}
|