Пример #1
0
        public void OnInteractionGUI()
        {
            if (target == null || serializedObject == null)
            {
                return;
            }
            serializedObject.Update();

            EditorGUILayout.PropertyField(this.spDescription);

            GUIContent gcIf   = InteractionUtilities.Get(InteractionUtilities.Icon.If);
            Rect       rectIf = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.boldLabel);

            EditorGUI.LabelField(rectIf, gcIf, EditorStyles.boldLabel);

            this.conditionsListEditor.OnInspectorGUI();
            EditorGUILayout.Space();

            GUIContent gcThen   = InteractionUtilities.Get(InteractionUtilities.Icon.Then);
            Rect       rectThen = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.boldLabel);

            EditorGUI.LabelField(rectThen, gcThen, EditorStyles.boldLabel);

            ActionsEditor.Return returnActions = ActionsEditor.PaintActionsGUI(
                this.parentEvent.gameObject,
                this.spActions,
                this.actionsEditor
                );

            if (returnActions != null)
            {
                this.spActions     = returnActions.spParentActions;
                this.actionsEditor = returnActions.parentActionsEditor;

                serializedObject.ApplyModifiedProperties();
                serializedObject.Update();
            }

            serializedObject.ApplyModifiedProperties();
        }
Пример #2
0
        private void PaintEvent()
        {
            if (this.spInteractions != null && this.spInteractions.arraySize > 0)
            {
                this.PaintInteractions();
            }
            else
            {
                EditorGUILayout.HelpBox(MSG_EMTPY_EVENTS, MessageType.None);
            }

            float widthAddInteraction = 100f;
            Rect  rectControls        = GUILayoutUtility.GetRect(GUIContent.none, CoreGUIStyles.GetToggleButtonNormalOn());
            Rect  rectAddInteraction  = new Rect(
                rectControls.x + (rectControls.width / 2.0f) - (widthAddInteraction + 25f) / 2.0f,
                rectControls.y,
                widthAddInteraction,
                rectControls.height
                );

            Rect rectPaste = new Rect(
                rectAddInteraction.x + rectAddInteraction.width,
                rectControls.y,
                25f,
                rectControls.height
                );

            if (GUI.Button(rectAddInteraction, "Add Interaction", CoreGUIStyles.GetButtonLeft()))
            {
                Interaction interactionCreated = this.instance.gameObject.AddComponent <Interaction>();

                int interactionCreatedIndex = this.spInteractions.arraySize;
                this.spInteractions.InsertArrayElementAtIndex(interactionCreatedIndex);
                this.spInteractions.GetArrayElementAtIndex(interactionCreatedIndex).objectReferenceValue = interactionCreated;

                this.AddSubEditorElement(interactionCreated, -1, true);

                serializedObject.ApplyModifiedProperties();
                serializedObject.Update();
            }

            GUIContent gcPaste = InteractionUtilities.Get(InteractionUtilities.Icon.Paste);

            EditorGUI.BeginDisabledGroup(CLIPBOARD_INTERACTION == null);
            if (GUI.Button(rectPaste, gcPaste, CoreGUIStyles.GetButtonRight()))
            {
                Interaction copy = this.instance.gameObject.AddComponent <Interaction>();
                EditorUtility.CopySerialized(CLIPBOARD_INTERACTION, copy);

                if (copy.conditionsList != null)
                {
                    IConditionsList conditionsListSource = copy.conditionsList;
                    IConditionsList conditionsListCopy   = this.instance.gameObject.AddComponent <IConditionsList>();

                    EditorUtility.CopySerialized(conditionsListSource, conditionsListCopy);
                    EventEditor.DuplicateIConditionList(conditionsListSource, conditionsListCopy);

                    SerializedObject soCopy = new SerializedObject(copy);
                    soCopy.FindProperty(InteractionEditor.PROP_CONDITIONSLIST).objectReferenceValue = conditionsListCopy;
                    soCopy.ApplyModifiedProperties();
                    soCopy.Update();
                }

                int interactionIndex = this.spInteractions.arraySize;
                this.spInteractions.InsertArrayElementAtIndex(interactionIndex);
                this.spInteractions.GetArrayElementAtIndex(interactionIndex).objectReferenceValue = copy;

                this.AddSubEditorElement(copy, -1, true);

                serializedObject.ApplyModifiedProperties();
                serializedObject.Update();

                DestroyImmediate(CLIPBOARD_INTERACTION.gameObject, true);
                CLIPBOARD_INTERACTION = null;

                /*
                 * int srcIndex = duplicateInteractionIndex;
                 * int dstIndex = duplicateInteractionIndex + 1;
                 *
                 * Interaction source = (Interaction)this.subEditors[srcIndex].target;
                 * Interaction copy = (Interaction)this.instance.gameObject.AddComponent(source.GetType());
                 * EditorUtility.CopySerialized(source, copy);
                 *
                 * if (copy.conditionsList != null)
                 * {
                 *  IConditionsList conditionsListSource = copy.conditionsList;
                 *  IConditionsList conditionsListCopy = this.instance.gameObject.AddComponent<IConditionsList>();
                 *
                 *  EditorUtility.CopySerialized(conditionsListSource, conditionsListCopy);
                 *  EventEditor.DuplicateIConditionList(conditionsListSource, conditionsListCopy);
                 *
                 *  SerializedObject soCopy = new SerializedObject(copy);
                 *  soCopy.FindProperty(InteractionEditor.PROP_CONDITIONSLIST).objectReferenceValue = conditionsListCopy;
                 *  soCopy.ApplyModifiedProperties();
                 *  soCopy.Update();
                 * }
                 *
                 * this.spInteractions.InsertArrayElementAtIndex(dstIndex);
                 * this.spInteractions.GetArrayElementAtIndex(dstIndex).objectReferenceValue = copy;
                 *
                 * this.spInteractions.serializedObject.ApplyModifiedProperties();
                 * this.spInteractions.serializedObject.Update();
                 *
                 * this.AddSubEditorElement(copy, dstIndex, true);
                 */
            }
            EditorGUI.EndDisabledGroup();

            GUIContent gcElse   = InteractionUtilities.Get(InteractionUtilities.Icon.Else);
            Rect       rectElse = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.boldLabel);

            EditorGUI.LabelField(rectElse, gcElse, EditorStyles.boldLabel);

            ActionsEditor.Return returnActions = ActionsEditor.PaintActionsGUI(
                this.instance.gameObject,
                this.spDefaultActions,
                this.actionsEditor
                );

            if (returnActions != null)
            {
                this.spDefaultActions = returnActions.spParentActions;
                this.actionsEditor    = returnActions.parentActionsEditor;

                serializedObject.ApplyModifiedProperties();
                serializedObject.Update();
            }

            EditorGUILayout.Space();
        }
Пример #3
0
        private void PaintInteractions()
        {
            int removeInteractionIndex    = -1;
            int duplicateInteractionIndex = -1;
            int copyInteractionIndex      = -1;

            bool forceRepaint     = false;
            int  interactionsSize = this.spInteractions.arraySize;

            for (int i = 0; i < interactionsSize; ++i)
            {
                if (this.subEditors == null || i >= this.subEditors.Length || this.subEditors[i] == null)
                {
                    continue;
                }

                bool repaint = this.editorSortableList.CaptureSortEvents(this.subEditors[i].handleDragRect, i);
                forceRepaint = repaint || forceRepaint;

                EditorGUILayout.BeginVertical();
                Rect rectHeader = GUILayoutUtility.GetRect(GUIContent.none, CoreGUIStyles.GetToggleButtonNormalOn());
                this.PaintDragHandle(i, rectHeader);

                EditorGUIUtility.AddCursorRect(this.subEditors[i].handleDragRect, MouseCursor.Pan);
                string   name  = (this.isExpanded[i].target ? "▾ " : "▸ ") + this.instance.interactions[i].description;
                GUIStyle style = (this.isExpanded[i].target
                                        ? CoreGUIStyles.GetToggleButtonMidOn()
                                        : CoreGUIStyles.GetToggleButtonMidOff()
                                  );

                Rect rectDelete = new Rect(
                    rectHeader.x + rectHeader.width - 25f,
                    rectHeader.y,
                    25f,
                    rectHeader.height
                    );

                Rect rectDuplicate = new Rect(
                    rectDelete.x - 25f,
                    rectHeader.y,
                    25f,
                    rectHeader.height
                    );

                Rect rectCopy = new Rect(
                    rectDuplicate.x - 25f,
                    rectHeader.y,
                    25f,
                    rectHeader.height
                    );

                Rect rectMain = new Rect(
                    rectHeader.x + 25f,
                    rectHeader.y,
                    rectHeader.width - (25f * 4f),
                    rectHeader.height
                    );

                if (GUI.Button(rectMain, name, style))
                {
                    this.ToggleExpand(i);
                }

                GUIContent gcCopy      = InteractionUtilities.Get(InteractionUtilities.Icon.Copy);
                GUIContent gcDuplicate = InteractionUtilities.Get(InteractionUtilities.Icon.Duplicate);
                GUIContent gcDelete    = InteractionUtilities.Get(InteractionUtilities.Icon.Delete);

                if (GUI.Button(rectCopy, gcCopy, CoreGUIStyles.GetButtonMid()))
                {
                    copyInteractionIndex = i;
                }

                if (GUI.Button(rectDuplicate, gcDuplicate, CoreGUIStyles.GetButtonMid()))
                {
                    duplicateInteractionIndex = i;
                }

                if (GUI.Button(rectDelete, gcDelete, CoreGUIStyles.GetButtonRight()))
                {
                    if (EditorUtility.DisplayDialog(MSG_REMOVE_TITLE, MSG_REMOVE_DESCR, "Yes", "Cancel"))
                    {
                        removeInteractionIndex = i;
                    }
                }

                using (var group = new EditorGUILayout.FadeGroupScope(this.isExpanded[i].faded))
                {
                    if (group.visible)
                    {
                        EditorGUILayout.BeginVertical(CoreGUIStyles.GetBoxExpanded());
                        this.subEditors[i].OnInteractionGUI();
                        EditorGUILayout.EndVertical();
                    }
                }

                EditorGUILayout.EndVertical();
                if (UnityEngine.Event.current.type == EventType.Repaint)
                {
                    this.subEditors[i].interactionRect = GUILayoutUtility.GetLastRect();
                }

                this.editorSortableList.PaintDropPoints(this.subEditors[i].interactionRect, i, interactionsSize);
            }

            if (copyInteractionIndex >= 0)
            {
                Interaction source       = (Interaction)this.subEditors[copyInteractionIndex].target;
                GameObject  copyInstance = EditorUtility.CreateGameObjectWithHideFlags(
                    "Interaction (Copy)",
                    HideFlags.HideAndDontSave
                    );

                CLIPBOARD_INTERACTION = (Interaction)copyInstance.AddComponent(source.GetType());
                EditorUtility.CopySerialized(source, CLIPBOARD_INTERACTION);

                if (CLIPBOARD_INTERACTION.conditionsList != null)
                {
                    IConditionsList conditionsListSource = CLIPBOARD_INTERACTION.conditionsList;
                    IConditionsList conditionsListCopy   = this.instance.gameObject.AddComponent <IConditionsList>();

                    EditorUtility.CopySerialized(conditionsListSource, conditionsListCopy);
                    EventEditor.DuplicateIConditionList(conditionsListSource, conditionsListCopy);

                    SerializedObject soCopy = new SerializedObject(CLIPBOARD_INTERACTION);
                    soCopy.FindProperty(InteractionEditor.PROP_CONDITIONSLIST).objectReferenceValue = conditionsListCopy;
                    soCopy.ApplyModifiedProperties();
                    soCopy.Update();
                }
            }

            if (duplicateInteractionIndex >= 0)
            {
                int srcIndex = duplicateInteractionIndex;
                int dstIndex = duplicateInteractionIndex + 1;

                Interaction source = (Interaction)this.subEditors[srcIndex].target;
                Interaction copy   = (Interaction)this.instance.gameObject.AddComponent(source.GetType());
                EditorUtility.CopySerialized(source, copy);

                if (copy.conditionsList != null)
                {
                    IConditionsList conditionsListSource = copy.conditionsList;
                    IConditionsList conditionsListCopy   = this.instance.gameObject.AddComponent <IConditionsList>();

                    EditorUtility.CopySerialized(conditionsListSource, conditionsListCopy);
                    EventEditor.DuplicateIConditionList(conditionsListSource, conditionsListCopy);

                    SerializedObject soCopy = new SerializedObject(copy);
                    soCopy.FindProperty(InteractionEditor.PROP_CONDITIONSLIST).objectReferenceValue = conditionsListCopy;
                    soCopy.ApplyModifiedProperties();
                    soCopy.Update();
                }

                this.spInteractions.InsertArrayElementAtIndex(dstIndex);
                this.spInteractions.GetArrayElementAtIndex(dstIndex).objectReferenceValue = copy;

                this.spInteractions.serializedObject.ApplyModifiedProperties();
                this.spInteractions.serializedObject.Update();

                this.AddSubEditorElement(copy, dstIndex, true);
            }

            if (removeInteractionIndex >= 0)
            {
                this.subEditors[removeInteractionIndex].OnDestroyInteraction();
                Interaction rmInteraction = (Interaction)this.spInteractions
                                            .GetArrayElementAtIndex(removeInteractionIndex).objectReferenceValue;

                this.spInteractions.DeleteArrayElementAtIndex(removeInteractionIndex);
                this.spInteractions.RemoveFromObjectArrayAt(removeInteractionIndex);
                DestroyImmediate(rmInteraction, true);
            }

            EditorSortableList.SwapIndexes swapIndexes = this.editorSortableList.GetSortIndexes();
            if (swapIndexes != null)
            {
                this.spInteractions.MoveArrayElement(swapIndexes.src, swapIndexes.dst);
                this.MoveSubEditorsElement(swapIndexes.src, swapIndexes.dst);
            }

            if (forceRepaint)
            {
                this.Repaint();
            }
        }
Пример #4
0
        // INSPECTOR: --------------------------------------------------------------------------------------------------

        public override void OnInspectorGUI()
        {
            if (target == null || serializedObject == null)
            {
                return;
            }
            serializedObject.Update();
            this.UpdateSubEditors(this.instance.actions);

            int  removeActionIndex    = -1;
            int  duplicateActionIndex = -1;
            int  copyActionIndex      = -1;
            bool forceRepaint         = false;
            bool actionsCollapsed     = true;

            int spActionsSize = this.spActions.arraySize;

            for (int i = 0; i < spActionsSize; ++i)
            {
                bool forceSortRepaint = this.editorSortableList.CaptureSortEvents(this.handleRect[i], i);
                forceRepaint = forceSortRepaint || forceRepaint;

                GUILayout.BeginVertical();
                ItemReturnOperation returnOperation = this.PaintActionHeader(i);
                if (returnOperation.removeIndex)
                {
                    removeActionIndex = i;
                }
                if (returnOperation.copyIndex)
                {
                    copyActionIndex = i;
                }
                if (returnOperation.duplicateIndex)
                {
                    duplicateActionIndex = i;
                }

                actionsCollapsed &= this.isExpanded[i].target;
                using (var group = new EditorGUILayout.FadeGroupScope(this.isExpanded[i].faded))
                {
                    if (group.visible)
                    {
                        EditorGUILayout.BeginVertical(CoreGUIStyles.GetBoxExpanded());
                        if (this.subEditors[i] != null)
                        {
                            this.subEditors[i].OnInspectorGUI();
                        }
                        else
                        {
                            EditorGUILayout.HelpBox(MSG_UNDEF_ACTION_1, MessageType.Warning);
                            EditorGUILayout.HelpBox(MSG_UNDEF_ACTION_2, MessageType.None);
                        }
                        EditorGUILayout.EndVertical();
                    }
                }

                GUILayout.EndVertical();

                if (UnityEngine.Event.current.type == EventType.Repaint)
                {
                    this.objectRect[i] = GUILayoutUtility.GetLastRect();
                }

                this.editorSortableList.PaintDropPoints(this.objectRect[i], i, spActionsSize);
            }

            Rect rectControls   = GUILayoutUtility.GetRect(GUIContent.none, CoreGUIStyles.GetToggleButtonNormalOn());
            Rect rectAddActions = new Rect(
                rectControls.x,
                rectControls.y,
                SelectTypePanel.WINDOW_WIDTH,
                rectControls.height
                );

            Rect rectPaste = new Rect(
                rectAddActions.x + rectAddActions.width,
                rectControls.y,
                25f,
                rectControls.height
                );

            Rect rectPlay = new Rect(
                rectControls.x + rectControls.width - 25f,
                rectControls.y,
                25f,
                rectControls.height
                );

            Rect rectCollapse = new Rect(
                rectPlay.x - 25f,
                rectPlay.y,
                25f,
                rectPlay.height
                );

            Rect rectUnused = new Rect(
                rectPaste.x + rectPaste.width,
                rectControls.y,
                rectControls.width - ((rectPaste.x + rectPaste.width) - rectControls.x) - rectPlay.width - rectCollapse.width,
                rectControls.height
                );

            if (GUI.Button(rectAddActions, "Add Action", CoreGUIStyles.GetToggleButtonLeftAdd()))
            {
                SelectTypePanel selectTypePanel = new SelectTypePanel(this.AddNewAction, "Actions", typeof(IAction));
                PopupWindow.Show(this.addActionsButtonRect, selectTypePanel);
            }

            if (UnityEngine.Event.current.type == EventType.Repaint)
            {
                this.addActionsButtonRect = rectAddActions;
            }

            EditorGUI.BeginDisabledGroup(CLIPBOARD_IACTION == null);
            GUIContent gcPaste = InteractionUtilities.Get(InteractionUtilities.Icon.Paste);

            if (GUI.Button(rectPaste, gcPaste, CoreGUIStyles.GetButtonMid()))
            {
                IAction actionInstance = (IAction)this.instance.gameObject.AddComponent(CLIPBOARD_IACTION.GetType());
                EditorUtility.CopySerialized(CLIPBOARD_IACTION, actionInstance);

                this.spActions.AddToObjectArray(actionInstance);
                this.AddSubEditorElement(actionInstance, -1, true);

                DestroyImmediate(CLIPBOARD_IACTION.gameObject, true);
                CLIPBOARD_IACTION = null;
            }
            EditorGUI.EndDisabledGroup();

            GUI.Label(rectUnused, "", CoreGUIStyles.GetToggleButtonMidOn());

            GUIContent gcToggle = (actionsCollapsed
               ? InteractionUtilities.Get(InteractionUtilities.Icon.Collapse)
               : InteractionUtilities.Get(InteractionUtilities.Icon.Expand)
                                   );

            EditorGUI.BeginDisabledGroup(this.instance.actions.Length == 0);
            if (GUI.Button(rectCollapse, gcToggle, CoreGUIStyles.GetButtonMid()))
            {
                for (int i = 0; i < this.subEditors.Length; ++i)
                {
                    this.SetExpand(i, !actionsCollapsed);
                }
            }
            EditorGUI.EndDisabledGroup();

            EditorGUI.BeginDisabledGroup(!EditorApplication.isPlaying);
            GUIContent gcPlay = InteractionUtilities.Get(InteractionUtilities.Icon.Play);

            if (GUI.Button(rectPlay, gcPlay, CoreGUIStyles.GetButtonRight()))
            {
                this.instance.Execute(this.instance.gameObject, () => { return; });
            }
            EditorGUI.EndDisabledGroup();

            if (removeActionIndex >= 0)
            {
                IAction source = (IAction)this.spActions.GetArrayElementAtIndex(removeActionIndex).objectReferenceValue;

                this.spActions.RemoveFromObjectArrayAt(removeActionIndex);
                this.RemoveSubEditorsElement(removeActionIndex);
                DestroyImmediate(source, true);
            }

            if (copyActionIndex >= 0)
            {
                IAction    source    = (IAction)this.subEditors[copyActionIndex].target;
                GameObject clipboard = new GameObject("ActionClipboard")
                {
                    hideFlags = HideFlags.HideAndDontSave
                };

                CLIPBOARD_IACTION = (IAction)clipboard.AddComponent(source.GetType());
                EditorUtility.CopySerialized(source, CLIPBOARD_IACTION);
            }

            if (duplicateActionIndex >= 0)
            {
                int srcIndex = duplicateActionIndex;
                int dstIndex = duplicateActionIndex + 1;

                IAction source = (IAction)this.subEditors[srcIndex].target;
                IAction copy   = (IAction)this.instance.gameObject.AddComponent(source.GetType());

                this.spActions.InsertArrayElementAtIndex(dstIndex);
                this.spActions.GetArrayElementAtIndex(dstIndex).objectReferenceValue = copy;

                EditorUtility.CopySerialized(source, copy);
                this.AddSubEditorElement(copy, dstIndex, true);
            }

            EditorSortableList.SwapIndexes swapIndexes = this.editorSortableList.GetSortIndexes();
            if (swapIndexes != null)
            {
                this.spActions.MoveArrayElement(swapIndexes.src, swapIndexes.dst);
                this.MoveSubEditorsElement(swapIndexes.src, swapIndexes.dst);
            }

            if (EditorApplication.isPlaying)
            {
                forceRepaint = true;
            }
            if (forceRepaint)
            {
                this.Repaint();
            }
            serializedObject.ApplyModifiedProperties();
        }
Пример #5
0
        private ItemReturnOperation PaintActionHeader(int i)
        {
            ItemReturnOperation returnOperation = new ItemReturnOperation();

            Color defaultBackgroundColor = GUI.backgroundColor;

            if (this.spExecutingIndex.intValue == i)
            {
                GUI.backgroundColor = COLOR_EXECUTING_ACTION;
            }

            Rect rectHeader = GUILayoutUtility.GetRect(GUIContent.none, CoreGUIStyles.GetToggleButtonNormalOn());

            this.PaintDragHandle(i, rectHeader);

            Texture2D icon = this.subEditors[i].GetIcon();
            string    name = (this.isExpanded[i].target ? " ▾ " : " ▸ ");

            name += (this.instance.actions[i] != null
                ? this.instance.actions[i].GetNodeTitle()
                : "<i>Undefined Action</i>"
                     );

            GUIStyle style = (this.isExpanded[i].target
                ? CoreGUIStyles.GetToggleButtonMidOn()
                : CoreGUIStyles.GetToggleButtonMidOff()
                              );

            float opacity = 1.0f;

            if (this.subEditors[i] != null && this.subEditors[i].action != null)
            {
                opacity = this.subEditors[i].action.GetOpacity();
            }

            Color tempColor = style.normal.textColor;

            style.normal.textColor = new Color(
                style.normal.textColor.r,
                style.normal.textColor.g,
                style.normal.textColor.b,
                opacity
                );

            Rect rectDelete = new Rect(
                rectHeader.x + rectHeader.width - 25f,
                rectHeader.y,
                25f,
                rectHeader.height
                );

            Rect rectDuplicate = new Rect(
                rectDelete.x - 25f,
                rectHeader.y,
                25f,
                rectHeader.height
                );

            Rect rectCopy = new Rect(
                rectDuplicate.x - 25f,
                rectHeader.y,
                25f,
                rectHeader.height
                );

            Rect rectMain = new Rect(
                rectHeader.x + 25f,
                rectHeader.y,
                rectHeader.width - (25f * 4f),
                rectHeader.height
                );

            if (GUI.Button(rectMain, new GUIContent(name, icon), style))
            {
                this.ToggleExpand(i);
            }

            style.normal.textColor = tempColor;

            GUIContent gcCopy      = InteractionUtilities.Get(InteractionUtilities.Icon.Copy);
            GUIContent gcDuplicate = InteractionUtilities.Get(InteractionUtilities.Icon.Duplicate);
            GUIContent gcDelete    = InteractionUtilities.Get(InteractionUtilities.Icon.Delete);

            if (this.instance.actions[i] != null && GUI.Button(rectCopy, gcCopy, CoreGUIStyles.GetButtonMid()))
            {
                returnOperation.copyIndex = true;
            }

            if (this.instance.actions[i] != null && GUI.Button(rectDuplicate, gcDuplicate, CoreGUIStyles.GetButtonMid()))
            {
                returnOperation.duplicateIndex = true;
            }

            if (GUI.Button(rectDelete, gcDelete, CoreGUIStyles.GetButtonRight()))
            {
                returnOperation.removeIndex = true;
            }

            GUI.backgroundColor = defaultBackgroundColor;

            return(returnOperation);
        }
Пример #6
0
        private ItemReturnOperation PaintConditionsHeader(int i)
        {
            ItemReturnOperation returnOperation = new ItemReturnOperation();

            Rect rectHeader = GUILayoutUtility.GetRect(GUIContent.none, CoreGUIStyles.GetToggleButtonNormalOn());

            this.PaintDragHandle(i, rectHeader);

            Texture2D conditionIcon = this.subEditors[i].GetIcon();
            string    conditionName = (this.isExpanded[i].target ? " ▾ " : " ▸ ");

            conditionName += (this.instance.conditions[i] != null
                     ? this.instance.conditions[i].GetNodeTitle()
                                : "<i>Undefined Condition</i>"
                              );

            GUIStyle style = (this.isExpanded[i].target
                                ? CoreGUIStyles.GetToggleButtonMidOn()
                                : CoreGUIStyles.GetToggleButtonMidOff()
                              );

            Rect rectDelete = new Rect(
                rectHeader.x + rectHeader.width - 25f,
                rectHeader.y,
                25f,
                rectHeader.height
                );

            Rect rectDuplicate = new Rect(
                rectDelete.x - 25f,
                rectHeader.y,
                25f,
                rectHeader.height
                );

            Rect rectCopy = new Rect(
                rectDuplicate.x - 25f,
                rectHeader.y,
                25f,
                rectHeader.height
                );

            Rect rectMain = new Rect(
                rectHeader.x + 25f,
                rectHeader.y,
                rectHeader.width - (25f * 4f),
                rectHeader.height
                );

            if (GUI.Button(rectMain, new GUIContent(conditionName, conditionIcon), style))
            {
                this.ToggleExpand(i);
            }

            GUIContent gcCopy      = InteractionUtilities.Get(InteractionUtilities.Icon.Copy);
            GUIContent gcDuplicate = InteractionUtilities.Get(InteractionUtilities.Icon.Duplicate);
            GUIContent gcDelete    = InteractionUtilities.Get(InteractionUtilities.Icon.Delete);

            if (this.instance.conditions[i] != null && GUI.Button(rectCopy, gcCopy, CoreGUIStyles.GetButtonMid()))
            {
                returnOperation.copyIndex = true;
            }

            if (this.instance.conditions[i] != null && GUI.Button(rectDuplicate, gcDuplicate, CoreGUIStyles.GetButtonMid()))
            {
                returnOperation.duplicateIndex = true;
            }

            if (GUI.Button(rectDelete, gcDelete, CoreGUIStyles.GetButtonRight()))
            {
                returnOperation.removeIndex = true;
            }

            return(returnOperation);
        }