示例#1
0
        protected Rect PaintBodyActions(Rect rect)
        {
            this.UpdateInitActions();
            if (this.editorActionsList != null)
            {
                this.editorActionsList.serializedObject.Update();
                this.editorActionsList.UpdateSubEditors(this.node.prefabActionsList.actions);
            }

            if (!this.ActionsAvailable())
            {
                return(rect);
            }

            Rect nextRect = new Rect(rect.x, rect.y, rect.width, BODY_ITEM_HEIGHT);
            int  size     = this.editorActionsList.subEditors.Length;

            for (int i = 0; i < size; ++i)
            {
                GUIContent content = GC_ERROR;
                if (this.editorActionsList.subEditors[i] != null &&
                    this.editorActionsList.subEditors[i].action != null)
                {
                    content = new GUIContent(
                        " " + this.editorActionsList.subEditors[i].action.GetNodeTitle(),
                        this.editorActionsList.subEditors[i].GetIcon()
                        );
                }

                EditorGUI.LabelField(nextRect, content, BehaviorStyles.GetNodeAction());
                nextRect.position = new Vector2(nextRect.x, nextRect.y + nextRect.height);
            }

            return(nextRect);
        }
示例#2
0
        protected virtual Rect PaintHead()
        {
            float height = this.GetHeadHeight();
            Rect  rect   = GUILayoutUtility.GetRect(
                0f, 4000f,
                height, height
                );

            EditorGUI.LabelField(rect, this.GetName(), BehaviorStyles.GetNodeHead());
            return(rect);
        }
        // PRIVATE METHODS: -----------------------------------------------------------------------

        private void PaintHeader(BehaviorWindow window, Event currentEvent)
        {
            Rect rect = GUILayoutUtility.GetRect(0f, 4000f, 30f, 30f);

            GUI.DrawTexture(
                new Rect(rect.x, rect.y + rect.height - 1f, rect.width, 1f),
                Texture2D.whiteTexture, ScaleMode.StretchToFill, true,
                1.0f, COLOR_SEPARATOR, 0f, 0f
                );

            GUI.Box(rect, "Blackboard", BehaviorStyles.GetBlackboardHeader());
        }
示例#4
0
        private void PaintSection(GUIContent content)
        {
            Rect rect = GUILayoutUtility.GetRect(content, BehaviorStyles.GetInspectorSection());

            rect.xMin -= 4f;
            rect.xMax += 4f;

            GUI.DrawTexture(
                rect, Texture2D.whiteTexture, ScaleMode.StretchToFill,
                false, 1f, COLOR_SECTION_BACKGR, 0f, 0f
                );

            GUI.DrawTexture(
                rect, Texture2D.whiteTexture, ScaleMode.StretchToFill,
                false, 1f, COLOR_SECTION_BORDER, new Vector4(0, 1, 0, 1), 0f
                );

            EditorGUI.LabelField(rect, content, BehaviorStyles.GetInspectorSection());
        }
        // PRIVATE METHODS: -----------------------------------------------------------------------

        private void PaintBreadcrumb(int index, string text, BehaviorGraph graph, bool on = false)
        {
            GUIStyle style = (index == 0
                ? BehaviorStyles.GetBreadcrumbLeft()
                : BehaviorStyles.GetBreadcrumbMid()
                              );

            GUIContent content = new GUIContent(ObjectNames.NicifyVariableName(text));
            Rect       rect    = this.GetBreadcrumbRect(content, style);

            switch (on)
            {
            case true: GUI.Toggle(rect, true, content, style); break;

            case false:
                if (GUI.Button(rect, content, style))
                {
                    BehaviorWindow.WINDOW.OpenStackBehaviorGraph(graph);
                }
                break;
            }
        }
        public void Update(BehaviorWindow window, Event currentEvent)
        {
            if (this.isOpen.faded < 0.0001)
            {
                return;
            }

            Rect rect = new Rect(
                (this.isOpen.faded * WINDOW_WIDTH) - WINDOW_WIDTH,
                EditorStyles.toolbar.fixedHeight + WNDOW_MARGIN_TOP,
                WINDOW_WIDTH,
                window.position.height - (WNDOW_MARGIN_TOP + WINDOW_BOTTOM)
                );

            if (Event.current.type != EventType.Layout)
            {
                BehaviorWindowEvents.HOVER_IS_BLACKBOARD = rect.Contains(currentEvent.mousePosition);
            }

            Color color = (EditorGUIUtility.isProSkin
                                ? BehaviorStyles.COLOR_BG_PRO
                                : BehaviorStyles.COLOR_BG_PERSONAL
                           );

            GUI.DrawTexture(
                rect, Texture2D.whiteTexture, ScaleMode.StretchToFill, false,
                1.0f, color, 0f, 0f
                );

            GUILayout.BeginArea(rect, BehaviorStyles.GetBlackboard());
            window.behaviorGraphEditor.serializedObject.Update();

            this.PaintHeader(window, currentEvent);
            this.PaintWindow(window, currentEvent);

            window.behaviorGraphEditor.serializedObject.ApplyModifiedPropertiesWithoutUndo();
            GUILayout.EndArea();
        }
示例#7
0
        public Rect PaintNodeInput(BehaviorWindow window)
        {
            if (!this.HasInput())
            {
                return(Rect.zero);
            }
            Rect inputRect = this.GetNodeInputRect(window, this.node);

            Texture2D texture = BehaviorResources.GetTexture(
                BehaviorResources.Name.InputEmpty,
                BehaviorResources.Format.Auto
                );

            if (this.node.input != null)
            {
                texture = BehaviorResources.GetTexture(
                    BehaviorResources.Name.InputLink,
                    BehaviorResources.Format.Auto
                    );
            }

            Color color = this.GetCurrentStateColor(
                (this.node.input == null ? Color.white : COLOR_INPUT)
                );

            GUI.DrawTexture(
                inputRect, texture, ScaleMode.StretchToFill,
                true, 1.0f, color, 0f, 0f
                );

            if (this.node.input != null)
            {
                int value = this.node.input.outputs.FindIndex(node => node == this.node) + 1;
                EditorGUI.LabelField(inputRect, value.ToString(), BehaviorStyles.GetNodeInput());
            }

            return(inputRect);
        }
 private void PaintWindow(BehaviorWindow window, Event currentEvent)
 {
     this.scroll = EditorGUILayout.BeginScrollView(this.scroll, BehaviorStyles.GetBlackboardBody());
     this.list.DoLayoutList();
     EditorGUILayout.EndScrollView();
 }