- ChoiceDialog: card-styled pop-up for pick (option rows with details, Random,
1-9 / R keys), number (spin box with min/max/default, Enter) and text.
Cancel, Esc, freeing the dialog, a new roll or a collection switch all
answer null through a separate Reply object, so a roll never hangs.
- Main: real prompt hook; the steps so far light on the board and in the
tray before each question; a roll with questions shows the rest at once;
a new roll cancels an open question cleanly; refresh_live() re-renders
variable, sheet and question text only after rolls and edits.
- TableCard: "?" badge and question for choice cards, loop icon, rule chip
and Each time / Afterwards rows, compact live variable cards (reset in
Build), live sheet cards with one outlet, expression-dice subtitles,
effect chips in Play and a validated effects editor in Build.
- Build: "+ Table" menu for every kind; kind-specific settings (choice type,
question, save as, min/max; loop mode and rule; variable name, type,
starting value; sheet template) checked with Expr.check; expression pipe
counts in the pipe popover and on pipe labels.
- Tray: effect lines under chips, last 12 steps behind "+N earlier steps",
sheet headline, Cancelled / action-limit pill, capped indents and Earlier
rows; Variables tab lists every board variable with Reset all.
- RichText: error markers in red; previews show {@x_*} and {= expr}.
- examples/logic_demo.json and tests/test_logic_ui.gd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.6 KiB
GDScript
36 lines
1.6 KiB
GDScript
class_name Icons
|
|
extends RefCounted
|
|
## Small vector icons drawn with CanvasItem calls.
|
|
|
|
|
|
## The TableTower mark: a tower outline with a brass doorway. Drawn in a 22x26 box.
|
|
static func draw_tower(ci: CanvasItem, origin: Vector2, scale: float, color: Color, accent: Color) -> void:
|
|
var pts := PackedVector2Array([
|
|
Vector2(3, 25), Vector2(3, 8), Vector2(6, 6), Vector2(6, 2), Vector2(9, 2), Vector2(9, 5),
|
|
Vector2(13, 5), Vector2(13, 2), Vector2(16, 2), Vector2(16, 6), Vector2(19, 8), Vector2(19, 25), Vector2(3, 25),
|
|
])
|
|
for i in pts.size():
|
|
pts[i] = origin + pts[i] * scale
|
|
ci.draw_polyline(pts, color, 1.7 * scale, true)
|
|
var door := PackedVector2Array([origin + Vector2(7, 25) * scale, origin + Vector2(7, 19) * scale])
|
|
for k in range(17):
|
|
var a := PI + PI * k / 16.0
|
|
door.append(origin + (Vector2(11, 19) + Vector2(cos(a), sin(a)) * 4.0) * scale)
|
|
door.append(origin + Vector2(15, 25) * scale)
|
|
ci.draw_polyline(door, accent, 1.7 * scale, true)
|
|
|
|
|
|
## A loop arrow: most of a circle with an arrowhead, centred on `center`.
|
|
static func draw_loop(ci: CanvasItem, center: Vector2, radius: float, color: Color, width: float = 2.0) -> void:
|
|
var start := -PI * 0.35
|
|
var end := start + TAU * 0.8
|
|
ci.draw_arc(center, radius, start, end, 24, color, width, true)
|
|
var tip := center + Vector2(cos(end), sin(end)) * radius
|
|
var tangent := Vector2(-sin(end), cos(end))
|
|
var normal := Vector2(cos(end), sin(end))
|
|
var s := radius * 0.62
|
|
ci.draw_colored_polygon(PackedVector2Array([
|
|
tip + tangent * s,
|
|
tip - normal * s * 0.85 - tangent * s * 0.15,
|
|
tip + normal * s * 0.85 - tangent * s * 0.15,
|
|
]), color)
|