Page 1 of 1

Custom EntryTag provider

Posted: Mon Oct 25, 2021 2:10 pm
by nehvaleem
Hi,

I'll try to be brief this time. Is it possible to customize the way that EntryTag is being constructed? It would be awesome if we could override it somehow.

My use case:
I have a lot of ink content written already. Each line has a custom tag (for localization purposes). It is unique for each line. It would be awesome if I could somehow create an EntryTag for my lines (for example in subclass of DialogueSystem) and then make it just work with all the Sequencer commands.

It will be tedious for me to add other tags or Sequencer calls for every line that I have just in order to play VoiceOver file for example.

I am a bit confused by the DialogueEntry vs Subtitle classes. It seems that there is something like ProcessTag with DialogueEntry being passed to, but I don't see a way how to modify the subtitle entrytag. Probably doing something wrong - it would be great if I could get any suggestion about how to handle my case.

Re: Custom EntryTag provider

Posted: Mon Oct 25, 2021 2:32 pm
by Tony Li
Hi,

I think I can add an option to provide your own entrytag provider. Essentially you'd assign something like DialogueManager.entrytagProvider a method like this:

Code: Select all

DialogueManager.entrytagProvider = MyCustomEntrytagProvider;

string MyCustomEntrytagProvider(Conversation conversation, DialogueEntry entry)
{
    return //(figure out how to use conversation & entry to generate an entrytag)
}
However, before I commit to that, I'll want to take a look at how this will work with the Ink integration. For the Ink integration, It may be better to add an option so that DialogueSystemInkIntegration.OnConversationLine sets the dialogue entry's VoiceOverFile field to some tag. Then you can set the Dialogue Manager's Entrytag Format to VoiceOverFile.

Re: Custom EntryTag provider

Posted: Mon Oct 25, 2021 3:16 pm
by nehvaleem
In my case the thing with DialogueSystemInkIntegration.OnConversationLine is that it has stripped out & modified contents because of the OnPrepareConversationLine when I do some stuff before actually displaying it. So in my case, the data needed to form the EntryTag in OnConversationLine is gone. It might be something that I could handle differently probably tho.

Re: Custom EntryTag provider

Posted: Mon Oct 25, 2021 3:27 pm
by Tony Li
How are you specifying the voiceover tags? I'll set up a similar test over here to play with some ideas.

Re: Custom EntryTag provider

Posted: Mon Oct 25, 2021 3:36 pm
by nehvaleem
This is how my typical ink line looks like:

Code: Select all

Ishida: Bunzō? And who's that? # LineTag_01_village_0455_6C810D78_Ishida
And then in OnPrepareConversationLine I am extracting the LineTag, fetch translated content and replacing the line contents with the localized version. I would love to use this exact same tag as entrytag for my lines.

Re: Custom EntryTag provider

Posted: Mon Oct 25, 2021 3:51 pm
by Tony Li
I think you can make a subclass that overrides the ProcessTag() method. Something like:

Code: Select all

public class CustomDialogueSystemInkIntegration : DialogueSystemInkIntegration
{
    protected override void ProcessTag(string tag, DialogueEntry entry)
    {
        if (tag.StartsWith("LineTag"))
        {
            Field.SetValue(entry.fields, "VoiceOverFile", tag);
        }
        else        
        {
            base.ProcessTag(tag, entry);
        }
    }
}
Then set the Dialogue Manager's Entrytag Format to VoiceOverFile.

Re: Custom EntryTag provider

Posted: Mon Oct 25, 2021 4:07 pm
by nehvaleem
That seems wonderful and suits my case perfectly I think! I'll try that right away, thank you again. Although maybe consider adding a customization for EntryTags in the future. Maybe it would help somebody else.

Re: Custom EntryTag provider

Posted: Mon Oct 25, 2021 4:21 pm
by Tony Li
Will do. I added it to the task list.