using UnityEngine;
using UnityEditor;
using System.Collections.Generic;
/// <summary>
/// Inspector class used to edit UITextureUV.
/// </summary>
[CustomEditor
(typeof(UITextureUV
))] public class UITextureUVInspector : UITextureInspector
{
private Rect mUV;
public override void OnInspectorGUI()
{
UITextureUV texture = target as UITextureUV;
GUILayout.BeginHorizontal();
GUILayout.Space(40f);
mUV = EditorGUILayout.RectField("UV", texture.UV);
GUILayout.EndHorizontal();
texture.UV = mUV;
base.OnInspectorGUI();
}
override protected void OnDrawTexture()
{
Texture2D tex = mWidget.mainTexture as Texture2D;
if (tex != null)
{
// Draw the atlas
EditorGUILayout.Separator();
Rect r
= NGUIEditorTools
.DrawSprite(tex,
new Rect
(0F, 0F, 1F, 1F
),
null);
// Draw the selection
NGUIEditorTools
.DrawOutline(r, mUV,
new Color
(0
.4f, 1f, 0f, 1f
));
// Sprite size label
Rect rect = GUILayoutUtility.GetRect(Screen.width, 18f);
EditorGUI.DropShadowLabel(rect, "Texture Size: " + tex.width + "x" + tex.height);
}
}
}