Example #1
0
 public override void getObj(string name, Action <Sprite, string> callBack, bool forceRemove = false)
 {
     //bundle池有
     if (AssetMgr.has(resName))
     {
         PackAsset pab = AssetMgr.get(resName);
         pab.getObj <Sprite>(name, callBack);
     }
     else
     {
         if (forceRemove)
         {
             Debug.LogError("加载资源失败 path " + resName);
         }
         else
         {
             if (!handler.ContainsKey(name))
             {
                 handler.Add(name, new List <Action <Sprite, string> >());
             }
             handler[name].Add(callBack);
             LoadItemMgr.add(resName, resPath, loadFinish);
         }
     }
 }
Example #2
0
 public virtual void getObj(Action <GameObject> callBack, bool forceRemove = false, int count = 0)
 {
     if (cacheLst.Count > count)
     {
         //缓存池有
         GameObject obj = cacheLst[0];
         cacheLst.RemoveAt(0);
         obj.transform.SetParent(null);
         callBack(obj);
     }
     else
     {
         //bundle池有
         if (AssetMgr.has(resName))
         {
             PackAsset pab = AssetMgr.get(resName);
             pab.getObj(callBack);
         }
         else
         {
             if (forceRemove)
             {
                 Debug.LogError("加载资源失败 path " + resName);
             }
             else
             {
                 //都没有 先load ab
                 if (handler == null)
                 {
                     handler = new List <Action <GameObject> >();
                 }
                 handler.Add(callBack);
                 LoadItemMgr.add(resName, resPath, loadFinish);
             }
         }
     }
 }