A static class that provides a simplified interface to the dialogue system's core functions. More...
Static Public Member Functions | |
static void | SetLanguage (string language) |
Sets the language to use for localized text. More... | |
static void | SetDialogueSystemInput (bool value) |
Enables or disables Dialogue System input. More... | |
static bool | IsDialogueSystemInputDisabled () |
Returns true if Dialogue System input is disabled. More... | |
static void | AddDatabase (DialogueDatabase database) |
Adds a dialogue database to memory. More... | |
static void | RemoveDatabase (DialogueDatabase database) |
Removes a dialogue database from memory. More... | |
static void | ResetDatabase (DatabaseResetOptions databaseResetOptions) |
Resets the database to a default state. More... | |
static void | PreloadMasterDatabase () |
Preloads the master database. More... | |
static void | PreloadDialogueUI () |
Preloads the dialogue UI. More... | |
static bool | ConversationHasValidEntry (string title, Transform actor, Transform conversant) |
Checks whether a conversation has any valid entries linked from the start entry, since it's possible that the conditions of all entries could be false. More... | |
static bool | ConversationHasValidEntry (string title, Transform actor) |
Checks whether a conversation has any valid entries linked from the start entry, since it's possible that the conditions of all entries could be false. More... | |
static bool | ConversationHasValidEntry (string title) |
Checks whether a conversation has any valid entries linked from the start entry, since it's possible that the conditions of all entries could be false. More... | |
static void | StartConversation (string title, Transform actor, Transform conversant, int initialDialogueEntryID) |
Starts a conversation, which also broadcasts an OnConversationStart message to the actor and conversant. More... | |
static void | StartConversation (string title, Transform actor, Transform conversant) |
Starts a conversation, which also broadcasts an OnConversationStart message to the actor and conversant. More... | |
static void | StartConversation (string title, Transform actor) |
Starts a conversation, which also broadcasts an OnConversationStart message to the actor. More... | |
static void | StartConversation (string title) |
Starts the conversation with no transforms specified for the actor or conversant. More... | |
static void | StopConversation () |
Stop the current conversation immediately, and sends an OnConversationEnd message to the actor and conversant. More... | |
static void | UpdateResponses () |
Updates the responses for the current state of the current conversation. More... | |
static void | Bark (string conversationTitle, Transform speaker, Transform listener, BarkHistory barkHistory) |
Causes a character to bark a line at another character. More... | |
static void | Bark (string conversationTitle, Transform speaker, Transform listener) |
Causes a character to bark a line at another character. More... | |
static void | Bark (string conversationTitle, Transform speaker) |
Causes a character to bark a line. More... | |
static void | Bark (string conversationTitle, Transform speaker, BarkHistory barkHistory) |
Causes a character to bark a line. More... | |
static void | BarkString (string barkText, Transform speaker, Transform listener=null, string sequence=null) |
Causes a character to bark a literal string instead of looking up its line from a conversation. More... | |
static float | GetBarkDuration (string barkText) |
Returns the default duration that a string of bark text will be shown. More... | |
static void | ShowAlert (string message, float duration) |
Shows an alert message using the dialogue UI. More... | |
static void | ShowAlert (string message) |
Shows an alert message using the dialogue UI for the UI's default duration. More... | |
static void | CheckAlerts () |
Checks Lua Variable['Alert'] to see if we need to show an alert. More... | |
static string | GetLocalizedText (string s) |
Gets localized text. More... | |
static Sequencer | PlaySequence (string sequence, Transform speaker, Transform listener, bool informParticipants, bool destroyWhenDone, string entrytag) |
Starts a sequence. More... | |
static Sequencer | PlaySequence (string sequence, Transform speaker, Transform listener, bool informParticipants, bool destroyWhenDone) |
Starts a sequence. More... | |
static Sequencer | PlaySequence (string sequence, Transform speaker, Transform listener, bool informParticipants) |
Starts a sequence. More... | |
static Sequencer | PlaySequence (string sequence, Transform speaker, Transform listener) |
Starts a sequence, and sends OnSequenceStart/OnSequenceEnd messages to the participants. More... | |
static Sequencer | PlaySequence (string sequence) |
Starts a sequence. More... | |
static void | StopSequence (Sequencer sequencer) |
Stops a sequence. More... | |
static void | Pause () |
Pauses the Dialogue System. More... | |
static void | Unpause () |
Unpauses the Dialogue System. More... | |
static void | UseDialogueUI (GameObject gameObject) |
Sets the dialogue UI. More... | |
static void | SetPortrait (string actorName, string portraitName) |
Sets an actor's portrait. More... | |
static void | AddLuaObserver (string luaExpression, LuaWatchFrequency frequency, LuaChangedDelegate luaChangedHandler) |
Adds a Lua expression observer. More... | |
static void | RemoveLuaObserver (string luaExpression, LuaWatchFrequency frequency, LuaChangedDelegate luaChangedHandler) |
Removes a Lua expression observer. More... | |
static void | RemoveAllObservers (LuaWatchFrequency frequency) |
Removes all Lua expression observers for a specified frequency. More... | |
static void | RemoveAllObservers () |
Removes all Lua expression observers. More... | |
static void | RegisterAssetBundle (AssetBundle bundle) |
Registers an asset bundle with the Dialogue System. More... | |
static void | UnregisterAssetBundle (AssetBundle bundle) |
Unregisters an asset bundle from the Dialogue System. More... | |
static UnityEngine.Object | LoadAsset (string name) |
Loads a named asset from the registered asset bundles or from Resources. More... | |
static UnityEngine.Object | LoadAsset (string name, System.Type type) |
Loads a named asset from the registered asset bundles or from Resources. More... | |
static void | SendUpdateTracker () |
Sends an "UpdateTracker" message to the Dialogue Manager, which may have a quest tracker component that listens for this message, More... | |
Properties | |
static DialogueSystemController | Instance [get] |
Gets the instance of DialogueSystemController. More... | |
static bool | HasInstance [get] |
Returns true if the singleton has found or created an instance. More... | |
static DatabaseManager | DatabaseManager [get] |
Gets the database manager. More... | |
static DialogueDatabase | MasterDatabase [get] |
Gets the master database. More... | |
static IDialogueUI | DialogueUI [get, set] |
Gets the dialogue UI. More... | |
static DisplaySettings | DisplaySettings [get] |
Gets the display settings. More... | |
static bool | IsConversationActive [get] |
Indicates whether a conversation is active. More... | |
static bool | AllowSimultaneousConversations [get] |
Indicates whether more than one conversation can play at the same time. More... | |
static IsDialogueEntryValidDelegate | IsDialogueEntryValid [get, set] |
The IsDialogueEntryValid delegate (if one is assigned). More... | |
static GetInputButtonDownDelegate | GetInputButtonDown [get, set] |
The GetInputButtonDown delegate. More... | |
static Transform | CurrentActor [get] |
Gets the current actor in the last conversation started (or null if no conversation is active or the last converstion started has ended). More... | |
static Transform | CurrentConversant [get] |
Gets the current conversant in the last conversation started (or null if no conversation is active or the last conversation started has ended). More... | |
static ConversationState | CurrentConversationState [get] |
Gets the current conversation state of the last conversation started (or null if no conversation is active or the last conversation started has ended). More... | |
static string | LastConversationStarted [get] |
Gets the title of the last conversation started. More... | |
static int | LastConversationID [get] |
Gets the ID of the last conversation started. More... | |
static ConversationController | ConversationController [get] |
static ConversationModel | ConversationModel [get] |
static ConversationView | ConversationView [get] |
static DialogueDebug.DebugLevel | DebugLevel [get, set] |
Gets or sets the debug level. More... | |
static bool | AllowLuaExceptions [get, set] |
Gets or sets a value indicating whether exceptions in Lua code will be caught by the calling method or allowed to rise up to Unity. More... | |
A static class that provides a simplified interface to the dialogue system's core functions.
This class manages a singleton instance of DialogueSystemController.
|
static |
Adds a dialogue database to memory.
To save memory or reduce load time, you may want to break up your dialogue data into multiple smaller databases. You can add or remove these databases as needed.
database | The database to add. |
|
static |
|
static |
Causes a character to bark a line.
A bark is a line spoken outside of a full conversation. It uses a simple gameplay bark UI instead of the dialogue UI. Since this form of the Bark() method does not include a BarkHistory, a random bark is selected from the bark lines.
conversationTitle | Title of the conversation that contains the bark lines. In this conversation, all dialogue entries linked from the first entry are considered bark lines. |
speaker | The character barking the line. |
|
static |
Causes a character to bark a line.
A bark is a line spoken outside of a full conversation. It uses a simple gameplay bark UI instead of the dialogue UI.
conversationTitle | Title of the conversation that contains the bark lines. In this conversation, all dialogue entries linked from the first entry are considered bark lines. |
speaker | The character barking the line. |
barkHistory | Bark history used to track the most recent bark, so the bark controller can go through the bark lines in a specified order. |
|
static |
Causes a character to bark a line at another character.
A bark is a line spoken outside of a full conversation. It uses a simple gameplay bark UI instead of the dialogue UI. Since this form of the Bark() method does not include a BarkHistory, a random bark is selected from the bark lines.
conversationTitle | Title of the conversation that contains the bark lines. In this conversation, all dialogue entries linked from the first entry are considered bark lines. |
speaker | The character barking the line. |
listener | The character being barked at. |
|
static |
Causes a character to bark a line at another character.
A bark is a line spoken outside of a full conversation. It uses a simple gameplay bark UI instead of the dialogue UI.
conversationTitle | Title of the conversation that contains the bark lines. In this conversation, all dialogue entries linked from the first entry are considered bark lines. |
speaker | The character barking the line. |
listener | The character being barked at. |
barkHistory | Bark history used to track the most recent bark, so the bark controller can go through the bark lines in a specified order. |
|
static |
Causes a character to bark a literal string instead of looking up its line from a conversation.
barkText | The string to bark. |
speaker | The barker. |
listener | The target of the bark. (May be null) |
sequence | The optional sequence to play. (May be null or empty) |
|
static |
|
static |
Checks whether a conversation has any valid entries linked from the start entry, since it's possible that the conditions of all entries could be false.
true
, if the conversation has a valid entry, false
otherwise. title | The title of the conversation to look up in the master database. |
|
static |
Checks whether a conversation has any valid entries linked from the start entry, since it's possible that the conditions of all entries could be false.
true
, if the conversation has a valid entry, false
otherwise. title | The title of the conversation to look up in the master database. |
actor | The transform of the actor (primary participant). The sequencer uses this to direct camera angles and perform other actions. In PC-NPC conversations, the actor is usually the PC. |
|
static |
Checks whether a conversation has any valid entries linked from the start entry, since it's possible that the conditions of all entries could be false.
true
, if the conversation has a valid entry, false
otherwise. title | The title of the conversation to look up in the master database. |
actor | The transform of the actor (primary participant). The sequencer uses this to direct camera angles and perform other actions. In PC-NPC conversations, the actor is usually the PC. |
conversant | The transform of the conversant (the other participant). The sequencer uses this to direct camera angles and perform other actions. In PC-NPC conversations, the conversant is usually the NPC. |
|
static |
Returns the default duration that a string of bark text will be shown.
barkText | The text that will be barked (to determine the duration). |
|
static |
Gets localized text.
s | The field to look up. |
|
static |
Returns true if Dialogue System input is disabled.
|
static |
Loads a named asset from the registered asset bundles or from Resources.
null
if not found.name | Name of the asset. |
|
static |
Loads a named asset from the registered asset bundles or from Resources.
null
if not found.name | Name of the asset. |
type | Type of the asset. |
|
static |
Pauses the Dialogue System.
Also broadcasts OnDialogueSystemPause to the Dialogue Manager and conversation participants. Conversations, timers, typewriter and fade effects, and the AudioWait() and Voice() sequencer commands will be paused. Other than this, AudioSource, Animation, and Animator components will not be paused; it's up to you to handle them as appropriate for your project.
|
static |
Starts a sequence.
See sequencer.
sequence | The sequence to play. |
|
static |
Starts a sequence, and sends OnSequenceStart/OnSequenceEnd messages to the participants.
See sequencer.
sequence | The sequence to play. |
speaker | The speaker, for sequence commands that reference the speaker. |
listener | The listener, for sequence commands that reference the listener. |
|
static |
Starts a sequence.
See sequencer.
sequence | The sequence to play. |
speaker | The speaker, for sequence commands that reference the speaker. |
listener | The listener, for sequence commands that reference the listener. |
informParticipants | Specifies whether to send OnSequenceStart and OnSequenceEnd messages to the speaker and listener. Default is true . |
|
static |
Starts a sequence.
See sequencer.
sequence | The sequence to play. |
speaker | The speaker, for sequence commands that reference the speaker. |
listener | The listener, for sequence commands that reference the listener. |
informParticipants | Specifies whether to send OnSequenceStart and OnSequenceEnd messages to the speaker and listener. Default is true . |
destroyWhenDone | Specifies whether destroy the sequencer when done playing the sequence. Default is true . |
|
static |
Starts a sequence.
See sequencer.
sequence | The sequence to play. |
speaker | The speaker, for sequence commands that reference the speaker. |
listener | The listener, for sequence commands that reference the listener. |
informParticipants | Specifies whether to send OnSequenceStart and OnSequenceEnd messages to the speaker and listener. Default is true . |
destroyWhenDone | Specifies whether destroy the sequencer when done playing the sequence. Default is |
entrytag | The entrytag to associate with the sequence. |
|
static |
Preloads the dialogue UI.
The Dialogue System delays loading of the dialogue UI until the first time it's needed for a conversation or alert. Since dialogue UIs often contain textures and other art assets, loading can cause a slight pause. You may want to preload the UI at a time of your design by using this method.
|
static |
Preloads the master database.
The Dialogue System delays loading of the dialogue database until the data is needed. This avoids potentially long delays during Start(). If you want to load the database manually (for example to run Lua commands on its contents), call this method.
|
static |
Registers an asset bundle with the Dialogue System.
This allows sequencer commands to load assets inside it.
bundle | Asset bundle. |
|
static |
Removes all Lua expression observers.
|
static |
Removes all Lua expression observers for a specified frequency.
frequency | Frequency. |
|
static |
Removes a dialogue database from memory.
To save memory or reduce load time, you may want to break up your dialogue data into multiple smaller databases. You can add or remove these databases as needed.
database | The database to remove. |
|
static |
|
static |
Resets the database to a default state.
databaseResetOptions | Accepts the following values:
|
|
static |
Sends an "UpdateTracker" message to the Dialogue Manager, which may have a quest tracker component that listens for this message,
|
static |
Enables or disables Dialogue System input.
value | True to enable, false to disable. |
|
static |
Sets the language to use for localized text.
language | Language to use. Specify null or an emtpy string to use the default language. |
|
static |
Sets an actor's portrait.
If can be:
null
to use the primary portrait defined in the database,actorName | Actor name. |
portraitName | Portrait name. |
|
static |
Shows an alert message using the dialogue UI for the UI's default duration.
message | The message to show. |
|
static |
Shows an alert message using the dialogue UI.
message | The message to show. |
duration | The duration in seconds to show the message. |
|
static |
Starts the conversation with no transforms specified for the actor or conversant.
title | The title of the conversation to look up in the master database. |
|
static |
Starts a conversation, which also broadcasts an OnConversationStart message to the actor.
Your scripts can listen for OnConversationStart to do anything necessary at the beginning of a conversation, such as pausing other gameplay or temporarily disabling player control. See the Feature Demo scene, which uses the SetEnabledOnDialogueEvent component to disable player control during conversations.
title | The title of the conversation to look up in the master database. |
actor | The transform of the actor (primary participant). The sequencer uses this to direct camera angles and perform other actions. In PC-NPC conversations, the actor is usually the PC. |
|
static |
Starts a conversation, which also broadcasts an OnConversationStart message to the actor and conversant.
Your scripts can listen for OnConversationStart to do anything necessary at the beginning of a conversation, such as pausing other gameplay or temporarily disabling player control. See the Feature Demo scene, which uses the SetEnabledOnDialogueEvent component to disable player control during conversations.
title | The title of the conversation to look up in the master database. |
actor | The transform of the actor (primary participant). The sequencer uses this to direct camera angles and perform other actions. In PC-NPC conversations, the actor is usually the PC. |
conversant | The transform of the conversant (the other participant). The sequencer uses this to direct camera angles and perform other actions. In PC-NPC conversations, the conversant is usually the NPC. |
StartConversation("Shopkeeper Conversation", player, shopkeeper);
|
static |
Starts a conversation, which also broadcasts an OnConversationStart message to the actor and conversant.
Your scripts can listen for OnConversationStart to do anything necessary at the beginning of a conversation, such as pausing other gameplay or temporarily disabling player control. See the Feature Demo scene, which uses the SetEnabledOnDialogueEvent component to disable player control during conversations.
title | The title of the conversation to look up in the master database. |
actor | The transform of the actor (primary participant). The sequencer uses this to direct camera angles and perform other actions. In PC-NPC conversations, the actor is usually the PC. |
conversant | The transform of the conversant (the other participant). The sequencer uses this to direct camera angles and perform other actions. In PC-NPC conversations, the conversant is usually the NPC. |
initialDialogueEntryID | The initial dialogue entry ID, or -1 to start from the beginning. |
StartConversation("Shopkeeper Conversation", player, shopkeeper);
|
static |
Stop the current conversation immediately, and sends an OnConversationEnd message to the actor and conversant.
Your scripts can listen for OnConversationEnd to do anything necessary at the end of a conversation, such as resuming other gameplay or re-enabling player control.
|
static |
Stops a sequence.
sequencer | The sequencer playing the sequence. |
|
static |
Unpauses the Dialogue System.
Also broadcasts OnDialogueSystemUnpause to the Dialogue Manager and conversation participants.
|
static |
Unregisters an asset bundle from the Dialogue System.
Always unregister asset bundles before freeing them.
bundle | Asset bundle. |
|
static |
Updates the responses for the current state of the current conversation.
If the response menu entries' conditions have changed while the response menu is being shown, you can call this method to update the response menu.
|
static |
Sets the dialogue UI.
gameObject | Game object containing an implementation of IDialogueUI. |
|
staticgetset |
|
staticget |
Indicates whether more than one conversation can play at the same time.
true
if simultaneous conversations are allowed; otherwise, false
.
|
staticget |
|
staticget |
|
staticget |
|
staticget |
Gets the current actor in the last conversation started (or null
if no conversation is active or the last converstion started has ended).
The actor in the current conversation.
|
staticget |
Gets the current conversant in the last conversation started (or null
if no conversation is active or the last conversation started has ended).
The conversant in the current conversation.
|
staticget |
Gets the current conversation state of the last conversation started (or null
if no conversation is active or the last conversation started has ended).
The current conversation state.
|
staticget |
Gets the database manager.
The database manager.
|
staticgetset |
Gets or sets the debug level.
The debug level.
|
staticgetset |
Gets the dialogue UI.
The dialogue UI.
|
staticget |
Gets the display settings.
The display settings.
|
staticgetset |
The GetInputButtonDown delegate.
Overrides calls to the standard Unity Input.GetButtonDown function.
|
staticget |
Returns true
if the singleton has found or created an instance.
true
if has instance; otherwise, false
.
|
staticget |
Gets the instance of DialogueSystemController.
The instance.
|
staticget |
Indicates whether a conversation is active.
true
if a conversation is active; otherwise, false
.
|
staticgetset |
The IsDialogueEntryValid delegate (if one is assigned).
This is an optional delegate that you can add to check if a dialogue entry is valid before allowing a conversation to use it. It should return true
if the entry is valid.
|
staticget |
Gets the ID of the last conversation started.
|
staticget |
Gets the title of the last conversation started.
The title of the last conversation started.
|
staticget |
Gets the master database.
The master database.