Example #1
0
        public static void CheckInstallationPackage(string versionPath)
        {
            updateTaskType = TaskType.CheckInstallationPackage;
            string bundleName;

            if (!AssetBundleManager.Instance.GetBundleName(versionPath, out bundleName))
            {
                return;
            }

            string bundlePath = Path.Combine(PlatformUtility.GetExternalPath(), bundleName);

            if (!File.Exists(bundlePath))
            {
                return;
            }

            AssetBundleManager.Instance.UnloadAssetBundle(bundleName);
            bundlePath = Path.Combine(PlatformUtility.GetStreamingAssetsPath(), bundleName);
            AssetBundle bundle = AssetBundle.LoadFromFile(bundlePath);

            if (bundle == null)
            {
                return;
            }

            string            assetName          = Path.GetFileNameWithoutExtension(versionPath);
            VersionUpdateData packageVersionData = bundle.LoadAsset <VersionUpdateData>(assetName);

            bundle.Unload(false);
            if (packageVersionData == null || versionData.versionNumber >= packageVersionData.versionNumber)
            {
                return;
            }

            Debug.LogFormat("The external path version is {0}, package version is {1}, Delete the external path.", versionData.versionNumber, packageVersionData.versionNumber);
            AssetBundleManager.Instance.UnloadAllAssetBundle();
            Directory.Delete(PlatformUtility.GetExternalPath(), true);
            AssetBundleManager.Instance.LoadedManifestAssetBundle();
        }
Example #2
0
 public static void Initialize(string versionPath)
 {
     AssetBundleManager.Initialize();
     versionData    = AssetBundleManager.Instance.LoadAsset <VersionUpdateData>(versionPath);
     updateTaskType = TaskType.Failure;
 }