dee
This commit is contained in:
parent
33234f32ae
commit
46258a83eb
15 changed files with 1303 additions and 446 deletions
28
js/render.js
28
js/render.js
|
|
@ -633,6 +633,7 @@ function render() {
|
|||
}
|
||||
};
|
||||
drawAtScreenPosition(world.selected, () => drawSelectedCard(ctx, world, lighting));
|
||||
drawNestBoxTooltip(ctx, world);
|
||||
|
||||
// Time HUD
|
||||
ctx.save();
|
||||
|
|
@ -675,6 +676,33 @@ function render() {
|
|||
}
|
||||
}
|
||||
|
||||
function drawNestBoxTooltip(ctx, world) {
|
||||
const info = world.pointerNestBoxInfo?.();
|
||||
if (!info) return;
|
||||
const box = info.box;
|
||||
const names = info.occupants.length ? info.occupants.map(t => t.name).join("\u3001") : "\u4e2d\u306b\u306f\u8ab0\u3082\u3044\u306a\u3044";
|
||||
const title = "\u5de3\u7bb1";
|
||||
const text = `${title}: ${names}`;
|
||||
ctx.save();
|
||||
ctx.font = "12px Yomogi, sans-serif";
|
||||
const w = Math.min(240, Math.max(92, ctx.measureText(text).width + 22));
|
||||
const h = 38;
|
||||
const pos = world.worldToScreen ? world.worldToScreen(box.x, box.y) : { x: box.x, y: box.y };
|
||||
const x = clamp(pos.x - w / 2, 8, ctx.canvas.width - w - 8);
|
||||
const y = clamp(pos.y - box.r * 1.8 - h, 8, ctx.canvas.height - h - 8);
|
||||
ctx.fillStyle = "rgba(46,38,30,0.62)";
|
||||
ctx.strokeStyle = "rgba(255,248,220,0.72)";
|
||||
ctx.lineWidth = 1.2;
|
||||
roundedRect(ctx, x, y, w, h, 10);
|
||||
ctx.fill();
|
||||
ctx.stroke();
|
||||
ctx.fillStyle = "#fff8e6";
|
||||
ctx.textAlign = "left";
|
||||
ctx.textBaseline = "middle";
|
||||
ctx.fillText(text, x + 11, y + h / 2);
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
function drawSelectedCard(ctx, world, lighting) {
|
||||
const t = world.selected;
|
||||
if (!t || t.dead || !world.tarinai.includes(t)) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue