Beispiel #1
0
        public static List <TextSymbol> CreateSymbolListFromText(string text)
        {
            var symbolList       = new List <TextSymbol>();
            int parsedCharacters = 0;

            while (parsedCharacters < text.Length)
            {
                TextSymbol symbol = null;

                // Check for tags
                var remainingText = text.Substring(parsedCharacters, text.Length - parsedCharacters);
                if (RichTextTag.StringStartsWithTag(remainingText))
                {
                    var tag = RichTextTag.ParseNext(remainingText);
                    symbol = new TextSymbol(tag);
                }
                else
                {
                    symbol = new TextSymbol(remainingText.Substring(0, 1));
                }

                parsedCharacters += symbol.Length;
                symbolList.Add(symbol);
            }

            return(symbolList);
        }
Beispiel #2
0
 /// <summary>
 /// Debug.Log with rich tags
 /// </summary>
 /// <param name="tag"></param>
 private void LogTag(RichTextTag tag)
 {
     if (tag != null)
     {
         Debug.Log("Tag: " + tag.ToString());
     }
 }
Beispiel #3
0
        private static string RemoveTags(string textWithTags, params string[] tags)
        {
            string textWithoutTags = textWithTags;

            foreach (var tag in tags)
            {
                textWithoutTags = RichTextTag.RemoveTagsFromString(textWithoutTags, tag);
            }

            return(textWithoutTags);
        }
Beispiel #4
0
 public TextSymbol(RichTextTag tag)
 {
     this.Tag = tag;
 }