Пример #1
0
 public ResourceObserver AsyncLoadAsset(string path, System.Action<string, ResourceObserver> cb)
 {
     ResourceObserver ret = this.GetLoadedResState(path);
     if (null == ret)
     {
         ret = m_loader.AsyncLoadAsset(path, (string resPath, ResourceObserver resOb) => {
             if (null == this.GetResObserver(path) && null != ret && ret.isValid)
             {
                 m_resObservers.Add(ret.path, ret);
             }
             else
             {
                 ret.Release();
             }
             if (null != cb)
             {
                 cb(resPath, resOb);
             }
         });
     }
     else
     {
         if (null != cb)
         {
             Core.ins.timer.Add(() => {
                 cb(path, ret);
             }, 0);
         }
     }
     return ret;
 }
Пример #2
0
 public ResourceObserver LoadAsset(string path)
 {
     ResourceObserver ret = this.GetLoadedResState(path);
     if (null == ret)
     {
         ret = m_loader.LoadAsset(path);
         if (null != ret && ret.isValid && null == GetResObserver(path))
         {
             m_resObservers.Add(ret.path, ret);
         }
         else
         {
             ret.Release();
             ret = this.GetLoadedResState(path);
         }
     }
     return ret;
 }