public bool Validate(UIAtlas atlas)
{
if (atlas == null)
{
return false;
}
if (!this.mIsValid)
{
if (string.IsNullOrEmpty(this.spriteName))
{
return false;
}
this.mSprite = (atlas == null) ? null : atlas.GetSprite(this.spriteName);
if (this.mSprite != null)
{
Texture texture = atlas.texture;
if (texture == null)
{
this.mSprite = null;
}
else
{
this.mUV = new Rect((float) this.mSprite.x, (float) this.mSprite.y, (float) this.mSprite.width, (float) this.mSprite.height);
this.mUV = NGUIMath.ConvertToTexCoords(this.mUV, texture.width, texture.height);
this.mOffsetX = this.mSprite.paddingLeft;
this.mOffsetY = this.mSprite.paddingTop;
this.mWidth = this.mSprite.width;
this.mHeight = this.mSprite.height;
this.mAdvance = this.mSprite.width + (this.mSprite.paddingLeft + this.mSprite.paddingRight);
this.mIsValid = true;
}
}
}
return (this.mSprite != null);
}