Пример #1
0
        public void DownloadPackage(Action <ResPackageHandler> callback)
        {
            if (m_Loader != null)
            {
                Log.w("Package Handler is Working.");
                return;
            }

            m_Loader = ResLoader.Allocate("ResPackageHolder");

            m_DownloadListener = callback;
            string resName = AssetName2ResName(m_Package.packageName);

            m_Loader.Add2Load(resName, OnPackageDownloadFinish);

            HotUpdateRes hotUpdateRes = ResMgr.S.GetRes <HotUpdateRes>(resName);

            string fullPath = FilePath.persistentDownloadCachePath + m_Package.relativeLocalParentFolder + m_Package.zipFileName;

            hotUpdateRes.SetUpdateInfo(fullPath, m_Package.zipUrl, 10000);
            if (m_Loader != null)
            {
                m_Loader.LoadAsync();
            }
        }
Пример #2
0
        public void CheckUpdateList(Action <ResPackageHandler> callBack)
        {
            if (m_Loader != null)
            {
                Log.w("Package Handler is Working.");
                return;
            }

            ApplyUpdateRecord();

            m_Loader = ResLoader.Allocate("ResPackageHolder");

            m_CheckListener = callBack;
            string resName = AssetName2ResName(m_Package.configFile);

            m_Loader.Add2Load(resName, OnRemoteABConfigDownloadFinish);

            HotUpdateRes hotUpdateRes = ResMgr.S.GetRes <HotUpdateRes>(resName);

            string fullPath = FilePath.persistentDownloadCachePath + m_Package.configFile;

            hotUpdateRes.SetUpdateInfo(fullPath, m_Package.GetAssetUrl(m_Package.configFile), 1000);

            if (m_Loader != null)
            {
                m_Loader.LoadAsync();
            }
        }
Пример #3
0
        protected void AddDownloadFile(string name)
        {
            string resName = ResPackageHandler.AssetName2ResName(name);

            m_ResLoader.Add2Load(resName, OnConfigFileDownloadResult);

            HotUpdateRes res          = ResMgr.S.GetRes <HotUpdateRes>(resName);
            string       relativePath = GetAssetRelativePath(name);
            string       fullPath     = FilePath.persistentDataPath4Res + relativePath;

            res.SetUpdateInfo(fullPath, GetAssetUrl(relativePath), 1000, ConfigFileValidChecker);
        }
Пример #4
0
        private void InnerStartUpdate(List <ABUnit> updateList)
        {
            if (updateList == null || updateList.Count == 0)
            {
                return;
            }

            if (m_Loader != null)
            {
                Log.w("Package Handler is Working.");
                return;
            }

            m_Loader = ResLoader.Allocate("ResPackageHolder");

            if (m_UpdateUnitMap == null)
            {
                m_UpdateUnitMap = new Dictionary <string, ABUnit>();
            }
            else
            {
                m_UpdateUnitMap.Clear();
            }

            for (int i = 0; i < updateList.Count; ++i)
            {
                string resName = AssetName2ResName(updateList[i].abName);

                m_UpdateUnitMap.Add(resName, updateList[i]);

                m_Loader.Add2Load(resName, OnResUpdateFinish);
                HotUpdateRes res          = ResMgr.S.GetRes <HotUpdateRes>(resName);
                string       relativePath = m_Package.GetABLocalRelativePath(updateList[i].abName);
                string       fullPath     = FilePath.persistentDataPath4Res + relativePath;
                res.SetUpdateInfo(fullPath, m_Package.GetAssetUrl(relativePath), updateList[i].fileSize);
            }

            m_Loader.LoadAsync(OnPackageUpdateFinish);
        }