Page 2 of 6
Re: Auto Play and Skip All buttons
Posted: Wed Apr 07, 2021 11:16 am
by mac
No, using the anchored position instead Transform position did not work but for different reasons, with Transform.position the button was moving to this odd place, like I showed in the screenshot.
Using anchored position instead (the code displayed in the last answer) nothing happens, the button sits where the OnPointerEnter 'animation' finishes. Like I said tweening is not relevant here, I just want to be able to move the button back to where it started. So basically, storing the rect transform position OnEnable and assigning it to the button OnPointerExit had no effect.
Re: Auto Play and Skip All buttons
Posted: Wed Apr 07, 2021 2:18 pm
by Tony Li
Depending on how your menu is set up (particularly if you're using a Vertical Layout Group that locks positions), it might help to tween an inner rect instead of the button's main rect. You may also want to change the rect's anchor to, say, something that's anchored on the left. Here's an example:
DS_TweenResponseButtonExample_2021-04-07.unitypackage
In the example, the response button template has an inner rect that gets tweened. The inner rect's anchor is the lower left.
Re: Auto Play and Skip All buttons
Posted: Wed Apr 07, 2021 3:43 pm
by mac
Ok, opening the scene you provided and playing works like intended, that's awesome, thank you Tony!
But the the dialogue panel you made differs from the default response button layout, like the default (JRPG layout at least) has a view port with scroll rect, but for my project I won't need one, there won't be that many options in dialogue, rendering the scroll rect useless, so can I make a prefab out of your example response button and apply it on my Dialogue UI template? Or is there any script or other layout changes required for that to work?
Re: Auto Play and Skip All buttons
Posted: Wed Apr 07, 2021 4:21 pm
by Tony Li
It's probably more effort than it's worth to create a prefab out of my example button.
To make the example, the main steps were:
- Started with a dialogue UI prefab (the Basic Standard Dialogue UI in this case, but it could have been any).
- Removed the Scroll Rect / Scrollbar stuff. Assigned the Response Menu Panel itself as the Button Template Holder.
- Added an intermediate Image GameObject in the response button template.
- Added a Vertical Layout Group to the Response Menu Panel.
Note that I also added a script that tweens the intermediate Image GameObject. Instead of using a real tweening library, for the example I just wrote a little coroutine.
Re: Auto Play and Skip All buttons
Posted: Wed Apr 07, 2021 8:22 pm
by mac
Thank you again Tony! Everything works like intended now.
Re: Auto Play and Skip All buttons
Posted: Wed Apr 07, 2021 8:43 pm
by Tony Li
Great! Glad to help.
Re: Auto Play and Skip All buttons
Posted: Fri Apr 23, 2021 11:39 pm
by mac
Hey Tony, I noticed that when clicking the Auto Play button, the dialogue plays the next sequence, like it also has the continue button functionality, is there any way to stop this from happening?
Re: Auto Play and Skip All buttons
Posted: Sat Apr 24, 2021 7:59 am
by Tony Li
Hi,
I don't quite follow. It should play the sequence in case the sequence does something required by the game such as setting a GameObject active or setting a variable value. If it's a critical sequencer command, put 'required' at the front to make sure it runs. If that doesn't help, can you please elaborate?
Re: Auto Play and Skip All buttons
Posted: Sat Apr 24, 2021 1:22 pm
by mac
With Autoplay active, dialogue happens automatically, right? So what happens is, instead of clicking the continue button to proceed, the dialogue automatically continues after a set delay, the thing is, when toggling Auto Play on, instead of waiting for this delay, the next line is played instantly, I don't want that to happen.
Re: Auto Play and Skip All buttons
Posted: Sat Apr 24, 2021 2:32 pm
by Tony Li
Got it. Yes, currently Auto Play works like a continue button for the current line. If you don't want that to happen, you could change the code in the ConversationControl script's ToggleAutoPlay method. Maybe something like:
Code: Select all
public void ToggleAutoPlay()
{
var mode = DialogueManager.displaySettings.subtitleSettings.continueButton;
var newMode = (mode == DisplaySettings.SubtitleSettings.ContinueButtonMode.Never) ? DisplaySettings.SubtitleSettings.ContinueButtonMode.Always : DisplaySettings.SubtitleSettings.ContinueButtonMode.Never;
DialogueManager.displaySettings.subtitleSettings.continueButton = newMode;
if (newMode == DisplaySettings.SubtitleSettings.ContinueButtonMode.Never)
{
Invoke(nameof(ContinueNow), DialogueManager.conversationView.GetDefaultSubtitleDuration(DialogueManager.currentConversationState.subtitle.formattedText.text));
}
}
private void ContinueNow()
{
dialogueUI.OnContinueConversation();
}