8 [CustomEditor(typeof(CUIImage))]
13 base.OnInspectorGUI();
17 EditorGUILayout.Space();
19 EditorGUI.BeginChangeCheck();
21 EditorGUI.BeginDisabledGroup(!(script.
UIImage.type ==
Image.Type.Sliced || script.
UIImage.type ==
Image.Type.Tiled));
22 Vector2 newCornerRatio = EditorGUILayout.Vector2Field(
"Corner Ratio", script.
cornerPosRatio);
23 if (EditorGUI.EndChangeCheck())
25 Undo.RecordObject(script,
"Change Corner Ratio");
26 EditorUtility.SetDirty(script);
30 if (GUILayout.Button(
"Use native corner ratio"))
32 Undo.RecordObject(script,
"Change Corner Ratio");
33 EditorUtility.SetDirty(script);
39 EditorGUILayout.HelpBox(
"With CUIImage, you can also adjust the size of the corners for filled or sliced Image. The grey sphere in the editor scene could also be moved to change the corner's size.", MessageType.Info);
43 EditorGUILayout.HelpBox(
"With CUIImage, you can also adjust the size of the corners for filled or sliced Image. You need to set Image to filled or sliced to use this feature.", MessageType.Info);
46 EditorGUI.EndDisabledGroup();
57 Vector3 cornerPos = Vector3.zero;
69 Handles.color =
Color.gray;
70 EditorGUI.BeginChangeCheck();
71 Vector3 newCornerPos = Handles.FreeMoveHandle(script.transform.TransformPoint(cornerPos), script.transform.rotation, HandleUtility.GetHandleSize(script.transform.TransformPoint(cornerPos)) / 7, Vector3.one, Handles.SphereHandleCap);
72 Handles.Label(newCornerPos,
string.Format(
"Corner Mover"));
74 newCornerPos = script.transform.InverseTransformPoint(newCornerPos);
76 if (EditorGUI.EndChangeCheck())
78 Undo.RecordObject(script,
"Move Corner");
79 EditorUtility.SetDirty(script);
81 script.
cornerPosRatio =
new Vector2(newCornerPos.x, newCornerPos.y);
System.Drawing.Image Image
Vector3 GetBCurveSandwichSpacePoint(float _xTime, float _yTime)
override void OnInspectorGUI()
override void OnSceneGUI()
Vector2 OriCornerPosRatio
Credit Erdener Gonenc - @PixelEnvision.