diff options
| author | Somhairle H. Marisol <[email protected]> | 2026-09-21 12:43:20 +0800 |
|---|---|---|
| committer | Somhairle H. Marisol <[email protected]> | 2026-09-21 12:43:20 +0800 |
| commit | 12616f1d67d936a542e1e22926fb0ebcd4108906 (patch) | |
| tree | 64e99e4eac72815d8aab15c599abb60d02d31c82 /src/LivingVillage.Desktop/Game.fs | |
| parent | eaedd532c7d93dec9cca5d361685ed32c85aeebb (diff) | |
| download | living-village-12616f1d67d936a542e1e22926fb0ebcd4108906.tar.gz | |
feat(desktop): 目标上方浮动情境提示
新增 FloatingPrompt 纯布局模块(含 measureWidth 与 PixelText 等宽规则):短提示锚定在唯一目标头顶上方,水平居中并钳制在视口内,避开左下 HUD 带(height-160)与右上状态条带(宽度 248);沿用现有 CJK 图集字体路径,不新造字形;对话/需求面板与菜单打开时不显示(复用 worldInputAllowed 判定与渲染门)。回归测试覆盖 1280x720/1920x1080 五个极限锚点、宽度测量、面板开启时提示为空且禁用世界输入。
Diffstat (limited to 'src/LivingVillage.Desktop/Game.fs')
| -rw-r--r-- | src/LivingVillage.Desktop/Game.fs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/LivingVillage.Desktop/Game.fs b/src/LivingVillage.Desktop/Game.fs index 4720008..1db5c3d 100644 --- a/src/LivingVillage.Desktop/Game.fs +++ b/src/LivingVillage.Desktop/Game.fs @@ -666,6 +666,19 @@ type LivingVillageGame() as this = let spec = VillageArt.npcSpriteSpecAtTarget npc.Id npc.Pos npc.Mind.Target world.Tick VillageArt.drawCharacter spriteBatch artTextures camera npc.Pos spec profile.WorldTint spriteBatch.End() + + // Contextual floating prompt over the unique target; same CJK atlas font path as the HUD. + if m5View.Panel = M5Panel.WorldPanel && menu.Page = Playing then + match m5View.Prompt, m5View.PromptTargetPos with + | Some text, Some targetPos -> + let scale = 2 + let rect = FloatingPrompt.layout viewport.Width viewport.Height targetPos.X targetPos.Y camera.X camera.Y scale text + spriteBatch.Begin() + spriteBatch.Draw(pixel, Rectangle(rect.X - 6, rect.Y - 5, rect.Width + 12, rect.Height + 8), Color(15, 19, 25, 200)) + spriteBatch.Draw(pixel, Rectangle(rect.X - 6, rect.Y - 5, rect.Width + 12, 2), Color(92, 180, 190)) + PixelText.draw spriteBatch pixel cjkAtlas rect.X rect.Y scale (Color(240, 250, 240)) text + spriteBatch.End() + | _ -> () this.DrawM5Overlay() member private this.DrawM5Overlay() = |
