From 70394b3e4ded4811b1f482e6d036b23b7dcb1765 Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Mon, 28 Sep 2026 09:27:14 +0800 Subject: feat(desktop): P38 HUD 图标化升级(时段/时间/倍速/体力/钱币) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 顶部常驻条每个状态段前加 7x7 原创点阵图标(用 pixel 贴图绘制,无外部素材): 时段=太阳、时间=钟、倍速=双箭头、体力=心形、钱币=圆形钱眼。图标占 iconWidth+iconGap 后接文本,段总宽含图标;底色药丸与 1px 描边同覆盖图标与文本, 昼夜两套调色板均可读;仍为半透明窄条(barHeight 不变,非大黑块)。 --- src/LivingVillage.Desktop/Game.fs | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'src/LivingVillage.Desktop/Game.fs') diff --git a/src/LivingVillage.Desktop/Game.fs b/src/LivingVillage.Desktop/Game.fs index cb28e58..8e58727 100644 --- a/src/LivingVillage.Desktop/Game.fs +++ b/src/LivingVillage.Desktop/Game.fs @@ -1581,14 +1581,33 @@ type LivingVillageGame() as this = spriteBatch.Draw(pixel, Rectangle(0, 0, viewport.Width, barHeight / 2), palette.BarTop) spriteBatch.Draw(pixel, Rectangle(0, barHeight / 2, viewport.Width, barHeight - barHeight / 2), palette.BarBottom) spriteBatch.Draw(pixel, Rectangle(0, barHeight, viewport.Width, HudLayout.accentHeight), palette.Accent) + // 图标用 pixel 贴图按 7x7 点阵绘制(无外部素材),先描边后填充,保证昼夜可读。 + let drawIcon (iconX: int) (iconY: int) (color: Color) (icon: HudLayout.HudIcon) = + HudLayout.iconRows icon + |> List.iteri (fun row bits -> + bits + |> Seq.iteri (fun column bit -> + if bit = '1' then + spriteBatch.Draw( + pixel, + Rectangle( + iconX + column * HudLayout.iconScale, + iconY + row * HudLayout.iconScale, + HudLayout.iconScale, + HudLayout.iconScale), + color))) + let iconY = (barHeight - HudLayout.iconHeight) / 2 for (x, width, segment) in placed do spriteBatch.Draw(pixel, HudLayout.segmentBackdrop x width, palette.SegmentBackdrop) + let textX = HudLayout.textOrigin x let labelAdvanced = FloatingPrompt.measureWidth (segment.Label + " ") HudLayout.textScale for (dx, dy) in HudLayout.textOutlineOffsets do - PixelText.draw spriteBatch pixel cjkAtlas (x + dx) (textY + dy) HudLayout.textScale palette.Outline segment.Label - PixelText.draw spriteBatch pixel cjkAtlas (x + labelAdvanced + dx) (textY + dy) HudLayout.textScale palette.Outline segment.Value - PixelText.draw spriteBatch pixel cjkAtlas x textY HudLayout.textScale palette.Label segment.Label - PixelText.draw spriteBatch pixel cjkAtlas (x + labelAdvanced) textY HudLayout.textScale palette.Value segment.Value + drawIcon (x + dx) (iconY + dy) palette.Outline segment.Icon + PixelText.draw spriteBatch pixel cjkAtlas (textX + dx) (textY + dy) HudLayout.textScale palette.Outline segment.Label + PixelText.draw spriteBatch pixel cjkAtlas (textX + labelAdvanced + dx) (textY + dy) HudLayout.textScale palette.Outline segment.Value + drawIcon x iconY palette.Value segment.Icon + PixelText.draw spriteBatch pixel cjkAtlas textX textY HudLayout.textScale palette.Label segment.Label + PixelText.draw spriteBatch pixel cjkAtlas (textX + labelAdvanced) textY HudLayout.textScale palette.Value segment.Value spriteBatch.End() /// 常驻情境状态:顶部条下方的小药丸,仅 WorldPanel 且瞬态未过期时出现。 -- cgit v1.2.3