Exemple #1
0
        public static void RemoveAllAssetBundle(BundleType bundleType)
        {
            string path = AssetBundleUtility.LocalAssetBundleDirectory(bundleType);

            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }
        }
Exemple #2
0
 public void SetAssetBundleDict(BundleType bundleType, Dictionary <string, AssetBundleInfo> fileName2AssetBundleDict)
 {
     this._fileName2AssetBundleDict[bundleType] = fileName2AssetBundleDict;
     foreach (KeyValuePair <string, AssetBundleInfo> pair in fileName2AssetBundleDict)
     {
         foreach (string str in pair.Value.AssetPathSet)
         {
             this._assetName2FileNameDict[bundleType][str] = pair.Key;
             string resourcePath = AssetBundleUtility.GetResourcePath(str);
             this._resPath2AssetNameDict[bundleType][resourcePath] = str;
         }
     }
 }
Exemple #3
0
 public void MergeAssetBundleDictOnRequire(BundleType bundleType, Dictionary <string, AssetBundleInfo> fileName2AssetBundleDict)
 {
     foreach (string str in fileName2AssetBundleDict.Keys)
     {
         if (!this._fileName2AssetBundleDict[bundleType].ContainsKey(str) && (fileName2AssetBundleDict[str].FileDownloadMode == DownloadMode.ON_REQUIRE))
         {
             this._fileName2AssetBundleDict[bundleType][str] = fileName2AssetBundleDict[str];
             foreach (string str2 in this._fileName2AssetBundleDict[bundleType][str].AssetPathSet)
             {
                 this._assetName2FileNameDict[bundleType][str2] = str;
                 string resourcePath = AssetBundleUtility.GetResourcePath(str2);
                 this._resPath2AssetNameDict[bundleType][resourcePath] = str2;
             }
         }
     }
 }
Exemple #4
0
 private void PreLoad()
 {
     if ((this._assetBundle == null) && File.Exists(this.LocalFilePath))
     {
         foreach (string str in this.ParentFileNameSet)
         {
             if (!string.IsNullOrEmpty(str))
             {
                 Singleton <AssetBundleManager> .Instance.GetAssetBundleInfoByFileName(this.FileBundleType, str).PreLoad();
             }
         }
         try
         {
             if (this.FileBundleType == BundleType.DATA_FILE)
             {
                 byte[] fileBytes = File.ReadAllBytes(this.LocalFilePath);
                 if (!this._completeness)
                 {
                     this._completeness = true;
                     if (AssetBundleUtility.CalculateFileCrc(null, fileBytes) != this.FileCrc)
                     {
                         throw new Exception("File is Not Completeness.");
                     }
                 }
                 AssetBundleUtility.MyAESDecrypted(ref fileBytes);
                 this._assetBundle = AssetBundle.LoadFromMemory(fileBytes);
             }
             else
             {
                 this._assetBundle = AssetBundle.LoadFromFile(this.LocalFilePath);
             }
         }
         catch (Exception)
         {
             this._assetBundle = null;
         }
         if (this._assetBundle == null)
         {
             if (File.Exists(this.LocalFilePath))
             {
                 File.Delete(this.LocalFilePath);
             }
             Singleton <MainUIManager> .Instance.ShowDialog(new HintWithConfirmDialogContext(LocalizationGeneralLogic.GetText("Menu_Desc_AssetBundleError", new object[0]), null, new Action(Application.Quit), LocalizationGeneralLogic.GetText("Menu_Tips", new object[0])), UIType.Any);
         }
     }
 }