From 09bc892c7283df8757a07b646d5af21ddaa263d1 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期四, 06 十一月 2025 18:22:34 +0800
Subject: [PATCH] 164 天子的考验-客户端
---
Main/Component/UI/Decorate/Graph/PolylineImage.cs | 94 +++++++++++++++++++++++------------------------
1 files changed, 46 insertions(+), 48 deletions(-)
diff --git a/Main/Component/UI/Decorate/Graph/PolylineImage.cs b/Main/Component/UI/Decorate/Graph/PolylineImage.cs
index 8aaddb2..e454443 100644
--- a/Main/Component/UI/Decorate/Graph/PolylineImage.cs
+++ b/Main/Component/UI/Decorate/Graph/PolylineImage.cs
@@ -1,66 +1,63 @@
锘�//--------------------------------------------------------
-// [Author]: 绗簩涓栫晫
+// [Author]: 鐜╀釜娓告垙
// [ Date ]: Thursday, August 10, 2017
//--------------------------------------------------------
using UnityEngine;
using UnityEngine.UI;
-namespace vnxbqy.UI {
- /// <summary>
- /// 杩欎釜缁勪欢鎺ユ敹涓�浜涢《鐐癸紝缁樺埗鍑烘按骞冲拰鍨傜洿鐨勭嚎銆�
- /// </summary>
- public class PolylineImage:Graphic {
+/// <summary>
+/// 杩欎釜缁勪欢鎺ユ敹涓�浜涢《鐐癸紝缁樺埗鍑烘按骞冲拰鍨傜洿鐨勭嚎銆�
+/// </summary>
+public class PolylineImage:Graphic {
- [SerializeField]
- float m_Width;
- public float width {
- get {
- return this.m_Width;
- }
- set {
- this.m_Width = value;
- base.SetVerticesDirty();
- }
+ [SerializeField]
+ float m_Width;
+ public float width {
+ get {
+ return this.m_Width;
+ }
+ set {
+ this.m_Width = value;
+ base.SetVerticesDirty();
+ }
+ }
+
+ [SerializeField]
+ Vector2[] m_Points;
+ public Vector2[] points {
+ get {
+ return this.m_Points;
+ }
+ set {
+ this.m_Points = value;
+ base.SetVerticesDirty();
+ }
+ }
+
+ protected override void OnPopulateMesh(VertexHelper vh) {
+ vh.Clear();
+ if(this.points == null || this.points.Length < 2) {
+ return;
}
- [SerializeField]
- Vector2[] m_Points;
- public Vector2[] points {
- get {
- return this.m_Points;
- }
- set {
- this.m_Points = value;
- base.SetVerticesDirty();
- }
- }
+ var hw = this.width * 0.5f;
- protected override void OnPopulateMesh(VertexHelper vh) {
- vh.Clear();
- if(this.points == null || this.points.Length < 2) {
- return;
- }
+ for(var i = 0;i < this.points.Length - 1;i++) {
+ var point = this.points[i];
+ var nextPoint = this.points[i + 1];
- var hw = this.width * 0.5f;
+ var xReversal = point.x > nextPoint.x;
+ var yReversal = point.y > nextPoint.y;
- for(var i = 0;i < this.points.Length - 1;i++) {
- var point = this.points[i];
- var nextPoint = this.points[i + 1];
+ var positions = new Vector3[4];
+ positions[0] = new Vector2(xReversal ? point.x + hw : point.x - hw,yReversal ? point.y + hw : point.y - hw);
+ positions[1] = new Vector2(xReversal ? nextPoint.x - hw : nextPoint.x + hw,yReversal ? point.y + hw : point.y - hw);
+ positions[2] = new Vector2(xReversal ? nextPoint.x - hw : nextPoint.x + hw,yReversal ? nextPoint.y - hw : nextPoint.y + hw);
+ positions[3] = new Vector2(xReversal ? point.x + hw : point.x - hw,yReversal ? nextPoint.y - hw : nextPoint.y + hw);
- var xReversal = point.x > nextPoint.x;
- var yReversal = point.y > nextPoint.y;
-
- var positions = new Vector3[4];
- positions[0] = new Vector2(xReversal ? point.x + hw : point.x - hw,yReversal ? point.y + hw : point.y - hw);
- positions[1] = new Vector2(xReversal ? nextPoint.x - hw : nextPoint.x + hw,yReversal ? point.y + hw : point.y - hw);
- positions[2] = new Vector2(xReversal ? nextPoint.x - hw : nextPoint.x + hw,yReversal ? nextPoint.y - hw : nextPoint.y + hw);
- positions[3] = new Vector2(xReversal ? point.x + hw : point.x - hw,yReversal ? nextPoint.y - hw : nextPoint.y + hw);
-
- UIUtility.AddQuad(vh,positions,color,new Vector2[4] { Vector2.one,Vector2.one,Vector2.one,Vector2.one });
- }
-
+ UIUtility.AddQuad(vh,positions,color,new Vector2[4] { Vector2.one,Vector2.one,Vector2.one,Vector2.one });
}
}
@@ -69,3 +66,4 @@
+
--
Gitblit v1.8.0