//-------------------------------------------------------- 
 | 
//    [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); 
 | 
            } 
 | 
  
 | 
        } 
 | 
  
 | 
  
 | 
    } 
 | 
  
 | 
} 
 |