Accumulate Text reaching limit causes greyed out effect to disappear

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
yyzdd
Posts: 4
Joined: Sun Oct 15, 2023 9:01 pm

Accumulate Text reaching limit causes greyed out effect to disappear

Post 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.
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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
yyzdd
Posts: 4
Joined: Sun Oct 15, 2023 9:01 pm

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

Post 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
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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
yyzdd
Posts: 4
Joined: Sun Oct 15, 2023 9:01 pm

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

Post 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.
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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
yyzdd
Posts: 4
Joined: Sun Oct 15, 2023 9:01 pm

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

Post by yyzdd »

Hi,

Thank you, all working now! :D
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

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

Post by Tony Li »

Glad to help!
Post Reply