TableTower/ui/help_menu.gd
RobinFiredrake 8f16d337cf UI pass: striped rows, View/Help menus, zoom control, card ⋯ menu, fuller sample
- Striped result rows (parchment tint, on by default, `striped_rows` setting).
- Top bar: View ▾ (Plain words / Rule text, Collapse/Expand all, Striped rows,
  Minimap) and a "− 90% ▾ +" zoom control replace the Plain|Text switch,
  Collapse all, −/Fit/+ and Map. Arrange ▾ folds into Board ▾; Search is an icon.
- Help ▾ and F1 open a Help window; the 17 topics live in help/topics.txt.
- Build cards get a ⋯ menu (settings, template, collapse, delete) instead of
  the gear and footer Delete, sharing Style.overflow_button with group cards.
  Row × buttons show only on hover, focus or selection.
- Sample: Luck value card, Make Camp (pick card) and Search the Ruins
  (1d6 + Luck, with results only a modifier reaches).
- New test suite test_top_bar; Canvas/GraphML round-trip tests compare plain
  tables only, since logic keys are JSON-only.
- DESIGN.md: open items, including the Card Mode UI redesign.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-09 10:36:38 -06:00

25 lines
716 B
GDScript

class_name HelpMenu
extends MenuButton
## The top bar's "Help ▾" menu: one item per help topic, each opening the
## Help window at that topic. F1 opens it at the first topic.
var m: Main
func setup(p_main: Main) -> void:
m = p_main
Style.menu_button("Help ▾", false, self)
tooltip_text = "How to use TableTower (F1)"
var pm := get_popup()
ModalCard.style_popup(pm)
var titles := HelpDialog.titles()
for i in titles.size():
pm.add_item(titles[i], i)
pm.id_pressed.connect(func(id: int) -> void: open(titles[id]))
## Opens the Help window at `topic` (the first topic when blank) and returns it.
func open(topic: String = "") -> HelpDialog:
var d := HelpDialog.new(topic)
m._add_modal(d)
return d