SpriteInfo[] FindSpriteInfos(SpriteInfo[] spr, string[] sName) { SpriteInfo[] uvs = new SpriteInfo[sName.Length]; for (int i = 0; i < sName.Length; i++) { string name = sName[i]; for (int j = 0; j < spr.Length; j++) { if (spr[j].Name == name) { uvs[i] = spr[j]; break; } } } return(uvs); }
SpriteInfo[] LoadSpriteData(FakeStructArray array) { var db = array.buffer; SpriteInfo[] spr = new SpriteInfo[array.Length]; for (int i = 0; i < spr.Length; i++) { unsafe { SpriteDataS *sp = (SpriteDataS *)array[i]; spr[i].rect = sp->rect; spr[i].pivot = sp->pivot; spr[i].Name = db.GetData(sp->name) as string; spr[i].uv = new Vector2[4]; spr[i].uv[0] = sp->uv0; spr[i].uv[1] = sp->uv1; spr[i].uv[2] = sp->uv2; spr[i].uv[3] = sp->uv3; } } return(spr); }
public bool FindSpriteInfo(string tName, string sName, ref SpriteInfo info) { if (infos == null) { return(false); } for (int i = 0; i < infos.Length; i++) { if (infos[i].Name == tName) { var spr = infos[i].sprites; for (int j = 0; j < spr.Length; j++) { if (spr[j].Name == sName) { info = spr[j]; return(true); } } } } return(false); }