| | |
| | | using UnityEditor; |
| | | using System; |
| | | |
| | | namespace vnxbqy.UI { |
| | | |
| | | [CustomEditor(typeof(CustomImage)), CanEditMultipleObjects] |
| | | public class CustomImageEidtor:Editor { |
| | | [CustomEditor(typeof(CustomImage)), CanEditMultipleObjects] |
| | | public class CustomImageEidtor:Editor { |
| | | |
| | | protected virtual void OnSceneGUI() { |
| | | var customImage = (CustomImage)this.target; |
| | | if(customImage.points != null) { |
| | | EditorGUI.BeginChangeCheck(); |
| | | for(var i = 0;i < customImage.points.Length;i++) { |
| | | var wh = customImage.points[i]; |
| | | var worldposition = customImage.transform.TransformPoint(wh); |
| | | var handlePosition = Handles.PositionHandle(worldposition,Quaternion.identity); |
| | | customImage.points[i] = customImage.transform.InverseTransformPoint(handlePosition); |
| | | } |
| | | |
| | | if(EditorGUI.EndChangeCheck()) { |
| | | customImage.SetVerticesDirty(); |
| | | } |
| | | |
| | | EditorUtility.SetDirty(customImage); |
| | | protected virtual void OnSceneGUI() { |
| | | var customImage = (CustomImage)this.target; |
| | | if(customImage.points != null) { |
| | | EditorGUI.BeginChangeCheck(); |
| | | for(var i = 0;i < customImage.points.Length;i++) { |
| | | var wh = customImage.points[i]; |
| | | var worldposition = customImage.transform.TransformPoint(wh); |
| | | var handlePosition = Handles.PositionHandle(worldposition,Quaternion.identity); |
| | | customImage.points[i] = customImage.transform.InverseTransformPoint(handlePosition); |
| | | } |
| | | |
| | | } |
| | | if(EditorGUI.EndChangeCheck()) { |
| | | customImage.SetVerticesDirty(); |
| | | } |
| | | |
| | | EditorUtility.SetDirty(customImage); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | |
| | | |