/// <summary> /// Draw the sprite preview. /// </summary> public override void OnPreviewGUI(Rect rect, GUIStyle background) { Texture2D tex = mTex.mainTexture as Texture2D; if (tex != null) { NGUIEditorTools.DrawTexture(tex, rect, mTex.uvRect, mTex.color); } }
/// <summary> /// Draw the sprite preview. /// </summary> public override void OnPreviewGUI(Rect rect, GUIStyle background) { if (mSprite != null && mSprite.sprite2D != null) { Texture2D tex = mSprite.mainTexture as Texture2D; if (tex != null) { NGUIEditorTools.DrawTexture(tex, rect, mSprite.uvRect, mSprite.color); } } }
/// <summary> /// Draw the font preview window. /// </summary> public override void OnPreviewGUI(Rect rect, GUIStyle background) { mFont = target as UIFont; if (mFont == null) { return; } Texture2D tex = mFont.texture; if (mView != View.Nothing && tex != null) { Material m = (mUseShader ? mFont.material : null); if (mView == View.Font && mFont.atlas != null && mFont.sprite != null) { NGUIEditorTools.DrawSprite(tex, rect, mFont.sprite, Color.white, m); } else { NGUIEditorTools.DrawTexture(tex, rect, new Rect(0f, 0f, 1f, 1f), Color.white, m); } } }