// PRIVATE METHODS: -----------------------------------------------------------------------

        private bool PaintStatusEffectHeader(int i)
        {
            bool result = false;

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

            this.PaintDragHandle(i, rectHeader);

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

            name += (this.instance.statusEffects[i] != null
                     ? this.instance.statusEffects[i].GetNodeTitle()
                : "<i>Undefined Status Effect</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 rectMain = new Rect(
                rectHeader.x + 25f,
                rectHeader.y,
                rectHeader.width - 50f,
                rectHeader.height
                );

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

            GUIContent gcDelete = ClausesUtilities.Get(ClausesUtilities.Icon.Delete);

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

            return(result);
        }
        // PRIVATE METHODS: -----------------------------------------------------------------------

        private bool PaintStatHeader(int i)
        {
            bool result = false;

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

            this.PaintDragHandle(i, rectHeader);

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

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

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

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

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

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

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

            GUIContent gcDelete = ClausesUtilities.Get(ClausesUtilities.Icon.Delete);

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

            GUIContent gcHide = (this.subEditors[i].spIsHidden.boolValue
                ? ClausesUtilities.Get(ClausesUtilities.Icon.EyeClosed)
                : ClausesUtilities.Get(ClausesUtilities.Icon.EyeOpen)
                                 );

            if (GUI.Button(rectHide, gcHide, CoreGUIStyles.GetButtonMid()))
            {
                this.subEditors[i].serializedObject.ApplyModifiedProperties();
                this.subEditors[i].serializedObject.Update();

                this.subEditors[i].spIsHidden.boolValue = !this.subEditors[i].spIsHidden.boolValue;

                this.subEditors[i].serializedObject.ApplyModifiedProperties();
                this.subEditors[i].serializedObject.Update();
            }

            return(result);
        }
Exemple #3
0
        private ItemReturnOperation PaintHeader(DatabaseInventoryEditor inventoryEditor, int index)
        {
            bool removeItem     = false;
            bool duplicateIndex = false;

            EditorGUILayout.BeginHorizontal();

            bool forceSortRepaint = false;

            if (inventoryEditor.itemsHandleRect.ContainsKey(index))
            {
                EditorGUIUtility.AddCursorRect(inventoryEditor.itemsHandleRect[index], MouseCursor.Pan);
                forceSortRepaint = inventoryEditor.editorSortableListItems.CaptureSortEvents(
                    inventoryEditor.itemsHandleRect[index], index
                    );
            }

            if (forceSortRepaint)
            {
                inventoryEditor.Repaint();
            }

            GUILayout.Label("=", CoreGUIStyles.GetButtonLeft(), GUILayout.Width(25f), GUILayout.Height(BTN_HEIGHT));
            if (UnityEngine.Event.current.type == EventType.Repaint)
            {
                Rect dragRect = GUILayoutUtility.GetLastRect();
                if (inventoryEditor.itemsHandleRect.ContainsKey(index))
                {
                    inventoryEditor.itemsHandleRect[index] = dragRect;
                }
                else
                {
                    inventoryEditor.itemsHandleRect.Add(index, dragRect);
                }
            }

            if (inventoryEditor.itemsHandleRectRow.ContainsKey(index))
            {
                inventoryEditor.editorSortableListItems.PaintDropPoints(
                    inventoryEditor.itemsHandleRectRow[index],
                    index,
                    inventoryEditor.spItems.arraySize
                    );
            }

            string name         = (this.animUnfold.target ? "▾ " : "▸ ");
            string spNameString = this.spName.FindPropertyRelative("content").stringValue;

            name += (string.IsNullOrEmpty(spNameString) ? "No-name" :  spNameString);

            GUIStyle style = (this.animUnfold.target
                                ? CoreGUIStyles.GetToggleButtonMidOn()
                                : CoreGUIStyles.GetToggleButtonMidOff()
                              );

            if (GUILayout.Button(name, style, GUILayout.Height(BTN_HEIGHT)))
            {
                this.animUnfold.target = !this.animUnfold.value;
            }

            GUIContent gcDuplicate = ClausesUtilities.Get(ClausesUtilities.Icon.Duplicate);

            if (GUILayout.Button(gcDuplicate, CoreGUIStyles.GetButtonMid(), GUILayout.Width(25), GUILayout.Height(BTN_HEIGHT)))
            {
                duplicateIndex = true;
            }

            GUIContent gcDelete = ClausesUtilities.Get(ClausesUtilities.Icon.Delete);

            if (GUILayout.Button(gcDelete, CoreGUIStyles.GetButtonRight(), GUILayout.Width(25), GUILayout.Height(BTN_HEIGHT)))
            {
                removeItem = true;
            }

            EditorGUILayout.EndHorizontal();
            if (UnityEngine.Event.current.type == EventType.Repaint)
            {
                Rect rect = GUILayoutUtility.GetLastRect();
                if (inventoryEditor.itemsHandleRectRow.ContainsKey(index))
                {
                    inventoryEditor.itemsHandleRectRow[index] = rect;
                }
                else
                {
                    inventoryEditor.itemsHandleRectRow.Add(index, rect);
                }
            }

            ItemReturnOperation result = new ItemReturnOperation();

            if (removeItem)
            {
                result.removeIndex = true;
            }
            if (duplicateIndex)
            {
                result.duplicateIndex = true;
            }

            return(result);
        }
Exemple #4
0
        private ItemReturnOperation PaintReferenceHeader(int i, bool usingSearch)
        {
            ItemReturnOperation returnOperation = new ItemReturnOperation();

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

            if (!usingSearch)
            {
                this.PaintDragHandle(i, rectHeader);
            }

            string variableName = (this.isExpanded[i].target ? " ▾ " : " ▸ ");

            variableName += this.GetReferenceName(i);

            Texture2D variableIcon = VariableEditorUtils.GetIcon(this.GetReferenceType(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 rectMain = new Rect(
                rectHeader.x + 25f,
                rectHeader.y,
                rectHeader.width - (25f * 2f),
                rectHeader.height
                );

            if (usingSearch)
            {
                style = (this.isExpanded[i].target
                    ? CoreGUIStyles.GetToggleButtonLeftOn()
                    : CoreGUIStyles.GetToggleButtonLeftOff()
                         );

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

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

            GUIContent gcDelete = ClausesUtilities.Get(ClausesUtilities.Icon.Delete);

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

            this.PaintTags(i);
            return(returnOperation);
        }