示例#1
0
        void AddImg(AddImgCmd cmd)
        {
                        #if FDB
            Should.False("nodeIdxDict.ContainsKey(cmd.id)", PtrIntDict.Contains(nodeDict, cmd.id));
            Should.True("Res.HasSpriteMeta(cmd.imgId)", Res.HasSpriteMeta(cmd.imgId));
                        #endif
            var node = (TpSprite *)Pool.Alloc(spritePool, sizeof(TpSprite));
            TpSprite.Init(node, Res.GetSpriteMeta(cmd.imgId));
            node->id = cmd.id;

            if (spritePool->shift != 0)
            {
                PtrLst.ShiftBase(spritePtrLst, spritePool->shift);
                PtrIntDict.ShiftBase(nodeDict, spritePool->shift);
                foreach (var esJob in esJobList)
                {
                    if (esJob is EsImgJob)
                    {
                        var esTpSpriteJob = (EsImgJob)esJob;
                        esTpSpriteJob.node = (TpSprite *)((byte *)esTpSpriteJob.node + spritePool->shift);
                    }
                }
                needDepthSort     = true;
                spritePool->shift = 0;
            }
            PtrLst.Push(spritePtrLst, node);
            PtrIntDict.Set(nodeDict, cmd.id, node);
        }
示例#2
0
文件: Res.cs 项目: DotLab/Futilef
 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);
         }
     }
 }