虽然不对,但是起码计算思路是对的

This commit is contained in:
2026-02-25 00:13:08 +08:00
parent b452ba073d
commit c4dfa3301e
2 changed files with 45 additions and 15 deletions
+6 -1
View File
@@ -29,6 +29,8 @@ namespace XericLibrary
/// </summary>
public bool center = true;
public float a = 1;
/// <summary>
/// 重写 MaskableGraphic 的方法,用于生成线条的网格
/// 当 UI 需要重建时会自动调用此方法
@@ -52,7 +54,10 @@ namespace XericLibrary
{
// 使用静态工具方法创建当前点与下一个点之间的线段
// 传递当前累积长度和总长度用于UV坐标计算
UILineRendererUtils.CreateLineSegment(points[i], points[i+1], thickness, center, rectTransform.sizeDelta, color, vh, currentLength, totalLength);
UILineRendererUtils.CreateLineSegment(points[i], points[i+1],
i > 0 ? Mathf.Acos(Vector2.Dot((points[i -1] - points[i]).normalized, (points[i + 1] - points[i]).normalized)) : 0,
i < points.Length-2 ? Mathf.Acos(Vector2.Dot((points[i + 1] - points[i]).normalized, (points[i + 1] - points[i +2]).normalized)) : 0,
thickness, center, rectTransform.sizeDelta, color, vh, currentLength, totalLength);
// 更新累积长度
currentLength += Vector2.Distance(points[i], points[i+1]);