Class: DialogueManager

DialogueManager


new DialogueManager()

The DialogueManager is shared by all mods and the game. Any names added to the list will be available for everyone to use.

Source:

Members


scene

The Dialogue scene is a Phaser scene. The scene shuts down once the playDialogue promise is resolved.
This variable is filled inside the playDialogue function.
You're going to have to learn Phaser if you want to use this scene to the fullest.

Source:
See:
Example
this.scene.add.image(0, 0, "fullScreenButton").setOrigin(0);

Methods


addDialogue(id, callback)

Adds a dialogue function to the dialogue list using the id. You can retrieve the dialogue after adding it by using DialogueManager#getDialogue

Parameters:
Name Type Description
id string
callback DialogueManager.dialogueCallback
Source:

addName(id, name)

Adds a new character to the list

Parameters:
Name Type Description
id string
name
Source:

getDialogue(id)

Returns the function associated with the dialogue id

Parameters:
Name Type Description
id string
Source:
Returns:
Type
function

getName(id)

Get the full name of the character using the characterID

Parameters:
Name Type Description
id string
Source:
Returns:
Type
string

playDialogue(id)

Gets the dialogue function and executes it. You can call this function during a dialogue and it won't interfere with the scene.
This function will return anything you pass into the resolve function inside the dialogue function.
The scope of the executed function will always be DialogueManager.

Parameters:
Name Type Description
id string
Source:
Returns:
Type
Promise.<any>

popUpBoard(text, type)

A popUpBoard is the message board that pops up and you either press "okay" or "yes/no"

Parameters:
Name Type Default Description
text string

Text to display in the box

type boolean false

Set to true for a "yes/no" pop up board. It will return a boolean if set to true.

Source:
Returns:

Promise


removeDialogue(id)

Removes the dialogue from the dialogue list

Parameters:
Name Type Description
id string
Source:

removeName(id)

There's like no reason to use this ever, but if you really want to remove a name from the list go ahead.

Parameters:
Name Type Description
id string
Source:

Searches through all of the dialogues to find a string. Use this to quickly find the dialogue id of any text in the game.

Parameters:
Name Type Description
string string
Source:
Returns:
Type
Array.<string>

talk(characterID, dialogueText)

Creates a regular dialogue pop-up. The promise is resolved once the user presses space or clicks the dialogue box

Parameters:
Name Type Default Description
characterID String ""

The ID of the character

dialogueText String ""

The text to put in the dialogue box

Source:
Returns:

Promise


userInput(config)

Parameters:
Name Type Description
config DialogueManager.userInputConfig
Source:
Returns:

Promise<number|object|false> - Will return a number if something from the array is selected. Will return a QuestManager.Subquest if a quest is selected. Will return false if exited.

Type Definitions


dialogueCallback(resolve, subquest)

Parameters:
Name Type Default Description
resolve function

Call resolve once you are done with the dialogue

subquest Subquest false

Subquest passed if the dialogue id is equal to a dialogueKey of a subquest

Source:

userInputConfig

The config object used in DialogueManager#userInput

Type:
  • object
Properties:
Name Type Argument Default Description
array array.<string>

Array of strings to display as input. If selected, the function will return the (index + 1) of the selected string.

dialogue string <optional>
""

Text to display on the dialogue box

character string <optional>
"nullPixel"

Character id to display in the background. If there is a hyphen(-) in this parameter, it will ignore the id and use the given string as a texture key

mapKey string <optional>

mapKeys are used for quests. If you want the userInput to show quest buttons then pass the mapKey.

exit boolean <optional>
false

If the user should be able to leave. Returns false if enabled.

Source: