private void FooterLeft()
 {
     EditorGUILayout.BeginHorizontal();
     {
         GUI.backgroundColor = Color.cyan;
         if (GUILayout.Button("Apply Setting", GUILayout.Height(30)))
         {
             UndoHelper.BuilderDataUndo("Apply Config");
             CurrentConfig = SelectedData.CurrentConfig;
             SelectedData.ApplyConfig();
             SelectedData.ApplyVersionListConfig();
             if (CurrentConfig != null)
             {
                 TreeViewInitialize();
             }
         }
         GUI.backgroundColor = Color.white;
         GUI.backgroundColor = Color.yellow;
         if (GUILayout.Button("Load Assets", GUILayout.Height(30)))
         {
             UndoHelper.BuilderDataUndo("Load Assets");
             CurrentConfig = SelectedData.CurrentConfig;
             if (CurrentConfig != null)
             {
                 SelectedData.BuildAssets = TreeHelper.GetFileTreeViewItems(CurrentConfig.AssetBundleBuildRootPath);
                 SelectedData.ApplyConfig();
                 SelectedData.LoadNewestAssetBundleList();
                 SelectedData.ApplyVersionListConfig();
                 TreeViewInitialize();
             }
         }
         GUI.backgroundColor = Color.white;
     }
     EditorGUILayout.EndHorizontal();
 }
        private void LabelSettingDrawer(DirectoryLabelSetting setting)
        {
            var rect = EditorGUILayout.BeginVertical(GUIHelper.Styles.NoSpaceBox);

            {
                GUI.backgroundColor = setting.IsActive ? Color.green : Color.grey;
                if (GUILayout.Button("", EditorStyles.toolbarButton, GUILayout.ExpandWidth(true)))
                {
                    UndoHelper.BuilderDataUndo("Change DirectoryLabel activation");
                    setting.IsActive = !setting.IsActive;
                    EditorGUIUtility.keyboardControl = 0;
                }
                GUI.backgroundColor = Color.white;

                EditorGUILayout.BeginHorizontal();
                {
                    Undo.IncrementCurrentGroup();
                    UndoHelper.BuilderDataUndo("Change DirectoryLabel Setting");
                    GUILayout.Label("Directory", GUILayout.Width(70));
                    setting.DirectoryName = EditorGUILayout.TextField(setting.DirectoryName);
                    var path = FileHelper.GetDraggedObject(Event.current, GUILayoutUtility.GetLastRect());
                    if (!string.IsNullOrEmpty(path))
                    {
                        setting.DirectoryName = FileHelper.AssetPathToBuildPath(BuildRootPath, path);
                    }
                }
                EditorGUILayout.EndHorizontal();

                if (setting.IsActive)
                {
                    EditorGUILayout.BeginHorizontal();
                    {
                        Undo.IncrementCurrentGroup();
                        UndoHelper.BuilderDataUndo("Change DirectoryLabel Setting");
                        GUILayout.Label("Label", GUILayout.Width(70));
                        setting.AssetBundleName = EditorGUILayout.TextField(setting.AssetBundleName);
                    }
                    EditorGUILayout.EndHorizontal();

                    setting.Type = ( DirectoryLabelNameType )EditorGUILayout.EnumPopup(setting.Type);
                    GUILayout.Space(5);
                }
            }
            EditorGUILayout.EndVertical();

            GUILayout.Space(3);

            if (IsContextClick(Event.current, rect))
            {
                var menu = new GenericMenu();
                menu.AddItem(new GUIContent("Delete"), false, () => {
                    UndoHelper.BuilderDataUndo("Delete DirectoryLabel Setting");
                    LabelSetting.Remove(setting);
                });
                menu.ShowAsContext();
            }
        }
예제 #3
0
        internal void OnGUI()
        {
            GUILayout.Space(5);

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            {
                GUILayout.Space(3);

                EditorGUILayout.BeginHorizontal();
                {
                    var fold = EditorGUILayout.Foldout(Fold, new GUIContent("Export Setting"));
                    if (fold != Fold)
                    {
                        EditorGUIUtility.keyboardControl = 0;
                        UndoHelper.BuilderDataUndo("Change fold");
                    }
                    Fold = fold;
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button(IsConfigAvailable ? GUIHelper.Textures.ConfigAvailable : GUIHelper.Textures.ConfigInvalid, GUIStyle.none, new GUILayoutOption[] { GUILayout.Width(20), GUILayout.Height(20) }))
                    {
                        CheckConfig();
                    }
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                {
                    GUILayout.Space(17);

                    EditorGUILayout.BeginVertical();
                    {
                        if (Fold)
                        {
                            Undo.IncrementCurrentGroup();
                            UndoHelper.BuilderDataUndo("Change CachePath");
                            using (new GUIHelper.Scope.DropSettingTextArea(new GUIContent("★AssetBundle CachePath", "used for exporting to ExportAssetBundlePath."), ref AssetBundleCachePath)) { };
                            if (GUILayout.Button("Open CachePath"))
                            {
                                EditorUtility.OpenWithDefaultApp(AssetBundleCachePath);
                            }

                            GUILayout.Space(5);

                            EditorGUILayout.BeginHorizontal();
                            {
                                Undo.IncrementCurrentGroup();
                                UndoHelper.BuilderDataUndo("Change export with Manifest");
                                GUILayout.Label(new GUIContent("Export with Manifest", "used for exporting to ExportAssetBundlePath."));
                                ExportWithManifest = EditorGUILayout.Toggle(ExportWithManifest);
                            }
                            EditorGUILayout.EndHorizontal();

                            Undo.IncrementCurrentGroup();
                            UndoHelper.BuilderDataUndo("Change ExportPath");
                            using (new GUIHelper.Scope.DropSettingTextArea(new GUIContent("★Export AssetBundle Path", "finally export assetbundles for this path."), ref ExportAssetBundlePath)) { };
                            if (GUILayout.Button("Open ExportPath"))
                            {
                                EditorUtility.OpenWithDefaultApp(ExportAssetBundlePath);
                            }

                            Undo.IncrementCurrentGroup();
                            UndoHelper.BuilderDataUndo("Change ExportType");
                            GUILayout.Label("★Export Type");
                            ExportType = ( ExportType )EditorGUILayout.EnumPopup(ExportType);

                            GUILayout.Space(2);
                        }
                    }
                    EditorGUILayout.EndVertical();
                }
                EditorGUILayout.EndHorizontal();

                GUILayout.Space(5);
            }
            EditorGUILayout.EndVertical();
        }
예제 #4
0
        internal void OnGUI()
        {
            GUILayout.Space(5);

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            {
                GUILayout.Space(3);

                EditorGUILayout.BeginHorizontal();
                {
                    var fold = EditorGUILayout.Foldout(Fold, "AssetBundleList Setting");
                    if (fold != Fold)
                    {
                        EditorGUIUtility.keyboardControl = 0;
                        UndoHelper.BuilderDataUndo("Change fold");
                    }
                    Fold = fold;
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button(IsConfigAvailable ? GUIHelper.Textures.ConfigAvailable : GUIHelper.Textures.ConfigWarning, GUIStyle.none, new GUILayoutOption[] { GUILayout.Width(20), GUILayout.Height(20) }))
                    {
                        CheckConfig();
                    }
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                {
                    GUILayout.Space(17);

                    EditorGUILayout.BeginVertical();
                    {
                        if (Fold)
                        {
                            EditorGUILayout.BeginHorizontal();
                            {
                                Undo.IncrementCurrentGroup();
                                UndoHelper.BuilderDataUndo("Change use AssetBundleList");
                                GUILayout.Label(new GUIContent("Use AssetBundleList", "used for exporting to ExportAssetBundlePath."));
                                UseAssetBundleList = EditorGUILayout.Toggle(UseAssetBundleList);
                            }
                            EditorGUILayout.EndHorizontal();

                            if (UseAssetBundleList)
                            {
                                GUILayout.Space(10);

                                Undo.IncrementCurrentGroup();
                                UndoHelper.BuilderDataUndo("Change AssetBundleList save path");
                                using (new GUIHelper.Scope.DropSettingTextArea(new GUIContent("★AssetBundleList SavePath", "used for loading asset-list."), ref AssetBundleListTextPath)) { };
                                if (GUILayout.Button("Open AssetList Folder"))
                                {
                                    EditorUtility.OpenWithDefaultApp(AssetBundleListTextPath);
                                }

                                GUILayout.Space(10);

                                Undo.IncrementCurrentGroup();
                                UndoHelper.BuilderDataUndo("Change ConvertFile save path");
                                using (new GUIHelper.Scope.DropSettingTextAreaInProject(new GUIContent("ConvertFile SavePath", "Convert file will created at the path."), ref AssetBundleListConvertPath)) { };

                                Undo.IncrementCurrentGroup();
                                UndoHelper.BuilderDataUndo("Change ConvertFileExtension");
                                GUILayout.Label(new GUIContent("ConvertFile Extension", "Default extension of convert file."));
                                AssetBundleListConvertExtension = EditorGUILayout.TextField(AssetBundleListConvertExtension);
                            }
                        }

                        GUILayout.Space(2);
                    }
                    EditorGUILayout.EndVertical();
                }
                EditorGUILayout.EndHorizontal();

                GUILayout.Space(5);
            }
            EditorGUILayout.EndVertical();
        }
예제 #5
0
        internal void Drawer()
        {
            GUILayout.Space(10);

            EditorGUILayout.BeginVertical();
            {
                if (GUILayout.Button(new GUIContent(ScriptName.ToBold(), GUIHelper.Textures.ScriptIcon), GUILayout.Height(20)))
                {
                    FileHelper.OpenInEditor(ScriptName);
                }
            }
            EditorGUILayout.EndVertical();

            GUILayout.Space(5);

            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            {
                GUILayout.Space(3);

                EditorGUILayout.BeginHorizontal();
                {
                    var fold = EditorGUILayout.Foldout(Fold, "Basic Setting");
                    if (fold != Fold)
                    {
                        EditorGUIUtility.keyboardControl = 0;
                        UndoHelper.BuilderDataUndo("Change fold");
                    }
                    Fold = fold;
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button(IsConfigAvailable ? GUIHelper.Textures.ConfigAvailable : GUIHelper.Textures.ConfigInvalid, GUIStyle.none, new GUILayoutOption[] { GUILayout.Width(20), GUILayout.Height(20) }))
                    {
                        CheckConfig();
                    }
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                {
                    GUILayout.Space(17);

                    EditorGUILayout.BeginVertical();
                    {
                        if (Fold)
                        {
                            Undo.IncrementCurrentGroup();
                            UndoHelper.BuilderDataUndo("Change BuildRootPath");
                            using (new GUIHelper.Scope.DropSettingTextAreaInProject(new GUIContent("★Root Path of Build AssetBundle", "This use for naming assetbundles"), ref AssetBundleBuildRootPath)) { };
                            AssetLabelConfig.BuildRootPath = AssetBundleBuildRootPath;

                            GUILayout.Space(3);

                            Undo.IncrementCurrentGroup();
                            UndoHelper.BuilderDataUndo("Change BuildOption");
                            GUILayout.Label(new GUIContent("★AssetBundle Build Options", "AssetBundle BuildOption"));
                            Options = ( BuildAssetBundleOptions )EditorGUILayout.EnumFlagsField(Options);

                            GUILayout.Space(3);

                            Undo.IncrementCurrentGroup();
                            UndoHelper.BuilderDataUndo("Change BuildPlatform");
                            GUILayout.Label(new GUIContent("★Build Platform", "Build AssetBundle for selected platform."));
                            Platform = EditorGUILayout.MaskField(Platform, BuildTargetUtility.GetBuildModulesMenu());
                        }

                        GUILayout.Space(2);
                    }
                    EditorGUILayout.EndVertical();
                }
                EditorGUILayout.EndHorizontal();

                GUILayout.Space(5);
            }
            EditorGUILayout.EndVertical();

            ExportConfig.OnGUI();
            AssetBundleListConfig.OnGUI();
            UploadConfig.OnGUI();

            GUILayout.FlexibleSpace();
        }
        internal void OnGUI()
        {
            var buildPathExists = !string.IsNullOrEmpty(BuildRootPath);

            if (!buildPathExists)
            {
                EditorGUILayout.HelpBox("set up buildroot path", MessageType.Warning);
            }

            EditorGUI.BeginDisabledGroup(!buildPathExists);
            EditorGUILayout.BeginVertical();
            {
                GUILayout.Space(7);

                EditorGUILayout.BeginHorizontal();
                {
                    Undo.IncrementCurrentGroup();
                    UndoHelper.BuilderDataUndo("Change default label type");
                    GUILayout.Label(new GUIContent("Default label type", "used for naming assetlabel"));
                    DefaultLabelType = ( AssetBundleLabelType )EditorGUILayout.EnumPopup(DefaultLabelType);
                }
                EditorGUILayout.EndHorizontal();

                GUILayout.Space(15);

                Undo.IncrementCurrentGroup();
                UndoHelper.BuilderDataUndo("Change NG filename pattern");
                GUILayout.Label("NG FileName Pattern");
                DefaultNGPattern = EditorGUILayout.TextField(DefaultNGPattern);

                GUILayout.Space(10);

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    GUILayout.Space(5);

                    var menu = GUILayout.Toolbar(SelectedMenu, new string[] { "FileName Checker", "Directory Label" }, GUILayout.Height(20));
                    if (SelectedMenu != menu)
                    {
                        UndoHelper.BuilderDataUndo("Change label menu");
                        EditorGUIUtility.keyboardControl = 0;
                    }
                    SelectedMenu = menu;

                    EditorGUILayout.BeginHorizontal();
                    {
                        GUI.backgroundColor = Color.yellow;
                        switch (SelectedMenu)
                        {
                        case 0:
                            if (GUILayout.Button("+", GUILayout.Width(25)))
                            {
                                UndoHelper.BuilderDataUndo("Add FilenameChecker Setting");
                                FileNameChecker.Add(new FileNameCkeckerSetting());
                                EditorGUIUtility.keyboardControl = 0;
                            }
                            break;

                        case 1:
                            if (GUILayout.Button("+", GUILayout.Width(25)))
                            {
                                UndoHelper.BuilderDataUndo("Add DirectoryLabel Setting");
                                LabelSetting.Add(new DirectoryLabelSetting());
                                EditorGUIUtility.keyboardControl = 0;
                            }
                            break;
                        }

                        GUI.backgroundColor = Color.white;

                        Undo.IncrementCurrentGroup();
                        UndoHelper.BuilderDataUndo("Change setting search text");
                        SearchText = EditorGUILayout.TextField(SearchText, GUIHelper.Styles.SearchField, GUILayout.ExpandWidth(true));
                        if (GUILayout.Button("", GUIHelper.Styles.SearchFieldCancel))
                        {
                            SearchText = "";
                            EditorGUIUtility.keyboardControl = 0;
                        }
                    }
                    EditorGUILayout.EndHorizontal();

                    GUILayout.Space(5);

                    ScrollView = EditorGUILayout.BeginScrollView(ScrollView);
                    {
                        switch (SelectedMenu)
                        {
                        case 0:
                            FileNameCheckerView();
                            break;

                        case 1:
                            LabelSettingView();
                            break;
                        }
                    }
                    EditorGUILayout.EndScrollView();

                    GUILayout.FlexibleSpace();
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndVertical();

            EditorGUI.EndDisabledGroup();
        }
예제 #7
0
        private void TreeView()
        {
            var data   = EasyAssetBundleWindow.win.SelectedData;
            var config = data.Config;

            EditorGUILayout.BeginVertical();
            GUILayout.FlexibleSpace();
            EditorGUILayout.EndVertical();

            treeView.searchString = SearchText;
            treeView.OnGUI(GUILayoutUtility.GetLastRect());
            EditorGUILayout.BeginVertical();
            {
                EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true));
                {
                    if (GUILayout.Button("Check Selection", EditorStyles.toolbarButton, GUILayout.Width(90)))
                    {
                        UndoHelper.BuilderDataUndo("Check Selection");
                        for (int i = 0; i < treeView.state.selectedIDs.Count; i++)
                        {
                            data.VersionAssets[treeView.state.selectedIDs[i]].IsBuild = true;
                        }
                    }
                    if (GUILayout.Button("UnCheck All", EditorStyles.toolbarButton, GUILayout.Width(75)))
                    {
                        UndoHelper.BuilderDataUndo("Uncheck all AssetList");
                        for (int i = 0; i < data.VersionAssets.Count; i++)
                        {
                            data.VersionAssets[i].IsBuild = false;
                        }
                    }
                    GUILayout.FlexibleSpace();
                    Undo.IncrementCurrentGroup();
                    UndoHelper.AssetListWindowUndo("Edit AssetList name");
                    SaveAssetBundleListName = EditorGUILayout.TextField(SaveAssetBundleListName, EditorStyles.toolbarTextField, GUILayout.Width(150));
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                {
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("Convert", new GUILayoutOption[] { GUILayout.Width(150), GUILayout.Height(25) }))
                    {
                        var convertPath = string.IsNullOrEmpty(config.AssetBundleListConfig.AssetBundleListConvertPath) ? Application.dataPath : config.AssetBundleListConfig.AssetBundleListConvertPath;
                        var savePath    = EditorUtility.SaveFilePanel("Convert AssetBundleList", convertPath, "ConvertFile", config.AssetBundleListConfig.AssetBundleListConvertExtension);
                        if (!string.IsNullOrEmpty(savePath))
                        {
                            savePath = FileHelper.SystemPathToAssetPath(savePath);
                            data.ConvertAssetBundleList(data.VersionAssets, savePath);
                        }
                    }
                    GUI.backgroundColor = Color.yellow;
                    if (GUILayout.Button("Save", new GUILayoutOption[] { GUILayout.Width(150), GUILayout.Height(25) }))
                    {
                        data.CurrentAssetBundleListName = SaveAssetBundleListName;
                        var processor = new EasyAssetBundleBuildProcessor(data, BuildProgress.SaveVersionFile, BuildProgress.SaveVersionFile);
                        processor.OnBuildProcessEnd += () => {
                            data.LoadNewestAssetBundleList();
                            data.ApplyVersionListConfig();
                        };
                        processor.Build("AssetBundleList Save Complete");
                    }
                    GUI.backgroundColor = Color.white;
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();
        }
예제 #8
0
        private void Header()
        {
            var data = EasyAssetBundleWindow.win.SelectedData;

            EditorGUILayout.BeginVertical();
            {
                EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true));
                {
                    GUILayout.Label("<b>" + data.CurrentAssetBundleListName + "</b>");
                }
                EditorGUILayout.EndHorizontal();

                GUILayout.Space(5);

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    GUILayout.Label(string.Format("FileNum: {0}", allFileNum));
                    GUILayout.Label(string.Format("FileSize: {0}", allFileSize));
                    EditorGUILayout.BeginHorizontal();
                    {
                    }
                    EditorGUILayout.EndHorizontal();
                }
                EditorGUILayout.EndVertical();

                GUILayout.Space(5);

                EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.ExpandWidth(true));
                {
                    Undo.IncrementCurrentGroup();
                    UndoHelper.AssetListWindowUndo("Edit AssetList search");
                    SearchText = EditorGUILayout.TextField(SearchText, GUIHelper.Styles.SearchFieldToolBar, GUILayout.Width(200));
                    if (GUILayout.Button("", GUIHelper.Styles.SearchFieldCancelToolBar))
                    {
                        SearchText = "";
                    }
                    GUILayout.FlexibleSpace();

                    treeView.showControls = GUILayout.Toggle(treeView.showControls, "Edit", EditorStyles.toolbarButton, GUILayout.Width(50));
                    var selectedMenu = EditorGUILayout.Popup(0, WindowHelper.MENU_ASSETLISTMENU, EditorStyles.toolbarPopup, GUILayout.Width(70));
                    if (selectedMenu != 0)
                    {
                        switch (selectedMenu)
                        {
                        case 2:
                            UndoHelper.BuilderDataUndo("Remove checked asset");
                            data.VersionAssets.RemoveAll(a => a.IsBuild);
                            break;

                        case 3:
                            UndoHelper.BuilderDataUndo("Remove invalid asset");
                            data.VersionAssets.RemoveAll(a => !a.IsAvailable);
                            break;

                        case 4:
                            for (int i = 0; i < data.VersionAssets.Count; i++)
                            {
                                data.VersionAssets[i].Version = 1;
                            }
                            break;

                        case 5:
                            Debug.Log("5");
                            break;
                        }
                        TreeViewInitialize();
                    }
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();
        }
        private void RightArea()
        {
            if (!WindowHelper.BuilderDataExists)
            {
                EditorGUILayout.BeginVertical();
                EditorGUILayout.HelpBox("No BuilderData.", MessageType.Warning);
                EditorGUILayout.EndVertical();
                return;
            }

            EditorGUILayout.BeginVertical(GUIHelper.Styles.NoSpaceBox);
            {
                if (treeView != null)
                {
                    EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
                    {
                        GUILayout.FlexibleSpace();
                        if (IsUseAssetBundleList)
                        {
                            if (GUILayout.Button("Open AssetList", EditorStyles.toolbarButton, GUILayout.Width(90)))
                            {
                                UndoHelper.BuilderDataUndo("Apply Config");
                                SelectedData.LoadNewestAssetBundleList();
                                SelectedData.ApplyVersionListConfig();
                                EasyAssetBundleAssetListWindow.Open();
                            }
                            GUILayout.Space(5);
                        }
                        var buildAssetMenu = EditorGUILayout.Popup(0, WindowHelper.MENU_BUILDERASSETMENU, EditorStyles.toolbarPopup, GUILayout.Width(90));
                        switch (buildAssetMenu)
                        {
                        case 2:
                            UndoHelper.BuilderDataUndo("Select files");
                            for (int i = 0; i < SelectedData.BuildAssets.Count; i++)
                            {
                                SelectedData.BuildAssets[i].IsBuild = SelectedData.BuildAssets[i].IsAsset;
                            }
                            break;

                        case 3:
                            UndoHelper.BuilderDataUndo("Select DifferentUnityVersion");
                            if (!IsUseAssetBundleList)
                            {
                                return;
                            }
                            for (int i = 0; i < SelectedData.BuildAssets.Count; i++)
                            {
                                SelectedData.BuildAssets[i].IsBuild = !SelectedData.BuildAssets[i].OldUnityVersion.Equals(Application.unityVersion);
                            }
                            break;
                        }
                    }
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginVertical();
                    GUILayout.FlexibleSpace();
                    EditorGUILayout.EndVertical();

                    treeView.OnGUI(GUILayoutUtility.GetLastRect());

                    EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
                    {
                        if (GUILayout.Button("Check Selection", EditorStyles.toolbarButton, GUILayout.Width(90)))
                        {
                            UndoHelper.BuilderDataUndo("Check Selection");
                            for (int i = 0; i < treeView.state.selectedIDs.Count; i++)
                            {
                                SelectedData.BuildAssets[treeView.state.selectedIDs[i]].IsBuild = true;
                            }
                        }
                        if (GUILayout.Button("Disable All", EditorStyles.toolbarButton, GUILayout.Width(70)))
                        {
                            UndoHelper.BuilderDataUndo("Disable all");
                            for (int i = 0; i < SelectedData.BuildAssets.Count; i++)
                            {
                                SelectedData.BuildAssets[i].IsBuild = false;
                            }
                        }
                        if (GUILayout.Button("Expand All", EditorStyles.toolbarButton, GUILayout.Width(70)))
                        {
                            treeView.ExpandAll();
                        }
                        GUILayout.FlexibleSpace();
                        if (IsUseAssetBundleList)
                        {
                            var listName = EditorGUILayout.TextField(SelectedData.CurrentAssetBundleListName, EditorStyles.toolbarTextField, GUILayout.Width(200));
                            if (listName != SelectedData.CurrentAssetBundleListName)
                            {
                                UndoHelper.BuilderDataUndo("Edit AssetList name");
                                SelectedData.CurrentAssetBundleListName = listName;
                            }
                        }
                    }
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    {
                        EditorGUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.ExpandWidth(true));
                        {
                            GUILayout.Label(string.Format("Build: {0}", SelectedData.BuildAssets.Count(a => a.IsBuild)));
                            GUILayout.Label(string.Format("InValid: {0}", SelectedData.BuildAssets.Count(a => !a.IsAvailable)));
                        }
                        EditorGUILayout.EndVertical();

                        GUI.backgroundColor = Color.green;
                        if (GUILayout.Button("Build", new GUILayoutOption[] { GUILayout.Width(200), GUILayout.ExpandHeight(true) }))
                        {
                            var processor = new EasyAssetBundleBuildProcessor(SelectedData);
                            processor.OnBuildProcessEnd += () => {
                                if (IsUseAssetBundleList)
                                {
                                    SelectedData.ApplyConfig();
                                    SelectedData.LoadNewestAssetBundleList();
                                    SelectedData.ApplyVersionListConfig();
                                    TreeViewInitialize();
                                    EasyAssetBundleAssetListWindow.Open();
                                }
                            };
                            processor.Build();
                        }
                        GUI.backgroundColor = Color.white;
                    }
                    EditorGUILayout.EndHorizontal();
                }
                else
                {
                    EditorGUILayout.HelpBox("set build config.", MessageType.Warning);
                    GUILayout.FlexibleSpace();
                }
            }
            EditorGUILayout.EndVertical();
        }
예제 #10
0
        void CellGUI(Rect cellRect, TreeViewItem <EditorAssetInfo> item, Columns column, ref RowGUIArgs args)
        {
            // Center cell rect vertically (makes it easier to place controls, icons etc in the cells)
            CenterRectUsingSingleLineHeight(ref cellRect);

            if (item.data.IsSelected != args.selected)
            {
                item.data.OnSelected();
                item.data.IsSelected = args.selected;
            }

            switch (column)
            {
            case Columns.Icon: {
                if (item.data.Texture != null)
                {
                    GUI.DrawTexture(cellRect, item.data.Texture, ScaleMode.ScaleToFit);
                }
            }
            break;

            case Columns.Checker: {
                GUI.DrawTexture(cellRect, item.data.IsAvailable  ? GUIHelper.Textures.CheckMarkOK : GUIHelper.Textures.CheckMaarkNG, ScaleMode.ScaleToFit);
            }
            break;

            case Columns.FileName: {
                var toggleRect = cellRect;
                toggleRect.x    += GetContentIndent(item);
                toggleRect.width = kToggleWidth;

                var build = EditorGUI.Toggle(toggleRect, item.data.IsBuild);           // hide when outside cell rect
                if (item.data.IsBuild != build)
                {
                    UndoHelper.BuilderDataUndo("Check asset");
                    setChildren(item, build);
                }
                //if( item.data.IsDirectoryLabel )
                //    SetExpanded( item.id, false );

                var rect = cellRect;
                rect.x     += GetContentIndent(item) + 15f;
                rect.width -= (GetContentIndent(item) + 15f);
                EditorGUI.BeginDisabledGroup(!item.data.IsBuild);
                DefaultGUI.Label(rect, item.data.Name, args.selected, args.focused);
                EditorGUI.EndDisabledGroup();
            }
            break;

            case Columns.Extension: {
                EditorGUI.BeginDisabledGroup(!item.data.IsBuild);
                DefaultGUI.Label(cellRect, item.data.Extension, args.selected, args.focused);
                EditorGUI.EndDisabledGroup();
            }
            break;

            case Columns.AssetBundleName: {
                if (item.data.IsBuild)
                {
                    var assetBundleName = Config.GetAssetLabel(item.data, BuildRootPath);
                    item.data.AssetBundleName = assetBundleName;
                }
                else
                {
                    if (item.parent != null)
                    {
                        var parent = getAssetInfo(item.parent);
                        item.data.AssetBundleName = parent.data.AssetBundleName;
                    }
                }
                if (!item.data.IsAvailable)
                {
                    break;
                }
                EditorGUI.BeginDisabledGroup(!item.data.IsBuild);
                DefaultGUI.Label(cellRect, item.data.AssetBundleName, args.selected, args.focused);
                EditorGUI.EndDisabledGroup();
            }
            break;

            case Columns.AssetPath: {
                EditorGUI.BeginDisabledGroup(!item.data.IsBuild);
                DefaultGUI.Label(cellRect, item.data.AssetPath, args.selected, args.focused);
                EditorGUI.EndDisabledGroup();
            }
            break;

            case Columns.Guid: {
                EditorGUI.BeginDisabledGroup(!item.data.IsBuild);
                DefaultGUI.Label(cellRect, item.data.Guid, args.selected, args.focused);
                EditorGUI.EndDisabledGroup();
            }
            break;

            case Columns.Version: {
                EditorGUI.BeginDisabledGroup(!item.data.IsBuild);
                if (Config.IsUseAssetBundleList)
                {
                    item.data.Version = item.data.IsBuild ? item.data.OldAssetVersion + 1 : item.data.OldAssetVersion;
                    var version = item.data.Version > 0 ? item.data.Version : 1;
                    DefaultGUI.Label(cellRect, version.ToString(), args.selected, args.focused);

                    var iconRect = cellRect;
                    iconRect.x    += 13;
                    iconRect.width = 30;
                    if (item.data.IsBuild)
                    {
                        GUI.DrawTexture(iconRect, item.data.OldAssetVersion > 0 ? GUIHelper.Textures.VersionUpdate : GUIHelper.Textures.VersionNew, ScaleMode.ScaleToFit);
                    }
                }
                EditorGUI.EndDisabledGroup();
            }
            break;

            case Columns.UnityVersion: {
                EditorGUI.BeginDisabledGroup(!item.data.IsBuild);
                if (Config.IsUseAssetBundleList)
                {
                    DefaultGUI.Label(cellRect, item.data.OldUnityVersion, args.selected, args.focused);
                }
                else
                {
                    DefaultGUI.Label(cellRect, item.data.UnityVersion, args.selected, args.focused);
                }
                EditorGUI.EndDisabledGroup();
            }
            break;
            }
        }