Page 1 of 1

Accumulate Text reaching limit causes greyed out effect to disappear

Posted: Fri Nov 24, 2023 2:33 pm
by yyzdd
Hi,

I'm using the scrolling dialogue UI in combination with this greyed out text code:

Code: Select all

using UnityEngine;
using PixelCrushers.DialogueSystem;
using System.Text.RegularExpressions;

public class GrayAccumulatedText : MonoBehaviour
{

    public Color oldTextColor = Color.gray;

    public void OnConversationLine(Subtitle subtitle)
    {
        if (string.IsNullOrEmpty(subtitle.formattedText.text)) return;
        SetAccumulatedTextGray();
    }

    private void SetAccumulatedTextGray()
    {
        var subtitlePanel = DialogueManager.standardDialogueUI.conversationUIElements.defaultNPCSubtitlePanel;

        // Remove color tags from old accumulated text:
        const string pattern = @"<color=[#]?\w+>|</color>";
        subtitlePanel.accumulatedText = Regex.Replace(subtitlePanel.accumulatedText, pattern, string.Empty);

        // Wrap accumulated text in gray:
        subtitlePanel.accumulatedText = UITools.WrapTextInColor(subtitlePanel.accumulatedText, oldTextColor);
    }
}
but when the accumulated text reaches the maximum number of lines, the greyed out effect disappears? The individual conversations are quite long so I can't just raise the max lines amount otherwise it starts to lag pretty bad.

Thanks.

Re: Accumulate Text reaching limit causes greyed out effect to disappear

Posted: Fri Nov 24, 2023 3:53 pm
by Tony Li
Hi,

Good catch. Max Lines was cutting off the entire first line, including the <color> tag that turned the text gray. This patch will fix it. The fix will also be in version 2.2.42.

DS_MaxLinesPatch_2023-11-24.unitypackage

Re: Accumulate Text reaching limit causes greyed out effect to disappear

Posted: Fri Nov 24, 2023 4:02 pm
by yyzdd
Hi,

I imported the unity package but I'm getting this error:

Assets\Plugins\Pixel Crushers\Dialogue System\Scripts\UI\Standard\Dialogue\StandardUISubtitlePanel.cs(541,61): error CS0103: The name 'eventSystem' does not exist in the current context

Re: Accumulate Text reaching limit causes greyed out effect to disappear

Posted: Fri Nov 24, 2023 4:12 pm
by Tony Li
Can you update to the current version of the Dialogue System? If not, this patch should update the file you need:

DS_UIPanelPatch_2023-11-24.unitypackage

Re: Accumulate Text reaching limit causes greyed out effect to disappear

Posted: Fri Nov 24, 2023 4:22 pm
by yyzdd
Hi,

I tried adding that package and also received a compiler error:

Assets\Plugins\Pixel Crushers\Common\Scripts\UI\UIPanel.cs(16,43): error CS0246: The type or namespace name 'IEventSystemUser' could not be found (are you missing a using directive or an assembly reference?)

I'm using version 2.2.38.2, would I just need to upgrade using Unity package manager? I'm not sure if I can risk an upgrade at the moment lol.

Thanks.

Re: Accumulate Text reaching limit causes greyed out effect to disappear

Posted: Fri Nov 24, 2023 5:29 pm
by Tony Li
Hi,

Yes, just update to version 2.2.41.1 from the Package Manager window, then import DS_MaxLinesPatch_2023-11-24.unitypackage

Re: Accumulate Text reaching limit causes greyed out effect to disappear

Posted: Tue Nov 28, 2023 3:50 pm
by yyzdd
Hi,

Thank you, all working now! :D

Re: Accumulate Text reaching limit causes greyed out effect to disappear

Posted: Tue Nov 28, 2023 6:31 pm
by Tony Li
Glad to help!