三国卡牌客户端基础资源仓库
hch
2025-06-06 2feb3add98556a7b6243ba01a0119bfb5cbab259
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Monday, August 14, 2017
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEditor;
 
 
[CustomEditor(typeof(PolylineImage)), CanEditMultipleObjects]
public class PolylineImageEditor:Editor {
 
    protected virtual void OnSceneGUI() {
 
        var polyline = (PolylineImage)this.target;
 
        if(polyline.points != null) {
            EditorGUI.BeginChangeCheck();
 
            for(var i = 0;i < polyline.points.Length;i++) {
                var wh = polyline.points[i];
                var worldposition = polyline.transform.TransformPoint(wh);
                var handlePosition = Handles.PositionHandle(worldposition,Quaternion.identity);
                polyline.points[i] = polyline.transform.InverseTransformPoint(handlePosition);
            }
 
            if(EditorGUI.EndChangeCheck()) {
                polyline.SetVerticesDirty();
            }
 
            EditorUtility.SetDirty(polyline);
        }
 
    }
 
 
}