protected void DrawAssetbundleRefrences(string assetbundleName, string key, int level = 0) { var instance = AssetBundleManager.Instance; var abRefrences = instance.GetAssetBundleRefrences(assetbundleName); var webRequestRefrences = instance.GetWebRequesterRefrences(assetbundleName); var abLoaderRefrences = instance.GetAssetBundleLoaderRefrences(assetbundleName); var expanded = false; expanded = GUILayoutUtils.DrawSubHeader(level + 1, "ABRefrence:", abRefrenceSate, key, abRefrences.Count.ToString()); if (expanded && abRefrences.Count > 0) { GUILayoutUtils.DrawTextListContent(abRefrences); } expanded = GUILayoutUtils.DrawSubHeader(level + 1, "WebRequester:", webRequestRefrenceSate, key, webRequestRefrences.Count.ToString()); if (expanded && webRequestRefrences.Count > 0) { GUILayoutUtils.DrawTextListContent(webRequestRefrences, "Sequence : "); } expanded = GUILayoutUtils.DrawSubHeader(level + 1, "ABLoader:", abLoaderfrenceSate, key, abLoaderRefrences.Count.ToString()); if (expanded && abLoaderRefrences.Count > 0) { GUILayoutUtils.DrawTextListContent(abLoaderRefrences, "Sequence : "); } }
void DrawFilterTypesList(List <AssetBundleCheckerFilter> checkerFilters) { GUILayout.BeginVertical(EditorStyles.textField); GUILayout.Space(3); EditorGUILayout.Separator(); for (int i = 0; i < checkerFilters.Count; i++) { var curFilter = checkerFilters[i]; var relativePath = string.IsNullOrEmpty(curFilter.RelativePath) ? "root" : curFilter.RelativePath; var objectFilter = string.IsNullOrEmpty(curFilter.ObjectFilter) ? "all" : curFilter.ObjectFilter; var filterType = relativePath + ": <" + objectFilter + ">"; var stateKey = "CheckerFilters" + i.ToString(); if (GUILayoutUtils.DrawRemovableSubHeader(1, filterType, inspectorSate, stateKey, () => { MarkChanged(); checkerFilters.RemoveAt(i); i--; })) { DrawFilterItem(curFilter); } EditorGUILayout.Separator(); } if (GUILayout.Button("Add")) { MarkChanged(); checkerFilters.Add(new AssetBundleCheckerFilter("", "t:prefab")); } EditorGUILayout.Separator(); GUILayout.Space(3); GUILayout.EndVertical(); }
void DrawAssetBundleDispatcherInspector() { if (GUILayoutUtils.DrawHeader("AssetBundle Dispatcher : ", inspectorSate, "DispatcherConfig", true, false)) { DrawAssetDispatcherConfig(); } }
void DrawAssetDispatcherConfig() { GUILayoutUtils.BeginContents(false); GUILayoutUtils.DrawProperty("Path:", AssetBundleUtility.AssetsPathToPackagePath(targetAssetPath), 300f, 80f); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("FilterType:", GUILayout.MaxWidth(80f)); var selectType = (AssetBundleDispatcherFilterType)EditorGUILayout.EnumPopup(filterType); if (selectType != filterType) { filterType = selectType; MarkChanged(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Separator(); var filtersCount = dispatcherConfig.CheckerFilters.Count; if (GUILayoutUtils.DrawSubHeader(0, "CheckerFilters:", inspectorSate, "CheckerFilters", filtersCount.ToString())) { DrawFilterTypesList(dispatcherConfig.CheckerFilters); } Color color = GUI.color; if (configChanged) { GUI.color = color * new Color(1, 1, 0.5f); } EditorGUILayout.Separator(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Apply")) { Apply(); } GUI.color = new Color(1, 0.5f, 0.5f); if (GUILayout.Button("Remove")) { ConfirmRemove(); } GUI.color = color; GUILayout.EndHorizontal(); EditorGUILayout.Separator(); GUILayoutUtils.EndContents(false); }
void DrawFilterItem(AssetBundleCheckerFilter checkerFilter) { GUILayout.BeginVertical(); var relativePath = GUILayoutUtils.DrawInputField("RelativePath:", checkerFilter.RelativePath, 300f, 80f); var objectFilter = GUILayoutUtils.DrawInputField("ObjectFilter:", checkerFilter.ObjectFilter, 300f, 80f); if (relativePath != checkerFilter.RelativePath) { MarkChanged(); checkerFilter.RelativePath = relativePath; } if (objectFilter != checkerFilter.ObjectFilter) { MarkChanged(); checkerFilter.ObjectFilter = objectFilter; } GUILayout.EndVertical(); }
// Create a 2D GUI window using auto layout, with automatically computed positions and sizes public void rotWindowGUILayout(int windowID) { GUILayout.Label("Rotation order: z, x, y"); // Layout using horizontal sliders GUILayoutUtils.HorizontalSliderAndText("X rot (pitch)", 0, 360, ref xRotValue, ref xRotString); GUILayoutUtils.HorizontalSliderAndText("Y rot (yaw)", 0, 360, ref yRotValue, ref yRotString); GUILayoutUtils.HorizontalSliderAndText("Z rot (roll)", 0, 360, ref zRotValue, ref zRotString); // Alternative layout replaces horizontal sliders with vertical sliders arranged in a horizontal group // GUILayout.BeginHorizontal (); // GUILayoutUtils.VerticalSliderAndText ("X rot (pitch)", 0, 360, ref xRotValue, ref xRotString); // GUILayoutUtils.VerticalSliderAndText ("Y rot (yaw)", 0, 360, ref yRotValue, ref yRotString); // GUILayoutUtils.VerticalSliderAndText ("Z rot (roll)", 0, 360, ref zRotValue, ref zRotString); // GUILayout.EndHorizontal (); autoLayout = GUILayout.Toggle(autoLayout, " Auto layout"); GUI.DragWindow(new Rect(0, 0, Screen.width, Screen.height)); // Make it draggable over the entire display }
protected void OnDrawAssetCaching() { var instance = AssetBundleManager.Instance; var assetCaching = instance.GetAssetCaching(); var totalCount = instance.GetAssetCachingCount(); var iter = assetCaching.GetEnumerator(); EditorGUILayout.BeginVertical(); GUILayoutUtils.DrawProperty("Total loaded assets count : ", totalCount.ToString()); while (iter.MoveNext()) { var assetbundleName = iter.Current.Key; var assetNameList = iter.Current.Value; string title = string.Format("{0}[{1}]", assetbundleName, assetNameList.Count); if (GUILayoutUtils.DrawHeader(title, abItemSate, assetbundleName, false, false)) { GUILayoutUtils.DrawTextListContent(assetNameList); } } EditorGUILayout.EndVertical(); }
protected void DrawAssetbundleContent(string assetbundleName, string key, int level) { var instance = AssetBundleManager.Instance; var expanded = false; GUILayoutUtils.BeginContents(false); var loaded = instance.GetAssetBundleCache(assetbundleName); EditorGUILayout.BeginHorizontal(GUILayout.MinWidth(250f)); EditorGUILayout.LabelField("", GUILayout.MinWidth(20 * level)); GUILayoutUtils.DrawProperty("Has Loaded:", loaded ? "true" : "false"); EditorGUILayout.EndHorizontal(); var referencesCount = instance.GetAssetbundleRefrenceCount(assetbundleName); expanded = GUILayoutUtils.DrawSubHeader(level, "References Count:", refrenceSate, key, referencesCount.ToString()); if (expanded) { DrawAssetbundleRefrences(assetbundleName, key, level); } var dependencies = instance.curManifest.GetAllDependencies(assetbundleName); var dependenciesCount = instance.GetAssetbundleDependenciesCount(assetbundleName); expanded = GUILayoutUtils.DrawSubHeader(level, "Dependencies Count:", dependenciesSate, key, dependenciesCount.ToString()); if (expanded && dependenciesCount > 0) { for (int i = 0; i < dependencies.Length; i++) { var dependence = dependencies[i]; if (!string.IsNullOrEmpty(dependence) && dependence != assetbundleName) { DrawAssetbundleItem(dependence, dependence, abItemSate, assetbundleName + dependence, level + 1); } } } GUILayoutUtils.EndContents(false); }
protected void DrawAssetbundleItem(string title, string assetbundleName, Dictionary <string, bool> states, string key, int level = 0) { var instance = AssetBundleManager.Instance; if (instance.IsAssetBundleLoaded(assetbundleName)) { title += "[loaded]"; } if (level == 0) { if (GUILayoutUtils.DrawHeader(title, states, key, false, false)) { DrawAssetbundleContent(assetbundleName, key, level); } } else { if (GUILayoutUtils.DrawSubHeader(level, title, states, key, "")) { DrawAssetbundleContent(assetbundleName, key, level + 1); } } }