This commit is contained in:
33333-33333 2026-06-23 11:48:11 +09:00
commit db81a509cf
6 changed files with 56 additions and 21 deletions

View file

@ -870,8 +870,8 @@ function drawSelectedCard(ctx, world, lighting) {
if (!t || t.dead || !world.tarinai.includes(t)) return;
const w = world.viewportW || world.w;
const h = world.viewportH || world.h;
const cardW = 152;
const cardH = 80;
const cardW = 172;
const cardH = 96;
let x = t.x + 18;
let y = t.y - 100;
x = clamp(x, 10, w - cardW - 10);
@ -889,9 +889,25 @@ function drawSelectedCard(ctx, world, lighting) {
const child = t.juvenile && t.parentToFollow?.() ? " / \u5b50" : "";
const zHint = t.digest > 4.9 ? " / \u305a\u3093\u3061" : "";
ctx.fillText(`${stateLabel(t.state)}${child}${zHint}`, x + 10, y + 35);
const genLabel = (t.displayGeneration && t.displayGeneration()) ? ` \u4e16\u4ee3 ${t.generation}` : "";
ctx.fillText(`\u7dcf\u5408\u7684\u6c17\u5206 ${fmt(t.mood)}${genLabel} \u4f53\u529b ${fmt(t.energy)}`, x + 10, y + 52);
ctx.fillText(`\u30b9\u30c8\u30ec\u30b9 ${fmt(t.stress)} \u7a7a\u8179 ${fmt(t.hunger)}`, x + 10, y + 68);
const needSystem = window.TarinaiNeedSystem;
const needLabels = needSystem?.NEED_LABELS || {
food: "\u6442\u990c",
sleep: "\u7761\u7720",
health: "\u5065\u5eb7",
safety: "\u5b89\u5168",
social: "\u95a2\u4fc2",
fulfill: "\u5145\u8db3",
};
const needKeys = needSystem?.NEED_KEYS || ["food", "sleep", "health", "safety", "social", "fulfill"];
const needValue = key => needSystem?.getNeedDisplayValue ? needSystem.getNeedDisplayValue(t.needs?.[key] || 0) : Math.round((t.needs?.[key] || 0) / 10);
const activeNeed = t.intent?.need || t.need || "";
const rowA = needKeys.slice(0, 3).map(key => `${needLabels[key]}${key === activeNeed ? "\u25b2" : ""} ${needValue(key)}`).join(" ");
const rowB = needKeys.slice(3).map(key => `${needLabels[key]}${key === activeNeed ? "\u25b2" : ""} ${needValue(key)}`).join(" ");
ctx.fillText(rowA, x + 10, y + 52);
ctx.fillText(rowB, x + 10, y + 68);
let actionText = `\u3044\u307e ${t.intent?.actionLabel || stateLabel(t.state)}`;
while (actionText.length > 4 && ctx.measureText(actionText).width > cardW - 20) actionText = `${actionText.slice(0, -4)}...`;
ctx.fillText(actionText, x + 10, y + 84);
ctx.restore();
}