コード例 #1
0
        /// <summary>
        /// Daws a list of all transitions of the state machine
        /// </summary>
        private void DrawTransitionList()
        {
            this.showTransitions = EditorGUILayout.Foldout(this.showTransitions, "Transitions");

            if (this.showTransitions)
            {
                GUILayoutUtils.Ident(() =>
                {
                    this.transitionSearchFilter = EditorGUILayout.TextField("Search", this.transitionSearchFilter);

                    EditorGUILayout.Space();

                    string filterKeyword = this.transitionSearchFilter.ToLower();

                    foreach (var transition in this.graph.Transitions)
                    {
                        GUILayoutUtils.HorizontalGroup(() =>
                        {
                            if (transition != null && transition.ID.ToLower().Contains(filterKeyword))
                            {
                                EditorGUILayout.LabelField(transition.ID);

                                if (GUILayout.Button(this.selectButtonContent, EditorStyles.miniButton, GUILayout.Width(50)))
                                {
                                    EditorWindowCommands.OpenStateMachineGraph(this.stateMachine).SelectTransition(transition);
                                }
                            }
                        });
                    }
                });
            }
        }
コード例 #2
0
        /// <summary>
        /// Draws a list of all states of the state machine
        /// </summary>
        private void DrawStateList()
        {
            this.showStates = EditorGUILayout.Foldout(this.showStates, this.stateListFoldoutContent);

            if (this.showStates)
            {
                GUILayoutUtils.Ident(() =>
                {
                    this.stateSearchFilter = EditorGUILayout.TextField("Search", this.stateSearchFilter);

                    EditorGUILayout.Space();

                    string filterKeyword = this.stateSearchFilter.ToLower();

                    foreach (var node in this.graph.Nodes)
                    {
                        if (node is State state)
                        {
                            GUILayoutUtils.HorizontalGroup(() =>
                            {
                                if (state.ID.ToLower().Contains(filterKeyword))
                                {
                                    EditorGUILayout.LabelField(state.ID);

                                    if (GUILayout.Button(this.selectButtonContent, EditorStyles.miniButton, GUILayout.Width(50)))
                                    {
                                        EditorWindowCommands.OpenStateMachineGraph(this.stateMachine).SelectState(state);
                                    }
                                }
                            });
                        }
                    }
                });
            }
        }
コード例 #3
0
        /// <summary>
        /// Draws the button to open the State Machine Graph Editor
        /// </summary>
        private void DrawGraphButton()
        {
            GUILayoutUtils.HorizontalGroup(() =>
            {
                EditorGUILayout.LabelField("Graph Editor");

                if (GUILayout.Button(this.openButtonContent, EditorStyles.miniButton, GUILayout.Width(50)))
                {
                    var castedTarget = (this.target as StateMachine);

                    EditorWindowCommands.OpenStateMachineGraph(castedTarget);
                }
            });
        }