少年修仙传客户端基础资源
lwb
2020-11-20 523a8c5b8de799aeaeaa7287f0b4f9e2edf339ee
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
38
39
40
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Monday, August 14, 2017
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEditor;
 
namespace Snxxz.UI {
 
    [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);
            }
 
        }
 
 
    }
 
}