Start maybe working on a native app
This commit is contained in:
@@ -55,7 +55,7 @@ export class CreditsScreen extends GuiScreen {
|
||||
|
||||
const content = document.createElement("div");
|
||||
content.style.cssText = "overflow-y:auto;flex:1;min-height:0;padding-right:8px;";
|
||||
content.innerHTML = this.#sections().map(({ heading, text }) =>
|
||||
content.innerHTML = credit_sections().map(({ heading, text }) =>
|
||||
`<section><h2 style="border-bottom:1px solid #374151;padding-bottom:4px">${escape_html(heading)}</h2>` +
|
||||
`${markdown.parse(text, { async: false })}</section>`
|
||||
).join("");
|
||||
@@ -72,14 +72,6 @@ export class CreditsScreen extends GuiScreen {
|
||||
document.body.append(this.#overlay);
|
||||
}
|
||||
|
||||
#sections() {
|
||||
const sections = [{ heading: "cubi", text: AssetManager.instance.get<string>("cubi:assets_text") ?? "" }];
|
||||
for (const mod of mod_credits) {
|
||||
sections.push({ heading: `${mod.name} ${mod.version}`, text: mod.text });
|
||||
}
|
||||
return sections;
|
||||
}
|
||||
|
||||
on_tick(_delta: number): void {}
|
||||
|
||||
on_render(): void {
|
||||
@@ -91,6 +83,15 @@ export class CreditsScreen extends GuiScreen {
|
||||
}
|
||||
}
|
||||
|
||||
// the engine's assets/ASSETS.md, then each loaded mod's credits file, as markdown
|
||||
export function credit_sections(): { heading: string; text: string }[] {
|
||||
const sections = [{ heading: "cubi", text: AssetManager.instance.get<string>("cubi:assets_text") ?? "" }];
|
||||
for (const mod of mod_credits) {
|
||||
sections.push({ heading: `${mod.name} ${mod.version}`, text: mod.text });
|
||||
}
|
||||
return sections;
|
||||
}
|
||||
|
||||
function escape_html(text: string) {
|
||||
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user