예제 #1
0
 public InspectorPlusVar(LimitType _limitType, float _min, float _max, bool _progressBar, int _iMin, int _iMax,
                         bool _active, string _type, string _name, string _dispName,
                         VectorDrawType _vectorDrawType, bool _relative, bool _scale, float _space,
                         bool[] _labelEnabled, string[] _label, bool[] _labelBold, bool[] _labelItalic,
                         int[] _labelAlign, bool[] _buttonEnabled, string[] _buttonText,
                         string[] _buttonCallback, bool[] buttonCondense, int _numSpace, string _classType,
                         Vector3 _offset, bool _QuaternionHandle, bool _canWrite, string _tooltip,
                         bool _hasTooltip,
                         bool _toggleStart, int _toggleSize, int _toggleLevel, bool _largeTexture,
                         float _textureSize, string _textFieldDefault, bool _textArea)
 {
     limitType        = _limitType;
     min              = _min;
     max              = _max;
     progressBar      = _progressBar;
     iMax             = _iMax;
     iMin             = _iMin;
     active           = _active;
     type             = _type;
     name             = _name;
     dispName         = _dispName;
     vectorDrawType   = _vectorDrawType;
     relative         = _relative;
     scale            = _scale;
     space            = _space;
     labelEnabled     = _labelEnabled;
     label            = _label;
     labelBold        = _labelBold;
     labelItalic      = _labelItalic;
     labelAlign       = _labelAlign;
     buttonEnabled    = _buttonEnabled;
     buttonText       = _buttonText;
     buttonCallback   = _buttonCallback;
     numSpace         = _numSpace;
     classType        = _classType;
     offset           = _offset;
     QuaternionHandle = _QuaternionHandle;
     canWrite         = _canWrite;
     tooltip          = _tooltip;
     hasTooltip       = _hasTooltip;
     toggleStart      = _toggleStart;
     toggleSize       = _toggleSize;
     toggleLevel      = _toggleLevel;
     largeTexture     = _largeTexture;
     textureSize      = _textureSize;
     textFieldDefault = _textFieldDefault;
     textArea         = _textArea;
 }
    public InspectorPlusVar(LimitType _limitType, float _min, float _max, bool _progressBar, int _iMin, int _iMax, bool _active, string _type, string _name, string _dispName,
                        VectorDrawType _vectorDrawType, bool _relative, bool _scale, float _space, bool[] _labelEnabled, string[] _label, bool[] _labelBold, bool[] _labelItalic, int[] _labelAlign, bool[] _buttonEnabled, string[] _buttonText,
                        string[] _buttonCallback, bool[] buttonCondense, int _numSpace, string _classType, Vector3 _offset, bool _QuaternionHandle, bool _canWrite, string _tooltip, bool _hasTooltip,
                        bool _toggleStart, int _toggleSize, int _toggleLevel, bool _largeTexture, float _textureSize, string _textFieldDefault, bool _textArea)
    {
        limitType = _limitType;
        min = _min;
        max = _max;
        progressBar = _progressBar;
        iMax = _iMax;
        iMin = _iMin;
        active = _active;
        type = _type;
        name = _name;
        dispName = _dispName;
        vectorDrawType = _vectorDrawType;
        relative = _relative;
        scale = _scale;
        space = _space;
        labelEnabled = _labelEnabled;
        label = _label;
        labelBold = _labelBold;
        labelItalic = _labelItalic;
        labelAlign = _labelAlign;
        buttonEnabled = _buttonEnabled;
        buttonText = _buttonText;
        buttonCallback = _buttonCallback;
        numSpace = _numSpace;
        classType = _classType;
        offset = _offset;
        QuaternionHandle = _QuaternionHandle;
        canWrite = _canWrite;
        tooltip = _tooltip;
        hasTooltip = _hasTooltip;
        toggleStart = _toggleStart;
        toggleSize = _toggleSize;
        toggleLevel = _toggleLevel;
        largeTexture = _largeTexture;
        textureSize = _textureSize;
		textFieldDefault = _textFieldDefault;
		textArea = _textArea;
    }
    public void DrawFieldGUI()
    {
        if (canWrite)
        {
            GUILayout.Space(30.0f);
            if (type == typeof(float).Name)
            {
                GUILayout.Label("Limit: ");
                limitType = (LimitType)EditorGUILayout.EnumPopup(limitType);

                bool oldEnabled = GUI.enabled;

                GUI.enabled = limitType == LimitType.Min || limitType == LimitType.Range;
                min         = EditorGUILayout.FloatField(min, GUILayout.Width(80.0f));

                GUI.enabled = limitType == LimitType.Max || limitType == LimitType.Range;
                max         = EditorGUILayout.FloatField(max, GUILayout.Width(80.0f));

                if (limitType == LimitType.Range)
                {
                    GUILayout.Label("ProgressBar: ");
                    progressBar = GUILayout.Toggle(progressBar, "");
                }

                GUI.enabled = oldEnabled;
            }
            else if (type == typeof(int).Name)
            {
                GUILayout.Label("Limit: ");
                limitType = (LimitType)EditorGUILayout.EnumPopup(limitType);

                bool oldEnabled = GUI.enabled;

                GUI.enabled = limitType == LimitType.Min || limitType == LimitType.Range;
                iMin        = EditorGUILayout.IntField(iMin, GUILayout.Width(80.0f));

                GUI.enabled = limitType == LimitType.Max || limitType == LimitType.Range;
                iMax        = EditorGUILayout.IntField(iMax, GUILayout.Width(80.0f));

                if (limitType == LimitType.Range)
                {
                    GUILayout.Label("ProgressBar: ");
                    progressBar = GUILayout.Toggle(progressBar, "");
                }

                GUI.enabled = oldEnabled;
            }
            else if (type == typeof(Vector3).Name || type == typeof(Vector2).Name)
            {
                GUILayout.Label("Draw: ");
                vectorDrawType = (VectorDrawType)EditorGUILayout.EnumPopup(vectorDrawType);

                bool oldEnabled = GUI.enabled;

                GUI.enabled = vectorDrawType != VectorDrawType.None;
                GUILayout.Label("Relative: ");
                relative = GUILayout.Toggle(relative, "");

                if (vectorDrawType == VectorDrawType.Direction)
                {
                    GUILayout.Label("Scale: ");
                    scale = GUILayout.Toggle(scale, "");
                }

                if (vectorDrawType == VectorDrawType.Scale || vectorDrawType == VectorDrawType.Rotation)
                {
                    GUILayout.Label("Offset: ");
                    offset.x = EditorGUILayout.FloatField(offset.x);
                    offset.y = EditorGUILayout.FloatField(offset.y);
                    offset.z = EditorGUILayout.FloatField(offset.z);
                }

                GUI.enabled = oldEnabled;
            }
            else if (type == typeof(Quaternion).Name)
            {
                QuaternionHandle = GUILayout.Toggle(QuaternionHandle, new GUIContent("Draw handle"));
                GUILayout.Space(20.0f);
                GUI.enabled = QuaternionHandle;
                GUILayout.Label("Offset: ");
                offset.x    = EditorGUILayout.FloatField(offset.x);
                offset.y    = EditorGUILayout.FloatField(offset.y);
                offset.z    = EditorGUILayout.FloatField(offset.z);
                GUI.enabled = true;
            }
            else if (type == typeof(bool).Name)
            {
                toggleStart = GUILayout.Toggle(toggleStart, "Toggle group");
                GUI.enabled = toggleStart;
                toggleSize  = EditorGUI.IntSlider(GUILayoutUtility.GetRect(150.0f, 18.0f), toggleSize, 1, Mathf.Max(1, (maxSize - index) - 1));
                GUI.enabled = true;
            }
            else if (type == typeof(Texture).Name || type == typeof(Texture2D).Name)
            {
                largeTexture = GUILayout.Toggle(largeTexture, new GUIContent("large preview"));
                GUI.enabled  = largeTexture;
                textureSize  = EditorGUILayout.Slider(textureSize, 35.0f, 300.0f);
                GUI.enabled  = true;
            }
            else if (type == typeof(string).Name)
            {
                GUILayout.Label("Default text");
                textFieldDefault = GUILayout.TextField(textFieldDefault, GUILayout.Width(180.0f));

                GUILayout.Label("Text area: ");
                textArea = GUILayout.Toggle(textArea, "");
            }
        }
        else
        {
            GUILayout.Label("Read only");
        }

        GUILayout.FlexibleSpace();
        EditorGUILayout.EndHorizontal();

        if (property)
        {
            EditorGUILayout.BeginHorizontal();

            GUILayout.TextField("");
            GUILayout.Toggle(false, new GUIContent(""));

            EditorGUILayout.EndHorizontal();
        }

        EditorGUILayout.BeginVertical("Box", GUILayout.Height(space), GUILayout.ExpandWidth(true));
        numSpace = Mathf.FloorToInt(space / 25.0f);
        bool guiEnabled = GUI.enabled;

        if (numSpace > 0)
        {
            GUILayout.Space((space - numSpace * 25.0f) / 2.0f);
        }

        for (int i = 0; i < numSpace; i += 1)
        {
            GUI.enabled = true;
            GUILayout.BeginHorizontal();
            GUILayout.Space(10.0f);
            labelEnabled[i] = GUILayout.Toggle(labelEnabled[i], "");

            GUI.enabled = labelEnabled[i];
            GUILayout.Label("Label ");
            label[i]       = EditorGUILayout.TextField("", label[i]);
            labelBold[i]   = GUILayout.Toggle(labelBold[i], new GUIContent("B"));
            labelItalic[i] = GUILayout.Toggle(labelItalic[i], new GUIContent("I"));
            GUILayout.Label("Align");
            labelAlign[i] = EditorGUILayout.IntSlider(labelAlign[i], 0, 2, GUILayout.Width(150.0f));
            GUILayout.Space(40.0f);
            GUI.enabled = true;

            for (int j = 0; j < 4; j += 1)
            {
                GUI.enabled = true;
                //button
                buttonEnabled[i * 4 + j] = GUILayout.Toggle(buttonEnabled[i * 4 + j], "");

                GUI.enabled = buttonEnabled[i * 4 + j];
                GUILayout.Label("Button ");
                buttonText[i * 4 + j] = EditorGUILayout.TextField("", buttonText[i * 4 + j], GUILayout.Width(50.0f));

                GUILayout.Label("Callback ");
                buttonCallback[i * 4 + j] = EditorGUILayout.TextField("", buttonCallback[i * 4 + j], GUILayout.Width(50.0f));

                bool buttonToCome = false;
                for (int k = j; k < 4; k += 1)
                {
                    if (buttonEnabled[i * 4 + k])
                    {
                        buttonToCome = true;
                    }
                }

                if (!buttonToCome || j == 3)
                {
                    GUI.enabled = true;
                    if (j > 1)
                    {
                        buttonCondense[i] = GUILayout.Toggle(buttonCondense[i], new GUIContent("Condense"));
                    }
                    break;
                }
            }

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }

        if (numSpace > 0)
        {
            GUILayout.Space(-(space - numSpace * 25.0f) / 2.0f);
        }
        else
        {
            GUILayout.Space(space);
        }

        GUI.enabled = guiEnabled;

        GUILayoutUtility.GetRect(18.0f, -4.0f, "TextField");
        EditorGUILayout.EndVertical();

        GUILayoutUtility.GetRect(18, -10.0f - 10.0f, "TextField");//really hack-ish, but we need to get some space back
        Rect rect = GUILayoutUtility.GetRect(18, 10.0f, "TextField");

        EditorGUIUtility.AddCursorRect(rect, MouseCursor.ResizeVertical);

        if (Event.current.type == EventType.mouseDown)
        {
            pressed = false;

            if (rect.Contains(Event.current.mousePosition))
            {
                startpos = Event.current.mousePosition;
                pressed  = true;
            }
        }

        if (Event.current.type == EventType.mouseDrag && pressed)
        {
            space   += (Event.current.mousePosition - startpos).y;
            startpos = Event.current.mousePosition;

            EditorWindow.GetWindow(typeof(InspectorPlusWindow)).Repaint();
            space = Mathf.Clamp(space, 0.0f, 4 * 25.0f);

            GUI.changed = true;
        }

        if (Event.current.type == EventType.mouseUp)
        {
            pressed = false;
        }
    }
예제 #4
0
    public void DrawFieldGUI(InspectorPlusTracker gui)
    {
        if (canWrite)
        {
            gui.GetRect(30.0f);

            if (type == typeof(float).Name)
            {
                GUI.Label(gui.GetRect(80.0f), "Limit: ");
                limitType = (LimitType)EditorGUI.EnumPopup(gui.GetRect(80.0f), limitType);

                bool oldEnabled = GUI.enabled;

                GUI.enabled = limitType == LimitType.Min || limitType == LimitType.Range;
                min         = EditorGUI.FloatField(gui.GetRect(80.0f), min);

                GUI.enabled = limitType == LimitType.Max || limitType == LimitType.Range;
                max         = EditorGUI.FloatField(gui.GetRect(80.0f), max);

                if (limitType == LimitType.Range)
                {
                    GUI.Label(gui.GetRect(80.0f), "ProgressBar: ");
                    progressBar = GUI.Toggle(gui.GetRect(80.0f), progressBar, "");
                }

                GUI.enabled = oldEnabled;
            }
            else if (type == typeof(int).Name)
            {
                GUI.Label(gui.GetRect(80.0f), "Limit: ");
                limitType = (LimitType)EditorGUI.EnumPopup(gui.GetRect(80.0f), limitType);

                bool oldEnabled = GUI.enabled;

                GUI.enabled = limitType == LimitType.Min || limitType == LimitType.Range;
                iMin        = EditorGUI.IntField(gui.GetRect(80.0f), iMin);

                GUI.enabled = limitType == LimitType.Max || limitType == LimitType.Range;
                iMax        = EditorGUI.IntField(gui.GetRect(80.0f), iMax);

                if (limitType == LimitType.Range)
                {
                    GUI.Label(gui.GetRect(80.0f), "ProgressBar: ");
                    progressBar = GUI.Toggle(gui.GetRect(80.0f), progressBar, "");
                }

                GUI.enabled = oldEnabled;
            }
            else if (type == typeof(Vector3).Name || type == typeof(Vector2).Name)
            {
                GUI.Label(gui.GetRect(80.0f), "Draw: ");
                vectorDrawType = (VectorDrawType)EditorGUI.EnumPopup(gui.GetRect(80.0f), vectorDrawType);

                bool oldEnabled = GUI.enabled;

                GUI.enabled = vectorDrawType != VectorDrawType.None;
                GUI.Label(gui.GetRect(80.0f), "Relative: ");
                relative = GUI.Toggle(gui.GetRect(80.0f), relative, "");

                if (vectorDrawType == VectorDrawType.Direction)
                {
                    GUI.Label(gui.GetRect(80.0f), "Scale: ");
                    scale = GUI.Toggle(gui.GetRect(80.0f), scale, "");
                }

                if (vectorDrawType == VectorDrawType.Scale || vectorDrawType == VectorDrawType.Rotation)
                {
                    GUI.Label(gui.GetRect(80.0f), "Offset: ");
                    offset.x = EditorGUI.FloatField(gui.GetRect(40.0f), offset.x);
                    offset.y = EditorGUI.FloatField(gui.GetRect(40.0f), offset.y);
                    offset.z = EditorGUI.FloatField(gui.GetRect(40.0f), offset.z);
                }

                GUI.enabled = oldEnabled;
            }
            else if (type == typeof(Quaternion).Name)
            {
                QuaternionHandle = GUI.Toggle(gui.GetRect(80.0f), QuaternionHandle, new GUIContent("handle"));
                gui.GetRect(20.0f);

                GUI.enabled = QuaternionHandle;
                GUI.Label(gui.GetRect(80.0f), "Offset: ");
                offset.x    = EditorGUI.FloatField(gui.GetRect(40.0f), offset.x);
                offset.y    = EditorGUI.FloatField(gui.GetRect(40.0f), offset.y);
                offset.z    = EditorGUI.FloatField(gui.GetRect(40.0f), offset.z);
                GUI.enabled = true;
            }
            else if (type == typeof(bool).Name)
            {
                toggleStart = GUI.Toggle(gui.GetRect(150.0f), toggleStart, "Toggle group");
                GUI.enabled = toggleStart;
                toggleSize  = EditorGUI.IntSlider(gui.GetRect(120.0f), toggleSize, 1,
                                                  Mathf.Max(1, (maxSize - index) - 1));
                GUI.enabled = true;
            }
            else if (type == typeof(Texture).Name || type == typeof(Texture2D).Name)
            {
                largeTexture = GUI.Toggle(gui.GetRect(120.0f), largeTexture, new GUIContent("large preview"));
                GUI.enabled  = largeTexture;
                textureSize  = EditorGUI.Slider(gui.GetRect(80.0f), textureSize, 35.0f, 300.0f);
                GUI.enabled  = true;
            }
            else if (type == typeof(string).Name)
            {
                GUI.Label(gui.GetRect(80.0f), "Default text");
                textFieldDefault = GUI.TextField(gui.GetRect(180.0f), textFieldDefault);

                GUI.Label(gui.GetRect(80.0f), "Text area: ");
                textArea = GUI.Toggle(gui.GetRect(80.0f), textArea, "");
            }
        }
        else
        {
            GUI.Label(gui.GetRect(80.0f), "Read only");
        }
    }
    public void DrawFieldGUI()
    {
		if (canWrite)
		{
			GUILayout.Space(30.0f);
	        if (type == typeof(float).Name)
	        {
	            GUILayout.Label("Limit: ");
	            limitType = (LimitType)EditorGUILayout.EnumPopup(limitType);
	
	            bool oldEnabled = GUI.enabled;
	
	            GUI.enabled = limitType == LimitType.Min || limitType == LimitType.Range;
	            min = EditorGUILayout.FloatField(min, GUILayout.Width(80.0f));
	
	            GUI.enabled = limitType == LimitType.Max || limitType == LimitType.Range;
	            max = EditorGUILayout.FloatField(max, GUILayout.Width(80.0f));
	
	            if (limitType == LimitType.Range)
	            {
	                GUILayout.Label("ProgressBar: ");
	                progressBar = GUILayout.Toggle(progressBar, "");
	            }
	
	            GUI.enabled = oldEnabled;
	        }
	        else if (type == typeof(int).Name)
	        {
	            GUILayout.Label("Limit: ");
	            limitType = (LimitType)EditorGUILayout.EnumPopup(limitType);
	
	            bool oldEnabled = GUI.enabled;
	
	            GUI.enabled = limitType == LimitType.Min || limitType == LimitType.Range;
	            iMin = EditorGUILayout.IntField(iMin, GUILayout.Width(80.0f));
	
	            GUI.enabled = limitType == LimitType.Max || limitType == LimitType.Range;
	            iMax = EditorGUILayout.IntField(iMax, GUILayout.Width(80.0f));
		           
				if (limitType == LimitType.Range)
	            {
	                GUILayout.Label("ProgressBar: ");
	                progressBar = GUILayout.Toggle(progressBar, "");
	            }
	
	            GUI.enabled = oldEnabled;
	        }
	        else if (type == typeof(Vector3).Name || type == typeof(Vector2).Name)
	        {
	            GUILayout.Label("Draw: ");
	            vectorDrawType = (VectorDrawType)EditorGUILayout.EnumPopup(vectorDrawType);
	
	            bool oldEnabled = GUI.enabled;
	
	            GUI.enabled = vectorDrawType != VectorDrawType.None;
	            GUILayout.Label("Relative: ");
	            relative = GUILayout.Toggle(relative, "");
	
	            if (vectorDrawType == VectorDrawType.Direction)
	            {
	                GUILayout.Label("Scale: ");
	                scale = GUILayout.Toggle(scale, "");
	            }

	            if (vectorDrawType == VectorDrawType.Scale || vectorDrawType == VectorDrawType.Rotation)
	            {
	                GUILayout.Label("Offset: ");
	                offset.x = EditorGUILayout.FloatField(offset.x);
	                offset.y = EditorGUILayout.FloatField(offset.y);
	                offset.z = EditorGUILayout.FloatField(offset.z);
	            }
	
	            GUI.enabled = oldEnabled;
	        }
	        else if (type == typeof(Quaternion).Name)
	        {
	            QuaternionHandle = GUILayout.Toggle(QuaternionHandle, new GUIContent("Draw handle"));
	            GUILayout.Space(20.0f);
	            GUI.enabled = QuaternionHandle;
	            GUILayout.Label("Offset: ");
	            offset.x = EditorGUILayout.FloatField(offset.x);
	            offset.y = EditorGUILayout.FloatField(offset.y);
	            offset.z = EditorGUILayout.FloatField(offset.z);
	            GUI.enabled = true;
	        }
            else if (type == typeof(bool).Name)
            {
                toggleStart = GUILayout.Toggle(toggleStart, "Toggle group");
                GUI.enabled = toggleStart;
                toggleSize = EditorGUI.IntSlider(GUILayoutUtility.GetRect(150.0f, 18.0f), toggleSize, 1, Mathf.Max(1, (maxSize - index) - 1));
                GUI.enabled = true;
            }
            else if (type == typeof(Texture).Name || type == typeof(Texture2D).Name)
            {
                largeTexture = GUILayout.Toggle(largeTexture, new GUIContent("large preview"));
                GUI.enabled = largeTexture;
                textureSize = EditorGUILayout.Slider(textureSize, 35.0f, 300.0f);
                GUI.enabled = true;
            }
			else if (type == typeof(string).Name)
			{
				GUILayout.Label("Default text");
				textFieldDefault = GUILayout.TextField(textFieldDefault, GUILayout.Width(180.0f));

				GUILayout.Label("Text area: ");
				textArea = GUILayout.Toggle(textArea, "");
				
			}
		}
		else GUILayout.Label("Read only");

        GUILayout.FlexibleSpace();
        EditorGUILayout.EndHorizontal();

        if (property)
        {
            EditorGUILayout.BeginHorizontal();

            GUILayout.TextField("");
            GUILayout.Toggle(false, new GUIContent(""));

            EditorGUILayout.EndHorizontal();
        }

        EditorGUILayout.BeginVertical("Box", GUILayout.Height(space), GUILayout.ExpandWidth(true));
        numSpace = Mathf.FloorToInt(space / 25.0f);
        bool guiEnabled = GUI.enabled;

        if (numSpace > 0)
            GUILayout.Space((space - numSpace * 25.0f) / 2.0f);

        for (int i = 0; i < numSpace; i += 1)
        {
            GUI.enabled = true;
            GUILayout.BeginHorizontal();
            GUILayout.Space(10.0f);
            labelEnabled[i] = GUILayout.Toggle(labelEnabled[i], "");

            GUI.enabled = labelEnabled[i];
            GUILayout.Label("Label ");
            label[i] = EditorGUILayout.TextField("", label[i]);
            labelBold[i] = GUILayout.Toggle(labelBold[i], new GUIContent("B"));
            labelItalic[i] = GUILayout.Toggle(labelItalic[i], new GUIContent("I"));
            GUILayout.Label("Align");
            labelAlign[i] = EditorGUILayout.IntSlider(labelAlign[i], 0, 2, GUILayout.Width(150.0f));
            GUILayout.Space(40.0f);
            GUI.enabled = true;

            for (int j = 0; j < 4; j += 1)
            {
                GUI.enabled = true;
                //button
                buttonEnabled[i * 4 + j] = GUILayout.Toggle(buttonEnabled[i * 4 + j], "");

                GUI.enabled = buttonEnabled[i * 4 + j];
                GUILayout.Label("Button ");
                buttonText[i * 4 + j] = EditorGUILayout.TextField("", buttonText[i * 4 + j], GUILayout.Width(50.0f));

                GUILayout.Label("Callback ");
                buttonCallback[i * 4 + j] = EditorGUILayout.TextField("", buttonCallback[i * 4 + j], GUILayout.Width(50.0f));

                bool buttonToCome = false;
                for (int k = j; k < 4; k += 1) if (buttonEnabled[i * 4 + k]) buttonToCome = true;

                if (!buttonToCome || j == 3)
                {
                    GUI.enabled = true;
                    if (j > 1)
                        buttonCondense[i] = GUILayout.Toggle(buttonCondense[i], new GUIContent("Condense"));
                    break;
                }
            }
            
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
        }

        if (numSpace > 0)
            GUILayout.Space(-(space - numSpace * 25.0f) / 2.0f);
        else
            GUILayout.Space(space);

        GUI.enabled = guiEnabled;

        GUILayoutUtility.GetRect(18.0f, -4.0f, "TextField");
        EditorGUILayout.EndVertical();

        GUILayoutUtility.GetRect(18, -10.0f - 10.0f, "TextField");//really hack-ish, but we need to get some space back
        Rect rect = GUILayoutUtility.GetRect(18, 10.0f, "TextField");
        EditorGUIUtility.AddCursorRect(rect, MouseCursor.ResizeVertical);

        if (Event.current.type == EventType.mouseDown)
        {
            pressed = false;

            if (rect.Contains(Event.current.mousePosition))
            {
                startpos = Event.current.mousePosition;
                pressed = true;
            }
        }

        if (Event.current.type == EventType.mouseDrag && pressed)
        {
            space += (Event.current.mousePosition - startpos).y;
            startpos = Event.current.mousePosition;

            EditorWindow.GetWindow(typeof(InspectorPlusWindow)).Repaint();
            space = Mathf.Clamp(space, 0.0f, 4 * 25.0f);

            GUI.changed = true;
        }

        if (Event.current.type == EventType.mouseUp)
            pressed = false;
    }