mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-22 00:20:18 +00:00
3.0
This commit is contained in:
@@ -27,7 +27,7 @@ namespace XUGL
|
||||
/// <param name="dent">箭头凹度</param>
|
||||
/// <param name="color">颜色</param>
|
||||
public static void DrawArrow(VertexHelper vh, Vector3 startPoint, Vector3 arrowPoint, float width,
|
||||
float height, float offset, float dent, Color32 color)
|
||||
float height, float offset, float dent, Color32 color)
|
||||
{
|
||||
var dir = (arrowPoint - startPoint).normalized;
|
||||
var sharpPos = arrowPoint + (offset + height / 4) * dir;
|
||||
@@ -187,13 +187,13 @@ namespace XUGL
|
||||
}
|
||||
|
||||
public static void AddVertToVertexHelper(VertexHelper vh, Vector3 top,
|
||||
Vector3 bottom, Color32 color, bool needTriangle = true)
|
||||
Vector3 bottom, Color32 color, bool needTriangle = true)
|
||||
{
|
||||
AddVertToVertexHelper(vh, top, bottom, color, color, needTriangle);
|
||||
}
|
||||
|
||||
public static void AddVertToVertexHelper(VertexHelper vh, Vector3 top,
|
||||
Vector3 bottom, Color32 topColor, Color32 bottomColor, bool needTriangle = true)
|
||||
Vector3 bottom, Color32 topColor, Color32 bottomColor, bool needTriangle = true)
|
||||
{
|
||||
var lastVertCount = vh.currentVertCount;
|
||||
vh.AddVert(top, topColor, Vector2.zero);
|
||||
@@ -518,7 +518,7 @@ namespace XUGL
|
||||
/// <param name="color">颜色</param>
|
||||
/// <param name="vertical">是否垂直方向</param>
|
||||
public static void DrawRectangle(VertexHelper vh, Vector3 p, float xRadius, float yRadius,
|
||||
Color32 color, bool vertical = true)
|
||||
Color32 color, bool vertical = true)
|
||||
{
|
||||
DrawRectangle(vh, p, xRadius, yRadius, color, color, vertical);
|
||||
}
|
||||
@@ -1049,14 +1049,14 @@ namespace XUGL
|
||||
if (borderWidth == 0 || UGLHelper.IsClearColor(color)) return;
|
||||
var halfWid = rectWidth / 2;
|
||||
var halfHig = rectHeight / 2;
|
||||
var lbIn = new Vector3(center.x - halfWid, center.y - halfHig);
|
||||
var lbOt = new Vector3(center.x - halfWid - borderWidth, center.y - halfHig - borderWidth);
|
||||
var ltIn = new Vector3(center.x - halfWid, center.y + halfHig);
|
||||
var ltOt = new Vector3(center.x - halfWid - borderWidth, center.y + halfHig + borderWidth);
|
||||
var rtIn = new Vector3(center.x + halfWid, center.y + halfHig);
|
||||
var rtOt = new Vector3(center.x + halfWid + borderWidth, center.y + halfHig + borderWidth);
|
||||
var rbIn = new Vector3(center.x + halfWid, center.y - halfHig);
|
||||
var rbOt = new Vector3(center.x + halfWid + borderWidth, center.y - halfHig - borderWidth);
|
||||
var lbIn = new Vector3(center.x - halfWid - extWidth, center.y - halfHig - extWidth);
|
||||
var lbOt = new Vector3(center.x - halfWid - borderWidth - extWidth, center.y - halfHig - borderWidth - extWidth);
|
||||
var ltIn = new Vector3(center.x - halfWid - extWidth, center.y + halfHig + extWidth);
|
||||
var ltOt = new Vector3(center.x - halfWid - borderWidth - extWidth, center.y + halfHig + borderWidth + extWidth);
|
||||
var rtIn = new Vector3(center.x + halfWid + extWidth, center.y + halfHig + extWidth);
|
||||
var rtOt = new Vector3(center.x + halfWid + borderWidth + extWidth, center.y + halfHig + borderWidth + extWidth);
|
||||
var rbIn = new Vector3(center.x + halfWid + extWidth, center.y - halfHig - extWidth);
|
||||
var rbOt = new Vector3(center.x + halfWid + borderWidth + extWidth, center.y - halfHig - borderWidth - extWidth);
|
||||
float brLt = 0, brRt = 0, brRb = 0, brLb = 0;
|
||||
bool needRound = false;
|
||||
InitCornerRadius(cornerRadius, rectWidth, rectHeight, horizontal, invertCorner, ref brLt, ref brRt, ref brRb,
|
||||
@@ -1185,7 +1185,7 @@ namespace XUGL
|
||||
}
|
||||
|
||||
public static void DrawTriangle(VertexHelper vh, Vector3 p1,
|
||||
Vector3 p2, Vector3 p3, Color32 color, Color32 color2, Color32 color3)
|
||||
Vector3 p2, Vector3 p3, Color32 color, Color32 color2, Color32 color3)
|
||||
{
|
||||
UIVertex v1 = new UIVertex();
|
||||
v1.position = p1;
|
||||
@@ -1213,7 +1213,7 @@ namespace XUGL
|
||||
}
|
||||
|
||||
public static void DrawCricle(VertexHelper vh, Vector3 center, float radius, Color32 color,
|
||||
Color32 toColor, float smoothness = 2f)
|
||||
Color32 toColor, float smoothness = 2f)
|
||||
{
|
||||
DrawSector(vh, center, radius, color, toColor, 0, 360, 0, s_ClearColor32, smoothness);
|
||||
}
|
||||
@@ -1260,13 +1260,13 @@ namespace XUGL
|
||||
}
|
||||
|
||||
public static void DrawSector(VertexHelper vh, Vector3 center, float radius, Color32 color,
|
||||
float startDegree, float toDegree, float smoothness = 2f)
|
||||
float startDegree, float toDegree, float smoothness = 2f)
|
||||
{
|
||||
DrawSector(vh, center, radius, color, color, startDegree, toDegree, 0, s_ClearColor32, smoothness);
|
||||
}
|
||||
|
||||
public static void DrawSector(VertexHelper vh, Vector3 center, float radius, Color32 color, Color32 toColor,
|
||||
float startDegree, float toDegree, int gradientType = 0, bool isYAxis = false, float smoothness = 2f)
|
||||
float startDegree, float toDegree, int gradientType = 0, bool isYAxis = false, float smoothness = 2f)
|
||||
{
|
||||
DrawSector(vh, center, radius, color, toColor, startDegree, toDegree, 0, s_ClearColor32, 0, smoothness,
|
||||
gradientType, isYAxis);
|
||||
@@ -1308,7 +1308,7 @@ namespace XUGL
|
||||
if (gap > 0 && Mathf.Abs(toDegree - startDegree) >= 360) gap = 0;
|
||||
radius -= borderWidth;
|
||||
smoothness = (smoothness < 0 ? 2f : smoothness);
|
||||
int segments = (int)((2 * Mathf.PI * radius) * (Mathf.Abs(toDegree - startDegree) / 360) / smoothness);
|
||||
int segments = (int) ((2 * Mathf.PI * radius) * (Mathf.Abs(toDegree - startDegree) / 360) / smoothness);
|
||||
if (segments < 1) segments = 1;
|
||||
float startAngle = startDegree * Mathf.Deg2Rad;
|
||||
float toAngle = toDegree * Mathf.Deg2Rad;
|
||||
@@ -1381,9 +1381,9 @@ namespace XUGL
|
||||
{
|
||||
p4 = new Vector3(p3.x, realCenter.y);
|
||||
var dist = p4.x - realCenter.x;
|
||||
var tcolor = Color32.Lerp(color, toColor, dist >= 0
|
||||
? dist / radius
|
||||
: Mathf.Min(radius + dist, radius) / radius);
|
||||
var tcolor = Color32.Lerp(color, toColor, dist >= 0 ?
|
||||
dist / radius :
|
||||
Mathf.Min(radius + dist, radius) / radius);
|
||||
if (isLeft && (i == segments || i == 0)) tcolor = toColor;
|
||||
DrawQuadrilateral(vh, lastP4, p2, p3, p4, lastColor, tcolor);
|
||||
lastP4 = p4;
|
||||
@@ -1500,7 +1500,7 @@ namespace XUGL
|
||||
var needSpace = gap != 0;
|
||||
var diffAngle = Mathf.Abs(toDegree - startDegree) * Mathf.Deg2Rad;
|
||||
|
||||
int segments = (int)((2 * Mathf.PI * outsideRadius) * (diffAngle * Mathf.Rad2Deg / 360) / smoothness);
|
||||
int segments = (int) ((2 * Mathf.PI * outsideRadius) * (diffAngle * Mathf.Rad2Deg / 360) / smoothness);
|
||||
if (segments < 1) segments = 1;
|
||||
float startAngle = startDegree * Mathf.Deg2Rad;
|
||||
float toAngle = toDegree * Mathf.Deg2Rad;
|
||||
@@ -1755,7 +1755,7 @@ namespace XUGL
|
||||
float lineWidth, Color32 lineColor, float smoothness)
|
||||
{
|
||||
var dist = Vector3.Distance(sp, ep);
|
||||
var segment = (int)(dist / (smoothness <= 0 ? 2f : smoothness));
|
||||
var segment = (int) (dist / (smoothness <= 0 ? 2f : smoothness));
|
||||
UGLHelper.GetBezierList2(ref s_CurvesPosList, sp, ep, segment, cp1, cp2);
|
||||
DrawCurvesInternal(vh, s_CurvesPosList, lineWidth, lineColor);
|
||||
}
|
||||
@@ -1898,4 +1898,4 @@ namespace XUGL
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user