| | |
| | | private static List<UIVertex> m_VetexList = new List<UIVertex>(); |
| | | // 材质池:Key为"颜色_宽度"格式的字符串,Value为对应的材质; 减少合批问题,又能保持不同的描边;共用材质会同时改变参数 |
| | | private static Dictionary<string, Material> m_MaterialPool = new Dictionary<string, Material>(); |
| | | private static Shader m_Shader; |
| | | |
| | | static Shader m_tmpShader; |
| | | private static Shader m_Shader |
| | | { |
| | | get |
| | | { |
| | | if (m_tmpShader == null) |
| | | { |
| | | m_tmpShader = Shader.Find("TSF Shaders/UI/OutlineEx"); |
| | | } |
| | | return m_tmpShader; |
| | | } |
| | | } |
| | | |
| | | protected override void Start() |
| | | { |
| | | base.Start(); |
| | | if (m_Shader == null) |
| | | { |
| | | m_Shader = Shader.Find("TSF Shaders/UI/OutlineEx"); |
| | | } |
| | | |
| | | |
| | | // 使用材质池获取或创建材质 |
| | | string key = GetMaterialKey(OutlineColor, OutlineWidth); |
| | | if (!m_MaterialPool.TryGetValue(key, out Material material)) |