TableTower/ui/build_mode_hint.gd
RobinFiredrake 2661744b06 Sheets phase B: main menu, Sheets list, sheet editor
- Main menu (Spreads, Sheets, Settings, Quit) on the theme background,
  with recent spreads and sheets; logo or ☰ returns to it.
- Sheets: data model, store, templates, snapshot undo; New sheet dialog
  (blank or a template); editor with folder tabs, snap-grid canvas on the
  spread background, field palette, inspector, Play/Build, status strip.
- Field kinds: Number, Text box (BBCode, live {@name}), Heading.
- PaletteList shared by the card and field palettes; shared top bar brand.
- Keys go to the screen that shows; theme reloads keep the screen.

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

48 lines
1.9 KiB
GDScript

class_name BuildModeHint
extends RefCounted
## Play mode tells new players that Build mode exists: the card palette is
## greyed under a notice with "Switch to Build" (CardPalette), and the ☰ menu
## has a greyed "New card". Clicking a greyed palette item explains, offers
## "Switch to Build" and makes the Build switch pulse.
const MESSAGE := "Cards are added and edited in Build mode."
const PALETTE_MESSAGE := "Cards are added in Build mode."
const TIP := "Switch to Build mode (top left) to add and edit cards"
## 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)
## The notice over a greyed palette in Play: the message and a button that
## switches to Build (`to_build`). Shared by the card and field palettes.
static func make_notice(_m: Main, to_build: Callable, message: String = PALETTE_MESSAGE) -> PanelContainer:
var box := PanelContainer.new()
box.add_theme_stylebox_override("panel", Style.bordered(Style.box(Style.CARD, 8, [10, 8, 10, 8]), 2, Style.TRIM))
var col := VBoxContainer.new()
col.add_theme_constant_override("separation", 6)
box.add_child(col)
var text := Style.make_label(message, Style.body_bold(), 14, Style.INK)
text.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
col.add_child(text)
var go := ModalCard.make_button("Switch to Build", "primary")
go.name = "SwitchToBuild"
go.pressed.connect(to_build)
col.add_child(go)
return box