Example #1
0
 public void NotifyUpdateComplete()
 {
     if (OnUpdateComplete != null)
     {
         OnUpdateComplete(true);
         OnUpdateComplete = null;
     }
 }
Example #2
0
    public void DoUpdateSelf()
    {
        if (mDownLoadedIndex >= 10)
        {
            //没下载x个文件保存一下列表防止中途中断更新
            mDownLoadedIndex = 0;
            SaveFileList();
        }
        if ((mDownData.Count <= 0) && !isDownLoading)
        {
            SaveFileList();
            if (OnUpdateComplete != null)
            {
                OnUpdateComplete(true);
                OnUpdateComplete = null;
            }
        }
        else
        {
            if (!Directory.Exists(mCachePath))
            {
                Directory.CreateDirectory(mCachePath);
            }

            while ((mDownData.Count > 0) && !fullDownLoading)
            {
                ///如果列表里有需要下载的东西,并且非全速下载
                ///执行一次下载
                int index = downLoadIndex;
                if (index == -1)
                {
                    Debug.LogError("DoUpdateSelf Error");
                    return;
                }
                ResData info = mDownData[0];
                if (info == null)
                {
                    Debug.LogError("DoUpdateSelf Error2");
                    return;
                }
                downLoadingDataInfoArray[index] = info;
                mDownData.RemoveAt(0);

                BehaviourUtil.StartCoroutine(WWWDownLoad(info.mDataPath, string.Format("{0}tmp{1}.ttdq", mCachePath, index), index));
            }
        }
    }