Skip to content

CfgIdDrawer<TValue>

Namespace: Shadop.Archmage.Sdk.Editor

Abstract base for config ID property drawers. Renders an ArchmageTools.DrawEasyDropdown(Rect, SerializedProperty, GUIContent, String, TValue[], String[], Vector2) dropdown in the Inspector. Subclasses provide the ID values and display names, typically populated from a config table at editor load time.

public abstract class CfgIdDrawer<TValue> : UnityEditor.PropertyDrawer

TValue
The underlying numeric or string type of the config ID.

Inheritance Object → GUIDrawer → PropertyDrawer → CfgIdDrawer

public PropertyAttribute attribute { get; }

PropertyAttribute

public FieldInfo fieldInfo { get; }

FieldInfo

public string preferredLabel { get; }

String

protected CfgIdDrawer()

Returns the header text displayed at the top of the dropdown window.

protected abstract string GetHeader()

String

Returns the config ID values shown in the dropdown.

protected abstract TValue[] GetIdValues()

TValue[]

Returns the display strings, one for each ID value.

protected abstract String[] GetDisplayNames()

String[]

BuildDisplayNames(TValue[], Func<TValue, String>, Int32)

Section titled “BuildDisplayNames(TValue[], Func<TValue, String>, Int32)”

Builds a display-name array from values.

protected static String[] BuildDisplayNames(TValue[] values, Func<TValue, string> format, int start)

values TValue[]
The ID values array.

format Func<TValue, String>
Formatter that converts an ID value to its display string.

start Int32
Index to start formatting from. Entries before start are left as null so the caller can fill them manually (e.g., a “Default” label at index 0).

String[]

OnGUI(Rect, SerializedProperty, GUIContent)

Section titled “OnGUI(Rect, SerializedProperty, GUIContent)”
public void OnGUI(Rect position, SerializedProperty property, GUIContent label)

position Rect

property SerializedProperty

label GUIContent