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)