Esempio n. 1
0
            public virtual bool RenderObjectProperties(GUIContent label)
            {
                bool dataChanged;

                _editableObject = SerializedObjectEditorGUILayout.ObjectField(_editableObject, label, out dataChanged);
                return(dataChanged);
            }
            public bool RenderObjectProperties(GUIContent label)
            {
                bool dataChanged = false;

                _editorFoldout = EditorGUILayout.Foldout(_editorFoldout, "Condition (" + _condition + ")");
                if (_editorFoldout)
                {
                    int origIndent = EditorGUI.indentLevel;
                    EditorGUI.indentLevel++;

                    bool objectChanged;
                    _condition   = SerializedObjectEditorGUILayout.ObjectField(_condition, "Properties", out objectChanged);
                    dataChanged |= objectChanged;

                    EditorGUI.indentLevel = origIndent;
                }

                dataChanged |= _state.RenderObjectProperties(new GUIContent("Go to"));

                EditorGUI.BeginChangeCheck();
                _duration    = EditorGUILayout.FloatField("Time Window", _duration);
                dataChanged |= EditorGUI.EndChangeCheck();

                return(dataChanged);
            }
Esempio n. 3
0
            protected override bool RenderStaticValueProperty()
            {
                bool objectChanged;

                _value = SerializedObjectEditorGUILayout.ObjectField(_value, "Value", out objectChanged);
                return(objectChanged);
            }
Esempio n. 4
0
                public override bool RenderObjectProperties(GUIContent label)
                {
                    bool dataChanged = RenderEventTime();

                    bool eventChanged;

                    SerializedObjectEditorGUILayout.ObjectField(GetEditableObject(), "Event Properties", out eventChanged);
                    dataChanged |= eventChanged;

                    return(dataChanged);
                }
Esempio n. 5
0
            public bool RenderObjectProperties(GUIContent label)
            {
                bool dataChanged = false;

                if (label == null)
                {
                    label = new GUIContent();
                }

                label.text += " (" + this + ")";

                _editorFoldout = EditorGUILayout.Foldout(_editorFoldout, label);
                if (_editorFoldout)
                {
                    int origIndent = EditorGUI.indentLevel;
                    EditorGUI.indentLevel++;

                    //Show drop down
                    eSourceType prevType = _sourceType;
                    _sourceType = SerializedObjectEditorGUILayout.ObjectField(_sourceType, "Source Type", out dataChanged);

                    if (prevType != _sourceType)
                    {
                        ClearGameObject();
                        dataChanged = true;
                    }

                    switch (_sourceType)
                    {
                    case eSourceType.Scene:
                    {
                        dataChanged |= RenderSceneObjectProperties();
                    }
                    break;

                    case eSourceType.Prefab:
                    {
                        dataChanged |= RenderPrefabProperties();
                    }
                    break;

                    case eSourceType.Loaded:
                    {
                        dataChanged |= RenderLoadedProperties();
                    }
                    break;
                    }

                    EditorGUI.indentLevel = origIndent;
                }

                return(dataChanged);
            }
                public override bool RenderObjectProperties(GUIContent label)
                {
                    EventDoThenGoToState evnt = GetEditableObject() as EventDoThenGoToState;
                    bool dataChanged          = false;

                    _firstStateEditorFoldout = EditorGUILayout.Foldout(_firstStateEditorFoldout, "First");
                    if (_firstStateEditorFoldout)
                    {
                        int origIndent = EditorGUI.indentLevel;
                        EditorGUI.indentLevel++;

                        evnt._preStateType = SerializedObjectEditorGUILayout.ObjectField(evnt._preStateType, "State Type", out dataChanged);

                        switch (evnt._preStateType)
                        {
                        case EventDoThenGoToState.eStateType.Timeline:
                            dataChanged |= evnt._preState.RenderObjectProperties(new GUIContent("State"));
                            break;

                        case EventDoThenGoToState.eStateType.Coroutine:
                            dataChanged |= evnt._preCoroutine.RenderObjectProperties(new GUIContent("State"));
                            break;
                        }

                        EditorGUI.indentLevel = origIndent;
                    }

                    _secondStateEditorFoldout = EditorGUILayout.Foldout(_secondStateEditorFoldout, "Then");
                    if (_secondStateEditorFoldout)
                    {
                        int origIndent = EditorGUI.indentLevel;
                        EditorGUI.indentLevel++;

                        evnt._stateType = SerializedObjectEditorGUILayout.ObjectField(evnt._stateType, "State Type", out dataChanged);

                        switch (evnt._stateType)
                        {
                        case EventDoThenGoToState.eStateType.Timeline:
                            dataChanged |= evnt._state.RenderObjectProperties(new GUIContent("State"));
                            break;

                        case EventDoThenGoToState.eStateType.Coroutine:
                            dataChanged |= evnt._coroutine.RenderObjectProperties(new GUIContent("State"));
                            break;
                        }

                        EditorGUI.indentLevel = origIndent;
                    }

                    return(dataChanged);
                }
Esempio n. 7
0
            public virtual bool RenderObjectProperties(GUIContent label)
            {
                bool dataChanged = false;

                if (label == null)
                {
                    label = new GUIContent();
                }

                label.text += " (" + (typeof(T) == typeof(float) ? "float" : typeof(T).Name) + ")";

                _editorFoldout = EditorGUILayout.Foldout(_editorFoldout, label);
                if (_editorFoldout)
                {
                    int origIndent = EditorGUI.indentLevel;
                    EditorGUI.indentLevel++;

                    _sourceType = SerializedObjectEditorGUILayout.ObjectField(_sourceType, new GUIContent("Input Type", "Static: Value will be constant.\nNode: Value read from other nodes output."), out dataChanged);
                    if (dataChanged)
                    {
                        ClearStaticValue();
                        _sourceNodeId = -1;
                    }

                    switch (_sourceType)
                    {
                    case eSourceType.Static:
                    {
                        dataChanged |= RenderStaticValueProperty();
                    }
                    break;

                    case eSourceType.Node:
                    {
                        dataChanged |= DrawNodeNamePopUps();
                    }
                    break;
                    }

                    EditorGUI.indentLevel = origIndent;
                }

                return(dataChanged);
            }
Esempio n. 8
0
                public override bool RenderObjectProperties(GUIContent label)
                {
                    EventGoToState evnt = GetEditableObject() as EventGoToState;

                    bool dataChanged;

                    evnt._stateType = SerializedObjectEditorGUILayout.ObjectField(evnt._stateType, "State Type", out dataChanged);

                    switch (evnt._stateType)
                    {
                    case EventGoToState.eStateType.Timeline:
                        dataChanged |= evnt._state.RenderObjectProperties(new GUIContent("State"));
                        break;

                    case EventGoToState.eStateType.Coroutine:
                        dataChanged |= evnt._coroutine.RenderObjectProperties(new GUIContent("State"));
                        break;
                    }

                    return(dataChanged);
                }
Esempio n. 9
0
            public bool RenderProperty(GUIContent label)
            {
                bool dataChanged = false;

                if (label == null)
                {
                    label = new GUIContent();
                }

                label.text += " (" + this;

                if (_additionalLoadingObjects != null && _additionalLoadingObjects.Length > 0)
                {
                    label.text += " with " + GetAdditionalLoadingObjectsDescription();
                }

                label.text += ")";

                _editorFoldout = EditorGUILayout.Foldout(_editorFoldout, label);

                if (_editorFoldout)
                {
                    int origIndent = EditorGUI.indentLevel;
                    EditorGUI.indentLevel++;

                    dataChanged |= _scene.RenderObjectProperties(new GUIContent("Scene"));

                    bool arrayChanged;
                    _additionalLoadingObjects = SerializedObjectEditorGUILayout.ObjectField(_additionalLoadingObjects, "Additional Loading Objects", out arrayChanged);
                    dataChanged |= arrayChanged;

                    EditorGUI.indentLevel = origIndent;
                }

                return(dataChanged);
            }
Esempio n. 10
0
                public override bool RenderObjectProperties(GUIContent label)
                {
                    Color orig = GUI.backgroundColor;
                    EventStartBranchingState evnt = GetEditableObject() as EventStartBranchingState;

                    bool dataChanged = false;

                    #region Render Brances
                    EditorGUILayout.LabelField("Branches:", EditorStyles.boldLabel);
                    EditorGUILayout.Separator();

                    for (int i = 0; i < evnt._branches.Length; i++)
                    {
                        GUI.backgroundColor = _branchLabelColor;
                        EditorGUILayout.LabelField(GetBranchLabel(evnt._branches[i], i == 0), EditorUtils.TextTitleStyle, GUILayout.Height(24.0f));
                        GUI.backgroundColor = orig;

                        //Draw branch properties
                        bool branchChanged;
                        SerializedObjectEditorGUILayout.ObjectField(evnt._branches[i], string.Empty, out branchChanged);
                        dataChanged |= branchChanged;

                        if (DrawEditBranchButtons(i))
                        {
                            dataChanged = true;
                            break;
                        }
                    }

                    dataChanged |= DrawAddBranchButton();
                    #endregion

                    EditorGUILayout.Separator();
                    EditorGUILayout.Separator();

                    #region Render Background Logic Threads
                    EditorGUILayout.LabelField("Background Logic:", EditorStyles.boldLabel);
                    EditorGUILayout.Separator();

                    for (int i = 0; i < evnt._backgroundLogic.Length; i++)
                    {
                        BranchingBackgroundLogic backgroundLogic = evnt._backgroundLogic[i];

                        GUI.backgroundColor = _branchLabelColor;
                        EditorGUILayout.LabelField(backgroundLogic.GetDescription(), EditorUtils.TextTitleStyle, GUILayout.Height(24.0f));
                        GUI.backgroundColor = orig;

                        //Draw backgroundLogic properties
                        {
                            int origIndent = EditorGUI.indentLevel;
                            EditorGUI.indentLevel++;

                            bool objectChanged;
                            backgroundLogic = SerializedObjectEditorGUILayout.ObjectField(backgroundLogic, "", out objectChanged);
                            dataChanged    |= objectChanged;

                            EditorGUI.indentLevel = origIndent;
                        }

                        if (DrawEditBackgroundLogicButtons(i))
                        {
                            dataChanged = true;
                            break;
                        }
                    }

                    dataChanged |= DrawAddBackgroundLogicButton();
                    #endregion

                    return(dataChanged);
                }
Esempio n. 11
0
                public override bool RenderObjectProperties(GUIContent label)
                {
                    EditorGUI.BeginChangeCheck();
                    GetEditableObject()._editorDescription = EditorGUILayout.TextField("Editor Description", GetEditableObject()._editorDescription);
                    bool dataChanged = EditorGUI.EndChangeCheck();

                    //Render Inputs
                    bool renderedFirstInput = false;
                    {
                        foreach (NodeEditorField input in _inputNodes)
                        {
                            if (!renderedFirstInput)
                            {
                                EditorGUILayout.Separator();
                                EditorGUILayout.LabelField("Inputs", EditorStyles.boldLabel);
                                EditorGUILayout.Separator();
                                renderedFirstInput = true;
                            }

                            string           fieldName       = StringUtils.FromCamelCase(input._name);
                            TooltipAttribute fieldToolTipAtt = SystemUtils.GetAttribute <TooltipAttribute>(input._fieldInfo);
                            GUIContent       labelContent    = fieldToolTipAtt != null ? new GUIContent(fieldName, fieldToolTipAtt.tooltip) : new GUIContent(fieldName);

                            bool   fieldChanged;
                            object nodeFieldObject = input._fieldInfo.GetValue(GetEditableObject());
                            nodeFieldObject = SerializedObjectEditorGUILayout.ObjectField(nodeFieldObject, labelContent, out fieldChanged);
                            if (fieldChanged)
                            {
                                dataChanged = true;
                                input._fieldInfo.SetValue(GetEditableObject(), nodeFieldObject);
                            }
                        }
                    }

                    //Render other properties
                    bool renderedFirstProperty = false;

                    {
                        SerializedFieldInfo[] serializedFields = SerializedFieldInfo.GetSerializedFields(GetEditableObject().GetType());
                        foreach (SerializedFieldInfo serializedField in serializedFields)
                        {
                            if (!serializedField.HideInEditor() && !SystemUtils.IsSubclassOfRawGeneric(typeof(NodeInputFieldBase <>), serializedField.GetFieldType()))
                            {
                                if (!renderedFirstProperty)
                                {
                                    EditorGUILayout.Separator();
                                    EditorGUILayout.LabelField("Properties", EditorStyles.boldLabel);
                                    EditorGUILayout.Separator();
                                    renderedFirstProperty = true;
                                }

                                string           fieldName       = StringUtils.FromCamelCase(serializedField.GetID());
                                TooltipAttribute fieldToolTipAtt = SystemUtils.GetAttribute <TooltipAttribute>(serializedField);
                                GUIContent       labelContent    = fieldToolTipAtt != null ? new GUIContent(fieldName, fieldToolTipAtt.tooltip) : new GUIContent(fieldName);

                                bool   fieldChanged;
                                object nodeFieldObject = serializedField.GetValue(GetEditableObject());
                                nodeFieldObject = SerializedObjectEditorGUILayout.ObjectField(nodeFieldObject, labelContent, out fieldChanged);
                                if (fieldChanged)
                                {
                                    dataChanged = true;
                                    serializedField.SetValue(GetEditableObject(), nodeFieldObject);
                                }
                            }
                        }
                    }

                    return(dataChanged);
                }
            public bool RenderObjectProperties(GUIContent label)
            {
                bool dataChanged = false;

                dataChanged |= _gameObject.RenderObjectProperties(new GUIContent("Game Object"));

                bool transformFlagsChanged;

                _transformFlags = SerializedObjectEditorGUILayout.ObjectField(_transformFlags, "Transform Flags", out transformFlagsChanged);
                dataChanged    |= transformFlagsChanged;

                bool moveTypeChanged;

                _moveType    = SerializedObjectEditorGUILayout.ObjectField(_moveType, "Move Type", out moveTypeChanged);
                dataChanged |= moveTypeChanged;

                bool easeChanged;

                _easeType    = SerializedObjectEditorGUILayout.ObjectField(_easeType, "Ease Type", out easeChanged);
                dataChanged |= easeChanged;

                EditorGUI.BeginChangeCheck();
                _duration    = EditorGUILayout.FloatField("Duration", _duration);
                dataChanged |= EditorGUI.EndChangeCheck();

                bool targetChanged;

                _targetType = SerializedObjectEditorGUILayout.ObjectField(_targetType, "Target Type", out targetChanged);
                if (targetChanged)
                {
                    dataChanged = true;

                    _targetTransform.ClearGameObject();
                    _targetPosition = Vector3.zero;
                    _targetRotation = Quaternion.identity;
                    _targetScale    = Vector3.one;
                }

                switch (_targetType)
                {
                case eTargetType.Transform:
                {
                    dataChanged |= _targetTransform.RenderObjectProperties(new GUIContent("Target Type"));
                }
                break;

                case eTargetType.LocalDelta:
                case eTargetType.LocalTarget:
                case eTargetType.WorldDelta:
                case eTargetType.WorldTarget:
                {
                    if ((_transformFlags & eTransformFlag.Translate) != 0)
                    {
                        EditorGUI.BeginChangeCheck();
                        _targetPosition = EditorGUILayout.Vector3Field("Translation", _targetPosition);
                        dataChanged    |= EditorGUI.EndChangeCheck();
                    }
                    if ((_transformFlags & eTransformFlag.Rotate) != 0)
                    {
                        EditorGUI.BeginChangeCheck();
                        _targetRotation.eulerAngles = EditorGUILayout.Vector3Field("Rotation", _targetRotation.eulerAngles);
                        dataChanged |= EditorGUI.EndChangeCheck();
                    }
                    if ((_transformFlags & eTransformFlag.Scale) != 0)
                    {
                        EditorGUI.BeginChangeCheck();
                        _targetScale = EditorGUILayout.Vector3Field("Scale", _targetScale);
                        dataChanged |= EditorGUI.EndChangeCheck();
                    }
                }
                break;
                }


                return(dataChanged);
            }