From ee5efa9f8d75bbf979944141cc68ecb0195aa699 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Thu, 13 Jun 2024 22:59:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0DrawEdge=E7=BB=98=E5=88=B6?= =?UTF-8?q?=E7=94=B1=E4=B8=8A=E4=B8=8B=E5=9D=90=E6=A0=87=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E7=BB=84=E6=88=90=E7=9A=84=E8=BE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/XUGL/UGL.cs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Runtime/XUGL/UGL.cs b/Runtime/XUGL/UGL.cs index 4e901a88..a6e01052 100644 --- a/Runtime/XUGL/UGL.cs +++ b/Runtime/XUGL/UGL.cs @@ -1986,6 +1986,36 @@ namespace XUGL } } + public static void DrawEdge(VertexHelper vh, List topList, List bottomList, + Color32 lineColor, Color32 lineToColor, Direction dire, float currProgress = float.NaN) + { + if (topList.Count < 2 || bottomList.Count < 2) return; + var minCount = Mathf.Min(topList.Count, bottomList.Count); + var isGradient = !UGLHelper.IsValueEqualsColor(lineColor, lineToColor); + AddVertToVertexHelper(vh, topList[0], bottomList[0], lineColor, false); + for (int i = 1; i < minCount; i++) + { + var up = topList[i]; + var dn = bottomList[i]; + if (currProgress != float.NaN) + { + if (dire == Direction.YAxis && up.y > currProgress) + break; + if (dire == Direction.XAxis && up.x > currProgress) + break; + } + if (isGradient) + { + var tcolor = Color32.Lerp(lineColor, lineToColor, i * 1.0f / minCount); + AddVertToVertexHelper(vh, up, dn, tcolor); + } + else + { + AddVertToVertexHelper(vh, up, dn, lineColor); + } + } + } + public static void DrawSvgPath(VertexHelper vh, string path) { SVG.DrawPath(vh, path);