Preskoči na vsebino

std-dialogue-box

Level: Atom | Entity: DialogueBox | Persistence: runtime

2 states, 5 events, 5 transitions

Live Preview

schema.orb
{
"name": "DialogueBoxOrbital",
"orbitals": [
{
"name": "DialogueBoxOrbital",
"entity": {
"name": "DialogueBox",
"persistence": "runtime",
"fields": [
{
"name": "id",
"type": "string"
},
{
"name": "name",
"type": "string"
},
{
"name": "description",
"type": "string"
},
{
"name": "status",
"type": "string",
"default": "active",
"values": [
"active",
"inactive",
"pending"
]
},
{
"name": "createdAt",
"type": "string"
},
{
"name": "speaker",
"type": "string",
"default": "Narrator"
},
{
"name": "text",
"type": "string",
"default": "Welcome, adventurer. Your journey begins here."
}
]
},
"traits": [
{
"name": "DialogueBoxDialogue",
"linkedEntity": "DialogueBox",
"category": "interaction",
"stateMachine": {
"states": [
{
"name": "talking",
"isInitial": true
},
{
"name": "idle"
}
],
"events": [
{
"key": "INIT",
"name": "Initialize"
},
{
"key": "ADVANCE",
"name": "Advance"
},
{
"key": "CHOICE",
"name": "Choice",
"payload": [
{
"name": "choiceId",
"type": "string",
"required": true
}
]
},
{
"key": "COMPLETE",
"name": "Complete"
},
{
"key": "START_DIALOGUE",
"name": "Start Dialogue"
}
],
"transitions": [
{
"from": "talking",
"to": "talking",
"event": "INIT",
"effects": [
[
"fetch",
"DialogueBox"
],
[
"set",
"@entity.speaker",
"Narrator"
],
[
"set",
"@entity.text",
"Welcome, adventurer. Your journey begins here."
],
[
"render-ui",
"main",
{
"type": "dialogue-box",
"dialogue": {
"speaker": "@entity.speaker",
"text": "@entity.text"
},
"typewriterSpeed": 30,
"position": "bottom"
}
]
]
},
{
"from": "talking",
"to": "talking",
"event": "ADVANCE",
"effects": [
[
"fetch",
"DialogueBox"
],
[
"render-ui",
"main",
{
"type": "dialogue-box",
"dialogue": {
"speaker": "@entity.speaker",
"text": "@entity.text"
},
"typewriterSpeed": 30,
"position": "bottom"
}
]
]
},
{
"from": "talking",
"to": "talking",
"event": "CHOICE",
"effects": [
[
"render-ui",
"main",
{
"type": "dialogue-box",
"dialogue": {
"speaker": "@entity.speaker",
"text": "@entity.text"
},
"typewriterSpeed": 30,
"position": "bottom"
}
]
]
},
{
"from": "talking",
"to": "idle",
"event": "COMPLETE",
"effects": [
[
"render-ui",
"main",
{
"type": "stack",
"direction": "vertical",
"gap": "md",
"align": "center",
"children": [
{
"type": "typography",
"content": "Dialogue complete",
"variant": "caption"
},
{
"type": "button",
"label": "New Dialogue",
"event": "START_DIALOGUE",
"variant": "primary",
"icon": "message-circle"
}
]
}
]
]
},
{
"from": "idle",
"to": "talking",
"event": "START_DIALOGUE",
"effects": [
[
"fetch",
"DialogueBox"
],
[
"render-ui",
"main",
{
"type": "dialogue-box",
"dialogue": {
"speaker": "@entity.speaker",
"text": "@entity.text"
},
"typewriterSpeed": 30,
"position": "bottom"
}
]
]
}
]
}
}
],
"pages": [
{
"name": "DialogueBoxDialoguePage",
"path": "/dialogueboxs",
"traits": [
{
"ref": "DialogueBoxDialogue"
}
]
}
]
}
],
"description": "RPG dialogue atom using the `dialogue-box` pattern. Shows speaker, portrait, typewriter text, and choices."
}
Loading preview...

Orbital Visualization

Loading visualization...

Entity Fields

FieldTypeDefault
idstring-
namestring-
descriptionstring-
statusstring"active"
createdAtstring-
speakerstring"Narrator"
textstring"Welcome, adventurer. Your journey begins here."

States

StateType
talkingInitial
idle-

Events

EventPayload
INIT-
ADVANCE-
CHOICEchoiceId: string
COMPLETE-
START_DIALOGUE-

Transitions

FromEventToEffects
talkingINITtalking4 effects
talkingADVANCEtalking2 effects
talkingCHOICEtalking1 effect
talkingCOMPLETEidle1 effect
idleSTART_DIALOGUEtalking2 effects