Example #1
0
 //更新
 public void Update()
 {
     if (isAllLogicRootComplete() == false)
     {
         foreach (LogicLoadRequest logicLoadReq in logicReqDic.Values)
         {
             if (curLoadCount < aSyncLoadCount)
             {
                 if (ResourceManager.Instance.GetLogicRes(logicLoadReq.resPath) != null)
                 {
                     logicLoadReq.status = LogicLoadRequest.LOADSTATUS.END;
                 }
                 else
                 {
                     if (logicLoadReq.status == LogicLoadRequest.LOADSTATUS.WAIT)
                     {
                         ResourceManager.Instance.LoadImpl(logicLoadReq.resPath, LogicResouce.getRootResType(logicLoadReq.resType),
                                                           (path) =>
                         {
                             AssetBundle ab = ResourceManager.Instance.GetPhyRes(path).assetBundle;
                             StringScriptableObject holder     = (StringScriptableObject)ab.Load("DependentBundleNames");
                             LogicResourceBuilder logicBuilder = new LogicResourceBuilder();
                             logicBuilder.resPath      = logicLoadReq.resPath;
                             logicBuilder.logicResType = logicLoadReq.resType;
                             if (holder != null)
                             {
                                 if (holder.content != null)
                                 {
                                     foreach (string s in holder.content)
                                     {
                                         // GameDefine.GameMethod.DebugError("got dependency:" + s);
                                         AddPhyFile(s, PhyResouce.EPhyResType.EPhyResPrefab);
                                         logicBuilder.resLists.Add(s);
                                     }
                                 }
                             }
                             ResourceManager.Instance.AddLogicResourceBuilder(logicBuilder);
                         });
                         logicLoadReq.status = LogicLoadRequest.LOADSTATUS.START;
                     }
                 }
             }
         }
     }
     else
     {
         foreach (PhyLoadRequest phyLoadReq in phyReqDic.Values)
         {
             if (curLoadCount < aSyncLoadCount)
             {
                 ResourceManager.Instance.LoadImpl(phyLoadReq.resPath, phyLoadReq.resType);
             }
         }
     }
     UpdateProgress();
 }
Example #2
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 #3
0
 //
 public void AddLogicResourceBuilder(LogicResourceBuilder builder)
 {
     //
     if (logicResBuilder.ContainsKey(builder.resPath))
     {
         return;
     }
     if (logicResDic.ContainsKey(builder.resPath))
     {
         return;
     }
     logicResBuilder.Add(builder.resPath, builder);
 }