DevJoy.Scene.Dialog (DevJoy v2.0.0)
View SourceA dialog is visually represented in a dialog box and contains text to be displayed. The character would be fetched at runtime making its data customisable using a data module.
Usage
The dialog always requires its content
and character id.
Optionally it's possible to add choices allowing to answer a question.
You can also optionally specify additional data.
defmodule MyApp.SceneName do
use DevJoy.Scene
part :dialog do
dialog :john_doe, "Dialog content"
dialog :john_doe, "Dialog content", some: :data
question :john_doe, "Question content" do
choice "Answer content", goto(:part_name)
end
question :john_doe, [some: :data], "Question content" do
choice "Answer content", goto(:part_name)
end
end
endSummary
Field types
The type representing the content of the dialog.
The type representing the additional data for the dialog.
The type representing the dialog's type.
Field types
@type content() :: String.t()
The type representing the content of the dialog.
@type data() :: Keyword.t()
The type representing the additional data for the dialog.
@type type() :: :normal | :question
The type representing the dialog's type.
:normal- a general dialog (default):question- a question asked by the character