Exemplo n.º 1
0
            private AssetInfoSatelliteData EnsureSatelliteData(AssetBundleOrganizer.AssetInfo assetInfo)
            {
                AssetInfoSatelliteData satelliteData;

                if (!m_EditorWindow.m_AssetInfoSatelliteDatas.TryGetValue(assetInfo.Guid, out satelliteData) ||
                    satelliteData.RawAssetInfo != assetInfo)
                {
                    satelliteData = new AssetInfoSatelliteData {
                        RawAssetInfo = assetInfo
                    };
                    m_EditorWindow.m_AssetInfoSatelliteDatas.Add(assetInfo.Guid, satelliteData);
                }

                return(satelliteData);
            }
Exemplo n.º 2
0
            private void DrawAssetTreeRecursively(AssetBundleOrganizer.AssetInfo assetInfo, int indentCount)
            {
                AssetInfoSatelliteData satelliteData = EnsureSatelliteData(assetInfo);

                var horizontalRect = EditorGUILayout.BeginHorizontal(ExpandWidth);

                {
                    var indentWidth = indentCount * DefaultIndentWidth;
                    GUILayout.Space(indentWidth);
                    var label = new GUIContent();
                    if (assetInfo.IsFile)
                    {
                        label.image = UnityEditorInternal.InternalEditorUtility.GetIconForFile(assetInfo.Path);
                    }
                    else
                    {
                        label.image = EditorGUIUtility.FindTexture(assetInfo.Children.Count > 0 ? "Folder Icon" : "FolderEmpty Icon");

                        var newFoldout = EditorGUI.Foldout(new Rect(horizontalRect.x + indentWidth,
                                                                    horizontalRect.y, FoldoutWidth, horizontalRect.height), satelliteData.Foldout, string.Empty);
                        if (newFoldout != satelliteData.Foldout)
                        {
                            if (Event.current.alt)
                            {
                                FoldoutRecursively(assetInfo, newFoldout);
                            }
                            else
                            {
                                satelliteData.Foldout = newFoldout;
                            }
                        }
                    }

                    GUILayout.Space(FoldoutWidth);
                    var oldSelected = AssetInfoIsSelected(satelliteData);
                    var newSelected = EditorGUILayout.Toggle(oldSelected, GUILayout.Width(ToggleWidth));
                    if (newSelected != oldSelected)
                    {
                        SelectAssetInfo(assetInfo, newSelected);
                    }

                    label.text = (assetInfo.IsRoot ? assetInfo.Path : assetInfo.Name)
                                 + (string.IsNullOrEmpty(assetInfo.AssetBundlePath)
                                     ? string.Empty
                                     : Core.Utility.Text.Format(" [{0}]", assetInfo.AssetBundlePath));
                    EditorGUILayout.LabelField(label, MinWidthOne);
                }
                EditorGUILayout.EndHorizontal();

                if (Event.current.type == EventType.Repaint && m_ScrollToAssetGuid != null && m_ScrollToAssetGuid == assetInfo.Guid)
                {
                    m_ScrollToAssetGuid        = null;
                    m_ScrollToAssetDisplayRect = horizontalRect;
                }

                if (!assetInfo.IsFile && satelliteData.Foldout)
                {
                    foreach (var child in assetInfo.Children.Values)
                    {
                        DrawAssetTreeRecursively(child, indentCount + 1);
                    }
                }
            }
Exemplo n.º 3
0
 private bool AssetInfoIsSelected(AssetInfoSatelliteData satelliteData)
 {
     return(satelliteData.Selected);
 }