コード例 #1
0
        public RootSOTreeView(RootSO rootSO, EditorWindow editor)
        {
            _rootSO          = rootSO;
            style.flexGrow   = 1;
            style.flexShrink = 1;

            SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale);
            Insert(0, new GridBackground());

            var contentDragger = new ContentDragger();

            //default activator requires Alt key. Alt key is tired.
            contentDragger.activators.Add(new ManipulatorActivationFilter()
            {
                button = MouseButton.LeftMouse,
            });
            // item dragging is prior to view dragging.
            this.AddManipulator(new SelectionDragger());
            this.AddManipulator(contentDragger);

            var provider = ScriptableObject.CreateInstance <NodeSearchWindowProvider>();

            provider.Initialize(this, editor);

            nodeCreationRequest += context =>
            {
                SearchWindow.Open(new SearchWindowContext(context.screenMousePosition), provider);
            };
        }
コード例 #2
0
        public static void Show(RootSO rootSO)
        {
            var window = Create(rootSO);

            window.Show();
            window.Focus();
        }
コード例 #3
0
        private static void StructGraphView(GraphEditorWindow window, RootSO behaviorTree)
        {
            window.rootVisualElement.Clear();
            var graphView = new RootSOTreeView(behaviorTree, window);

            graphView.Restore();
            window.rootVisualElement.Add(window.CreateToolBar(graphView));
            window.rootVisualElement.Add(graphView);
        }
コード例 #4
0
        public RootNode()
        {
            SetBehavior(typeof(Root));
            title = "Root";
            Child = CreateChildPort();
            outputContainer.Add(Child);

            RootSO rootSO = ScriptableObject.CreateInstance <RootSO>();

            rootSO.name = "New Behavior Root";
        }
コード例 #5
0
        private static GraphEditorWindow Create(RootSO root)
        {
            var key = root.GetInstanceID();

            if (cache.ContainsKey(key))
            {
                return(cache[key]);
            }

            var window = CreateInstance <GraphEditorWindow>();

            StructGraphView(window, root);
            window.titleContent = new GUIContent($"BehaviorTree Editor({root.name})");
            window.key          = key;
            cache[key]          = window;
            return(window);
        }
コード例 #6
0
 public void PostCommit(RootSO rootSO)
 {
     rootSO.SetRoot(NodeBehavior as Root);
 }