struct

PointClickEngine::UI::DialogChoice

Inherits YAML::Serializable < Struct < Value < Object

Represents a selectable choice in a dialog.

Dialog choices allow players to make decisions during conversations,

triggering different outcomes based on their selection.

## Usage

```crystal

choice = DialogChoice.new("I'll help you!", -> {

player.add_quest("help_villager")

npc.mood = CharacterMood::Grateful

})

```

NOTE: Actions are not serialized - re-register after loading

Constructors

new(ctx : YAML::ParseContext, node : YAML::Nodes::Node)
Source
new(text : String, action : Proc(Nil))

Creates a choice with text and action.

- text : Text displayed to the player

- action : Callback to execute when selected

Source
new

Creates an empty choice (used for deserialization)

Source
new(*, __context_for_yaml_serializable ctx : YAML::ParseContext, __node_for_yaml_serializable node : YAML::Nodes::Node)
Source

Instance methods

action

Callback executed when this choice is selected (runtime only)

Source
action=(action : Proc(Nil))

Callback executed when this choice is selected (runtime only)

Source
text

Display text for this choice

Source
text=(text : String)

Display text for this choice

Source