Example #1
0
        private void DoInspectorExporterGUI(Node node)
        {
            if (node.exportPath == null)
            {
                return;
            }

            EditorGUILayout.HelpBox("Exporter: Export given files to output directory.", MessageType.Info);
            UpdateNodeName(node);

            GUILayout.Space(10f);

            node.currentPlatform = UpdateCurrentPlatform(node.currentPlatform);

            using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                EditorGUILayout.LabelField("Export Path:");
                var newExportPath = EditorGUILayout.TextField(
                    GraphStackController.GetProjectName(),
                    GraphStackController.ValueFromPlatformAndPackage(
                        node.exportPath.ReadonlyDict(),
                        node.currentPlatform
                        ).ToString()
                    );

                var exporterrNodePath = GraphStackController.WithProjectPath(newExportPath);
                if (IntegratedGUIExporter.ValidateExportPath(
                        newExportPath,
                        exporterrNodePath,
                        () => {
                    // TODO Make text field bold
                },
                        () => {
                    using (new EditorGUILayout.HorizontalScope()) {
                        EditorGUILayout.LabelField(exporterrNodePath + " does not exist.");
                        if (GUILayout.Button("Create directory"))
                        {
                            Directory.CreateDirectory(exporterrNodePath);
                            node.Save();
                        }
                    }
                    EditorGUILayout.Space();

                    EditorGUILayout.LabelField("Available Directories:");
                    string[] dirs = Directory.GetDirectories(Path.GetDirectoryName(exporterrNodePath));
                    foreach (string s in dirs)
                    {
                        EditorGUILayout.LabelField(s);
                    }
                }
                        ))
                {
                    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(exporterrNodePath);
                        }
                    }
                }


                if (newExportPath != GraphStackController.ValueFromPlatformAndPackage(
                        node.exportPath.ReadonlyDict(),
                        node.currentPlatform
                        ).ToString()
                    )
                {
                    node.BeforeSave();
                    node.exportPath.Add(GraphStackController.Platform_Package_Key(node.currentPlatform), newExportPath);
                    node.Save();
                }
            }

            UpdateDeleteSetting(node);
        }
Example #2
0
        private void DoInspectorLoaderGUI(Node node)
        {
            if (node.loadPath == null)
            {
                return;
            }

            EditorGUILayout.HelpBox("Loader: Load assets in given directory path.", MessageType.Info);
            UpdateNodeName(node);

            GUILayout.Space(10f);

            /*
             *      platform & package
             */
            if (packageEditMode)
            {
                EditorGUI.BeginDisabledGroup(true);
            }

            // update platform & package.
            node.currentPlatform = UpdateCurrentPlatform(node.currentPlatform);

            using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                EditorGUILayout.LabelField("Load Path:");
                var newLoadPath = EditorGUILayout.TextField(
                    GraphStackController.GetProjectName() + AssetBundleGraphSettings.ASSETS_PATH,
                    GraphStackController.ValueFromPlatformAndPackage(
                        node.loadPath.ReadonlyDict(),
                        node.currentPlatform
                        ).ToString()
                    );
                var loaderNodePath = GraphStackController.WithAssetsPath(newLoadPath);
                IntegratedGUILoader.ValidateLoadPath(
                    newLoadPath,
                    loaderNodePath,
                    () => {
                    //EditorGUILayout.HelpBox("load path is empty.", MessageType.Error);
                },
                    () => {
                    //EditorGUILayout.HelpBox("Directory not found:" + loaderNodePath, MessageType.Error);
                }
                    );

                if (newLoadPath != GraphStackController.ValueFromPlatformAndPackage(
                        node.loadPath.ReadonlyDict(),
                        node.currentPlatform
                        ).ToString()
                    )
                {
                    node.BeforeSave();
                    node.loadPath.Add(GraphStackController.Platform_Package_Key(node.currentPlatform), newLoadPath);
                    node.Save();
                }
            }

            if (packageEditMode)
            {
                EditorGUI.EndDisabledGroup();
            }
            UpdateDeleteSetting(node);
        }