public override void Draw()
            {
                EditorGUILayout.LabelField("Asset Bundle Contents", EditorStyles.boldLabel, MinWidthOne);
                EnsureData();

                if (m_EditorWindow.m_SelectedAssetBundleInfo != null)
                {
                    EditorGUILayout.LabelField("Asset Bundle: " + m_EditorWindow.m_SelectedAssetBundleInfo.Path, MinWidthOne);
                    DrawSelectAllSection();
                }
                else
                {
                    EditorGUILayout.HelpBox("No asset bundle selected.", MessageType.Info);
                }

                m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition, ExpandHeight, ExpandWidth);
                {
                    DrawAssetInfoList();
                }
                EditorGUILayout.EndScrollView();

                EditorGUILayout.BeginHorizontal();
                {
                    DrawRemoveButton();
                    DrawSwitchSortByButton();
                }
                EditorGUILayout.EndHorizontal();
                m_LastSelectedAssetBundleInfo = m_EditorWindow.m_SelectedAssetBundleInfo;
            }
Ejemplo n.º 2
0
 private void FoldoutRecursively(AssetBundleOrganizer.AssetBundleInfo rootABInfo, bool foldout)
 {
     EnsureSatelliteData(rootABInfo).Foldout = foldout;
     foreach (var child in rootABInfo.Children.Values)
     {
         if (child.IsDirectory)
         {
             FoldoutRecursively(child, foldout);
         }
     }
 }
Ejemplo n.º 3
0
            private AssetBundleInfoSatelliteData EnsureSatelliteData(AssetBundleOrganizer.AssetBundleInfo abInfo)
            {
                AssetBundleInfoSatelliteData satelliteData;

                if (!m_EditorWindow.m_AssetBundleInfoSatelliteDatas.TryGetValue(abInfo.Path, out satelliteData))
                {
                    satelliteData = new AssetBundleInfoSatelliteData();
                    m_EditorWindow.m_AssetBundleInfoSatelliteDatas.Add(abInfo.Path, satelliteData);
                }

                return(satelliteData);
            }
Ejemplo n.º 4
0
            private void DrawAssetBundleTreeRecursively(AssetBundleOrganizer.AssetBundleInfo abInfo, int indentCount)
            {
                var satelliteData  = EnsureSatelliteData(abInfo);
                var horizontalRect = EditorGUILayout.BeginHorizontal(ExpandWidth);

                {
                    var indentWidth = indentCount * DefaultIndentWidth;
                    GUILayout.Space(indentWidth);
                    GUIContent label = new GUIContent();
                    if (abInfo.IsDirectory)
                    {
                        label.image = EditorGUIUtility.FindTexture("Folder 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(abInfo, newFoldOut);
                            }
                            else
                            {
                                satelliteData.Foldout = newFoldOut;
                            }
                        }

                        GUILayout.Space(FoldoutWidth);
                        label.text = abInfo.Name;
                    }
                    else
                    {
                        // Use the built-in "DefaultAsset Icon", which cannot be displayed by calling
                        // EditorGUIUtility.FindTexture("DefaultAsset Icon").
                        label.image = UnityEditorInternal.InternalEditorUtility.GetIconForFile(string.Empty);

                        var oldSelected = m_EditorWindow.m_SelectedAssetBundleInfo == abInfo;
                        var newSelected = EditorGUILayout.Toggle(oldSelected, GUILayout.Width(ToggleWidth));

                        if (m_Status == Status.Edit)
                        {
                            // Do nothing, which means not to change the selected asset bundle path during renaming it.
                        }
                        else if (!oldSelected && newSelected)
                        {
                            m_EditorWindow.m_SelectedAssetBundleInfo = abInfo;
                        }
                        else if (oldSelected && !newSelected)
                        {
                            m_EditorWindow.m_SelectedAssetBundleInfo = null;
                        }

                        label.text = Core.Utility.Text.Format("{0} [{1}{2}]", abInfo.Name, abInfo.GroupId,
                                                              abInfo.DontPack ? string.Empty : ", Packed");
                    }

                    EditorGUILayout.LabelField(label, MinWidthOne);
                }
                EditorGUILayout.EndHorizontal();

                if (abInfo.IsDirectory && satelliteData.Foldout)
                {
                    foreach (var child in abInfo.Children.Values)
                    {
                        DrawAssetBundleTreeRecursively(child, indentCount + 1);
                    }
                }
            }
 private void RefreshAssetBundleTree()
 {
     m_AssetBundleOrganizer.RefreshAssetBundleTree();
     m_AssetBundleInfoSatelliteDatas.Clear();
     m_SelectedAssetBundleInfo = null;
 }