示例#1
0
        public static void UF_OnPopulateMesh(UILabel label, List <TextToken> tokens, List <UIVertex> uivertexs)
        {
            if (tokens.Count == 0)
            {
                return;
            }
            int handlebit = label.handleTokenBit;

            if ((handlebit & TextTokenType.HEAD_C) > 0)
            {
                RTColor.UF_OnPopulateMesh(label, tokens, uivertexs);
            }
            if ((handlebit & TextTokenType.HEAD_H) > 0)
            {
                RTHyperlink.UF_OnPopulateMesh(label, tokens, uivertexs);
            }
            if ((handlebit & TextTokenType.HEAD_U) > 0)
            {
                RTUnderLine.UF_OnPopulateMesh(label, tokens, uivertexs);
            }
            if ((handlebit & TextTokenType.QUAD) > 0)
            {
                RTSprite.UF_OnPopulateMesh(label, tokens, uivertexs);
            }
            if ((handlebit & TextTokenType.HEAD_G) > 0)
            {
                RTGradual.UF_OnPopulateMesh(label, tokens, uivertexs, 0);
            }

            //底部显示效果必须在最后,并获取前置索引
            int sourceLen  = uivertexs.Count;
            int startIndex = 0;

            if ((handlebit & TextTokenType.HEAD_O) > 0)
            {
                RTOutline.UF_OnPopulateMesh(label, tokens, uivertexs, startIndex);
                startIndex = uivertexs.Count - sourceLen;
            }
            if ((handlebit & TextTokenType.HEAD_S) > 0)
            {
                RTShadow.UF_OnPopulateMesh(label, tokens, uivertexs, startIndex);
                startIndex = uivertexs.Count - sourceLen;
            }
        }
示例#2
0
        protected override void OnPopulateMesh(VertexHelper vertexHelper)
        {
            UF_OnPopulateTextMesh(vertexHelper);
            //RichText 的处理在这里

            //基于 tokens  处理富文本
            if (this.supportRichText && (textTokens.Count > 0 || outline))
            {
                List <UIVertex> tempUIVerts = ListCache <UIVertex> .Acquire();

                vertexHelper.GetUIVertexStream(tempUIVerts);
                //根据m_HandleTokenBit 值处理对应的RichText
                RichText.UF_OnPopulateMesh(this, textTokens, tempUIVerts);

                int sourceLen  = tempUIVerts.Count;
                int startIndex = 0;
                //全局描边
                if (outline)
                {
                    RTOutline.UF_HandleMesh(tempUIVerts, GHelper.UF_IntToColor(outlineColor), outlineParam, startIndex);
                    startIndex = tempUIVerts.Count - sourceLen;
                }
                //全局阴影
                if (shadow)
                {
                    RTShadow.UF_HandleMesh(tempUIVerts, GHelper.UF_IntToColor(shadowColor), shadowParam, startIndex);
                    startIndex = tempUIVerts.Count - sourceLen;
                }


                vertexHelper.Clear();
                vertexHelper.AddUIVertexTriangleStream(tempUIVerts);

                ListCache <UIVertex> .Release(tempUIVerts);
            }
        }