DoozyUI help with integration

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
OscarLeif
Posts: 6
Joined: Mon Sep 02, 2019 11:40 pm

DoozyUI help with integration

Post by OscarLeif »

Hello I was trying to use DoozyUI with Dialog System

I was following the instructions from this link.
https://www.pixelcrushers.com/dialogue_ ... y_u_i.html
And I found a small issue with Dialogue Panel, the dialogue starts fine show the UIView animation, but when the conversation ends the animation is never played, it disable the gameobject, I'm not sure if there's a missing step here.
Has anyone have this issue ?
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: DoozyUI help with integration

Post by Tony Li »

Hi Oscar,

Edit: Completely unnecessary. See my post below.

That's the default behavior -- but the Standard Dialogue UI has provisions to handle it. How you set it up depends on whether you need to wait for the subtitle/menu panels' UIViews to close first. Below, I'll assume you want to wait until the subtitle/menus panels have finished closing, and then close the main dialogue panel.

1. Tick the dialogue UI's Wait For Close checkbox.

2. Make a subclass of StandardDialogueUI and override the AreAnyPanelsClosing() and CloseNow() methods, Something like:
MyDialogueUI.cs

Code: Select all

using System.Collections;
using UnityEngine;
using PixelCrushers.DialogueSystem;
using Doozy.Engine.UI;

public class MyDialogueUI : StandardDialogueUI
{    

    protected override void CloseNow()
    {
        StartCoroutine(CloseAfterHidden());
    }
    
    protected IEnumerator CloseAfterHidden()
    {
        var uiView = GetComponent<UIView>();
        uiView.Hide();
        float timeout = DialogueTime.time + 5; // Safeguard: Time out after 5 seconds if Doozy fails to hide.
        while (!uiView.IsHidden && DialogueTime.time < timeout)
        {
            yield return null;
        }
        base.CloseNow();
    }

    public override bool AreAnyPanelsClosing()
    {
        foreach (var panel in conversationUIElements.subtitlePanels)
        {
            if (IsPanelStillHiding(panel.GameObject)) return true;
        }
        foreach (var panel in conversationUIElements.menuPanels)
        {
            if (IsPanelStillHiding(panel.GameObject)) return true;
        }
        return false;
    }
    
    protected bool IsPanelStillHiding(GameObject panelGO)
    {
        var uiView = panelGO.GetComponent<UIView>();
        return (uiView != null) && !uiView.IsHidden;
    }
}
3. On your dialogue UI, replace the StandardDialogueUI component with your subclass. (Change the Inspector to Debug mode and drag your subclass script into the StandardDialogueUI component's Script field.)

I'm assuming that you're telling the UIViews to hide in OnOpen() and OnClose() UnityEvents, but you could just as easily skip those UnityEvents and call them in the script above instead.
OscarLeif
Posts: 6
Joined: Mon Sep 02, 2019 11:40 pm

Re: DoozyUI help with integration

Post by OscarLeif »

Thanks, Tony.

While that works fine, using Doozy seems more complex than I thought.
Because First, we have The Parent UI GameObject with a "StandardDialogueUI" component.
First The child Dialog Panel needs an animation.
Then every subtitle panel also needs an animation.
The response menu panel also needs an animation.

My goal was to use the UIView to have more animations when dialogs appear, but it seems I have to write customs scripts for this.
As I know I have to write custom scripts for
-Standard UI Subtitle Panel
-Standard Dialogue UI
-Standard UI Menu panel.

It's easier to just modify the animation templates and forgot to use Doozy.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: DoozyUI help with integration

Post by Tony Li »

Hi,

You should only need to write a subclass of StandardDialogueUI. You don't need to add any animations. I'll put together an example and post it here.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: DoozyUI help with integration

Post by Tony Li »

Sorry, I totally forgot that the Dialogue System's DoozyUI support was improved back in November. You don't need to do any scripting. I updated the example scene on the Dialogue System Extras page to also control the subtitle panel with DoozyUI. So the main panel, subtitle panel, and response panel are all Doozy-controlled.

Just follow the setup instructions on the DoozyUI Support page. If you're using version 2.2.15 (the current version as of this post) or earlier, I also recommend importing the dialogue UI patch on the Extras page. It's in the "Updated for 2.2.15" foldout. It has some improvements that handle DoozyUI more smoothly.
OscarLeif
Posts: 6
Joined: Mon Sep 02, 2019 11:40 pm

Re: DoozyUI help with integration

Post by OscarLeif »

Ok, I made a lot of tests.
And I want to say.

-First, you need to use the latest version of the Dialogue System.
-Second, You need to apply the patch that Tony talks about. (Without this animations will not play correctly).
-Third follows the DoozyUI integration and everything should work smoothly.

The Alert Panel and Dialogue Panel will play their own animations.

The subtitle panels (NPC, PC, and Response panels)will also play the animation in the correct order, is very smooth and nice.
But something is missing in the instructions

First "Dialogue Panel" UIVIew animation "Behaviour at start" must be "Do Nothing".
If you set it to Hide probably fails because coroutines cannot work if this game object is disabled.
I'm not sure if we set this "When UIView is Hidden" no disable the game object should work.

Thank you Tony for the Example, without this I probably never setup this correctly.
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: DoozyUI help with integration

Post by Tony Li »

Hi,

Thanks for sharing your notes. I'll include the example scene in a Third Party Support / DoozyUI Support package for future users and update the manual page with your notes.
Post Reply