Code: Select all
private string GetLastSubtitle(string conversationTitle)
{
var dialogueUI = DialogueManager.instance.GetComponentInChildren<SMSDialogueUI>();
if (dialogueUI == null) return string.Empty;
DialogueLua.SetVariable("Conversation", conversationTitle);
if (!DialogueLua.DoesVariableExist(dialogueUI.currentDialogueEntryRecords)) return string.Empty;
var s = DialogueLua.GetVariable(dialogueUI.currentDialogueEntryRecords).AsString;
var ints = s.Split(';');
var lastConversationID = Tools.StringToInt(ints[ints.Length - 3]);
var lastEntryID = Tools.StringToInt(ints[ints.Length - 2]);
var entry = DialogueManager.masterDatabase.GetDialogueEntry(lastConversationID, lastEntryID);
if (entry == null) return string.Empty;
return entry.currentDialogueText;
}
Code: Select all
string lastMessage = GetLastSubtitle("Chat With Sally");