本文整理汇总了C#中UISpriteData类的典型用法代码示例。如果您正苦于以下问题:C# UISpriteData类的具体用法?C# UISpriteData怎么用?C# UISpriteData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UISpriteData类属于命名空间,在下文中一共展示了UISpriteData类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CopyBorderFrom
public void CopyBorderFrom(UISpriteData sd)
{
this.borderLeft = sd.borderLeft;
this.borderRight = sd.borderRight;
this.borderTop = sd.borderTop;
this.borderBottom = sd.borderBottom;
}
开发者ID:floatyears,项目名称:Decrypt,代码行数:7,代码来源:UISpriteData.cs
示例2: SetAtlasSprite
protected void SetAtlasSprite(UISpriteData sprite){
mSpriteSet = true;
if (sprite != null) {
mSprite = sprite;
mSpriteName = mSprite.name;
} else {
mSpriteName = (mSprite!=null) ? mSprite.name : "";
mSprite = sprite;
}
}
开发者ID:ziyihu,项目名称:Tower-Defence,代码行数:10,代码来源:QuadTextureNgui.cs
示例3: CopyFrom
public void CopyFrom(UISpriteData sd)
{
this.name = sd.name;
this.x = sd.x;
this.y = sd.y;
this.width = sd.width;
this.height = sd.height;
this.borderLeft = sd.borderLeft;
this.borderRight = sd.borderRight;
this.borderTop = sd.borderTop;
this.borderBottom = sd.borderBottom;
this.paddingLeft = sd.paddingLeft;
this.paddingRight = sd.paddingRight;
this.paddingTop = sd.paddingTop;
this.paddingBottom = sd.paddingBottom;
}
开发者ID:floatyears,项目名称:Decrypt,代码行数:16,代码来源:UISpriteData.cs
示例4: AddSprite
/// <summary>
/// Add a new sprite to the atlas, given the texture it's coming from and the packed rect within the atlas.
/// </summary>
static UISpriteData AddSprite(List<UISpriteData> sprites, SpriteEntry se)
{
// See if this sprite already exists
foreach (UISpriteData sp in sprites)
{
if (sp.name == se.name)
{
sp.CopyFrom(se);
return sp;
}
}
UISpriteData sprite = new UISpriteData();
sprite.CopyFrom(se);
sprites.Add(sprite);
return sprite;
}
开发者ID:TomMulvaney,项目名称:JoyGatsby_Runner,代码行数:20,代码来源:UIAtlasMaker.cs
示例5: CopyFrom
/// <summary>
/// Copy all values of the specified sprite data.
/// </summary>
public void CopyFrom (UISpriteData sd)
{
name = sd.name;
x = sd.x;
y = sd.y;
width = sd.width;
height = sd.height;
borderLeft = sd.borderLeft;
borderRight = sd.borderRight;
borderTop = sd.borderTop;
borderBottom = sd.borderBottom;
paddingLeft = sd.paddingLeft;
paddingRight = sd.paddingRight;
paddingTop = sd.paddingTop;
paddingBottom = sd.paddingBottom;
}
开发者ID:1001ye-qiang,项目名称:RTP,代码行数:23,代码来源:UISpriteData.cs
示例6: Start
// Use this for initialization
void Start()
{
Texture2D textrue = AvatarAssetManager.s.getTexture("skin/cloth/1");
Shader shader = Shader.Find("Unlit/Transparent Colored");
Material mat = new Material(shader);
mat.mainTexture = textrue;
UISpriteData uiSpData = new UISpriteData();
uiSpData.width = textrue.width;
uiSpData.height = textrue.height;
UIAtlas atlas = gameObject.AddComponent<UIAtlas>();
atlas.spriteMaterial = mat;
List<UISpriteData> list = new List<UISpriteData>();
list.Add(uiSpData);
atlas.spriteList = list;
UISprite sp = gameObject.AddComponent<UISprite>();
sp.atlas = atlas;
sp.MakePixelPerfect();
}
开发者ID:mengqc,项目名称:MToolbox,代码行数:20,代码来源:test.cs
示例7: SetUp
public void SetUp()
{
GameObject go = new GameObject();
atlas = go.AddComponent<UIAtlas>();
sprite = go.AddComponent<UISprite>();
sprite.atlas = atlas;
sprite.spriteName = "testSprite";
UISpriteData[] spriteDatas = new UISpriteData[] {
new UISpriteData() {
name = "available"
},
new UISpriteData() {
name = "unused"
}
};
sprite.spriteName = "available";
atlas.spriteList.AddRange(spriteDatas);
usages = new AtlasUsages(atlas);
}
开发者ID:renao,项目名称:UnityTools,代码行数:22,代码来源:TestAtlasUsages.cs
示例8: GetAltasSprite
public UISpriteData GetAltasSprite(){
if (!mSpriteSet) {
mSprite = null;
}
if (mSprite == null && Atlas != null) {
if(!string.IsNullOrEmpty(mSpriteName)){
UISpriteData sp = Atlas.GetSprite(mSpriteName);
if(sp == null) return null;
SetAtlasSprite(sp);
}
if(mSprite == null && Atlas.spriteList.Count > 0){
UISpriteData sp = Atlas.spriteList[0];
if(sp == null) return null;
SetAtlasSprite(sp);
if(mSprite == null){
this.PRINT(Atlas.name+"seems to have a null sprite");
return null;
}
mSpriteName = mSprite.name;
}
}
return mSprite;
}
开发者ID:ziyihu,项目名称:Tower-Defence,代码行数:23,代码来源:QuadTextureNgui.cs
示例9: ExtractSprite
/// <summary>
/// Extract the specified sprite from the atlas texture.
/// </summary>
static SpriteEntry ExtractSprite (UISpriteData es, Color32[] oldPixels, int oldWidth, int oldHeight)
{
int xmin = Mathf.Clamp(es.x, 0, oldWidth);
int ymin = Mathf.Clamp(es.y, 0, oldHeight);
int xmax = Mathf.Min(xmin + es.width, oldWidth - 1);
int ymax = Mathf.Min(ymin + es.height, oldHeight - 1);
int newWidth = Mathf.Clamp(es.width, 0, oldWidth);
int newHeight = Mathf.Clamp(es.height, 0, oldHeight);
if (newWidth == 0 || newHeight == 0) return null;
Color32[] newPixels = new Color32[newWidth * newHeight];
for (int y = 0; y < newHeight; ++y)
{
int cy = ymin + y;
if (cy > ymax) cy = ymax;
for (int x = 0; x < newWidth; ++x)
{
int cx = xmin + x;
if (cx > xmax) cx = xmax;
int newIndex = (newHeight - 1 - y) * newWidth + x;
int oldIndex = (oldHeight - 1 - cy) * oldWidth + cx;
newPixels[newIndex] = oldPixels[oldIndex];
}
}
// Create a new sprite
SpriteEntry sprite = new SpriteEntry();
sprite.CopyFrom(es);
sprite.SetRect(0, 0, newWidth, newHeight);
sprite.temporaryTexture = true;
sprite.tex = new Texture2D(newWidth, newHeight);
sprite.tex.SetPixels32(newPixels);
sprite.tex.Apply();
return sprite;
}
开发者ID:ElectrikSheep,项目名称:E_Project,代码行数:44,代码来源:UIAtlasMaker.cs
示例10: Upgrade
/// <summary>
/// Performs an upgrade from the legacy way of specifying data to the new one.
/// </summary>
bool Upgrade()
{
if (mSprites.Count == 0 && sprites.Count > 0)
{
Texture tex = material.mainTexture;
int width = (tex != null) ? tex.width : 512;
int height = (tex != null) ? tex.height : 512;
for (int i = 0; i < sprites.Count; ++i)
{
Sprite old = sprites[i];
Rect outer = old.outer;
Rect inner = old.inner;
if (mCoordinates == Coordinates.TexCoords)
{
NGUIMath.ConvertToPixels(outer, width, height, true);
NGUIMath.ConvertToPixels(inner, width, height, true);
}
UISpriteData sd = new UISpriteData();
sd.name = old.name;
sd.x = Mathf.RoundToInt(outer.xMin);
sd.y = Mathf.RoundToInt(outer.yMin);
sd.width = Mathf.RoundToInt(outer.width);
sd.height = Mathf.RoundToInt(outer.height);
sd.paddingLeft = Mathf.RoundToInt(old.paddingLeft * outer.width);
sd.paddingRight = Mathf.RoundToInt(old.paddingRight * outer.width);
sd.paddingBottom = Mathf.RoundToInt(old.paddingBottom * outer.height);
sd.paddingTop = Mathf.RoundToInt(old.paddingTop * outer.height);
sd.borderLeft = Mathf.RoundToInt(inner.xMin - outer.xMin);
sd.borderRight = Mathf.RoundToInt(outer.xMax - inner.xMax);
sd.borderBottom = Mathf.RoundToInt(inner.yMin - outer.yMin);
sd.borderTop = Mathf.RoundToInt(outer.yMax - inner.yMax);
mSprites.Add(sd);
}
sprites.Clear();
#if UNITY_EDITOR
UnityEditor.EditorUtility.SetDirty(this);
UnityEditor.AssetDatabase.SaveAssets();
#endif
return true;
}
return false;
}
开发者ID:jennydvr,项目名称:Speedrun,代码行数:52,代码来源:UIAtlas.cs
示例11: GetAtlasSprite
public UISpriteData GetAtlasSprite()
{
if (!this.mSpriteSet)
{
this.mSprite = null;
}
if ((this.mSprite == null) && (this.mAtlas != null))
{
if (!string.IsNullOrEmpty(this.mSpriteName))
{
UISpriteData sprite = this.mAtlas.GetSprite(this.mSpriteName);
if (sprite == null)
{
return null;
}
this.SetAtlasSprite(sprite);
}
if ((this.mSprite == null) && (this.mAtlas.spriteList.Count > 0))
{
UISpriteData sp = this.mAtlas.spriteList[0];
if (sp == null)
{
return null;
}
this.SetAtlasSprite(sp);
if (this.mSprite == null)
{
Debug.LogError(this.mAtlas.name + " seems to have a null sprite!");
return null;
}
this.mSpriteName = this.mSprite.name;
}
}
return this.mSprite;
}
开发者ID:Lessica,项目名称:Something-of-SHIPWAR-GAMES,代码行数:35,代码来源:UISprite.cs
示例12: AddDepth
/// <summary>
/// Add a dark shadowy outline around the sprite, giving it some visual depth.
/// </summary>
void AddDepth (UISpriteData sprite)
{
List<UIAtlasMaker.SpriteEntry> sprites = new List<UIAtlasMaker.SpriteEntry>();
UIAtlasMaker.ExtractSprites(mAtlas, sprites);
UIAtlasMaker.SpriteEntry se = null;
for (int i = 0; i < sprites.Count; ++i)
{
if (sprites[i].name == sprite.name)
{
se = sprites[i];
break;
}
}
if (se != null)
{
int w1 = se.tex.width;
int h1 = se.tex.height;
int w2 = w1 + 2;
int h2 = h1 + 2;
Color32[] c1 = se.tex.GetPixels32();
Color32[] c2 = new Color32[w2 * h2];
for (int y2 = 0; y2 < h2; ++y2)
{
int y1 = NGUIMath.ClampIndex(y2 - 1, h1);
for (int x2 = 0; x2 < w2; ++x2)
{
int x1 = NGUIMath.ClampIndex(x2 - 1, w1);
int i2 = x2 + y2 * w2;
c2[i2] = c1[x1 + y1 * w1];
if (x2 == 0 || x2 + 1 == w2 || y2 == 0 || y2 + 1 == h2)
c2[i2].a = 0;
}
}
for (int y2 = 0; y2 < h2; ++y2)
{
for (int x2 = 0; x2 < w2; ++x2)
{
int index = x2 + y2 * w2;
Color32 uc = c2[index];
if (uc.a == 255) continue;
Color original = uc;
float val = original.a * 4f;
int count = 4;
float div1 = 1f / 255f;
float div2 = 2f / 255f;
if (x2 != 0)
{
val += c2[x2 - 1 + y2 * w2].a * div2;
count += 2;
}
if (x2 + 1 != w2)
{
val += c2[x2 + 1 + y2 * w2].a * div2;
count += 2;
}
if (y2 != 0)
{
val += c2[x2 + (y2 - 1) * w2].a * div2;
count += 2;
}
if (y2 + 1 != h2)
{
val += c2[x2 + (y2 + 1) * w2].a * div2;
count += 2;
}
if (x2 != 0 && y2 != 0)
{
val += c2[x2 - 1 + (y2 - 1) * w2].a * div1;
++count;
}
if (x2 != 0 && y2 + 1 != h2)
{
val += c2[x2 - 1 + (y2 + 1) * w2].a * div1;
++count;
}
if (x2 + 1 != w2 && y2 != 0)
{
val += c2[x2 + 1 + (y2 - 1) * w2].a * div1;
++count;
}
//.........这里部分代码省略.........
开发者ID:Jefferson-Henrique,项目名称:fuzzy-char-creation,代码行数:101,代码来源:UIAtlasInspector.cs
示例13: UISpriteData
public static int UISpriteData(IntPtr L)
{
UISpriteData ret = new UISpriteData(
);
LuaStatic.addGameObject2Lua(L,ret,"UISpriteData");
return 1;
}
开发者ID:fengqk,项目名称:Art,代码行数:7,代码来源:LuaUISpriteData.cs
示例14: LoadSpriteData
/// <summary>
/// Parse the specified JSon file, loading sprite information for the specified atlas.
/// </summary>
static void LoadSpriteData (UIAtlas atlas, Hashtable decodedHash)
{
if (decodedHash == null || atlas == null) return;
List<UISpriteData> oldSprites = atlas.spriteList;
atlas.spriteList = new List<UISpriteData>();
Hashtable frames = (Hashtable)decodedHash["frames"];
foreach (System.Collections.DictionaryEntry item in frames)
{
UISpriteData newSprite = new UISpriteData();
newSprite.name = item.Key.ToString();
bool exists = false;
// Check to see if this sprite exists
foreach (UISpriteData oldSprite in oldSprites)
{
if (oldSprite.name.Equals(newSprite.name, StringComparison.OrdinalIgnoreCase))
{
exists = true;
break;
}
}
// Get rid of the extension if the sprite doesn't exist
// The extension is kept for backwards compatibility so it's still possible to update older atlases.
if (!exists)
{
newSprite.name = newSprite.name.Replace(".png", "");
newSprite.name = newSprite.name.Replace(".tga", "");
}
// Extract the info we need from the TexturePacker json file, mainly uvRect and size
Hashtable table = (Hashtable)item.Value;
Hashtable frame = (Hashtable)table["frame"];
int frameX = int.Parse(frame["x"].ToString());
int frameY = int.Parse(frame["y"].ToString());
int frameW = int.Parse(frame["w"].ToString());
int frameH = int.Parse(frame["h"].ToString());
// Read the rotation value
//newSprite.rotated = (bool)table["rotated"];
newSprite.x = frameX;
newSprite.y = frameY;
newSprite.width = frameW;
newSprite.height = frameH;
// Support for trimmed sprites
Hashtable sourceSize = (Hashtable)table["sourceSize"];
Hashtable spriteSize = (Hashtable)table["spriteSourceSize"];
if (spriteSize != null && sourceSize != null)
{
// TODO: Account for rotated sprites
if (frameW > 0)
{
int spriteX = int.Parse(spriteSize["x"].ToString());
int spriteW = int.Parse(spriteSize["w"].ToString());
int sourceW = int.Parse(sourceSize["w"].ToString());
newSprite.paddingLeft = spriteX;
newSprite.paddingRight = sourceW - (spriteX + spriteW);
}
if (frameH > 0)
{
int spriteY = int.Parse(spriteSize["y"].ToString());
int spriteH = int.Parse(spriteSize["h"].ToString());
int sourceH = int.Parse(sourceSize["h"].ToString());
newSprite.paddingTop = spriteY;
newSprite.paddingBottom = sourceH - (spriteY + spriteH);
}
}
// If the sprite was present before, see if we can copy its inner rect
foreach (UISpriteData oldSprite in oldSprites)
{
if (oldSprite.name.Equals(newSprite.name, StringComparison.OrdinalIgnoreCase))
{
newSprite.borderLeft = oldSprite.borderLeft;
newSprite.borderRight = oldSprite.borderRight;
newSprite.borderBottom = oldSprite.borderBottom;
newSprite.borderTop = oldSprite.borderTop;
}
}
// Add this new sprite
atlas.spriteList.Add(newSprite);
}
// Sort imported sprites alphabetically
atlas.spriteList.Sort(CompareSprites);
//.........这里部分代码省略.........
开发者ID:OvertimeStudios,项目名称:CreepyBuster,代码行数:101,代码来源:NGUIJson.cs
示例15: SetAtlasSprite
protected void SetAtlasSprite(UISpriteData sp)
{
base.mChanged = true;
this.mSpriteSet = true;
if (sp != null)
{
this.mSprite = sp;
this.mSpriteName = this.mSprite.name;
}
else
{
this.mSpriteName = (this.mSprite == null) ? string.Empty : this.mSprite.name;
this.mSprite = sp;
}
}
开发者ID:Lessica,项目名称:Something-of-SHIPWAR-GAMES,代码行数:15,代码来源:UISprite.cs
示例16: AddOutline
/// <summary>
/// Add a dark shadowy outline around the sprite, giving it some visual depth.
/// </summary>
void AddOutline (UISpriteData sprite)
{
List<UIAtlasMaker.SpriteEntry> sprites = new List<UIAtlasMaker.SpriteEntry>();
UIAtlasMaker.ExtractSprites(mAtlas, sprites);
UIAtlasMaker.SpriteEntry se = null;
for (int i = 0; i < sprites.Count; ++i)
{
if (sprites[i].name == sprite.name)
{
se = sprites[i];
break;
}
}
if (se != null)
{
int w1 = se.tex.width;
int h1 = se.tex.height;
int w2 = w1 + 2;
int h2 = h1 + 2;
Color32[] c2 = NGUIEditorTools.AddBorder(se.tex.GetPixels32(), w1, h1);
NGUIEditorTools.AddDepth(c2, w2, h2, NGUISettings.backgroundColor);
if (se.temporaryTexture) DestroyImmediate(se.tex);
if ((se.borderLeft | se.borderRight | se.borderBottom | se.borderTop) != 0)
{
++se.borderLeft;
++se.borderRight;
++se.borderTop;
++se.borderBottom;
}
se.tex = new Texture2D(w2, h2);
se.tex.name = sprite.name;
se.tex.SetPixels32(c2);
se.tex.Apply();
se.temporaryTexture = true;
UIAtlasMaker.UpdateAtlas(mAtlas, sprites);
DestroyImmediate(se.tex);
se.tex = null;
}
}
开发者ID:Kaiymu,项目名称:SpaceBallBlaster,代码行数:52,代码来源:UIAtlasInspector.cs
示例17: AddTiledBorder
/// <summary>
/// Add a border around the sprite that copies the pixels from the opposite side, making it possible for the sprite to tile without seams.
/// </summary>
void AddTiledBorder (UISpriteData sprite)
{
List<UIAtlasMaker.SpriteEntry> sprites = new List<UIAtlasMaker.SpriteEntry>();
UIAtlasMaker.ExtractSprites(mAtlas, sprites);
UIAtlasMaker.SpriteEntry se = null;
for (int i = 0; i < sprites.Count; ++i)
{
if (sprites[i].name == sprite.name)
{
se = sprites[i];
break;
}
}
if (se != null)
{
int w1 = se.tex.width - se.borderLeft - se.borderRight;
int h1 = se.tex.height - se.borderBottom - se.borderTop;
int w2 = se.tex.width + 2;
int h2 = se.tex.height + 2;
Color32[] c1 = se.tex.GetPixels32();
Color32[] c2 = new Color32[w2 * h2];
for (int y2 = 0; y2 < h2; ++y2)
{
int y1 = se.borderBottom + NGUIMath.RepeatIndex(y2 - se.borderBottom - 1, h1);
for (int x2 = 0; x2 < w2; ++x2)
{
int x1 = se.borderLeft + NGUIMath.RepeatIndex(x2 - se.borderLeft - 1, w1);
c2[x2 + y2 * w2] = c1[x1 + y1 * se.tex.width];
}
}
if (se.temporaryTexture) DestroyImmediate(se.tex);
++se.borderLeft;
++se.borderRight;
++se.borderTop;
++se.borderBottom;
se.tex = new Texture2D(w2, h2);
se.tex.name = sprite.name;
se.tex.SetPixels32(c2);
se.tex.Apply();
se.temporaryTexture = true;
UIAtlasMaker.UpdateAtlas(mAtlas, sprites);
DestroyImmediate(se.tex);
se.tex = null;
}
}
开发者ID:Kaiymu,项目名称:SpaceBallBlaster,代码行数:60,代码来源:UIAtlasInspector.cs
示例18: AddTransparentBorder
/// <summary>
/// Add a transparent border around the sprite.
/// </summary>
void AddTransparentBorder (UISpriteData sprite)
{
List<UIAtlasMaker.SpriteEntry> sprites = new List<UIAtlasMaker.SpriteEntry>();
UIAtlasMaker.ExtractSprites(mAtlas, sprites);
UIAtlasMaker.SpriteEntry se = null;
for (int i = 0; i < sprites.Count; ++i)
{
if (sprites[i].name == sprite.name)
{
se = sprites[i];
break;
}
}
if (se != null)
{
int w1 = se.tex.width;
int h1 = se.tex.height;
int w2 = w1 + 2;
int h2 = h1 + 2;
Color32[] c1 = se.tex.GetPixels32();
Color32[] c2 = new Color32[w2 * h2];
for (int y2 = 0; y2 < h2; ++y2)
{
int y1 = NGUIMath.ClampIndex(y2 - 1, h1);
for (int x2 = 0; x2 < w2; ++x2)
{
int x1 = NGUIMath.ClampIndex(x2 - 1, w1);
int i2 = x2 + y2 * w2;
c2[i2] = c1[x1 + y1 * w1];
if (x2 == 0 || x2 + 1 == w2 || y2 == 0 || y2 + 1 == h2)
c2[i2].a = 0;
}
}
if (se.temporaryTexture) DestroyImmediate(se.tex);
++se.borderLeft;
++se.borderRight;
++se.borderTop;
++se.borderBottom;
se.tex = new Texture2D(w2, h2);
se.tex.name = sprite.name;
se.tex.SetPixels32(c2);
se.tex.Apply();
se.temporaryTexture = true;
UIAtlasMaker.UpdateAtlas(mAtlas, sprites);
DestroyImmediate(se.tex);
se.tex = null;
}
}
开发者ID:Jefferson-Henrique,项目名称:fuzzy-char-creation,代码行数:64,代码来源:UIAtlasInspector.cs
示例19: CropBorder
/// <summary>
/// Crop the border pixels around the sprite.
/// </summary>
void CropBorder (UISpriteData sprite)
{
List<UIAtlasMaker.SpriteEntry> sprites = new List<UIAtlasMaker.SpriteEntry>();
UIAtlasMaker.ExtractSprites(mAtlas, sprites);
UIAtlasMaker.SpriteEntry se = null;
for (int i = 0; i < sprites.Count; ++i)
{
if (sprites[i].name == sprite.name)
{
se = sprites[i];
break;
}
}
if (se != null)
{
int w1 = se.tex.width;
int h1 = se.tex.height;
int w2 = w1 - se.borderLeft - se.borderRight;
int h2 = h1 - se.borderTop - se.borderBottom;
Color32[] c1 = se.tex.GetPixels32();
Color32[] c2 = new Color32[w2 * h2];
for (int y2 = 0; y2 < h2; ++y2)
{
int y1 = y2 + se.borderBottom;
for (int x2 = 0; x2 < w2; ++x2)
{
int x1 = x2 + se.borderLeft;
c2[x2 + y2 * w2] = c1[x1 + y1 * w1];
}
}
se.borderLeft = 0;
se.borderRight = 0;
se.borderTop = 0;
se.borderBottom = 0;
if (se.temporaryTexture) DestroyImmediate(se.tex);
se.tex = new Texture2D(w2, h2);
se.tex.name = sprite.name;
se.tex.SetPixels32(c2);
se.tex.Apply();
se.temporaryTexture = true;
UIAtlasMaker.UpdateAtlas(mAtlas, sprites);
DestroyImmediate(se.tex);
se.tex = null;
}
}
开发者ID:Kaiymu,项目名称:SpaceBallBlaster,代码行数:60,代码来源:UIAtlasInspector.cs
示例20: GetAtlasSprite
/// <summary>
/// Retrieve the atlas sprite referenced by the spriteName field.
/// </summary>
public UISpriteData GetAtlasSprite ()
{
if (!mSpriteSet) mSprite = null;
if (mSprite == null && mAtlas != null)
{
if (!string.IsNullOrEmpty(mSpriteName))
{
UISpriteData sp = mAtlas.GetSprite(mSpriteName);
if (sp == null) return null;
SetAtlasSprite(sp);
}
if (mSprite == null && mAtlas.spriteList.Count > 0)
{
UISpriteData sp = mAtlas.spriteList[0];
if (sp == null) return null;
SetAtlasSprite(sp);
if (mSprite == null)
{
Debug.LogError(mAtlas.name + " seems to have a null sprite!");
return null;
}
mSpriteName = mSprite.name;
}
}
return mSprite;
}
开发者ID:Jetblacktsunami,项目名称:TreasureCove,代码行数:33,代码来源:UISprite.cs
注:本文中的UISpriteData类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论