コード例 #1
0
        public async Task LoadAbAsync(string abName)
        {
            var abHash = _abManifest.GetAssetBundleHash(abName);

            if (_loaders.ContainsKey(abHash))
            {
                await _loaders[abHash].LoadAbAsync();
                return;
            }

            HandleRelationsByRecursive(abName);

            if (_relations.ContainsKey(abHash))
            {
                var relation     = _relations[abHash];
                var dependencies = relation.GetAllDependence();
                for (int i = 0; i < dependencies.Count; i++)
                {
                    await LoadAbAsync(dependencies[i]);
                }

                var loader = AbLoaderManager.Create(abName, abHash);
                await loader.LoadAbAsync();

                _loaders.Add(abHash, loader);
            }
        }
コード例 #2
0
        public void Dispose()
        {
            try
            {
                var e = _loaders.GetEnumerator();
                while (e.MoveNext())
                {
                    AbLoaderManager.Unload(e.Current.Key);
                }

                e.Dispose();
            }
            finally
            {
                _loaders.Clear();
                _loaders = null;
                _relations.Clear();
                _relations = null;
            }
        }