Esempio n. 1
0
        /*public void StartLoadTask(BundleLoadTask task)
         * {
         *      if(null!=task)
         *      {
         *              StartCoroutine(task.Run());
         *              tasks.Add(task);
         *      }
         * }*/
        #endregion
        #region Private Method

        /*private void CheckAndSwapTasks()
         * {
         *      for(int i=0;i<tasks.Count;++i)
         *      {
         *              BundleLoadTask task = tasks[i];
         *              if(task.IsFinished)
         *              {
         *                      if(null!=task.Holder)
         *                              task.Holder.OnLoaded();
         *              }
         *              else
         *                      tasksSwap.Add(task);
         *      }
         *      tasks.Clear();
         *      List<BundleLoadTask> tmp = tasks;
         *      tasks = tasksSwap;
         *      tasksSwap = tmp;
         * }*/
        #endregion
        void Update()
        {
            if (null != progressTask)
            {
                bool  isAllLoaded = false;
                float progress    = progressTask.GetProgress(ref isAllLoaded);
                //LuaEntrance.Instance.OnProgressLoad(progress);
                if (isAllLoaded)
                {
                    progressTask = null;
                }
            }
            //this.CheckAndSwapTasks();
            //关闭尝试只是在切换场景的时候delete
            float deltaTime = Time.deltaTime;

            clearDeltaTime += deltaTime;
            if (clearDeltaTime > CLEAR_PERIOD)
            {
                clearDeltaTime = 0f;
                StartCoroutine(GameObjPool.Instance.PeriodClean());
                StartCoroutine(BundleMgr.Instance.TryDelete());
            }
            BundleMgr.Instance.Update(deltaTime);
        }
Esempio n. 2
0
 private const float CLEAR_PERIOD = 5f;        //无用资源的存在时间超过这个时间的才删除,
 #endregion
 #region Public Method
 public void StartProgressTask(List <BundleHolder> loadingHoladers)
 {
     if (null == progressTask)
     {
         progressTask = new ProgressLoadTask(loadingHoladers);
     }
 }