Class MetadataDictionaryAdaptor
Implements
Inherited Members
Namespace: Unity.VisualScripting
Assembly: Unity.VisualScripting.Core.Editor.dll
Syntax
public class MetadataDictionaryAdaptor : MetadataCollectionAdaptor, IReorderableListAdaptor
Constructors
MetadataDictionaryAdaptor(Metadata, Inspector)
Declaration
public MetadataDictionaryAdaptor(Metadata metadata, Inspector parentDrawer)
Parameters
Properties
Count
Gets count of elements in list.
Declaration
public override int Count { get; }
Property Value
Type | Description |
---|---|
int |
Overrides
this[object]
Declaration
public object this[object key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
object | key |
Property Value
Type | Description |
---|---|
object |
metadata
Declaration
protected Metadata metadata { get; }
Property Value
Type | Description |
---|---|
Metadata |
Methods
Add()
Add new element at end of list.
Declaration
public override void Add()
Overrides
CanAdd()
Declaration
protected bool CanAdd()
Returns
Type | Description |
---|---|
bool |
CanDrag(int)
Determines whether an item can be reordered by dragging mouse.
Declaration
public override bool CanDrag(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Zero-based index for list element. |
Returns
Type | Description |
---|---|
bool | A value of |
Overrides
Remarks
This should be a light-weight method since it will be used to determine whether grab handle should be included for each item in a reorderable list.
Please note that returning a value of false
does not prevent movement
on list item since other draggable items can be moved around it.
CanRemove(int)
Determines whether an item can be removed from list.
Declaration
public override bool CanRemove(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Zero-based index for list element. |
Returns
Type | Description |
---|---|
bool | A value of |
Overrides
Remarks
This should be a light-weight method since it will be used to determine whether remove button should be included for each item in list.
This is redundant when Hide
Clear()
Clear all elements from list.
Declaration
public override void Clear()
Overrides
ConstructDictionary()
Declaration
protected virtual IDictionary ConstructDictionary()
Returns
Type | Description |
---|---|
IDictionary |
ConstructKey()
Declaration
protected virtual object ConstructKey()
Returns
Type | Description |
---|---|
object |
ConstructValue()
Declaration
protected virtual object ConstructValue()
Returns
Type | Description |
---|---|
object |
DrawItem(Rect, int)
Draws main interface for a list item.
Declaration
public override void DrawItem(Rect position, int index)
Parameters
Overrides
Remarks
This method is used to handle all GUI events.
Duplicate(int)
Duplicate existing element.
Declaration
public override void Duplicate(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Zero-based index of list element. |
Overrides
Remarks
Consider using the ICloneable interface to duplicate list elements where appropriate.
GetItemAdaptiveWidth(int)
Declaration
public override float GetItemAdaptiveWidth(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index |
Returns
Type | Description |
---|---|
float |
Overrides
GetItemHeight(float, int)
Declaration
public override float GetItemHeight(float width, int index)
Parameters
Returns
Type | Description |
---|---|
float |
Overrides
Insert(int)
Insert new element at specified index.
Declaration
public override void Insert(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Zero-based index for list element. |
Overrides
Move(int, int)
Move element from source index to destination index.
Declaration
public override void Move(int sourceIndex, int destinationIndex)
Parameters
Overrides
Remove(int)
Remove element at specified index.
Declaration
public override void Remove(int index)
Parameters
Type | Name | Description |
---|---|---|
int | index | Zero-based index of list element. |
Overrides
Events
itemAdded
Declaration
public event Action<object, object> itemAdded