Пример #1
0
        public void Init()
        {
            string localPath = ABPathResolver.GetBundleSourceFile(ABPathResolver.DEPEND_FILE_NAME, false);
            string cachePath = string.Format("{0}/{1}", ABPathResolver.BundleCacheDir, ABPathResolver.DEPEND_FILE_NAME);

            ReDebug.Log(ReLogType.System, "ABDataHelper", "######## " + localPath);

            if (File.Exists(localPath))
            {
                readFromPath(localPath);
            }
            else if (File.Exists(cachePath))
            {
                readFromPath(cachePath);
            }
        }
Пример #2
0
        /// <summary>
        /// 加载Bundle
        /// </summary>
        /// <param name="immediately"></param>
        private void LoadBundle(bool immediately)
        {
            string cachePath = Path.Combine(ABPathResolver.BundleCacheDir, string.Format("{0}.ab", abName));
            string srcPath   = ABPathResolver.GetBundleSourceFile(string.Format("{0}.ab", abName), false);

            string loadPath = File.Exists(cachePath) ? cachePath : srcPath;

            if (immediately)
            {
                LoadFromFileSync(loadPath);
                OnTaskFinish(true);
            }
            else
            {
                state    = ABLoadState.LoadSelf;
                loadTask = CoroutineTaskManager.Instance.AddTask(LoadFromFileAsync(loadPath), (succ) =>
                {
                    OnTaskFinish(succ);
                    _loadContext.loadingCount--;
                    LoadWaitingLoader();
                });
            }
        }