public void Set(List <TextInfo> textInfos, float duration, Vector2 position) { if (null == textInfos) { return; } SetBounds(position); var Tags = new List <string>(); string WrappedText = string.Empty; foreach (var TextInfo in textInfos) { var CurrentWrappedText = WordWrapText(TextInfo.Text); var LinesCount = CurrentWrappedText.Count(x => x == NL) + 1; Tags.AddRange(Enumerable.Repeat(TextInfo.Tag, LinesCount)); WrappedText += CurrentWrappedText + NL; } WrappedText = WrappedText.TrimEnd(NL); Duration = TextDuration.Default(WrappedText, duration); if (Duration >= 0) { Duration += 2 * FadeDuration; AlphaPercentage = 0; } CreateLines(position, WrappedText, Tags); _ConstrainOffset = ConstrainBounds(); }
public void Set(string text, float duration, Vector2 position) { if (null == text) { text = string.Empty; } SetBounds(position); var wrappedText = WordWrapText(text); Duration = TextDuration.Default(text, duration); if (Duration >= 0) { Duration += 2 * FadeDuration; AlphaPercentage = 0; } CreateLines(position, wrappedText, null); _ConstrainOffset = ConstrainBounds(); }