Esempio n. 1
0
 public static void LoadAtlases(params int[] ids)
 {
     for (int i = 0, len = ids.Length; i < len; i += 1)
     {
         int id        = ids[i];
         var atlasMeta = TpAtlasMeta.New(Resources.Load <TextAsset>(id.ToString()).text);
         PtrLst.Push(atlasMetaLst, atlasMeta);
         for (int j = 0, jlen = atlasMeta->spriteCount; j < jlen; j += 1)
         {
             var spriteMeta = atlasMeta->sprites + j;
             PtrIntDict.Set(spriteMetaDict, spriteMeta->name, spriteMeta);
             // spriteMetaLstIdxDict[spriteMeta->name] = spriteMetaLst->count;
             // PtrLst.Push(spriteMetaLst, spriteMeta);
         }
     }
 }
Esempio n. 2
0
 public static void ReleaseAtlases(params int[] ids)
 {
     for (int i = 0, len = ids.Length; i < len; i += 1)
     {
         int id        = ids[i];
         var atlasMeta = (TpAtlasMeta *)atlasMetaLst->arr[i];
         if (atlasMeta->name == id)
         {
             ReleaseTexture(id);
             for (int j = 0, jlen = atlasMeta->spriteCount; j < jlen; j += 1)
             {
                 var spriteMeta = atlasMeta->sprites + j;
                 PtrIntDict.Remove(spriteMetaDict, spriteMeta->name);
             }
             TpAtlasMeta.Decon(atlasMeta); Mem.Free(atlasMeta);
             PtrLst.RemoveAt(atlasMetaLst, i);
             i -= 1;
         }
     }
 }