Пример #1
0
        public uint AddDiffManifestTask(FileManifest mainifest1, FileManifest mainifest2, System.Action <LoadingEventArg> onProgress, System.Action <bool> onComplete)
        {
            if (mainifest1 == null)
            {
                return(0);
            }

            var           loadInfos = mainifest1.CompareFileManifest(mainifest2);
            List <ABInfo> re        = new List <ABInfo>();

            foreach (var abInfo in loadInfos)
            {
                if (abInfo.priority <= FileManifestOptions.AutoHotPriority) //非自动下载级别
                {
                    re.Add(abInfo);
                }
                else if (FileHelper.PersistentFileExists(abInfo.abName))//存在表示已经下载过但是版本不对
                {
                    re.Add(abInfo);
                }
            }

            re.Sort(abInfoCompare);

            return(AddTask(re, FileManifestOptions.ManualPriority, onProgress, onComplete));
        }
Пример #2
0
        public List <ABInfo> CompareFileManifest(FileManifest compare)
        {
            List <ABInfo> re = new List <ABInfo>();

            if (compare == null)
            {
                return(re);
            }
            if (appNumVersion > compare.appNumVersion)
            {
                return(re);
            }
            var    compareABInfos = compare.allAbInfo;
            ABInfo abInfo;

            for (int i = 0; i < compareABInfos.Count; i++)
            {
                abInfo = compareABInfos[i];
                if (!CheckABCrc(abInfo))
                {
                    re.Add(abInfo);
                }
            }

            return(re);
        }
Пример #3
0
        public uint AddFirstManifestTask(FileManifest mainifest1, FileManifest mainifest2, System.Action <LoadingEventArg> onProgress, System.Action <bool> onComplete)
        {
            if (mainifest1 == null)
            {
                return(0);
            }

            List <ABInfo> re = new List <ABInfo>();

            var    localABInfos = mainifest1.allAbInfo;
            var    diffABInfos  = mainifest1.CompareFileManifest(mainifest2); //mainifest2.appNumVersion - mainifest1.appNumVersion >= 0;
            ABInfo abInfo;

            for (int i = 0; i < localABInfos.Count; i++)
            {
                abInfo = localABInfos[i];
                if (abInfo.priority >= FileManifestOptions.FirstLoadPriority &&
                    abInfo.priority < FileManifestOptions.AutoHotPriority) //首包下载内容
                {
                    re.Add(abInfo);
                }
            }

            for (int i = 0; i < diffABInfos.Count; i++)
            {
                abInfo = diffABInfos[i];
                re.Add(abInfo);
            }

            re.Sort(abInfoCompare);

            return(AddTask(re, FileManifestOptions.ManualPriority, onProgress, onComplete));
        }
Пример #4
0
        public bool AppendFileManifest(FileManifest newFileManifest)
        {
            bool canAppend = appNumVersion <= newFileManifest.appNumVersion;

            newAppNumVersion = newFileManifest.appNumVersion;
            Debug.LogFormat("appNumVersion local={0},new={1}", appNumVersion, newFileManifest.appNumVersion);
            if (canAppend)
            {
                Debug.LogFormat("version old={0},new={1}", version, newFileManifest.version);
                var newVersion = newFileManifest.version;
                if (!string.IsNullOrEmpty(newVersion))
                {
                    version = newVersion;
                }
                else
                {
                    Debug.LogWarningFormat("newFileManifest({0}) version is null", newFileManifest.appNumVersion);
                }

                var variants = newFileManifest.allAssetBundlesWithVariant;
                for (int i = 0; i < variants.Length; i++)
                {
                    AddVariant(variants[i]);
                }

                var list = newFileManifest.allAbInfo;
                for (int i = 0; i < list.Count; i++)
                {
                    Add(list[i]);
                }
            }

            return(canAppend);
        }
Пример #5
0
        public void AppendFileManifest(FileManifest newFileManifest)
        {
            if (appNumVersion <= newFileManifest.appNumVersion)
            {
                this.allAssetBundlesWithVariant = newFileManifest.allAssetBundlesWithVariant;

                var list = newFileManifest.allAbInfo;
                for (int i = 0; i < list.Count; i++)
                {
                    Add(list[i]);
                }
            }
        }
Пример #6
0
        public bool AppendFileManifest(FileManifest newFileManifest)
        {
            bool canAppend = appNumVersion <= newFileManifest.appNumVersion;

            newAppNumVersion = newFileManifest.appNumVersion;
            Debug.LogFormat("appNumVersion local={0},new={1}", appNumVersion, newFileManifest.appNumVersion);
            if (canAppend)
            {
                Debug.LogFormat("version old={0},new={1}", version, newFileManifest.version);
                var newVersion = newFileManifest.version;
                if (!string.IsNullOrEmpty(newVersion))
                {
                    version = newVersion;
                }
                else
                {
                    Debug.LogWarningFormat("newFileManifest({0}) version is null", newFileManifest.appNumVersion);
                }

                var variants = newFileManifest.allAssetBundlesWithVariant;
                for (int i = 0; i < variants.Length; i++)
                {
                    AddVariant(variants[i]);
                }

                var           list = newFileManifest.allAbInfo;
                ABInfo        abinfo;
                ABInfo        abinfo1;
                List <ABInfo> removes = new List <ABInfo>();
                for (int i = 0; i < list.Count; i++)
                {
                    abinfo = list[i];
                    if (abInfoDict.TryGetValue(abinfo.abName, out abinfo1) && abinfo.crc32 == abinfo1.crc32) //the same abinfo should remove
                    {
                        removes.Add(abinfo);
                    }
                    Add(abinfo);
                }

                for (int i = 0; i < removes.Count; i++)
                {
                    newFileManifest.Remove(removes[i]);
                }
            }

            return(canAppend);
        }
Пример #7
0
        public void AppendFileManifest(FileManifest newFileManifest)
        {
            if (appNumVersion <= newFileManifest.appNumVersion)
            {
                var variants = newFileManifest.allAssetBundlesWithVariant;
                for (int i = 0; i < variants.Length; i++)
                {
                    AddVariant(variants[i]);
                }

                var list = newFileManifest.allAbInfo;
                for (int i = 0; i < list.Count; i++)
                {
                    Add(list[i]);
                }
            }
        }
Пример #8
0
        public uint AddManualManifestTask(FileManifest mainifest1, string folder, System.Action <LoadingEventArg> onProgress, System.Action <bool> onComplete)
        {
            if (mainifest1 == null)
            {
                return(0);
            }

            var           allAbInfos = mainifest1.allAbInfo;
            List <ABInfo> loadInfos  = new List <ABInfo>();
            ABInfo        abInfo;

            for (int i = 0; i < allAbInfos.Count; i++)
            {
                abInfo = allAbInfos[i];
                if (abInfo.abName.Contains(folder) && !FileHelper.PersistentFileExists(abInfo.abName))// && abInfo.priority > FileManifestOptions.AutoHotPriority)
                {
                    loadInfos.Add(abInfo);
                }
            }

            loadInfos.Sort(abInfoCompare);

            return(AddTask(loadInfos, FileManifestOptions.ManualPriority, onProgress, onComplete));
        }