lcy
7 天以前 8f56204fdd6f7c5c3b9bf6752e103db7124d1e2b
592 多语言适配 英语时OutlineEx描边宽度减半,其他语言保持原值
1个文件已修改
22 ■■■■ 已修改文件
Main/Component/UI/Core/OutlineEx.cs 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/Component/UI/Core/OutlineEx.cs
@@ -37,7 +37,19 @@
    [Range(0, 30)]
    //默认10,不同的颜色(包括调整alpha)视觉上描边粗细有差异,故shader里乘以0.2适应不同情况
    public int OutlineWidth = 10;
    public int OutlineWidth = 10;
    //多语言适配:英语时描边宽度减半,其他语言保持原值
    private int EffectiveOutlineWidth
    {
        get
        {
            string langId = Language.Id;
            if (langId == "en")
                return OutlineWidth / 2;
            return OutlineWidth;
        }
    }
    private List<UIVertex> m_VetexList = new List<UIVertex>();
@@ -207,18 +219,18 @@
            //OutlineColor 和 OutlineWidth 也传入,避免出现不同的材质球
            var col_rg = new Vector2(OutlineColor.r, OutlineColor.g);       //描边颜色 用uv3 和 tangent的 zw传递
            var col_ba = new Vector4(0,0,OutlineColor.b, OutlineColor.a);   
            var normal = new Vector3(0, 0, OutlineWidth);                   //描边的宽度 用normal的z传递
            var normal = new Vector3(0, 0, EffectiveOutlineWidth);          //描边的宽度 用normal的z传递
            // 为每个顶点设置新的Position和UV,并传入原始UV框
            v1 = _SetNewPosAndUV(v1, this.OutlineWidth, posCenter, triX, triY, uvX, uvY, uvMin, uvMax);
            v1 = _SetNewPosAndUV(v1, EffectiveOutlineWidth, posCenter, triX, triY, uvX, uvY, uvMin, uvMax);
            v1.uv3 = col_rg;
            v1.tangent = col_ba;
            v1.normal = normal;
            v2 = _SetNewPosAndUV(v2, this.OutlineWidth, posCenter, triX, triY, uvX, uvY, uvMin, uvMax);
            v2 = _SetNewPosAndUV(v2, EffectiveOutlineWidth, posCenter, triX, triY, uvX, uvY, uvMin, uvMax);
            v2.uv3 = col_rg;
            v2.tangent = col_ba;
            v2.normal = normal;
            v3 = _SetNewPosAndUV(v3, this.OutlineWidth, posCenter, triX, triY, uvX, uvY, uvMin, uvMax);
            v3 = _SetNewPosAndUV(v3, EffectiveOutlineWidth, posCenter, triX, triY, uvX, uvY, uvMin, uvMax);
            v3.uv3 = col_rg;
            v3.tangent = col_ba;
            v3.normal = normal;