Page 1 of 2
Continue button with bubble template
Posted: Mon Feb 17, 2020 5:43 am
by Tetralogia
Hi
I'm using the
Basic Standard Dialogue UI + the
Dialogue Actor component with the
Dialogue UI Settings set to
Custom > Bubble Template Standard UI Subtitle Panel so that my NPCs speak in bubbles.
I'd like to simulate the continue button when clicking on mouse so I have a
UI Button Key Trigger and the setting
Continue Button set to
Always. However, the continue button never shows up and the mouse click does not seem to work either.
When I switch the
Dialogue UI Settings back to
Standard, it works fine. What can I do?
Re: Continue button with bubble template
Posted: Mon Feb 17, 2020 8:48 am
by Tony Li
Hi,
Take a look at the Bubble Subtitle Example on the
Dialogue System Extras page.
Note: In it, the Continue Button is not actually assigned to the bubble subtitle panel's Continue Button. (This is just a peculiarity of the original case that the scene was set up for.) But it works just fine if you assign it to the Continue Button field, too.
When you say that you want to simulate the continue button click when clicking the mouse, do you mean clicking anywhere onscreen, or only on the continue button? (Another note: You could make transparent and set to cover the entire bubble image.) In either case, you probably don't want to use UI Button Key Trigger. This listens for an input, such as "mouse button 0", but it runs independently of actual mouse clicks on UI elements. If you click on an entirely different UI button, Unity UI will click that UI button, but the UI Button Key Trigger will also simulate a click of the continue button.
If none of that helps, please feel free to send an example scene to tony (at) pixelcrushers.com. I'll be happy to take a look.
Re: Continue button with bubble template
Posted: Mon Feb 17, 2020 9:58 am
by Tetralogia
Ok great! The example helped me do what I was trying to. Thanks
I may come back with other questions, it's my first time using the bubble UI.
I've got one weird thing on my scene, I think it's when I click on the continue button, there's an audio file saying "I'm on it." Where may that come from?
Re: Continue button with bubble template
Posted: Mon Feb 17, 2020 10:00 am
by Tony Li
Sounds like you used the Dialogue Manager from the demo scenes. Check your Dialogue Manager's Default Sequence. Try setting Display Settings > Camera & Cutscene Settings > Default Sequence to:
and set Default Player Sequence to a blank string.
Re: Continue button with bubble template
Posted: Mon Feb 17, 2020 10:52 am
by Tetralogia
Ok weird that never happened before. I fixed it thanks!
In the example scene for the Bubble Subtitle there's a typewriter effect. How do I implement that?
Re: Continue button with bubble template
Posted: Mon Feb 17, 2020 11:20 am
by Tetralogia
Nevermind I didn't look enough before asking!
Re: Continue button with bubble template
Posted: Tue Feb 18, 2020 5:31 am
by Tetralogia
Hi again,
How can I wait for the end of a typewriter effect on a dialogue text to call a Lua registered function?
Re: Continue button with bubble template
Posted: Tue Feb 18, 2020 7:46 am
by Tony Li
If the function should be called for
every subtitle, you can hook up your function to the typewriter effect's OnEnd() UnityEvent.
Otherwise, it's easy to coordinate the typewriter effect and sequences. For example:
If you can make your code into a
custom sequencer command instead of registering it as a Lua function, you can do this:
Coordinating the typewriter effect and Script field is more complicated. The Script field runs just before the subtitle starts. The idea is that Lua is primarily for internal data management (e.g., setting variables), whereas sequences are for user experience activity that depend on timing, such as typewriter effects, animation, and audio.
If you can't use a custom sequencer command, you could get your Lua registered function to hook into the typewriter's OnEnd() event in code. Example:
Code: Select all
void Awake() // Register Lua function.
{
Lua.RegisterFunction("MyFunction", this, SymbolExtensions.GetMethodInfo(() => MyFunction()));
}
void MyFunction()
{
var typewriter = // (Get a reference to the appropriate typewriter effect)
typewriter.onEnd.AddListener(() => { Typed(typewriter); });
}
void Typed(AbstractTypewriterEffect typewriter)
{
typewriter.onEnd.RemoveListener(Typed);
// Do your thing here.
}
Re: Continue button with bubble template
Posted: Tue Feb 18, 2020 8:54 am
by Tetralogia
I'm trying to write a custom sequencer command but I'm not understanding everything (it seems to be beyond my programming knowledge). Here's my code :
Code: Select all
using UnityEngine;
using System.Collections;
using PixelCrushers.DialogueSystem;
using UnityEngine.UI;
namespace PixelCrushers.DialogueSystem.SequencerCommands
{
public class SequencerCommandOpenPopup : SequencerCommand
{
public void Awake()
{
string text = GetParameter(0);
GlobalConversationsVariables.popupBox.SetActive(true);
GlobalConversationsVariables.popupText.text = text;
Stop();
}
public void OnDestroy()
{
// Add your finalization code here. This is critical. If the sequence is cancelled and this
// command is marked as "required", then only Awake() and OnDestroy() will be called.
// Use it to clean up whatever needs cleaning at the end of the sequencer command.
// If you don't need to do anything at the end, you can delete this method.
}
}
}
I want this code to open an image with a text. So I wrote OpenPopup("text") in the sequencer. Nothing is happening.
Re: Continue button with bubble template
Posted: Tue Feb 18, 2020 9:06 am
by Tony Li
Try adding a Debug.Log line or a debugger breakpoint to make sure the command is running.
Also, with sequencer commands you can omit quotes:
OpenPopup(text)