Help getting the UI to do what I want

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Bluerex
Posts: 4
Joined: Mon Jan 18, 2016 11:56 pm

Help getting the UI to do what I want

Post by Bluerex »

Ok, I've gotten a decent handle on the framework, but the rendering options for subtitle text is just confusing me beyond belief.

This is the effect I want (I dont think it's compicated) (I'm using NGUI):

1. Render dialog text using typewriter effect
2. When the typewriter effect is done, show responses

Currently what I have can't do that. There is a min delay for showing subtitle (why?), so I set that to 2 seconds, then the typewriter text disappears even if its not done, and then shows the subtitle reminder which doesn't work.

Also, the "OnFinished" event for the typewriter effect triggers instantly, which ruins some of my animations (I have animations for mouth movement while type writer effect is going, then I want OnFinish to stop the animation).

The LUA side and the database editing of this framework is lovely, but the UI portion has been a pain to work in.

Can you help me solve this issue?

Here are some images to hopefully help.

Image
Image
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Help getting the UI to do what I want

Post by Tony Li »

Hi,

Sorry about the frustrations with the UI stuff. The flipside of flexibility is complexity, and when you add in another third party product (NGUI), it's even more complicated. (As an aside, you're not absolutely tied to using the Dialogue System's built-in NGUI support scripts. If you prefer, you can make a copy of Scripts/Templates/TemplateDialogueUI.cs and customize it. You'd just need to fill in the code for methods such as ShowSubtitle and ShowResponses.)

Here are some suggestions for getting your UI working with the built-in scripts:

1. On the Dialogue Manager, set Subtitle Chars Per Second to a value equal to or less than your Typewriter Effect's Chars Per Second. The duration that the subtitle is onscreen is independent of the Typewriter Effect.

2. The built-in scripts show and hide various UI elements, such as the subtitle line, by enabling and disabling their components. However, when NGUI's Typewriter Effect is disabled, it simulates a finish and invokes the OnFinished event. Here are two ideas to work around that:

- I can provide a customized Typewriter Effect that doesn't invoke OnFinished when the component is disabled. (I'll PM this to you.)

- Or, instead of the OnFinished event, use a sequencer command that runs at the end of the subtitle duration. For example:

Code: Select all

Animation(idle)@{{end}}
Bluerex
Posts: 4
Joined: Mon Jan 18, 2016 11:56 pm

Re: Help getting the UI to do what I want

Post by Bluerex »

Ok I've got everything mostly working based on your feedback, I just need help understanding the sequencer stuff.

Right now I've got a function that I was calling from the typewritter OnFinish, StopTalking(), that I also put into LUA (lxStopTalking()).

I need to read into the sequencer stuff more (right now I'm mostly just using LUA in the dialog system to call my c# functions). Is there a way to call a LUA function from the sequencer? Or will I need to add my own sequencer function that calls my C# function, StopTalking().

Thanks for your help.
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Help getting the UI to do what I want

Post by Tony Li »

It'll be easiest to make a sequencer command. (The idea is that sequencer commands are for running cutscene sequence stuff -- animation, camerawork, etc. -- whereas Lua is for data management such as setting variable values. It's possible for them to overlap duties, but this was the original concept.)

Sequencer commands are really easy to write. Make a copy of Scripts/Templates/SequencerCommandTemplate.cs called SequencerCommandStopTalking.cs. Change the name of the class to SequencerCommandStopTalking, and put this the Start method:

Code: Select all

public void Start() {
    // Put your code here to call StopTalking(). The speaker's GameObject is is Sequencer.Speaker.
    Stop();
}
Then use this sequencer command in the Sequence field:

Code: Select all

StopTalking()@{{end}}
You could even add that to the Dialogue Manager's Default Sequence if you want it to always run with every dialogue entry. Then leave the dialogue entry's Sequence field blank. (A blank Sequence field causes the dialogue entry to use the Dialogue Manager's Default Sequence.)
Post Reply