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. More... | |
int | GetConversationID (ConversationState state) |
ConversationOverrideDisplaySettings | GetConversationOverrideSettings (ConversationState state) |
void | InformParticipants (string message, bool informDialogueManager=false) |
Sends a message to the actor and conversant. More... | |
ConversationState | GetState (DialogueEntry entry, bool includeLinks, bool stopAtFirstValid=false, bool skipExecution=false) |
"Follows" a dialogue entry and returns its full conversation state. More... | |
ConversationState | GetState (DialogueEntry entry) |
"Follows" a dialogue entry and returns its full conversation state. More... | |
void | UpdateResponses (ConversationState state) |
Updates the responses in the specified state. More... | |
CharacterInfo | GetCharacterInfo (int id, Transform character) |
Gets the character info for a character given its actor ID and transform. More... | |
CharacterInfo | GetCharacterInfo (int id) |
Gets the character info for a character given its actor ID. More... | |
void | SetActorPortraitTexture (string actorName, Texture2D portraitTexture) |
Updates the actor portrait texture for any cached character info. More... | |
string | GetPCName () |
Returns the name of the PC in this conversation. More... | |
Texture2D | GetPCTexture () |
Returns the portrait texture of the PC in this conversation. More... | |
Properties | |
ConversationState | FirstState [get] |
The first state in the conversation, which is the root of the dialogue tree. More... | |
CharacterInfo | ActorInfo [get] |
Gets the actor info for this conversation. More... | |
CharacterInfo | ConversantInfo [get] |
Gets the conversant info for this conversation. More... | |
bool | HasValidEntry [get] |
Indicates whether the conversation has any responses linked from the start entry. More... | |
IsDialogueEntryValidDelegate | IsDialogueEntryValid [get, set] |
Gets or sets the IsDialogueEntryValid delegate. More... | |
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.
PixelCrushers.DialogueSystem.ConversationModel.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.
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. |
CharacterInfo PixelCrushers.DialogueSystem.ConversationModel.GetCharacterInfo | ( | int | id | ) |
Gets the character info for a character given its actor ID.
id | The character's actor ID in the dialogue database. |
CharacterInfo PixelCrushers.DialogueSystem.ConversationModel.GetCharacterInfo | ( | int | id, |
Transform | character | ||
) |
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. |
int PixelCrushers.DialogueSystem.ConversationModel.GetConversationID | ( | ConversationState | state | ) |
ConversationOverrideDisplaySettings PixelCrushers.DialogueSystem.ConversationModel.GetConversationOverrideSettings | ( | ConversationState | state | ) |
string PixelCrushers.DialogueSystem.ConversationModel.GetPCName | ( | ) |
Returns the name of the PC in this conversation.
null
if both are NPCs.Texture2D PixelCrushers.DialogueSystem.ConversationModel.GetPCTexture | ( | ) |
Returns the portrait texture of the PC in this conversation.
null
if both are NPCs.ConversationState PixelCrushers.DialogueSystem.ConversationModel.GetState | ( | DialogueEntry | entry | ) |
"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." |
ConversationState PixelCrushers.DialogueSystem.ConversationModel.GetState | ( | DialogueEntry | entry, |
bool | includeLinks, | ||
bool | stopAtFirstValid = false , |
||
bool | skipExecution = false |
||
) |
"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. |
void PixelCrushers.DialogueSystem.ConversationModel.InformParticipants | ( | string | message, |
bool | informDialogueManager = false |
||
) |
Sends a message to the actor and conversant.
Used to send OnConversationStart and OnConversationEnd messages.
message | The message (e.g., OnConversationStart or OnConversationEnd). |
void PixelCrushers.DialogueSystem.ConversationModel.SetActorPortraitTexture | ( | string | actorName, |
Texture2D | portraitTexture | ||
) |
Updates the actor portrait texture for any cached character info.
actorName | Actor name. |
portraitTexture | Portrait texture. |
void PixelCrushers.DialogueSystem.ConversationModel.UpdateResponses | ( | ConversationState | state | ) |
Updates the responses in the specified state.
state | State to check. |
|
get |
Gets the actor info for this conversation.
The actor info.
|
get |
Gets the conversant info for this conversation.
The conversant info.
|
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 |
Gets or sets the IsDialogueEntryValid delegate.