public void UpdateUVs(bool force)
{
if ((type == Type.Sliced || type == Type.Tiled) && cachedTransform.localScale != mScale)
{
mScale = cachedTransform.localScale;
mChanged = true;
}
if (isValid && (force
#if UNITY_EDITOR
|| !Application.isPlaying && (mOuter != mSprite.outer || mInner != mSprite.inner)
#endif
))
{
Texture tex = mainTexture;
if (tex != null)
{
mInner = mSprite.inner;
mOuter = mSprite.outer;
mInnerUV = mInner;
mOuterUV = mOuter;
if (atlas.coordinates == UIAtlas.Coordinates.Pixels)
{
mOuterUV = NGUIMath.ConvertToTexCoords(mOuterUV, tex.width, tex.height);
mInnerUV = NGUIMath.ConvertToTexCoords(mInnerUV, tex.width, tex.height);
}
}
}
}
public void unexecute() { LayoutEditorWindow.RequestRepaint(); #if NGUI_3_5_8 foreach (var p in UIPanel.list) { p.RebuildAllDrawCalls(); } #else UIPanel.SetDirty(); #endif // sprite 实时刷新 foreach (UnityEngine.Object obj in Objs) { if (obj is UIWidget) { (obj as UIWidget).MarkAsChanged(); } } if (CmdName == "Sprite Change" && Objs[0] is UISprite) { UISprite sprite = Objs[0] as UISprite; #if NGUI_3_5_8 sprite.MarkAsChanged(); #else if (sprite.isValid) { sprite.UpdateUVs(true); } #endif } }