Exemplo n.º 1
0
 void UpdateComplete(ByteFileInfoList pInfo, string pError)
 {
     Debug.Log(pError);
     if (pError == null)
     {
     }
 }
Exemplo n.º 2
0
        ByteFileInfoList GetNeedDownloadFiles(List <ByteFileInfo> pList)
        {
            if (pList == null || pList.Count == 0)
            {
                return(null);
            }


            var tcmp = new ByteFileInfoList();

            tcmp.AddRange(pList);

            string tdedfile  = GameCore.CombinePath(GameCore.PersistentResDataPath, downloadedfile);
            var    tdedinfo  = new ByteFileInfoList(tdedfile);
            var    tneedList = tdedinfo.Comparison(tcmp);

            if (tneedList.Count == 0)
            {
                UpdateLocalList();
                return(null);
            }
            else
            {
                ByteFileInfoList ret = new ByteFileInfoList();
                ret.AddRange(tneedList);
                return(ret);
            }
        }
Exemplo n.º 3
0
        void DownLoadCheckFileFinished(CheckComplete onComplete)
        {
            isChecking = false;
            ByteFileInfoList ret = GetNeedDownloadFiles(GetUpdateList());

            CallCheckOnComplete(onComplete, ret);
        }
Exemplo n.º 4
0
        void FileUpdateing(ByteFileInfoList pInfo, UpdateComplete onComplete, bool autoRetry)
        {
            curInfo       = pInfo;
            curOnComplete = onComplete;
            curAutoRetry  = autoRetry;
            ReleaseGroupLoader();
            downLoadGroup = new DownLoadGroup("updateGroup");
            foreach (var item in pInfo.fileInfoList)
            {
                string turl    = GetServerUrl(item.resName);
                var    tloader = downLoadGroup.AddByUrl(turl, GameCore.PersistentResDataPath, item.resName, item.fileMD5, item.fileSize, false);
                tloader.priority    = item.priority;
                tloader.OnComplete += (a) =>
                {
                    if (a.IsCompleteDownLoad)
                    {
                        OnUpdateOneComplete(pInfo[a.FileName]);
                    }
                };
            }
            downLoadGroup.StartAsync();
            UpdateProcess();

            StartCoroutine(WaitUpdateDone());
        }
Exemplo n.º 5
0
        ByteFileInfoList GetErroListInfo(DownLoadGroup pGroup, ByteFileInfoList pInfo)
        {
            var tlist = pGroup.GetNotCompletFileNameTable();

            pInfo.RemoveRangeWithOutList(tlist);
            return(pInfo);
        }
Exemplo n.º 6
0
 static public void UpdateRes(ByteFileInfoList pInfo, UpdateComplete onComplete, bool autoRetry)
 {
     if (isUpdateing)
     {
         Debug.LogError("Updateing.");
         return;
     }
     isUpdateing = true;
     Instance.StartCoroutine(Instance.WaitStarUpdate(0.1f, pInfo, onComplete, autoRetry));
 }
Exemplo n.º 7
0
 void CallUpdateOnComplete(UpdateComplete onComplete, ByteFileInfoList pInfo, string pError)
 {
     try
     {
         ReleaseGroupLoader();
         ReTryCount = 0;
         onComplete?.Invoke(pInfo, pError);
     }
     catch (System.Exception erro)
     {
         Debug.LogError("CheckUpdate->" + erro.ToString());
     }
 }
 void OnUpdateComplete(ByteFileInfoList info, string error)
 {
     if (string.IsNullOrEmpty(error))
     {
         updateType = UpdateType.finished;
         checkType  = CheckType.AllGood;
         updateList = null;
     }
     else
     {
         updateType = UpdateType.fail;
         updateList = info;
     }
 }
Exemplo n.º 9
0
        public void LoadByteFileInfoList()
        {
            _ByteInfoData = new ByteFileInfoList();
            AssetBundle tinfobundle = AssetBundle.LoadFromFile(GetFullPath(byteFileInfoFileName));

            if (tinfobundle != null)
            {
                TextAsset tass = tinfobundle.LoadAsset <TextAsset>(byteFileInfoFileName);
                if (tass != null)
                {
                    _ByteInfoData.Load(tass.bytes);
                }
                tinfobundle.Unload(false);
            }
        }
Exemplo n.º 10
0
        void CallCheckOnComplete(CheckComplete onComplete, ByteFileInfoList pObj)
        {
            try
            {
                string error = checkLoader != null ? checkLoader.Error : null;

                ReleaseCheckLoader();
                ReTryCheckCount = 0;

                onComplete?.Invoke(pObj, error);
            }
            catch (System.Exception erro)
            {
                Debug.LogError("CheckUpdate->" + erro.ToString());
            }
        }
Exemplo n.º 11
0
 void OnCheckComplete(ByteFileInfoList info, string error)
 {
     if (error == null)
     {
         if (info != null && info.fileMap.Count > 0)
         {
             checkType  = CheckType.needUpdate;
             updateList = info;
         }
         else
         {
             checkType = CheckType.AllGood;
         }
     }
     else
     {
         checkType = CheckType.fail;
     }
 }
Exemplo n.º 12
0
        void UpdateFileFail()
        {
            isUpdateing = false;
            ByteFileInfoList erroListInfo = GetErroListInfo(downLoadGroup, curInfo);

            if (ReTryCount >= ReTryMaxCount)
            {
                curAutoRetry = false;
            }
            if (!curAutoRetry)
            {
                CallUpdateOnComplete(curOnComplete, erroListInfo, downLoadGroup.Error);
            }
            else
            {
                Debug.Log(downLoadGroup.Error);
                ReTryCount++;
                StartCoroutine(WaitReTryUpdate());
            }
        }
Exemplo n.º 13
0
        List <ByteFileInfo> GetUpdateList()
        {
            List <ByteFileInfo> ret = null;
            var    tinfo            = new ByteFileInfoList();
            string tfilePath        = GameCore.CombinePath(GameCore.PersistentResDataPath, GetCheckFileName());

            if (File.Exists(tfilePath))
            {
                AssetBundle tinfobundle = AssetBundle.LoadFromFile(tfilePath);
                if (tinfobundle != null)
                {
                    TextAsset tass = tinfobundle.LoadAsset <TextAsset>(LoaderManager.byteFileInfoFileName);
                    if (tass != null)
                    {
                        tinfo.Load(tass.bytes);
                    }
                    tinfobundle.Unload(false);
                }
            }

            ret = LoaderManager.ByteInfoData.Comparison(tinfo);
            return(ret);
        }
Exemplo n.º 14
0
        IEnumerator WaitStarUpdate(float delayTime, ByteFileInfoList pInfo, UpdateComplete onComplete, bool autoRetry)
        {
            yield return(new WaitForSeconds(delayTime));

            Instance.FileUpdateing(pInfo, onComplete, autoRetry);
        }