This commit is contained in:
2026-11-23 23:51:51 +08:00
5 changed files with 318 additions and 7 deletions
+14 -7
View File
@@ -118,6 +118,7 @@ import { applyStoryOutcome, getAvailableStoryChoices } from "./progression/story
import { finishRandomEvent } from "./progression/random-event.js";
import { playDialogue } from "./ui/dialogue.js";
import { chooseButtons } from "./ui/flow-ui.js";
import { chooseCharacterCards } from "./ui/character-select.js";
import { chooseRest } from "./ui/rest-ui.js";
import { chooseShop } from "./ui/shop-ui.js";
import { acquirePotion, createPotionOffer, potionSlots } from "./potions/state.js";
@@ -186,12 +187,18 @@ const chooseRun = async savedRun => {
};
const chooseCharacter = async (backLabel = "返回存档选择") => {
const choices = config.characters.filter(name => lib.character[name]).map(name => ({
id: name,
name: get.translation(name),
description: lib.translate[`${name}_title`] || "作为本次征程的角色",
}));
return chooseButtons("选择出征武将", [...(choices.length ? choices : [{ id: "mengsan_liubei_shuying", name: "刘备" }]), { id: "back", name: backLabel, description: "不会修改现有征程" }], "此武将将陪伴你完成本次征程。", { back: "back", eyebrow: "出征准备" });
const playable = config.characters.filter(id => lib.character[id]).map(id => {
const { group, img } = lib.character[id];
return {
id,
name: get.translation(id),
faction: group,
factionName: get.translation(group),
portrait: img ? lib.assetURL + img : "",
description: lib.translate[`${id}_title`] || "作为本次征程的角色",
};
});
return chooseCharacterCards(playable, STYLE_PATH, backLabel);
};
const chooseDefeatAction = async run => chooseButtons("角色阵亡", [
@@ -2124,7 +2131,7 @@ export async function createMengsanMode() {
[245, 196, 193, 1], [192, 85, 91, 1],
] });
}
await Promise.all(["style", "shop", "rest", "potions"].map(name => new Promise(resolve => {
await Promise.all(["style", "shop", "rest", "potions", "character-select"].map(name => new Promise(resolve => {
const style = lib.init.css(`${STYLE_PATH}/ui`, name, resolve);
style.addEventListener("error", resolve, { once: true });
})));