Handles logic for the data model of a conversation. More...
Public Member Functions | |
ConversationModel (DialogueDatabase database, string title, Transform actor, Transform conversant, bool allowLuaExceptions, IsDialogueEntryValidDelegate isDialogueEntryValid, int initialDialogueEntryID=-1, bool stopAtFirstValid=false, bool skipExecution=false) | |
Initializes a new ConversationModel. | |
int | GetConversationID (ConversationState state) |
ConversationOverrideDisplaySettings | GetConversationOverrideSettings (ConversationState state) |
void | InformParticipants (string message, bool informDialogueManager=false) |
Sends a message to the actor and conversant. | |
ConversationState | GetState (DialogueEntry entry, bool includeLinks, bool stopAtFirstValid=false, bool skipExecution=false) |
"Follows" a dialogue entry and returns its full conversation state. | |
void | ForceNextStateToLinkToEntry (DialogueEntry entry) |
Forces the next state to link to a specific dialogue entry instead of its designed links. | |
ConversationState | GetState (DialogueEntry entry) |
"Follows" a dialogue entry and returns its full conversation state. | |
void | UpdateResponses (ConversationState state) |
Updates the responses in the specified state. | |
void | SetParticipants (Conversation conversation, Transform actor, Transform conversant) |
void | UpdateParticipantsOnLinkedConversation (int newConversationID) |
Call when linking to another conversation. | |
void | OverrideCharacterInfo (int id, Transform character) |
Overrides the conversation model's cached info for a character. | |
CharacterInfo | GetCharacterInfo (int id, Transform character) |
Gets the character info for a character given its actor ID and transform. | |
CharacterInfo | GetCharacterInfo (int id) |
Gets the character info for a character given its actor ID. | |
void | SetActorPortraitSprite (string actorName, Sprite sprite) |
Updates the actor portrait sprite for any cached character info. | |
string | GetPCName () |
Returns the name of the PC in this conversation. | |
Sprite | GetPCSprite () |
Returns the portrait sprite of the PC in this conversation. | |
Properties | |
string | conversationTitle [get] |
Title of the conversation that started this ConversationModel. | |
ConversationState | firstState [get] |
The first state in the conversation, which is the root of the dialogue tree. | |
CharacterInfo | actorInfo [get] |
Info about the character that is specified as the actor in the conversation. | |
CharacterInfo | conversantInfo [get] |
Info about the character that is specified as the conversant in the conversation. | |
bool | hasValidEntry [get] |
Indicates whether the conversation has any responses linked from the start entry. | |
IsDialogueEntryValidDelegate | isDialogueEntryValid [get, set] |
Gets or sets the IsDialogueEntryValid delegate. | |
bool | allowLuaExceptions [get, set] |
EntrytagFormat | entrytagFormat [get, set] |
EmTag | emTagForOldResponses [get, set] |
EmTag | emTagForInvalidResponses [get, set] |
bool | includeInvalidEntries [get, set] |
Handles logic for the data model of a conversation.
This class retrieves dialogue entries and updates the data state, which includes the dialogue database and Lua environment. It does not keep track of state or handle the user interface. The ConversationController controls the current state of the conversation, and ConversationView handles the user interface.
|
inline |
Initializes a new ConversationModel.
database | The database to use. |
title | The title of the conversation in the database. |
actor | Actor. |
conversant | Conversant. |
allowLuaExceptions | If set to true allow Lua exceptions. |
isDialogueEntryValid | Is dialogue entry valid. |
initialDialogueEntryID | Initial dialogue entry ID (-1 to start at beginning). |
stopAtFirstValid | If set to true stop at first valid link from the initial entry. |
skipExecution | IF set to true , doesn't run the Lua Script or OnExecute event on the initial entry. |
|
inline |
Forces the next state to link to a specific dialogue entry instead of its designed links.
|
inline |
Gets the character info for a character given its actor ID.
id | The character's actor ID in the dialogue database. |
|
inline |
Gets the character info for a character given its actor ID and transform.
id | The character's actor ID in the dialogue database. |
character | The transform of the character's GameObject. |
|
inline |
|
inline |
|
inline |
Returns the name of the PC in this conversation.
null
if both are NPCs.
|
inline |
Returns the portrait sprite of the PC in this conversation.
null
if both are NPCs.
|
inline |
"Follows" a dialogue entry and returns its full conversation state.
This method updates the Lua environment (marking the entry as visited) and evaluates all links from the dialogue entry and records valid links in the state.
entry | The dialogue entry to "follow." |
|
inline |
"Follows" a dialogue entry and returns its full conversation state.
This method updates the Lua environment (marking the entry as visited). If includeLinks is true
, it evaluates all links from the dialogue entry and records valid links in the state.
entry | The dialogue entry to "follow." |
includeLinks | If set to true records all links from the dialogue entry whose conditions are true. |
stopAtFirstValid | If set to true ,stops including at the first valid link. |
skipExecution | IF set to true , doesn't run the Lua Script or OnExecute event. |
|
inline |
Sends a message to the actor and conversant.
Used to send OnConversationStart and OnConversationEnd messages.
message | The message (e.g., OnConversationStart or OnConversationEnd). |
|
inline |
Overrides the conversation model's cached info for a character.
id | Actor ID |
character | Character's transform. Will use its Dialogue Actor info if present. |
|
inline |
Updates the actor portrait sprite for any cached character info.
actorName | Actor name. |
sprite | Portrait sprite. |
|
inline |
conversation | |
actor | |
conversant |
|
inline |
Call when linking to another conversation.
If the player actor has changed, this method updates the PC portrait name and image.
|
inline |
Updates the responses in the specified state.
state | State to check. |
|
get |
Info about the character that is specified as the actor in the conversation.
This is typically the character that initiates the conversation, such as the PC.
|
getset |
|
get |
Info about the character that is specified as the conversant in the conversation.
This is the other character in the conversation (e.g., the NPC in a PC-NPC conversation).
|
get |
Title of the conversation that started this ConversationModel.
|
getset |
|
getset |
|
getset |
|
get |
The first state in the conversation, which is the root of the dialogue tree.
The first state.
|
get |
Indicates whether the conversation has any responses linked from the start entry.
true
if the conversation has responses; otherwise, false
.
|
getset |
|
getset |
Gets or sets the IsDialogueEntryValid delegate.