Beispiel #1
0
        protected void RegisterLinkData(string linkId, string argStr, TagActionManager.TagData tagData)
        {
            if (string.IsNullOrEmpty(linkId) || string.IsNullOrEmpty(argStr))
            {
                return;
            }

            linkDataList.Add(new LinkData(linkId, argStr, tagData.isChangeTextColor, tagData.textColor, tagData.argEvent));
        }
Beispiel #2
0
 public TagMatch(TagActionManager.TagData tagData, string argStr, string taggedText, int matchIndex, int matchLength, int tagLength)
 {
     this.tagData     = tagData;
     this.argStr      = argStr;
     this.taggedText  = taggedText;
     this.matchIndex  = matchIndex;
     this.matchLength = matchLength;
     this.tagLength   = tagLength;
 }
Beispiel #3
0
        protected override void OnPopulateMesh(VertexHelper vertexHelper)
        {
            base.RemoveAllLinkData();
            if (originText != m_Text)
            {
                originText = m_Text;
                base.ResetTapped();
            }
            tagMatchList.Clear();

            if (TagManager != null)
            {
                base.isChangeTappedColor = TagManager.isChangeTappedColor;
                base.tappedColor         = TagManager.tappedColor;
                matchHelper.CreateTagMatchList(originText, TagManager.tagData, tagMatchList);
            }

            if (tagMatchList.Count > 0)
            {
                int totalTagStrLength = 0;
                int currentIndex      = 0;
#if (NET_2_0 || NET_2_0_SUBSET)
                textSB.Remove(0, textSB.Length);
#else
                textSB.Clear();                 //require higher .Net4.0 in Unity editor settings
#endif
                foreach (TagMatch item in tagMatchList)
                {
                    TagActionManager.TagData data = item.tagData;
                    if ((item.matchIndex - currentIndex) < 0)
                    {
                        continue;
                    }
                    textSB.Append(originText.Substring(currentIndex, item.matchIndex - currentIndex));
                    textSB.Append(item.taggedText);
                    base.RegisterLinkData(item.matchIndex - totalTagStrLength, item.taggedText.Length, item.argStr, data);
                    currentIndex       = item.matchIndex + item.matchLength;
                    totalTagStrLength += item.tagLength;
                }
                textSB.Append(originText.Substring(currentIndex));

                base.untagText = m_Text = textSB.ToString();
                base.OnPopulateMesh(vertexHelper);
                m_Text = originText;
            }
            else
            {
                base.OnPopulateMesh(vertexHelper);
            }
        }
Beispiel #4
0
        /*
         * protected override void Start()
         * {
         *      base.Start();
         * }
         */

        protected void RegisterLinkData(int startIndex, int targetStrLength, string argStr, TagActionManager.TagData tagData)
        {
            if (string.IsNullOrEmpty(argStr))
            {
                return;
            }
            if (startIndex < 0 || targetStrLength <= 0 || startIndex + targetStrLength > text.Length)
            {
                return;
            }

            linkDataList.Add(new LinkData(startIndex, targetStrLength, argStr, tagData.isChangeTextColor, tagData.textColor, tagData.argEvent));
        }