breakout71/src/help.ts

73 lines
1.7 KiB
TypeScript
Raw Normal View History

2025-03-31 20:13:47 +02:00
import { allLevels, icons, upgrades } from "./loadGameData";
import { t } from "./i18n/i18n";
import { asyncAlert } from "./asyncAlert";
import { miniMarkDown } from "./pure_functions";
2025-04-08 21:54:19 +02:00
import {
2025-04-09 11:28:32 +02:00
catchRateBest,
catchRateGood,
2025-04-08 21:54:19 +02:00
levelTimeBest,
2025-04-09 11:28:32 +02:00
levelTimeGood,
missesBest,
missesGood,
2025-04-08 21:54:19 +02:00
wallBouncedBest,
2025-04-09 11:28:32 +02:00
wallBouncedGood,
} from "./pure_functions";
2025-03-31 20:08:17 +02:00
export function helpMenuEntry() {
2025-03-31 20:13:47 +02:00
return {
icon: icons["icon:help"],
text: t("main_menu.help_title"),
help: t("main_menu.help_help"),
async value() {
await asyncAlert({
title: t("main_menu.help_title"),
allowClose: true,
content: [
2025-04-09 11:28:32 +02:00
miniMarkDown(
t("main_menu.help_content", {
catchRateBest,
catchRateGood,
levelTimeBest,
levelTimeGood,
missesBest,
missesGood,
wallBouncedBest,
wallBouncedGood,
}),
),
2025-04-08 21:54:19 +02:00
miniMarkDown(t("main_menu.help_upgrades")),
2025-03-31 20:13:47 +02:00
...upgrades.map(
(u) => `
2025-03-31 20:08:17 +02:00
<div class="upgrade used">
${u.icon}
<p>
<strong>${u.name}</strong><br/>
${u.help(1)}
</p>
</div>
${miniMarkDown(u.fullHelp)}
2025-03-31 20:13:47 +02:00
`,
),
2025-04-09 11:28:32 +02:00
"<h2>" + t("main_menu.credit_levels") + "</h2>",
2025-03-31 20:13:47 +02:00
...allLevels
2025-04-08 15:02:38 +02:00
.filter((l) => l.credit?.trim())
2025-03-31 20:13:47 +02:00
.map(
(l) => `
2025-03-31 20:08:17 +02:00
<div class="upgrade used">
${icons[l.name]}
2025-04-08 15:02:38 +02:00
<div>
2025-03-31 20:08:17 +02:00
<p>
2025-04-08 15:02:38 +02:00
<strong>${l.name}</strong>
2025-03-31 20:08:17 +02:00
</p>
2025-04-08 15:02:38 +02:00
${miniMarkDown(l.credit || "")}
</div>
2025-03-31 20:13:47 +02:00
</div>`,
),
],
});
},
};
2025-03-31 20:08:17 +02:00
}