TableTower/ui/build_mode_hint.gd
RobinFiredrake 48b57e284c Play shows that Build mode exists
A greyed + Card in Play's top bar explains that cards are added in Build,
offers Switch to Build and pulses the Build switch. The ☰ menu shows New
card greyed with a tip. The toast's button can now run any action.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 12:42:29 -06:00

38 lines
1.3 KiB
GDScript

class_name BuildModeHint
extends RefCounted
## Play mode tells new players that Build mode exists: a greyed "+ Card"
## button in the top bar and a greyed "New card" in the ☰ menu. Clicking the
## button explains, offers "Switch to Build" and makes the Build switch pulse.
const MESSAGE := "Cards are added and edited in Build mode."
const TIP := "Switch to Build mode (top left) to add and edit cards"
## The greyed "+ Card" shown in Play in place of the real one.
static func make_button(m: Main) -> Button:
var b := Style.bar_button("+ Card")
b.modulate.a = 0.5
b.tooltip_text = TIP
b.focus_mode = Control.FOCUS_NONE
b.pressed.connect(func() -> void: explain(m))
return b
## The ☰ menu's greyed "New card" in Play (Actions.background).
static func menu_item() -> Dictionary:
return {"text": "New card", "disabled": true, "tip": TIP}
static func explain(m: Main) -> void:
m.top_bar.toast_action(MESSAGE, "Switch to Build", func() -> void: m.set_mode(Main.Mode.BUILD))
pulse(m.top_bar._build_button)
## Flashes a button three times to draw the eye.
static func pulse(b: Control) -> void:
if b == null or not b.is_inside_tree():
return
var tween := b.create_tween()
for i in 3:
tween.tween_property(b, "modulate", Color(1.6, 1.4, 0.8), 0.18)
tween.tween_property(b, "modulate", Color.WHITE, 0.22)