Exemplo n.º 1
0
    /// <summary>
    /// 绘制行为树所有的行为节点
    /// </summary>
    /// <param name="window"></param>
    public void drawTaskList(DesignerWindow window)
    {
        //搜索
        GUILayout.BeginHorizontal(new GUILayoutOption[0]);
        GUI.SetNextControlName("Search");
        string value = GUILayout.TextField(SearchStr, GUI.skin.FindStyle("ToolbarSeachTextField"), new GUILayoutOption[0]);
        //if (this.mFocusSearch)
        //{
        //    GUI.FocusControl("Search");
        //    this.mFocusSearch = false;
        //}
        if (!this.SearchStr.Equals(value))
        {
            this.SearchStr = value;
            this.Search(SearchStr.ToLower().Replace(" ", ""), this.TreeNodes);
        }
        if (GUILayout.Button("", this.SearchStr.Equals("") ? GUI.skin.FindStyle("ToolbarSeachCancelButtonEmpty") : GUI.skin.FindStyle("ToolbarSeachCancelButton"), new GUILayoutOption[0]))
        {
            this.SearchStr = "";
            this.Search("", this.TreeNodes);
            GUI.FocusControl(null);
        }
        GUILayout.EndHorizontal();

        DesignerHelp.DrawContentSeperator(2);
        GUILayout.Space(4f);
        ScrollPosition = GUILayout.BeginScrollView(ScrollPosition, new GUILayoutOption[0]);

        for (int i = 0; i < TreeNodes.Count; i++)
        {
            this.DrawCategory(window, this.TreeNodes[i]);
        }
        GUILayout.EndScrollView();
    }
Exemplo n.º 2
0
        public void DoTabs(Rect tabsRect, DesignerWindow designerWindow)
        {
            EditorGUI.DrawRect(tabsRect, InvertGraphEditor.Settings.BackgroundColor);
            var color = new Color(InvertGraphEditor.Settings.BackgroundColor.r * 0.8f,
                                  InvertGraphEditor.Settings.BackgroundColor.g * 0.8f, InvertGraphEditor.Settings.BackgroundColor.b * 0.8f);

            EditorGUI.DrawRect(tabsRect, color);
            if (designerWindow != null && designerWindow.Designer != null)
            {
                GUILayout.BeginArea(tabsRect);
                GUILayout.BeginHorizontal();

                foreach (var tab in designerWindow.Designer.Tabs.ToArray())
                {
                    if (tab == null)
                    {
                        continue;
                    }
                    if (tab.Name == null)
                    {
                        continue;
                    }
                    var isCurrent = designerWindow.Workspace != null && designerWindow.Workspace.CurrentGraph != null && tab.Identifier == designerWindow.Workspace.CurrentGraph.Identifier;
                    if (GUILayout.Button(tab.Name,
                                         isCurrent
                            ? ElementDesignerStyles.TabStyle
                            : ElementDesignerStyles.TabInActiveStyle, GUILayout.MinWidth(150)))
                    {
                        var projectService = InvertGraphEditor.Container.Resolve <WorkspaceService>();

                        if (Event.current.button == 1)
                        {
                            var isLastGraph = projectService.CurrentWorkspace.Graphs.Count() <= 1;

                            if (!isLastGraph)
                            {
                                var tab1 = tab;
                                projectService.Repository.RemoveAll <WorkspaceGraph>(p => p.WorkspaceId == projectService.CurrentWorkspace.Identifier && p.GraphId == tab1.Identifier);
                                var lastGraph = projectService.CurrentWorkspace.Graphs.LastOrDefault();
                                if (isCurrent && lastGraph != null)
                                {
                                    designerWindow.SwitchDiagram(lastGraph);
                                }
                            }
                        }
                        else
                        {
                            designerWindow.SwitchDiagram(projectService.CurrentWorkspace.Graphs.FirstOrDefault(p => p.Identifier == tab.Identifier));
                        }
                    }
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                GUILayout.EndArea();
            }
        }
    static void Menu_RTS_Brushes_RescanBrushes()
    {
        // Refresh asset database.
        AssetDatabase.Refresh();

        // Automatically detect new brushes.
        BrushDatabase.Instance.Rescan(RefreshPreviews.ClearCache);

        // Repaint windows that may have been affected.
        ToolUtility.RepaintPaletteWindows();
        DesignerWindow.RepaintWindow();
    }
Exemplo n.º 4
0
        public void Execute(ApplyRenameCommand command)
        {
            if (string.IsNullOrEmpty(command.Item.Name))
            {
                command.Item.Name = "RenameMe";
            }

            command.Item.Rename(command.Name);
            command.Item.EndEditing();

            DesignerWindow dw = InvertApplication.Container.Resolve <DesignerWindow>();

            dw.RefreshContent();
        }
Exemplo n.º 5
0
        public void DoToolbar(Rect toolbarTopRect, DesignerWindow designerWindow, ToolbarPosition position)
        {
            if (designerWindow == null)
            {
                throw new ArgumentNullException("designerWindow");
            }

            if (designerWindow.Toolbar == null)
            {
                throw new ArgumentNullException("designerWindow.Toolbar");
            }
            GUILayout.BeginArea(toolbarTopRect);
            if (toolbarTopRect.y > 20)
            {
                designerWindow.Toolbar.GoBottom();
            }
            else
            {
                designerWindow.Toolbar.Go();
            }
            GUILayout.EndArea();
        }
Exemplo n.º 6
0
        public void DoTabs(Rect tabsRect, DesignerWindow designerWindow)
        {
            EditorGUI.DrawRect(tabsRect, InvertGraphEditor.Settings.BackgroundColor);
            var color = new Color(InvertGraphEditor.Settings.BackgroundColor.r * 0.8f,
                InvertGraphEditor.Settings.BackgroundColor.g * 0.8f, InvertGraphEditor.Settings.BackgroundColor.b * 0.8f);
            EditorGUI.DrawRect(tabsRect, color);
            if (designerWindow != null && designerWindow.Designer != null)
            {
                GUILayout.BeginArea(tabsRect);
                GUILayout.BeginHorizontal();

                foreach (var tab in designerWindow.Designer.Tabs.ToArray())
                {
                    if (tab == null) continue;
                    if (tab.Name == null)
                        continue;
                    var isCurrent = designerWindow.Workspace != null && designerWindow.Workspace.CurrentGraph != null && tab.Identifier == designerWindow.Workspace.CurrentGraph.Identifier;
                    if (GUILayout.Button(tab.Name,
                        isCurrent
                            ? ElementDesignerStyles.TabStyle
                            : ElementDesignerStyles.TabInActiveStyle, GUILayout.MinWidth(150)))
                    {
                        var projectService = InvertGraphEditor.Container.Resolve<WorkspaceService>();

                        if (Event.current.button == 1)
                        {

                            var isLastGraph = projectService.CurrentWorkspace.Graphs.Count() <= 1;

                            if (!isLastGraph)
                            {
                                var tab1 = tab;
                                projectService.Repository.RemoveAll<WorkspaceGraph>(p => p.WorkspaceId == projectService.CurrentWorkspace.Identifier && p.GraphId == tab1.Identifier);
                                var lastGraph = projectService.CurrentWorkspace.Graphs.LastOrDefault();
                                if (isCurrent && lastGraph != null)
                                {
                                    designerWindow.SwitchDiagram(lastGraph);
                                }

                            }
                        }
                        else
                        {
                            designerWindow.SwitchDiagram(projectService.CurrentWorkspace.Graphs.FirstOrDefault(p => p.Identifier == tab.Identifier));
                        }

                    }
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                GUILayout.EndArea();
            }
        }
Exemplo n.º 7
0
        public void DoToolbar(Rect toolbarTopRect, DesignerWindow designerWindow, ToolbarPosition position)
        {
            if (designerWindow == null) throw new ArgumentNullException("designerWindow");

            if (designerWindow.Toolbar == null) throw new ArgumentNullException("designerWindow.Toolbar");
            GUILayout.BeginArea(toolbarTopRect);
            if (toolbarTopRect.y > 20)
            {
                designerWindow.Toolbar.GoBottom();
            }
            else
            {
                designerWindow.Toolbar.Go();
            }
            GUILayout.EndArea();
        }
Exemplo n.º 8
0
 private void DrawCategoryTaskList(DesignerWindow window, List<DesignerTreeNode> categoryList)
 {
     for (int i = 0; i < categoryList.Count; i++)
     {
         this.DrawCategory(window, categoryList[i]);
     }
 }
Exemplo n.º 9
0
 /// <summary>
 /// 绘制树的叶子结点
 /// </summary>
 /// <param name="window"></param>
 /// <param name="node"></param>
 private void DrawCategory(DesignerWindow window, DesignerTreeNode node)
 {
     if (node.Visible)
     {
         node.Expanded = EditorGUILayout.Foldout(node.Expanded, node.Name, DesignerHelp.TaskFoldoutGUIStyle);
        // this.SetExpanded(node.ID, node.Expanded);
         if (node.Expanded)
         {
             EditorGUI.indentLevel = EditorGUI.indentLevel + 1;
             if (node.Tasks != null)
             {
                 for (int i = 0; i < node.Tasks.Count; i++)
                 {
                     if (node.Tasks[i].Visible)
                     {
                         GUILayout.BeginHorizontal(new GUILayoutOption[0]);
                         GUILayout.Space((float)(EditorGUI.indentLevel * 10));
                         if (GUILayout.Button(node.Tasks[i].Type.Name.ToString(), EditorStyles.toolbarButton, new GUILayoutOption[0]))
                         {//点击按钮,添加一个任务
                             window.addTask(node.Tasks[i].Type, false);
                         }
                         GUILayout.Space(3f);
                         GUILayout.EndHorizontal();
                     }
                 }
             }
             if (node.Childs != null)
             {
                 this.DrawCategoryTaskList(window, node.Childs);
             }
             EditorGUI.indentLevel = EditorGUI.indentLevel - 1;
         }
     }
 }
Exemplo n.º 10
0
 /// <summary>
 /// 当窗口获得焦点时调用一次
 /// </summary>
 public void OnFocus()
 {
     DesignerWindow.Instance = this;
     base.wantsMouseMove = true;
     init();
     //if (!this.mLockActiveGameObject)
     //{
     //    this.mActiveObject = Selection.activeObject;
     //}
     //this.ReloadPreviousBehavior();
     //this.UpdateGraphStatus();
 }
Exemplo n.º 11
0
 static void Menu_RTS_BrushDesigner()
 {
     DesignerWindow.ShowWindow().Focus();
 }
Exemplo n.º 12
0
 public static void ToolMenu_EditorWindows_Designer()
 {
     DesignerWindow.ShowWindow().Focus();
 }