コード例 #1
0
    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();
    }
コード例 #2
0
    static void GUI_ExInlcudes()
    {
        if (currentBundle.exIncludeGUIDs.Count > 0)
        {
#if !(UNITY_4_2 || UNITY_4_1 || UNITY_4_0)
            m_FoldoutExIncludes = EditorGUILayout.Foldout(m_FoldoutExIncludes, "EXINCLUDE", BMGUIStyles.GetStyle("CFoldout"));
#else
            m_FoldoutExIncludes = EditorGUILayout.Foldout(m_FoldoutExIncludes, "EXINCLUDE");
#endif
        }
        else
        {
            GUILayout.Label("EXINCLUDE", BMGUIStyles.GetStyle("UnfoldableTitle"));
        }

        if (!m_FoldoutExIncludes)
        {
            return;
        }

        EditorGUILayout.BeginVertical();
        {
            foreach (var guid in currentBundle.exIncludeGUIDs)
            {
                string assetPath = AssetDatabase.GUIDToAssetPath(guid);
//				bool isCurrentPathSelect = m_CurSelectAsset == guid && !m_IsMetaListSelect;
                AssetItemState itemState = GUI_AssetItem(assetPath, false, GetSharedIconOfInlucde(guid));
//				if(itemState != AssetItemState.None)
//				{
//					if(!isCurrentPathSelect)
//					{
//						m_IsMetaListSelect = false;
//						m_CurSelectAsset = guid;
//					}
//					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();
    }