Exemple #1
0
                private void CreateEditor()
                {
                    if (_stateMachineEditor == null || _stateMachineEditor.GetEditorWindow() == null)
                    {
                        TimelineStateMachineEditorStyle style = new TimelineStateMachineEditorStyle();
                        style._defaultStateColor = new Color(61f / 255f, 154f / 255f, 92f / 255f);
                        style._linkColor         = Color.white;

                        _stateMachineEditor = TimelineStateMachineEditor.CreateInstance <TimelineStateMachineEditor>();
                        _stateMachineEditor.Init(kWindowTitle, this, kWindowTag, SystemUtils.GetAllSubTypes(typeof(IStateMachineEvent)), style);
                    }
                }
Exemple #2
0
                public override bool RenderObjectProperties(GUIContent label)
                {
                    EditorGUI.BeginChangeCheck();

                    TimelineState state = GetEditableObject();

                    if (IsExternal)
                    {
                        GUILayout.Label("External State Link: " + ExternalStateRef, EditorStyles.centeredGreyMiniLabel);

                        EditorGUILayout.Separator();

                        if (GUILayout.Button("Open State machine"))
                        {
                            TimelineStateMachineEditor timelineStateMachineEditor = (TimelineStateMachineEditor)GetEditor();
                            timelineStateMachineEditor.LoadExternalState(this);
                        }
                    }
                    else if (IsNote)
                    {
                        state._editorDescription = EditorGUILayout.TextArea(state._editorDescription);
                    }
                    else
                    {
                        _labelFoldout = EditorGUILayout.Foldout(_labelFoldout, "State Description");
                        if (_labelFoldout)
                        {
                            int origIndent = EditorGUI.indentLevel;
                            EditorGUI.indentLevel++;

                            state._editorAutoDescription = EditorGUILayout.Toggle("Auto", state._editorAutoDescription);

                            if (!state._editorAutoDescription)
                            {
                                state._editorDescription = EditorGUILayout.DelayedTextField(state._editorDescription);
                            }

                            EditorGUI.indentLevel = origIndent;
                        }

                        _labelFoldout = EditorGUILayout.Foldout(_labelFoldout, "State Color");
                        if (_labelFoldout)
                        {
                            int origIndent = EditorGUI.indentLevel;
                            EditorGUI.indentLevel++;

                            state._editorAutoColor = EditorGUILayout.Toggle("Auto", state._editorAutoColor);

                            if (!state._editorAutoColor)
                            {
                                state._editorColor = EditorGUILayout.ColorField("Color", state._editorColor);
                            }

                            EditorGUI.indentLevel = origIndent;
                        }

                        if (GUILayout.Button("Edit"))
                        {
                            TimelineStateMachineEditor timelineStateMachineEditor = (TimelineStateMachineEditor)GetEditor();
                            timelineStateMachineEditor.SwitchToStateView(state._stateId);
                        }
                    }

                    return(EditorGUI.EndChangeCheck());
                }