Example #1
0
 //
 //加载一个逻辑资源,使用阻塞加载
 public void AsynLoadLogicRes(string path, LogicResouce.ELogicResType type, OnResLoaded onLoaded = null)
 {
     if (GetLogicRes(path) != null)
     {
         if (onLoaded != null)
         {
             onLoaded(path);
         }
         return;
     }
     //
     //LogicResouce res = new LogicResouce();
     //res.resPath = path;
     //res.logicResType = type;
     switch (type)
     {
     case LogicResouce.ELogicResType.ERes_Effect:
     {
         LoadImpl(path, PhyResouce.EPhyResType.EPhyResPrefab,
                  (resPath) =>
             {
                 AssetBundle ab = ResourceManager.Instance.GetPhyRes(path).assetBundle;
                 StringScriptableObject holder     = (StringScriptableObject)ab.Load("DependentBundleNames");
                 LogicResourceBuilder logicBuilder = new LogicResourceBuilder();
                 logicBuilder.resPath                = resPath;
                 logicBuilder.logicResType           = type;
                 logicBuilder.onLogicResourceBuilded = (builderPath) =>
                 {
                     if (onLoaded != null)
                     {
                         onLoaded(builderPath);
                     }
                 };
                 //
                 if (holder != null)
                 {
                     if (holder.content != null)
                     {
                         foreach (string s in holder.content)
                         {
                             logicBuilder.resLists.Add(s);
                             LoadImpl(s, PhyResouce.EPhyResType.EPhyResPrefab);
                             //Debug.LogError(s);
                         }
                     }
                 }
                 ResourceManager.Instance.AddLogicResourceBuilder(logicBuilder);
             }
                  , null);
     }
     break;
     }
 }
Example #2
0
        //
        public void LoadImpl(string path, PhyResouce.EPhyResType type, OnResLoaded onLoaded = null, OnResLoadError onError = null)
        {
            //GameDefine.GameMethod.DebugError("load " + path);
            if (phyResDic.ContainsKey(path) == true)
            {
                return;
            }
            if (loadImplDic.ContainsKey(path) == true)
            {
                return;
            }
            LoadImplement l = new LoadImplement();

            l.phyResType     = type;
            l.onResLoaded    = onLoaded;
            l.onResLoadError = onError;
            l.resPath        = path;
            l.start();
            loadImplDic.Add(path, l);
        }