/// <summary> /// 获取bundle打包信息 /// </summary> /// <param name="path">bundle路径</param> /// <returns></returns> BundlePackInfo GetPackInfo(string path) { ResPackConfig config = ResService.GetInstance().PackConfig; if (config == null) { return(null); } return(config.GetPackInfo(path) as BundlePackInfo); }
/// <summary> /// 获取已加载的bundle对应的资源 /// </summary> /// <param name="bundlePath"></param> /// <returns></returns> public JWObjList <string> GetLoadedBundleResources(string bundlePath) { if (string.IsNullOrEmpty(bundlePath) || _loadingResources.Count == 0) { return(null); } ResPackConfig config = ResService.GetInstance().PackConfig; if (config == null) { return(null); } BundlePackInfo pi = config.GetPackInfo(bundlePath) as BundlePackInfo; if (pi == null) { return(null); } for (int i = _loadingResources.Count - 1; i >= 0; i--) { string path = _loadingResources[i]; if (pi.Contains(path)) { if (!_relatedResources.Contains(path)) { _relatedResources.Add(path); } _loadingResources.Remove(path); } } return(_relatedResources); }
void OnGUI() { if (!BundleService.IsValidate()) { return; } JWObjDictionary <string, BundleRef> bundleDict = BundleService.GetInstance().BundleDict; GUILayout.Space(3f); GUILayout.BeginVertical(); // list title GUILayout.BeginHorizontal("Table Title", GUILayout.MinHeight(20f)); GUILayout.Label("Index", _labelStyle, GUILayout.Width(60f)); GUILayout.Label("RefCnt", _labelStyle, GUILayout.Width(60f)); GUILayout.Label("Tag", _labelStyle, GUILayout.Width(120f)); GUILayout.Label("Name", _labelStyle, GUILayout.Width(60f)); GUILayout.EndHorizontal(); ResPackConfig config = ResService.GetInstance().PackConfig; if (config == null) { return; } // list mScroll = GUILayout.BeginScrollView(mScroll); int index = 0; foreach (var kv in bundleDict) { BundleRef bundle = kv.Value; BundlePackInfo pi = config.GetPackInfo(bundle.Path) as BundlePackInfo; if (pi == null) { continue; } index++; GUILayout.BeginHorizontal("Table Row", GUILayout.MinHeight(20f)); // index GUILayout.Label(index.ToString(), _labelStyle, GUILayout.Width(60f)); // ref count GUILayout.Label(bundle.RefCnt.ToString(), _labelStyle, GUILayout.Width(60f)); // tag //GUILayout.Label(pi.Tag, _labelStyle, GUILayout.Width(120f)); // path GUILayout.Label(pi.Path, _labelStyle); GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.Space(3f); }