private void DoInspectorGroupingGUI(NodeGUI node)
        {
            if (node.groupingKeyword == null)
            {
                return;
            }

            EditorGUILayout.HelpBox("Grouping: Create group of assets.", MessageType.Info);
            UpdateNodeName(node);

            GUILayout.Space(10f);

            node.currentPlatform = UpdateCurrentPlatform(node.currentPlatform);

            using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                var newGroupingKeyword = EditorGUILayout.TextField(
                    "Grouping Keyword",
                    SystemDataUtility.GetPlatformValue(
                        node.groupingKeyword.ReadonlyDict(),
                        node.currentPlatform
                        ).ToString()
                    );
                EditorGUILayout.HelpBox("Grouping Keyword requires \"*\" in itself. It assumes there is a pattern such as \"ID_0\" in incoming paths when configured as \"ID_*\" ", MessageType.Info);


                IntegratedGUIGrouping.ValidateGroupingKeyword(
                    newGroupingKeyword,
                    () => {
//						EditorGUILayout.HelpBox("groupingKeyword is empty.", MessageType.Error);
                },
                    () => {
//						EditorGUILayout.HelpBox("grouping keyword does not contain " + AssetBundleGraphSettings.KEYWORD_WILDCARD + " groupingKeyword:" + newGroupingKeyword, MessageType.Error);
                }
                    );

                if (newGroupingKeyword != SystemDataUtility.GetPlatformValue(
                        node.groupingKeyword.ReadonlyDict(),
                        node.currentPlatform
                        ).ToString()
                    )
                {
                    node.BeforeSave();
                    node.groupingKeyword.Add(SystemDataUtility.CreateKeyNameFromString(node.currentPlatform), newGroupingKeyword);
                    node.Save();
                }
            }

            UpdateDeleteSetting(node);
        }
        private bool UpdateDeleteSetting(NodeGUI currentNode)
        {
            var currentNodePlatformPackageKey = SystemDataUtility.CreateKeyNameFromString(currentNode.currentPlatform);

            if (currentNodePlatformPackageKey == AssetBundleGraphSettings.PLATFORM_DEFAULT_NAME)
            {
                return(false);
            }

            var deleted = false;

            using (new EditorGUILayout.HorizontalScope()) {
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Use Default Setting", GUILayout.Width(150)))
                {
                    currentNode.BeforeSave();
                    currentNode.DeleteCurrentPackagePlatformKey(currentNodePlatformPackageKey);
                    GUI.FocusControl(string.Empty);
                    currentNode.Save();
                    deleted = true;
                }
            }
            return(deleted);
        }
        private void DoInspectorExporterGUI(NodeGUI node)
        {
            if (node.exportTo == 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(
                    SystemDataUtility.GetProjectName(),
                    SystemDataUtility.GetPlatformValue(
                        node.exportTo.ReadonlyDict(),
                        node.currentPlatform
                        ).ToString()
                    );

                var exporterrNodePath = FileUtility.GetPathWithProjectPath(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 != SystemDataUtility.GetPlatformValue(
                        node.exportTo.ReadonlyDict(),
                        node.currentPlatform
                        ).ToString()
                    )
                {
                    node.BeforeSave();
                    node.exportTo.Add(SystemDataUtility.CreateKeyNameFromString(node.currentPlatform), newExportPath);
                    node.Save();
                }
            }

            UpdateDeleteSetting(node);
        }
        private void DoInspectorBundleBuilderGUI(NodeGUI node)
        {
            if (node.enabledBundleOptions == null)
            {
                return;
            }

            EditorGUILayout.HelpBox("BundleBuilder: Build asset bundles with given asset bundle settings.", MessageType.Info);
            UpdateNodeName(node);

            GUILayout.Space(10f);

            node.currentPlatform = UpdateCurrentPlatform(node.currentPlatform);

            using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                var bundleOptions = SystemDataUtility.GetPlatformValue(
                    node.enabledBundleOptions.ReadonlyDict(),
                    node.currentPlatform
                    );

                var plartform_pakcage_key = SystemDataUtility.CreateKeyNameFromString(node.currentPlatform);

                for (var i = 0; i < AssetBundleGraphSettings.DefaultBundleOptionSettings.Count; i++)
                {
                    var enablablekey = AssetBundleGraphSettings.DefaultBundleOptionSettings[i];

                    // contains keyword == enabled. if not, disabled.
                    var isEnabled = bundleOptions.Contains(enablablekey);

                    var result = EditorGUILayout.ToggleLeft(enablablekey, isEnabled);
                    if (result != isEnabled)
                    {
                        node.BeforeSave();

                        var resultsDict = node.enabledBundleOptions.ReadonlyDict();
                        var resultList  = new List <string>();
                        if (resultsDict.ContainsKey(plartform_pakcage_key))
                        {
                            resultList = resultsDict[plartform_pakcage_key];
                        }

                        if (result)
                        {
                            if (!resultList.Contains(enablablekey))
                            {
                                var currentEnableds = new List <string>();
                                if (resultsDict.ContainsKey(plartform_pakcage_key))
                                {
                                    currentEnableds = resultsDict[plartform_pakcage_key];
                                }
                                currentEnableds.Add(enablablekey);

                                node.enabledBundleOptions.Add(
                                    SystemDataUtility.CreateKeyNameFromString(node.currentPlatform),
                                    currentEnableds
                                    );
                            }
                        }

                        if (!result)
                        {
                            if (resultList.Contains(enablablekey))
                            {
                                var currentEnableds = new List <string>();
                                if (resultsDict.ContainsKey(plartform_pakcage_key))
                                {
                                    currentEnableds = resultsDict[plartform_pakcage_key];
                                }
                                currentEnableds.Remove(enablablekey);

                                node.enabledBundleOptions.Add(
                                    SystemDataUtility.CreateKeyNameFromString(node.currentPlatform),
                                    currentEnableds
                                    );
                            }
                        }

                        /*
                         *                              Cannot use options DisableWriteTypeTree and IgnoreTypeTreeChanges at the same time.
                         */
                        if (enablablekey == "Disable Write TypeTree" && result &&
                            node.enabledBundleOptions.ReadonlyDict()[SystemDataUtility.CreateKeyNameFromString(node.currentPlatform)].Contains("Ignore TypeTree Changes"))
                        {
                            var newEnableds = node.enabledBundleOptions.ReadonlyDict()[SystemDataUtility.CreateKeyNameFromString(node.currentPlatform)];
                            newEnableds.Remove("Ignore TypeTree Changes");

                            node.enabledBundleOptions.Add(
                                SystemDataUtility.CreateKeyNameFromString(node.currentPlatform),
                                newEnableds
                                );
                        }

                        if (enablablekey == "Ignore TypeTree Changes" && result &&
                            node.enabledBundleOptions.ReadonlyDict()[SystemDataUtility.CreateKeyNameFromString(node.currentPlatform)].Contains("Disable Write TypeTree"))
                        {
                            var newEnableds = node.enabledBundleOptions.ReadonlyDict()[SystemDataUtility.CreateKeyNameFromString(node.currentPlatform)];
                            newEnableds.Remove("Disable Write TypeTree");

                            node.enabledBundleOptions.Add(
                                SystemDataUtility.CreateKeyNameFromString(node.currentPlatform),
                                newEnableds
                                );
                        }

                        node.Save();
                        return;
                    }
                }
            }

            UpdateDeleteSetting(node);
        }
        private void DoInspectorBundlizerGUI(NodeGUI node)
        {
            if (node.bundleNameTemplate == null)
            {
                return;
            }

            EditorGUILayout.HelpBox("Bundlizer: Create asset bundle settings with given group of assets.", MessageType.Info);
            UpdateNodeName(node);

            GUILayout.Space(10f);

            node.currentPlatform = UpdateCurrentPlatform(node.currentPlatform);

            using (new EditorGUILayout.VerticalScope(GUI.skin.box)) {
                var bundleNameTemplate = EditorGUILayout.TextField(
                    "Bundle Name Template",
                    SystemDataUtility.GetPlatformValue(
                        node.bundleNameTemplate.ReadonlyDict(),
                        node.currentPlatform
                        ).ToString()
                    ).ToLower();

                IntegratedGUIBundlizer.ValidateBundleNameTemplate(
                    bundleNameTemplate,
                    () => {
//						EditorGUILayout.HelpBox("No Bundle Name Template set.", MessageType.Error);
                }
                    );

                if (bundleNameTemplate != SystemDataUtility.GetPlatformValue(
                        node.bundleNameTemplate.ReadonlyDict(),
                        node.currentPlatform
                        ).ToString()
                    )
                {
                    node.BeforeSave();
                    node.bundleNameTemplate.Add(SystemDataUtility.CreateKeyNameFromString(node.currentPlatform), bundleNameTemplate);
                    node.Save();
                }

                GUILayout.Label("Variants:");
                for (int i = 0; i < node.variants.Keys.Count; ++i)
                {
                    var inputConnectionId = node.variants.Keys[i];

                    using (new GUILayout.HorizontalScope()) {
                        if (GUILayout.Button("-", GUILayout.Width(30)))
                        {
                            node.BeforeSave();
                            node.variants.Remove(inputConnectionId);
                            node.DeleteInputPoint(inputConnectionId);
                        }
                        else
                        {
                            var variantName = node.variants.Values[i];

                            GUIStyle s             = new GUIStyle((GUIStyle)"TextFieldDropDownText");
                            Action   makeStyleBold = () => {
                                s.fontStyle = FontStyle.Bold;
                                s.fontSize  = 12;
                            };

                            IntegratedGUIBundlizer.ValidateVariantName(variantName, node.variants.Values,
                                                                       makeStyleBold,
                                                                       makeStyleBold,
                                                                       makeStyleBold);

                            variantName = EditorGUILayout.TextField(variantName, s);

                            if (variantName != node.variants.Values[i])
                            {
                                node.BeforeSave();
                                node.variants.Values[i] = variantName;
                                node.RenameInputPoint(inputConnectionId, variantName);
                            }
                        }
                    }
                }

                if (GUILayout.Button("+"))
                {
                    node.BeforeSave();
                    var newid = Guid.NewGuid().ToString();
                    node.variants.Add(newid, AssetBundleGraphSettings.BUNDLIZER_VARIANTNAME_DEFAULT);
                    node.AddInputPoint(newid, AssetBundleGraphSettings.BUNDLIZER_VARIANTNAME_DEFAULT);
                }
            }

            UpdateDeleteSetting(node);
        }
        private void DoInspectorLoaderGUI(NodeGUI 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(
                    SystemDataUtility.GetProjectName() + AssetBundleGraphSettings.ASSETS_PATH,
                    SystemDataUtility.GetPlatformValue(
                        node.loadPath.ReadonlyDict(),
                        node.currentPlatform
                        ).ToString()
                    );
                var loaderNodePath = FileUtility.GetPathWithAssetsPath(newLoadPath);
                IntegratedGUILoader.ValidateLoadPath(
                    newLoadPath,
                    loaderNodePath,
                    () => {
                    //EditorGUILayout.HelpBox("load path is empty.", MessageType.Error);
                },
                    () => {
                    //EditorGUILayout.HelpBox("Directory not found:" + loaderNodePath, MessageType.Error);
                }
                    );

                if (newLoadPath != SystemDataUtility.GetPlatformValue(
                        node.loadPath.ReadonlyDict(),
                        node.currentPlatform
                        ).ToString()
                    )
                {
                    node.BeforeSave();
                    node.loadPath.Add(SystemDataUtility.CreateKeyNameFromString(node.currentPlatform), newLoadPath);
                    node.Save();
                }
            }

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