Class NeoPropertyDrawer
Namespace: NeoFPSEditor
Assembly: NeoFPS.dll
Syntax
public abstract class NeoPropertyDrawer : PropertyDrawer
Fields
boxPadding
The padding for the contents of a GUI box
Declaration
public static readonly Vector2 boxPadding
Field Value
| Type | Description |
|---|---|
| Vector2 |
fullLineHeight
The height of a field/line in the inspector with padding
Declaration
public static readonly float fullLineHeight
Field Value
| Type | Description |
|---|---|
| System.Single |
Methods
DrawBackgroundBox(Rect)
Declaration
public static Rect DrawBackgroundBox(Rect position)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | position |
Returns
| Type | Description |
|---|---|
| Rect |
GetArrayHeight(Int32, Single, Boolean)
Returns the GUI pixel height of an array (not reorderable list) with the provided contents.
Declaration
public static float GetArrayHeight(int numEntries, float entryHeight, bool isExpanded)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | numEntries | The number of entries in the array |
| System.Single | entryHeight | The height of an individual entry |
| System.Boolean | isExpanded |
Returns
| Type | Description |
|---|---|
| System.Single | The height |
GetFirstLine(Rect)
Squashes the provided rect down to a single line height
Declaration
public static Rect GetFirstLine(Rect position)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | position | The original rect (eg multiple fields) |
Returns
| Type | Description |
|---|---|
| Rect | A copy of the original rect squashed to the height of a single line |
GetHeight(Int32)
Returns the GUI pixel height for the provided number of fields/lines in the inspector.
Declaration
public static float GetHeight(int numLines)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | numLines | The number of fields/lines |
Returns
| Type | Description |
|---|---|
| System.Single | The height |
GetHeight(Int32, Single)
Returns the GUI pixel height for the provided number of fields/lines in the inspector.
Declaration
public static float GetHeight(int numLines, float padding)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | numLines | The number of fields/lines |
| System.Single | padding | An extra padding between lines |
Returns
| Type | Description |
|---|---|
| System.Single | The height |
GetListHeight(Int32, Single, Boolean)
Returns the GUI pixel height for a reorderable list with the provided contents.
Declaration
public static float GetListHeight(int numEntries, float entryHeight, bool hasControls)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | numEntries | The number of entries in the list |
| System.Single | entryHeight | The height of a single entry in the list |
| System.Boolean | hasControls | Does the list have +/- controls visible underneath |
Returns
| Type | Description |
|---|---|
| System.Single | The height |
Indent(Rect)
Increments the editor GUI indent level and returns an indented version of the source rect
Declaration
public static Rect Indent(Rect position)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | position | The unindented rect |
Returns
| Type | Description |
|---|---|
| Rect | The indented rect |
NextLine(Rect)
Returns a copy of the position rect shifted down 1 line
Declaration
public static Rect NextLine(Rect position)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | position | The current line position rect |
Returns
| Type | Description |
|---|---|
| Rect | The shifted rect for the next line |
NextRect(Rect)
Returns a copy of the position rect shifted down based on its height and line spacing, so that the new rect sits exactly below the input
Declaration
public static Rect NextRect(Rect position)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | position | The current position rect |
Returns
| Type | Description |
|---|---|
| Rect | The shifted rect |
OnLayoutPropertyChanged(SerializedProperty)
Used to apply modified properties and abort the inspector UI to prevent layout vs draw mismatches
Declaration
public static void OnLayoutPropertyChanged(SerializedProperty property)
Parameters
| Type | Name | Description |
|---|---|---|
| SerializedProperty | property | The drawer's target property |
SetIndent(Rect, Int32)
Sets the editor GUI indent level and modifies the provided position rect. For example, if indent has increased, the rect will be shifted right and its width shrunk. If the indent has decreased, the rect will be shifted left and its width grown.
Declaration
public static Rect SetIndent(Rect position, int indentLevel)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | position | |
| System.Int32 | indentLevel |
Returns
| Type | Description |
|---|---|
| Rect |
Unindent(Rect)
Decrements the editor GUI indent level and returns an indented version of the source rect
Declaration
public static Rect Unindent(Rect position)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | position | The unindented rect |
Returns
| Type | Description |
|---|---|
| Rect | The indented rect |