diff options
Diffstat (limited to 'src/LivingVillage.Desktop/Game.fs')
| -rw-r--r-- | src/LivingVillage.Desktop/Game.fs | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/src/LivingVillage.Desktop/Game.fs b/src/LivingVillage.Desktop/Game.fs index 77fa314..8c1ea21 100644 --- a/src/LivingVillage.Desktop/Game.fs +++ b/src/LivingVillage.Desktop/Game.fs @@ -3311,11 +3311,21 @@ type LivingVillageGame() as this = 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 + let layout = FloatingPrompt.layoutWrapped viewport.Width viewport.Height targetPos.X targetPos.Y camera.X camera.Y scale text + let promptPalette = HudLayout.palette (M6Presentation.profileAtTick world.Tick).Mode 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 + // P77:与顶/底条同语言的药丸——半透明底 + 1px 描边 + 发丝高光,非大黑块。 + spriteBatch.Draw(pixel, Rectangle(layout.X - 6, layout.Y - 5, layout.Width + 12, layout.Height + 8), promptPalette.SegmentBackdrop) + spriteBatch.Draw(pixel, Rectangle(layout.X - 6, layout.Y - 5, layout.Width + 12, 1), promptPalette.Outline) + spriteBatch.Draw(pixel, Rectangle(layout.X - 6, layout.Y + 3, layout.Width + 12, 1), promptPalette.Accent) + spriteBatch.Draw(pixel, Rectangle(layout.X - 6, layout.Y - 5, 1, layout.Height + 8), promptPalette.Outline) + spriteBatch.Draw(pixel, Rectangle(layout.X + layout.Width + 5, layout.Y - 5, 1, layout.Height + 8), promptPalette.Outline) + layout.Lines + |> List.iteri (fun index line -> + let lineY = layout.Y + index * (8 * scale + 4) + for (dx, dy) in HudLayout.textOutlineOffsets do + PixelText.draw spriteBatch pixel cjkAtlas (layout.X + dx) (lineY + dy) scale promptPalette.Outline line + PixelText.draw spriteBatch pixel cjkAtlas layout.X lineY scale promptPalette.Value line) spriteBatch.End() | _ -> () this.DrawM5Overlay() @@ -3488,11 +3498,12 @@ type LivingVillageGame() as this = let line1 = HudLayout.calendarLine1 reading let line2 = HudLayout.calendarLine2 reading spriteBatch.Begin() + // P77:与顶/底条同语言的药丸——半透明底 + 1px 描边 + 发丝高光,卡片微缩。 spriteBatch.Draw(pixel, rect, palette.SegmentBackdrop) - spriteBatch.Draw(pixel, Rectangle(rect.X, rect.Y, rect.Width, 2), palette.Accent) - spriteBatch.Draw(pixel, Rectangle(rect.X, rect.Bottom - 2, rect.Width, 2), palette.Outline) - spriteBatch.Draw(pixel, Rectangle(rect.X, rect.Y, 2, rect.Height), palette.Outline) - spriteBatch.Draw(pixel, Rectangle(rect.Right - 2, rect.Y, 2, rect.Height), palette.Outline) + spriteBatch.Draw(pixel, Rectangle(rect.X, rect.Y, rect.Width, 1), palette.Accent) + spriteBatch.Draw(pixel, Rectangle(rect.X, rect.Bottom - 1, rect.Width, 1), palette.Outline) + spriteBatch.Draw(pixel, Rectangle(rect.X, rect.Y, 1, rect.Height), palette.Outline) + spriteBatch.Draw(pixel, Rectangle(rect.Right - 1, rect.Y, 1, rect.Height), palette.Outline) let iconX = rect.X + HudLayout.calendarPadX let iconY = rect.Y + (rect.Height - HudLayout.iconHeight) / 2 this.DrawPattern (HudLayout.iconRows HudLayout.calendarIcon) iconX iconY HudLayout.iconScale palette.Value @@ -3586,16 +3597,19 @@ type LivingVillageGame() as this = let textScale = 2 let lineHeight = 18 let lines = M5Interaction.panelLines world m5View - let panelWidth = min 380 (max 1 (viewport.Width - 32)) - let panelX = 16 - let innerX = panelX + 12 - let innerWidth = max 1 (panelWidth - 24) + let widthGuess = min 380 (max 1 (viewport.Width - 32)) + let innerWidthGuess = max 1 (widthGuess - 24) // P76:按实测像素宽度折行(中文逐字),换行而非整行截断;不再 Substring 截断。 - let wrapped = HudLayout.wrapLines innerWidth textScale lines + let wrapped = HudLayout.wrapLines innerWidthGuess textScale lines let maxLines = max 1 ((viewport.Height - HudLayout.barHeight - 48) / lineHeight) let visibleLines = wrapped |> List.truncate maxLines - let panelHeight = visibleLines.Length * lineHeight + 26 - let panelY = max (HudLayout.barHeight + 12) (viewport.Height - panelHeight - 16) + // P77:面板几何由 HudLayout 统一给出,底边抬到 hotbar 顶上方,绝不遮挡快捷栏。 + let rect = HudLayout.panelRect viewport.Width viewport.Height visibleLines.Length + let panelX = rect.X + let panelY = rect.Y + let panelWidth = rect.Width + let panelHeight = rect.Height + let innerX = panelX + HudLayout.panelPadX spriteBatch.Begin() // 半透明圆角感面板:细描边 + 1px 发丝线(与 P75/P76 同语言),非大色块/纯黑。 spriteBatch.Draw(pixel, Rectangle(panelX, panelY, panelWidth, panelHeight / 2), Color(38, 52, 62, 175)) |
