internal AssetViewerInfo.ClickType CheckMousePress(EventType eventType, int clickCount, Vector2 mousePosition, out string folderName)
    {
        AssetViewerInfo.ClickType press = AssetViewerInfo.ClickType.NONE;
        folderName = string.Empty;

        if (IsSelected == false && IsSearched == false)
        {
            return(press);
        }

        for (int j = 0; j < AssetInfo.Count; ++j)
        {
            press = AssetInfo[j].Click(eventType, clickCount, mousePosition, out folderName);

            if (press == AssetViewerInfo.ClickType.EXPAND)
            {
                IsExpanded = true;
            }

            if (press != AssetViewerInfo.ClickType.NONE)
            {
                break;
            }
        }

        return(press);
    }
예제 #2
0
    public AssetViewerInfo.ClickType Click(EventType eventType, int clickCount, Vector2 mousePosition, out string folderName)
    {
        AssetViewerInfo.ClickType clickType = ClickType.NONE;
        folderName = string.Empty;

        if (SelectionRect.Contains(mousePosition))
        {
            folderName = FolderName;
            //	if it has we set it as selected and update the Selection.activeobject so its visible in the inspector
            Object obj = AssetDatabase.LoadAssetAtPath(FileSystemInfo.FullName.RemoveProjectPath(), typeof(Object));
            if (obj != null)
            {
                Selection.activeObject = obj;
            }

            //	 a user double clicks on the folder
            //	select the folder and expand the folder to mimic project folder hierarchy
            if (eventType == EventType.MouseDown && clickCount == 2)
            {
                //	if there is no file extension which means its a folder expand it!
                if (CanExplore)
                {
                    IsSelected = false;
                    clickType  = ClickType.EXPAND;
                }
                else
                {
                    clickType = ClickType.DOUBLE_CLICK;

                    IsSelected = true;
                    if (obj != null)
                    {
                        AssetDatabase.OpenAsset(obj);
                    }
                }
            }
            else
            {
                clickType  = ClickType.CLICK;
                IsSelected = true;
            }
        }
        return(clickType);
    }