Ejemplo n.º 1
0
        //字符串网格控制
        public override bool HandleTextMesh(URichTextParseInfo info)
        {
            if (info.vertStartIndex < 0)
            {
                return(false);
            }

            int vertEndIndex   = GetVertEndIndex(info.vertStartIndex, endMsg);
            int vertStartIndex = info.vertStartIndex + preMsg.Length;


            //可以考虑用内存池,减少内存分配
            var output = new List <UIVertex>();

            vHelper.GetUIVertexStream(output);

            //绘制下划线
            vHelper.Clear();
            List <Rect> lineRects = richText.GetTextTiles(vertStartIndex, vertEndIndex, output);

            for (int i = 0; i < lineRects.Count; i++)
            {
                output.AddRange(URichTextUtil.GetUnderLineVerts(lineRects[i], vertEndIndex, richText.GetUnderLineInfo()));
            }
            //添加的顶点数组
            vHelper.AddUIVertexTriangleStream(output);

            info.urlHrefInfo.m_tagTextRects.AddRange(lineRects);

            info.urlHrefInfo.strHrefEvent = info.values[1].ToString();
            return(true);
        }