Documentation ¶
Index ¶
Constants ¶
View Source
const DOT_ALWAYS = 1
View Source
const DOT_SINGLE = 0
Variables ¶
This section is empty.
Functions ¶
func WriteToFile ¶
Types ¶
type Dialog ¶
type Dialog struct { ID string `bson:"id,omitempty" json:"id,omitempty" yaml:"id,omitempty"` Text string `bson:"text,omitempty" json:"text,omitempty" yaml:"text"` // if AlternateTexts is not empty then the text should be randomly selected AlternateTexts []string `bson:"alternateTexts,omitempty" json:"alternateTexts,omitempty" yaml:"alternateTexts,omitempty"` // if ordered texts is set the shown text will be based on how many times you visited the dialog OrderedTexts *bool `bson:"orderedTexts,omitempty" json:"orderedTexts,omitempty" yaml:"orderedTexts,omitempty"` // a dialog either has options the player can choose from or it has a response that is shown to the player. Options []*Dialog `bson:"options,omitempty" json:"options,omitempty" yaml:"options,omitempty"` Answer *Dialog `bson:"answer,omitempty" json:"answer,omitempty" yaml:"answer,omitempty"` RequiresVisitedDialogs []string `bson:"requires_visited_dialogs,omitempty" json:"requires_visited_dialogs,omitempty" yaml:"requires_visited_dialogs,omitempty"` ShowOnlyOnce *bool `bson:"show_only_once,omitempty" json:"show_only_once,omitempty" yaml:"show_only_once,omitempty"` // HasAnswer *bool `bson:"has_answer,omitempty" json:"has_answer,omitempty" yaml:"has_answer,omitempty"` IsDialogExit *bool `bson:"is_dialog_exit,omitempty" json:"is_dialog_exit,omitempty" yaml:"is_dialog_exit,omitempty"` }
Dialog ...
func ReadFromFile ¶
func (*Dialog) Render ¶
func (d *Dialog) Render(state *DialogState) string
func (*Dialog) RenderPlain ¶
func (d *Dialog) RenderPlain(state *DialogState) string
type DialogOptionType ¶
type DialogOptionType int
create DialogOptionType enum with options SINGLE and ALWAYS
type DialogOptions ¶
type DialogOptions []*Dialog
func NewResponse ¶
func NewResponse(id string, text string) DialogOptions
creates a dialog that is used as a response (defaults to DOT_ALWAYS)
func Options ¶
func Options(dialogs ...*Dialog) DialogOptions
create dialog map structure and add all parameters to it
type DialogState ¶
type DialogState struct { CurrentDialogID string // DialogVisited stores how many times a dialog has been visited DialogVisited map[string]int Context map[string]string DynamicContext map[string]func() string }
func NewDialogState ¶
func NewDialogState() *DialogState
Click to show internal directories.
Click to hide internal directories.