private void Create()
 {
     if (string.IsNullOrEmpty(Version))
     {
         throw new InvalidDataException("必须填写版本号");
     }
     if (Version == GetCurrentVersion())
     {
         Debug.LogWarning("不使用新的版本号将导致新的版本无法被察觉, 从而导致无法升级");
     }
     if (!Directory.Exists(OutputPath))
     {
         Directory.CreateDirectory(OutputPath);
         var manifest = BuildPipeline.BuildAssetBundles(OutputPath, BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget);
         if (manifest)
         {
             CreateResourceListJsonFile(manifest);
             CreateVersionJsonFile();
             ABLocalManager.ClearEmtry(OutputPath);
         }
         else
         {
             Clear();
         }
     }
     else
     {
         var ab          = AssetBundle.LoadFromFile(Path.Combine(OutputPath, "AssetBundles"));
         var oldManifest = ab.LoadAsset <AssetBundleManifest>("AssetBundleManifest");
         var oldABList   = ABUtility.CreateABListFromManifest(oldManifest);
         ab.Unload(true);
         var newManifest = BuildPipeline.BuildAssetBundles(OutputPath, BuildAssetBundleOptions.None, EditorUserBuildSettings.activeBuildTarget);
         if (newManifest)
         {
             CreateResourceListJsonFile(newManifest);
             CreateVersionJsonFile();
             var newABList  = ABUtility.CreateABListFromManifest(newManifest);
             var deleteList = ABUtility.GetDeleteABList(oldABList, newABList);
             foreach (var name in deleteList)
             {
                 File.Delete(Path.Combine(OutputPath, name));
                 File.Delete(Path.Combine(OutputPath, name + ".manifest"));
             }
             ABLocalManager.ClearEmtry(OutputPath);
         }
         else
         {
             Clear();
         }
     }
 }
Esempio n. 2
0
 private void Awake()
 {
     Instance      = this;
     localManager  = new ABLocalManager(LocalSetting);
     remoteManager = new ABRemoteManager(RemoteSetting, localManager);
 }
Esempio n. 3
0
 public ABUpdater(ABRemoteSetting remoteSetting, ABLocalSetting localSetting)
 {
     localManager  = new ABLocalManager(localSetting);
     remoteManager = new ABRemoteManager(remoteSetting, localManager.LocalAssetBundlePath);
 }
Esempio n. 4
0
 public ABRemoteManager(ABRemoteSetting setting, ABLocalManager localManager)
 {
     this.setting      = setting;
     this.localManager = localManager;
 }