static void GUI_Inlcudes() { if (currentBundle.includs.Count > 0) { #if UNITY_4_3 m_FoldoutIncludes = EditorGUILayout.Foldout(m_FoldoutIncludes, "INCLUDE", BMGUIStyles.GetCustomStyle("CFoldout")); #else m_FoldoutIncludes = EditorGUILayout.Foldout(m_FoldoutIncludes, "INCLUDE"); #endif } else { GUILayout.Label("INCLUDE", BMGUIStyles.GetCustomStyle("UnfoldableTitle")); } if (!m_FoldoutIncludes) { return; } EditorGUILayout.BeginVertical(); { foreach (var assetPath in currentBundle.includs) { bool isCurrentPathSelect = m_CurSelectAsset == assetPath && !m_IsMetaListSelect; AssetItemState itemState = GUI_AssetItem(assetPath, isCurrentPathSelect, GetSharedIconOfInlucde(assetPath)); if (itemState != AssetItemState.None) { if (!isCurrentPathSelect) { m_IsMetaListSelect = false; m_CurSelectAsset = assetPath; } else if (itemState != AssetItemState.RClicked) // Only left click can disable selection { if (EditorApplication.timeSinceStartup - m_LastClickTime < 2f) { // Double clicked EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(assetPath, typeof(Object))); } else { m_CurSelectAsset = ""; } } m_LastClickTime = EditorApplication.timeSinceStartup; Refresh(); // Right click if (itemState == AssetItemState.RClicked) { GenericMenu rightClickMenu = new GenericMenu(); rightClickMenu.AddItem(new GUIContent("Delete"), false, GUI_DeleteMenuCallback); rightClickMenu.DropDown(new Rect(Event.current.mousePosition.x, Event.current.mousePosition.y, 0, 0)); } } } } EditorGUILayout.EndVertical(); }
static void GUI_DependencyList() { if (currentBundle.dependAssets.Count > 0) { #if UNITY_4_3 m_FoldoutMetaFiles = EditorGUILayout.Foldout(m_FoldoutMetaFiles, "DEPEND", BMGUIStyles.GetCustomStyle("CFoldout")); #else m_FoldoutMetaFiles = EditorGUILayout.Foldout(m_FoldoutMetaFiles, "DEPEND"); #endif } else { GUILayout.Label("DEPEND", BMGUIStyles.GetCustomStyle("UnfoldableTitle")); return; } if (m_FoldoutMetaFiles) { EditorGUILayout.BeginVertical(); { foreach (string assetPath in currentBundle.dependAssets) { bool isCurrentPathSelect = m_CurSelectAsset == assetPath && m_IsMetaListSelect; if (GUI_AssetItem(assetPath, isCurrentPathSelect, GetSharedIconOfDepend(assetPath)) != AssetItemState.None) { if (!isCurrentPathSelect) { m_IsMetaListSelect = true; m_CurSelectAsset = assetPath; } else { if (EditorApplication.timeSinceStartup - m_LastClickTime < 2f) { // Double clicked EditorGUIUtility.PingObject(AssetDatabase.LoadAssetAtPath(assetPath, typeof(Object))); } else { m_CurSelectAsset = ""; } } m_LastClickTime = EditorApplication.timeSinceStartup; Refresh(); } } } EditorGUILayout.EndVertical(); } }
static GUIStyle GetLabelStyle(bool selected, bool exist) { if (!exist) { return(BMGUIStyles.GetCustomStyle("CAssetLabelRed")); } if (selected) { return(BMGUIStyles.GetCustomStyle("CAssetLabelActive")); } else { return(BMGUIStyles.GetCustomStyle("CAssetLabelNormal")); } }
Rect GUI_DrawItem(BundleData bundle, int indent) { bool isEditing = m_CurrentEditing == bundle.name; bool isRecieving = m_CurrentRecieving == bundle.name; bool isSelected = m_Selections.Contains(bundle.name); GUIStyle currentLableStyle = BMGUIStyles.GetCustomStyle("TreeItemUnSelect"); if (isRecieving) { currentLableStyle = BMGUIStyles.GetCustomStyle("receivingLable"); } else if (isSelected && !isEditing) { currentLableStyle = HasFocuse() ? BMGUIStyles.GetCustomStyle("TreeItemSelectBlue") : BMGUIStyles.GetCustomStyle("TreeItemSelectGray"); } Rect itemRect = EditorGUILayout.BeginHorizontal(currentLableStyle); if (bundle.children.Count == 0) { GUILayout.Space(m_IndentWidth * indent + m_NoToggleIndent); } else { GUILayout.Space(m_IndentWidth * indent); bool fold = !GUILayout.Toggle(!IsFold(bundle.name), "", BMGUIStyles.GetCustomStyle("Foldout")); SetFold(bundle.name, fold); } GUILayout.Label(bundle.sceneBundle ? BMGUIStyles.GetIcon("sceneBundleIcon") : BMGUIStyles.GetIcon("assetBundleIcon"), BMGUIStyles.GetCustomStyle("BItemLabelNormal"), GUILayout.ExpandWidth(false)); if (!isEditing) { GUILayout.Label(bundle.name, isSelected ? BMGUIStyles.GetCustomStyle("BItemLabelActive") : BMGUIStyles.GetCustomStyle("BItemLabelNormal")); } else { GUI.SetNextControlName(m_EditTextFeildName); m_EditString = GUILayout.TextField(m_EditString, BMGUIStyles.GetCustomStyle("TreeEditField")); } EditorGUILayout.EndHorizontal(); return(itemRect); }
static GUIStyle GetItemStyle(bool selected, bool focused) { if (!selected) { return(BMGUIStyles.GetCustomStyle("TreeItemUnSelect")); } else { if (focused) { return(BMGUIStyles.GetCustomStyle("TreeItemSelectBlue")); } else { return(BMGUIStyles.GetCustomStyle("TreeItemSelectGray")); } } }