/// <inheritdoc/> public virtual IOrderedDictionaryListAdaptor CreateListAdaptor(SerializedProperty dictionaryProperty) { var target = this.FindTargetOrderedDictionary(dictionaryProperty); var keysProperty = dictionaryProperty.FindPropertyRelative("keys"); var valuesProperty = dictionaryProperty.FindPropertyRelative("values"); var keysAdaptor = new SerializedPropertyAdaptor(keysProperty); var valuesAdaptor = new SerializedPropertyAdaptor(valuesProperty); return(new OrderedDictionaryListAdaptor(target, keysAdaptor, valuesAdaptor)); }
/// <summary> /// Initializes a new instance of the <see cref="OrderedDictionaryListAdaptor"/> class. /// </summary> /// <param name="target">The target object.</param> /// <param name="keysPropertyAdaptor">The adaptor for the ordered dictionary's keys.</param> /// <param name="valuesPropertyAdaptor">The adaptor for the ordered dictionary's values.</param> public OrderedDictionaryListAdaptor(OrderedDictionary target, SerializedPropertyAdaptor keysPropertyAdaptor, SerializedPropertyAdaptor valuesPropertyAdaptor) { this.Target = target; this.KeysPropertyAdaptor = keysPropertyAdaptor; this.ValuesPropertyAdaptor = valuesPropertyAdaptor; }
/// <summary> /// Draw list field control for serializable property array. /// </summary> /// <param name="position">Position of control.</param> /// <param name="arrayProperty">Serializable property.</param> /// <param name="fixedItemHeight">Use fixed height for items rather than <see cref="UnityEditor.EditorGUI.GetPropertyHeight(SerializedProperty)"/>.</param> /// <param name="drawEmpty">Callback to draw custom content for empty list (optional).</param> /// <param name="flags">Optional flags to pass into list field.</param> private static void DoListFieldAbsolute(Rect position, SerializedProperty arrayProperty, float fixedItemHeight, ReorderableListControl.DrawEmptyAbsolute drawEmpty, ReorderableListFlags flags) { var adaptor = new SerializedPropertyAdaptor(arrayProperty, fixedItemHeight); ReorderableListControl.DrawControlFromState(position, adaptor, drawEmpty, flags); }