Prompts (game/scripts/prompts.gd) holds every key-naming prompt: on a phone (MobilePort.active()) it says each in touch words, elsewhere exactly the old string. World labels drop the key (Gather, Repair, Upgrade to, Upgrades, Shop), the build ghost says Place / Dismantle, the build bar's line is "Place · Rotate · Dismantle · Done" and its slots drop the number keys, the cutscenes say "Hold to skip" / "Tap to skip", the tip footer says "× hides tips", and the tutorial's tips and the first morning's sign name the thumbs (sides from TouchSticks), Use, Build, Place, Fear, Bomb, Patch, the hotbar, and the backpack. MobilePort gains the `forced` test override. game/tests/mobile/prompts_test.gd checks every phone string and that the desktop strings are byte for byte as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
72 lines
2.8 KiB
GDScript
72 lines
2.8 KiB
GDScript
class_name BuildHud
|
|
extends Control
|
|
## The build bar, shown in build mode in the weapons hotbar's place (ScarecrowHud), hand-drawn
|
|
## like the HUD's pouch panel (Sketch): "Build" over a pen rule with how many structures stand on
|
|
## the farm, one slot per buildable with its key, name, and cost (red when the builder can't
|
|
## afford it from their own pouch and the shed), the selected one lifted in a gold frame, and the
|
|
## controls in dim text under them.
|
|
|
|
const SLOT := Vector2(250.0, 80.0)
|
|
const GAP := 12.0
|
|
const PAD := 18.0
|
|
const HEAD := 52.0
|
|
const HELP := 32.0
|
|
const BOTTOM := 22.0
|
|
const SHORT := Color(1.0, 0.45, 0.4)
|
|
|
|
var build: BuildMode
|
|
var campaign: CampaignController
|
|
|
|
|
|
func setup(p_build: BuildMode, p_campaign: CampaignController) -> void:
|
|
build = p_build
|
|
campaign = p_campaign
|
|
|
|
|
|
func _ready() -> void:
|
|
set_anchors_preset(Control.PRESET_FULL_RECT)
|
|
mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
|
func _process(_delta: float) -> void:
|
|
visible = build != null and build.active
|
|
if visible:
|
|
queue_redraw()
|
|
|
|
|
|
## The controls line, as shown.
|
|
func help_text() -> String:
|
|
return Prompts.build_help()
|
|
|
|
|
|
func _draw() -> void:
|
|
if build == null or not build.active:
|
|
return
|
|
var r := campaign.state.resources
|
|
var slot := build.kit.slot if build.kit != null else 0
|
|
var n := StructureSystem.ORDER.size()
|
|
var width := n * SLOT.x + (n - 1) * GAP + PAD * 2.0
|
|
var height := HEAD + SLOT.y + HELP + PAD
|
|
var panel := Rect2(Vector2((size.x - width) * 0.5, size.y - BOTTOM - height), Vector2(width, height))
|
|
Sketch.panel(self, panel, 801.0)
|
|
Sketch.text(self, panel.position + Vector2(PAD, 6.0), "Build", 32)
|
|
Sketch.text(self, Vector2(panel.end.x - PAD - 8.0, panel.position.y + 12.0), "%d built" % build.structures.count(), 24,
|
|
Sketch.DIM, HORIZONTAL_ALIGNMENT_RIGHT, 6)
|
|
Sketch.rule(self, panel.position.x + 14.0, panel.end.x - 14.0, panel.position.y + 48.0, 802.0)
|
|
for i in n:
|
|
var t: String = StructureSystem.ORDER[i]
|
|
var cost: Dictionary = campaign.config.costs.get(t, {})
|
|
var rect := Rect2(panel.position + Vector2(PAD + i * (SLOT.x + GAP), HEAD + 4.0), SLOT)
|
|
var picked := i == build.selected
|
|
if picked:
|
|
rect = rect.grow(3.0)
|
|
rect.position.y -= 4.0
|
|
Sketch.box(self, rect, Sketch.SLOT, Sketch.INK, 2.5, 810.0 + i * 3.0)
|
|
if picked:
|
|
Sketch.box(self, rect.grow(2.0), Color(0, 0, 0, 0), Sketch.GOLD, 3.5, 830.0 + i)
|
|
Sketch.text(self, rect.position + Vector2(12.0, 4.0), Prompts.build_slot(i + 1, StructureSystem.NAMES[t]), 28, Sketch.TEXT,
|
|
HORIZONTAL_ALIGNMENT_LEFT, 6)
|
|
Sketch.text(self, rect.position + Vector2(12.0, 42.0), ResourceStore.describe(cost), 22,
|
|
Sketch.TEXT if r.can_afford(cost, slot) else SHORT, HORIZONTAL_ALIGNMENT_LEFT, 6)
|
|
Sketch.text(self, Vector2(panel.get_center().x, panel.end.y - PAD - 22.0), help_text(), 22, Sketch.DIM,
|
|
HORIZONTAL_ALIGNMENT_CENTER, 6)
|