class_name WelcomeDialog extends RefCounted ## Morgan's welcome on the first launch: what a spread is, where the spread ## switcher is, and three ways to start (explore the demo, a blank spread, ## import one). maybe_show() shows it once (the "welcome_seen" setting); ## open() shows it any time, for a later "Show the welcome again" button. const SETTING := "welcome_seen" const MASCOT_PIXELS := 96 ## Shows the welcome if it hasn't been seen, then remembers that it has. ## Not in sessions that don't save (tests, screenshots). static func maybe_show(main: Main) -> void: if not main._saving_enabled or main.state == null or main.state.get_setting(SETTING, false): return main.state.set_setting(SETTING, true) main.state.save() open(main) static func open(main: Main) -> ModalCard: var dialog := ModalCard.new("Welcome to Table Tarot", 560.0) var row := HBoxContainer.new() row.add_theme_constant_override("separation", 18) var art := MascotArt.texture(ThemeStore.current, MASCOT_PIXELS) if art: var picture := TextureRect.new() picture.texture = art picture.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED picture.custom_minimum_size = Vector2(MASCOT_PIXELS, MASCOT_PIXELS) picture.size_flags_vertical = Control.SIZE_SHRINK_BEGIN row.add_child(picture) var text := VBoxContainer.new() text.add_theme_constant_override("separation", 10) text.size_flags_horizontal = Control.SIZE_EXPAND_FILL for line in [ "I'm Morgan. Let me show you around.", "A spread is a set of table cards laid out together, like cards in a tarot reading. Each card is a random table. Threads carry a roll from one card to the next.", "You're looking at a demo spread. Your own spreads live in the Spread ▾ menu at the top left. Switch between them, or make a new one, there at any time.", ]: text.add_child(ModalCard.note(line, Style.INK)) row.add_child(text) dialog.body.add_child(row) dialog.add_button("Import a spread…", "plain", func() -> void: dialog.close() main.collections.import_collection()) dialog.add_button("Start a blank spread", "plain", func() -> void: dialog.close() main.new_collection()) dialog.add_button("Explore the demo", "primary", dialog.close) main._add_modal(dialog) return dialog