Example #1
0
        private void DoInspectorGroupingGUI(Node 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",
                    GraphStackController.ValueFromPlatformAndPackage(
                        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 != GraphStackController.ValueFromPlatformAndPackage(
                        node.groupingKeyword.ReadonlyDict(),
                        node.currentPlatform
                        ).ToString()
                    )
                {
                    node.BeforeSave();
                    node.groupingKeyword.Add(GraphStackController.Platform_Package_Key(node.currentPlatform), newGroupingKeyword);
                    node.Save();
                }
            }

            UpdateDeleteSetting(node);
        }
Example #2
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 #3
0
        private void DoInspectorBundleBuilderGUI(Node 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 = GraphStackController.ValueFromPlatformAndPackage(
                    node.enabledBundleOptions.ReadonlyDict(),
                    node.currentPlatform
                    );

                var plartform_pakcage_key = GraphStackController.Platform_Package_Key(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(
                                    GraphStackController.Platform_Package_Key(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(
                                    GraphStackController.Platform_Package_Key(node.currentPlatform),
                                    currentEnableds
                                    );
                            }
                        }

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

                            node.enabledBundleOptions.Add(
                                GraphStackController.Platform_Package_Key(node.currentPlatform),
                                newEnableds
                                );
                        }

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

                            node.enabledBundleOptions.Add(
                                GraphStackController.Platform_Package_Key(node.currentPlatform),
                                newEnableds
                                );
                        }

                        node.Save();
                        return;
                    }
                }
            }

            UpdateDeleteSetting(node);
        }
Example #4
0
        private void DoInspectorBundlizerGUI(Node 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",
                    GraphStackController.ValueFromPlatformAndPackage(
                        node.bundleNameTemplate.ReadonlyDict(),
                        node.currentPlatform
                        ).ToString()
                    ).ToLower();

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

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

                var isUseOutputResoruces = GraphStackController.ValueFromPlatformAndPackage(
                    node.bundleUseOutput.ReadonlyDict(),
                    node.currentPlatform
                    ).ToString().ToLower();

                var useOrNot = false;
                switch (isUseOutputResoruces)
                {
                case "true": {
                    useOrNot = true;
                    break;
                }
                }

                var result = EditorGUILayout.ToggleLeft("Asset Output for Dependency", useOrNot);

                if (result != useOrNot)
                {
                    node.BeforeSave();

                    if (result)
                    {
                        node.AddBundlizerDependencyOutput();
                    }
                    else
                    {
                        node.RemoveBundlizerDependencyOutput();
                    }

                    node.bundleUseOutput.Add(GraphStackController.Platform_Package_Key(node.currentPlatform), result.ToString());
                    node.Save();
                }

                EditorGUILayout.HelpBox("Check this to enable asset output slot to create asset bundle which has dependency to asset bundle of this node.", MessageType.Info);
            }

            UpdateDeleteSetting(node);
        }
Example #5
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);
        }