public BundleItem LoadAssetBundleSync(string abName) { if (m_manifest == null) { // 加载 manifest 先 if (!LoadAssetBundleManifest()) { return(null); } } for (int _i = 0, _max = m_bundleList.Count; _i < _max; _i++) { var _item = m_bundleList[_i]; if (!_item.Name.Equals(abName)) { continue; } _item.Retain(); return(_item); } BundleItem _bundleItem = new BundleItem(abName); m_bundleList.Add(_bundleItem); _bundleItem.Load(); LoadDependencies(abName); _bundleItem.Retain(); return(_bundleItem); }
protected bool LoadDependencies(string bundleName) { bool _ret = true; if (m_manifest != null) { List <string> _dpList; if (m_manifest.TryGetValue(bundleName, out _dpList)) { foreach (string _abName in _dpList) { bool _find = false; for (int _i = 0, _max = m_bundleList.Count; _i < _max; _i++) { var _item = m_bundleList[_i]; if (!_item.Name.Equals(_abName)) { continue; } _item.Retain(); _find = true; break; } if (!_find) { BundleItem _bundleItem = new BundleItem(_abName); m_bundleList.Add(_bundleItem); _bundleItem.Load(); _bundleItem.Retain(); } } } else { Debug.Log(string.Format("BundleName {0} is Error", bundleName)); _ret = false; } } return(_ret); }