Exemple #1
0
 void init(System.Action <bool> whenOver)
 {
     if (checkUpdate())                                           //检查资源是否需要更新
     {
         Debug.Log("更新资源配置信息");
         pullAssetinfoFromSer((AssetVersion newAsset) =>
         {
             Debug.Log("更新资源");
             updateAssets(newAsset, (bool result) =>
             {
                 if (result)
                 {
                     Debug.Log("资源下载完毕");
                     AssetbundleHelp.UnLoadBundles();
                     FileStream file = File.Create(AssetBundleInfo.assetPath_local + "/" + "assetVersionInfo.txt");
                     StreamWriter sw = new StreamWriter(file);
                     sw.Write(newAsset.ToStr());
                     sw.Close();
                     file.Close();
                     if (whenOver != null)
                     {
                         whenOver(true);
                     }
                 }
                 else if (whenOver != null)
                 {
                     whenOver(false);
                 }
             });
         });
     }
     else
     {
         AssetbundleHelp.UnLoadBundles();
         UnityEngine.Debug.Log("没有要更新的资源");
         //      AppFacade.Ins.Log(BugType.log, "没有要更新的资源");
         if (whenOver != null)
         {
             whenOver(true);
         }
     }
 }