前言
等有空再补详细说明,先上代码。看官自行阅读
代码
UICurveData 类,用于存放点数据的基础结构。
public class UICurveData
{
#region [Fields]
public List<Vector2> Postion = new List<Vector2>();
public Color Ccolor;
public float Thickness = 1;
#endregion
#region [PublicTools]
public void Addpos(float varX, float varY)
{
Addpos(new Vector2(varX, varY));
}
public void Addpos(Vector2 varV2)
{
Postion.Add(varV2);
}
#endregion
}
UICurve 负责构建顶点数据,mesh。
public class UICurve : MaskableGraphic
{
#region [Fields]
private Dictionary<int, UICurveData> mCurveData = new Dictionary<int, UICurveData>();
#endregion
#region [Inherit]
protected override void OnPopulateMesh(VertexHelper varVerHeler)