Hello,
I followed the examples on how to setup a scrolling text like Disco Elysium and it works perfectly.
Now I'm trying to change the logic that puts all old text as gray to keep already set colors but I'm having trouble.
For example in this picture, the line "Virtue check success ! [Medium: Success]" when it shows is green <color=green>
but then of course the GrayAccumulatedText removes the color tag and wraps all accumulated text with gray when another line comes.
I would like to keep such dialogue as green so of course I've tried playing with the different regex in GrayAccumulatedText to no avail.
Any help on this ?
Scrolling accumulated text - old text gray
Re: Scrolling accumulated text - old text gray
Hello,
Thanks for fast reply.
But I'm already using GrayAccumulatedText class with provided code.
SetAccumulatedTextGray() function Regex.Replace call removes all color tags in accumulatedText, thus losing
<color=green>Virtue check success ! [Medium: Success]</color>
I would like to keep color likes this :
Instead of this :
Removing the following lines
provides the correct behaviour but then color tags start to accumulate :
Thanks for fast reply.
But I'm already using GrayAccumulatedText class with provided code.
Code: Select all
// 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);
<color=green>Virtue check success ! [Medium: Success]</color>
I would like to keep color likes this :
Instead of this :
Removing the following lines
Code: Select all
// Remove color tags from old accumulated text:
const string pattern = @"<color=[#]?\w+>|</color>";
subtitlePanel.accumulatedText = Regex.Replace(subtitlePanel.accumulatedText, pattern, string.Empty);
Last edited by ongre on Thu Nov 02, 2023 4:58 pm, edited 1 time in total.
Re: Scrolling accumulated text - old text gray
Try removing only the outermost color tag -- "<color=7f7f7fff>" at the beginning of the string and "</color>" at the end.
Re: Scrolling accumulated text - old text gray
Indeed, I just needed more time I couldn't find the correct Regex.
Here is my solution for anyone stumbling on this that wants to keep color in the accumulated grey text :
Don't know if it covers all cases but so far it works and doesn't accumulate any tags.
Here is my solution for anyone stumbling on this that wants to keep color in the accumulated grey text :
Code: Select all
string pattern = @"^(<color=[#]?\w+>)|(</color>)(?!\n.?|</color>)";
subtitlePanel.accumulatedText = Regex.Replace(subtitlePanel.accumulatedText, pattern, string.Empty);
Re: Scrolling accumulated text - old text gray
Thanks for sharing!