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.
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.
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
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.