it is possible to access to the total num of DialogueEntry of the current conversation? i have a custom action where i pass the current subtitle and the current DialogueUI. Of course can access to the DialogueManager singleton too, but dont know where i can access to this information.
That will work. The total number of entries is "dialogueEntries.Count", not "dialogueEntries.Count - 1". Also keep in mind that each entry has an ID number. The ID doesn't have to correspond to the index of the dialogue entry in the dialogueEntries list.
So if you have 3 dialogue entries, they will be in dialogueEntries[0], dialogueEntries[1], and dialogueEntries[2]. But dialogueEntries[0].id won't necessarily be 0. It may be a different value.
var endID = 0;
var currentConversation = DialogueManager.MasterDatabase.GetConversation(subtitle.dialogueEntry.conversationID);
currentConversation.dialogueEntries.ForEach(entry => endID = Mathf.Max(endID, entry.id));
I used List<T>.ForEach(), but the same idea applies if you use a traditional for/foreach loop. (List<T>.ForEach isn't available on the WinRT platform.) BTW, Monodevelop's compiler generates garbage (boxing) in some foreach loops, so I usually use for:
for (int i = 0; i < currentConversation.dialogueEntries.Count; i++)
{
var entry = currentConversation.dialogueEntries[i];
endID = Mathf.Max(endID, entry.id);
}
but the maxID doesnt guarante that is the last one, i can have for example 4 nodes with ids (0,1,2,3) and the id 3 can be the first one, what i need is to check if the current node is the last one that will be showed and after that the dialague will be closed.
so maybe checking that doesnt have any link to another node will be a good clue to know that this is the last one?