Ejemplo n.º 1
0
 /// <summary>
 /// "Follows" a dialogue entry and returns its full conversation state. This method updates
 /// the Lua environment (marking the entry as visited). If includeLinks is <c>true</c>,
 /// it evaluates all links from the dialogue entry and records valid links in the state.
 /// </summary>
 /// <returns>
 /// The state representing the dialogue entry.
 /// </returns>
 /// <param name='entry'>
 /// The dialogue entry to "follow."
 /// </param>
 /// <param name='includeLinks'>
 /// If <c>true</c>, records all links from the dialogue entry whose conditions are true.
 /// </param>
 public ConversationState GetState(DialogueEntry entry, bool includeLinks)
 {
     if (entry != null)
     {
         DialogueLua.MarkDialogueEntryDisplayed(entry);
         SetDialogTable(entry.conversationID);
         Lua.Run(entry.userScript, DialogueDebug.LogInfo, allowLuaExceptions);
         CharacterInfo actorInfo     = GetCharacterInfo(entry.ActorID);
         CharacterInfo listenerInfo  = GetCharacterInfo(entry.ConversantID);
         FormattedText formattedText = FormattedText.Parse(entry.SubtitleText, database.emphasisSettings);
         CheckSequenceField(entry);
         string          entrytag     = database.GetEntrytag(entry.conversationID, entry.id, entrytagFormat);
         Subtitle        subtitle     = new Subtitle(actorInfo, listenerInfo, formattedText, entry.Sequence, entry.ResponseMenuSequence, entry, entrytag);
         List <Response> npcResponses = new List <Response>();
         List <Response> pcResponses  = new List <Response>();
         if (includeLinks)
         {
             EvaluateLinks(entry, npcResponses, pcResponses, new List <DialogueEntry>());
         }
         return(new ConversationState(subtitle, npcResponses.ToArray(), pcResponses.ToArray(), entry.isGroup));
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// "Follows" a dialogue entry and returns its full conversation state. This method updates
 /// the Lua environment (marking the entry as visited). If includeLinks is <c>true</c>,
 /// it evaluates all links from the dialogue entry and records valid links in the state.
 /// </summary>
 /// <returns>The state.</returns>
 /// <param name="entry">The dialogue entry to "follow."</param>
 /// <param name="includeLinks">If set to <c>true</c> records all links from the dialogue entry whose conditions are true.</param>
 /// <param name="stopAtFirstValid">If set to <c>true</c> ,stops including at the first valid link.</param>
 /// <param name="skipExecution">IF set to <c>true</c>, doesn't run the Lua Script or OnExecute event.</param>
 public ConversationState GetState(DialogueEntry entry, bool includeLinks, bool stopAtFirstValid = false, bool skipExecution = false)
 {
     if (entry != null)
     {
         DialogueManager.instance.SendMessage(DialogueSystemMessages.OnPrepareConversationLine, entry, SendMessageOptions.DontRequireReceiver);
         DialogueLua.MarkDialogueEntryDisplayed(entry);
         Lua.Run("thisID = " + entry.id);
         SetDialogTable(entry.conversationID);
         if (!skipExecution)
         {
             Lua.Run(entry.userScript, DialogueDebug.logInfo, m_allowLuaExceptions);
             entry.onExecute.Invoke();
         }
         CharacterInfo actorInfo     = GetCharacterInfo(entry.ActorID);
         CharacterInfo listenerInfo  = GetCharacterInfo(entry.ConversantID);
         FormattedText formattedText = FormattedText.Parse(entry.subtitleText, m_database.emphasisSettings);
         CheckSequenceField(entry);
         string          entrytag     = m_database.GetEntrytag(entry.conversationID, entry.id, m_entrytagFormat);
         Subtitle        subtitle     = new Subtitle(actorInfo, listenerInfo, formattedText, entry.currentSequence, entry.currentResponseMenuSequence, entry, entrytag);
         List <Response> npcResponses = new List <Response>();
         List <Response> pcResponses  = new List <Response>();
         if (includeLinks)
         {
             EvaluateLinks(entry, npcResponses, pcResponses, new List <DialogueEntry>(), stopAtFirstValid);
         }
         return(new ConversationState(subtitle, npcResponses.ToArray(), pcResponses.ToArray(), entry.isGroup));
     }
     else
     {
         return(null);
     }
 }