示例#1
0
 public static void CenterOnGraph(DungeonThemeEditorWindow editor)
 {
     if (editor.GraphEditor != null)
     {
         editor.GraphEditor.FocusCameraOnBestFit(editor.position);
     }
 }
示例#2
0
 public static void RefreshThumbnails(DungeonThemeEditorWindow editor)
 {
     if (editor.GraphEditor != null)
     {
         AssetThumbnailCache.Instance.Reset();
     }
 }
示例#3
0
        public static void RecreateNodeIds(DungeonThemeEditorWindow editor)
        {
            var confirm = EditorUtility.DisplayDialog("Recreate Node Ids?",
                                                      "Are you sure you want to recreate node Ids?  You should do this after cloning a theme file", "Yes", "Cancel");

            if (confirm)
            {
                DungeonEditorHelper._Advanced_RecreateGraphNodeIds();
            }
        }
        public static void BuildReplacePrefab(DungeonThemeEditorWindow editor)
        {
            var window = (BulkPrefabReplacementWindow)EditorWindow.GetWindow(typeof(BulkPrefabReplacementWindow));

            if (window != null)
            {
                window.titleContent = new GUIContent("Bulk Prefab Replacer");
                window.GraphEditor  = editor;
                window.Show();
            }
        }
        public BulkReplacementEntry[] Process(DungeonThemeEditorWindow editor)
        {
            var graphEditor  = editor.GraphEditor;
            var targetFiles  = GetTargetFiles();
            var replacements = new List <BulkReplacementEntry>();

            foreach (var node in graphEditor.Graph.Nodes)
            {
                if (node is GameObjectNode)
                {
                    var goNode = node as GameObjectNode;
                    if (goNode.Template != null)
                    {
                        string path     = AssetDatabase.GetAssetPath(goNode.Template);
                        var    pathInfo = new FileInfo(path);
                        if (pathInfo != null)
                        {
                            if (targetFiles.ContainsKey(pathInfo.Name))
                            {
                                // Found a target file. Replace
                                var replacementEntry = new BulkReplacementEntry();
                                replacementEntry.node = goNode;
                                replacementEntry.currentPrefabInfo     = pathInfo;
                                replacementEntry.replacementPrefabInfo = targetFiles[pathInfo.Name];

                                // Make sure the current and target are not the same prefabs, to avoid unnecessary replacements
                                if (replacementEntry.currentPrefabInfo.FullName != replacementEntry.replacementPrefabInfo.FullName)
                                {
                                    replacements.Add(replacementEntry);
                                }
                            }
                        }
                    }
                }
            }

            return(replacements.ToArray());
        }
示例#6
0
 public static void CreateDefaultMarkersForBSP(DungeonThemeEditorWindow editor)
 {
     CreateDefaultMarkersFor(editor.GraphEditor, typeof(BSPDungeonBuilder));
 }
示例#7
0
 public static void CreateDefaultMarkersForCircularCity(DungeonThemeEditorWindow editor)
 {
     CreateDefaultMarkersFor(editor.GraphEditor, typeof(CircularCityDungeonBuilder));
 }