Пример #1
0
    public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor,
                                        Action onValueChanged)
    {
        editor.UpdateNodeName(node);

        GUILayout.Space(10f);

        editor.DrawPlatformSelector(node);
        using (new EditorGUILayout.VerticalScope(GUI.skin.box))
        {
            var disabledScope = editor.DrawOverrideTargetToggle(node, m_myValue.ContainsValueOf(editor.CurrentEditingGroup),
                                                                b =>
            {
                using (new RecordUndoScope("Remove Target Platform Settings", node, true))
                {
                    if (b)
                    {
                        m_myValue[editor.CurrentEditingGroup] = m_myValue.DefaultValue;
                    }
                    else
                    {
                        m_myValue.Remove(editor.CurrentEditingGroup);
                    }
                    onValueChanged();
                }
            });

            using ( disabledScope )
            {
                _exportDirectory = editor.DrawFolderSelector("Export Directory", "Select Output Folder", _exportDirectory,
                                                             Application.dataPath + "/../", folderSelected => folderSelected);
                _hgAction = ( HGAction )EditorGUILayout.EnumPopup("HGAction", _hgAction);
            }
        }
    }
    public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor,
                                        Action onValueChanged)
    {
        editor.UpdateNodeName(node);

        GUILayout.Space(10f);

        editor.DrawPlatformSelector(node);
        using (new EditorGUILayout.VerticalScope(GUI.skin.box))
        {
            var disabledScope = editor.DrawOverrideTargetToggle(node, m_myValue.ContainsValueOf(editor.CurrentEditingGroup),
                                                                b =>
            {
                using (new RecordUndoScope("Remove Target Platform Settings", node, true))
                {
                    if (b)
                    {
                        m_myValue[editor.CurrentEditingGroup] = m_myValue.DefaultValue;
                    }
                    else
                    {
                        m_myValue.Remove(editor.CurrentEditingGroup);
                    }

                    onValueChanged();
                }
            });

            using (disabledScope)
            {
                _copyManifestExternal    = EditorGUILayout.Toggle("Copy manifest to external folder", _copyManifestExternal);
                _manifestDirectoryExport = editor.DrawFolderSelector("Output Directory", "Select Output Folder",
                                                                     _manifestDirectoryExport, Application.dataPath + "/../", folderSelected => folderSelected);
                _manifestFileName = EditorGUILayout.TextField("Output file name", _manifestFileName);
                EditorGUILayout.LabelField(
                    "Specify the folders, you want to cut from\nassets name. Use this if you have\none folder for all resources and want to\nmake assets name alb shorter.\nEach folder from a new line\nExample:\nMyStaffs/Dogs\nMyStaffs2/Cats",
                    GUILayout.Height(120));
                _resourcesPathes = EditorGUILayout.TextArea(_resourcesPathes);
            }
        }
    }
Пример #3
0
    public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged)
    {
        if (!InternalEditorUtility.inBatchMode)
        {
            _serverBundlesFolder = editor.DrawFolderSelector("Server bundles folder", "Choose server bundles folder", _serverBundlesFolder, string.Empty, s => s);
            EditorGUILayout.HelpBox("At build machine this folder will be re-setted automatically.", MessageType.Info);
        }

        _manifestFileName = EditorGUILayout.TextField("Manifest file name", _manifestFileName);
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();

        EditorGUILayout.HelpBox(
            "Specify pathes that will be stripped from asset pathes. Each path on new line. Example:\n" +
            "You have an asset \"Assets/Resources/GUI/Dialogs/MyDialog.prefab\"\n" + "You want this asset as \"Dialogs/MyDialog\" in bundle.\n" +
            "The stripped path will be \"Recources/GUI", MessageType.Info);
        _pathesToStrip = EditorGUILayout.TextArea(_pathesToStrip);
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();

        EditorGUILayout.HelpBox("Specify files extentions, that will not include in manifest assets. (separator - \",\")", MessageType.Info);
        _excludeResourcesExtensions = EditorGUILayout.TextArea(_excludeResourcesExtensions);
    }
Пример #4
0
    public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged)
    {
        if (_enabledOptions == null)
        {
            return;
        }

        EditorGUILayout.HelpBox("Удаляет папку и все файлы в ней", MessageType.Info);
        editor.UpdateNodeName(node);

        GUILayout.Space(10f);

        //Show target configuration tab
        editor.DrawPlatformSelector(node);
        using (new EditorGUILayout.VerticalScope(GUI.skin.box))
        {
            var disabledScope = editor.DrawOverrideTargetToggle(node, _enabledOptions.ContainsValueOf(editor.CurrentEditingGroup), (bool enabled) =>
            {
                using (new RecordUndoScope("Remove Target Bundle Options", node, true))
                {
                    if (enabled)
                    {
                        _enabledOptions[editor.CurrentEditingGroup] = _enabledOptions.DefaultValue;
                        _outputDir[editor.CurrentEditingGroup]      = _outputDir.DefaultValue;
                        _outputOption[editor.CurrentEditingGroup]   = _outputOption.DefaultValue;
                    }
                    else
                    {
                        _enabledOptions.Remove(editor.CurrentEditingGroup);
                        _outputDir.Remove(editor.CurrentEditingGroup);
                        _outputOption.Remove(editor.CurrentEditingGroup);
                    }

                    onValueChanged();
                }
            });

            using (disabledScope)
            {
                OutputOption opt       = (OutputOption)_outputOption[editor.CurrentEditingGroup];
                var          newOption = (OutputOption)EditorGUILayout.EnumPopup("Output Option", opt);
                if (newOption != opt)
                {
                    using (new RecordUndoScope("Change Output Option", node, true))
                    {
                        _outputOption[editor.CurrentEditingGroup] = (int)newOption;
                        onValueChanged();
                    }
                }

                using (new EditorGUI.DisabledScope(opt == OutputOption.BuildInCacheDirectory || opt == OutputOption.BuildInBundlesCacheDirectory))
                {
                    var newDirPath = editor.DrawFolderSelector("Output Directory", "Select Output Folder",
                                                               _outputDir[editor.CurrentEditingGroup],
                                                               Application.dataPath + "/../",
                                                               (string folderSelected) =>
                    {
                        var projectPath = Directory.GetParent(Application.dataPath).ToString();

                        if (projectPath == folderSelected)
                        {
                            folderSelected = string.Empty;
                        }
                        else
                        {
                            var index = folderSelected.IndexOf(projectPath);
                            if (index >= 0)
                            {
                                folderSelected = folderSelected.Substring(projectPath.Length + index);
                                if (folderSelected.IndexOf('/') == 0)
                                {
                                    folderSelected = folderSelected.Substring(1);
                                }
                            }
                        }

                        return(folderSelected);
                    }
                                                               );

                    if (newDirPath != _outputDir[editor.CurrentEditingGroup])
                    {
                        using (new RecordUndoScope("Change Output Directory", node, true))
                        {
                            _outputDir[editor.CurrentEditingGroup] = newDirPath;



                            onValueChanged();
                        }
                    }

                    var outputDir = PrepareOutputDirectory(BuildTargetUtility.GroupToTarget(editor.CurrentEditingGroup), node.Data);

                    using (new EditorGUI.DisabledScope(!Directory.Exists(outputDir)))
                    {
                        using (new EditorGUILayout.HorizontalScope())
                        {
                            GUILayout.FlexibleSpace();
#if UNITY_EDITOR_OSX
                            string buttonName = "Reveal in Finder";
#else
                            string buttonName = "Show in Explorer";
#endif
                            if (GUILayout.Button(buttonName))
                            {
                                EditorUtility.RevealInFinder(outputDir);
                            }
                        }
                    }

                    EditorGUILayout.HelpBox("You can use '{Platform}' variable for Output Directory path to include platform name.", MessageType.Info);
                }
            }
        }
    }
Пример #5
0
    public override void OnInspectorGUI(NodeGUI node, AssetReferenceStreamManager streamManager, NodeGUIEditor editor, Action onValueChanged)
    {
        if (_enabledOptions == null)
        {
            return;
        }

        EditorGUILayout.HelpBox("Сохраняет конфигурацию бандлей в json", MessageType.Info);
        editor.UpdateNodeName(node);

        GUILayout.Space(10f);

        //Show target configuration tab
        editor.DrawPlatformSelector(node);
        using (new EditorGUILayout.VerticalScope(GUI.skin.box))
        {
            var disabledScope = editor.DrawOverrideTargetToggle(node, _enabledOptions.ContainsValueOf(editor.CurrentEditingGroup), (bool enabled) =>
            {
                using (new RecordUndoScope("Remove Target Bundle Options", node, true))
                {
                    if (enabled)
                    {
                        _enabledOptions[editor.CurrentEditingGroup] = _enabledOptions.DefaultValue;
                        _inputDir[editor.CurrentEditingGroup]       = _inputDir.DefaultValue;
                        _inputOption[editor.CurrentEditingGroup]    = _inputOption.DefaultValue;
                        _fileName[editor.CurrentEditingGroup]       = _fileName.DefaultValue;
                    }
                    else
                    {
                        _enabledOptions.Remove(editor.CurrentEditingGroup);
                        _inputDir.Remove(editor.CurrentEditingGroup);
                        _inputOption.Remove(editor.CurrentEditingGroup);
                        _fileName.Remove(editor.CurrentEditingGroup);
                    }

                    onValueChanged();
                }
            });

            using (disabledScope)
            {
                SaveBundlesConfigurationNode.OutputOption opt = (SaveBundlesConfigurationNode.OutputOption)_inputOption[editor.CurrentEditingGroup];
                var newOption = (SaveBundlesConfigurationNode.OutputOption)EditorGUILayout.EnumPopup("Output Option", opt);
                if (newOption != opt)
                {
                    using (new RecordUndoScope("Change Output Option", node, true))
                    {
                        _inputOption[editor.CurrentEditingGroup] = (int)newOption;
                        onValueChanged();
                    }
                }

                using (new EditorGUI.DisabledScope(opt == SaveBundlesConfigurationNode.OutputOption.BuildInCacheDirectory))
                {
                    var newDirPath = editor.DrawFolderSelector("Output Directory", "Select Output Folder",
                                                               _inputDir[editor.CurrentEditingGroup],
                                                               Application.dataPath + "/../",
                                                               (string folderSelected) =>
                    {
                        var projectPath = Directory.GetParent(Application.dataPath).ToString();

                        if (projectPath == folderSelected)
                        {
                            folderSelected = string.Empty;
                        }
                        else
                        {
                            var index = folderSelected.IndexOf(projectPath);
                            if (index >= 0)
                            {
                                folderSelected = folderSelected.Substring(projectPath.Length + index);
                                if (folderSelected.IndexOf('/') == 0)
                                {
                                    folderSelected = folderSelected.Substring(1);
                                }
                            }
                        }

                        return(folderSelected);
                    }
                                                               );
                    if (newDirPath != _inputDir[editor.CurrentEditingGroup])
                    {
                        using (new RecordUndoScope("Change Output Directory", node, true))
                        {
                            _inputDir[editor.CurrentEditingGroup] = newDirPath;
                            onValueChanged();
                        }
                    }

                    var outputDir = PrepareOutputDirectory(BuildTargetUtility.GroupToTarget(editor.CurrentEditingGroup), node.Data, false);

                    if (opt == SaveBundlesConfigurationNode.OutputOption.ErrorIfNoOutputDirectoryFound &&
                        editor.CurrentEditingGroup != BuildTargetGroup.Unknown &&
                        !string.IsNullOrEmpty(_inputDir[editor.CurrentEditingGroup]) &&
                        !Directory.Exists(outputDir))
                    {
                        using (new EditorGUILayout.HorizontalScope())
                        {
                            EditorGUILayout.LabelField(outputDir + " does not exist.");
                            if (GUILayout.Button("Create directory"))
                            {
                                Directory.CreateDirectory(outputDir);
                            }
                        }

                        EditorGUILayout.Space();

                        string parentDir = Path.GetDirectoryName(_inputDir[editor.CurrentEditingGroup]);
                        if (Directory.Exists(parentDir))
                        {
                            EditorGUILayout.LabelField("Available Directories:");
                            string[] dirs = Directory.GetDirectories(parentDir);
                            foreach (string s in dirs)
                            {
                                EditorGUILayout.LabelField(s);
                            }
                        }

                        EditorGUILayout.Space();
                    }

                    using (new EditorGUI.DisabledScope(!Directory.Exists(outputDir)))
                    {
                        using (new EditorGUILayout.HorizontalScope())
                        {
                            GUILayout.FlexibleSpace();
#if UNITY_EDITOR_OSX
                            string buttonName = "Reveal in Finder";
#else
                            string buttonName = "Show in Explorer";
#endif
                            if (GUILayout.Button(buttonName))
                            {
                                EditorUtility.RevealInFinder(outputDir);
                            }
                        }
                    }

                    EditorGUILayout.HelpBox("You can use '{Platform}' variable for Output Directory path to include platform name.", MessageType.Info);
                }

                GUILayout.Space(8f);

                var fileName    = _fileName[editor.CurrentEditingGroup];
                var newFileName = EditorGUILayout.TextField("File Name", fileName);
                if (newFileName != fileName)
                {
                    using (new RecordUndoScope("Change File Name", node, true))
                    {
                        _fileName[editor.CurrentEditingGroup] = newFileName;
                        onValueChanged();
                    }
                }
            }
        }
    }