// Removes all non-text mesh pro tags. protected void ProcessTags() { string source = textComponent.text; string result = ""; int index = 0; var tagMatches = Tools.GetTagMatches(source); foreach (Match match in tagMatches) { if (Tools.IsTextMeshProTag(match.Value) || Tools.IsRichTextCode(match.Value)) { result += source.Substring(index, match.Index + match.Length - index); } else { result += source.Substring(index, match.Index - index); } index = match.Index + match.Length; } result += source.Substring(index, source.Length - index); textComponent.text = Tools.UnescapeTagBrackets(result); }
private bool doParse(string inText) { int textPos = 0; var tagMatches = Tools.GetTagMatches(inText); foreach (Match match in tagMatches) { string textPart = Tools.UnescapeTagBrackets(inText.Substring(textPos, match.Index - textPos)); _textWithoutTags += textPart; if (Tools.IsTextMeshProTag(match.Value) || Tools.IsRichTextCode(match.Value) || !tryParseEffectTag(match.Value, _textWithoutTags.Length)) { _textWithoutEffects += textPart + inText.Substring(match.Index, match.Length); } else { _textWithoutEffects += textPart; } textPos = match.Index + match.Length; } _textWithoutTags += inText.Substring(textPos, inText.Length - textPos); _textWithoutEffects += inText.Substring(textPos, inText.Length - textPos); return(_formingEffects.Count == 0 && !haveErrors); }