protected void OnAdd(ReorderableList list) { int index = KeysProperty.arraySize; KeysProperty.InsertArrayElementAtIndex(index); ValuesProperty.InsertArrayElementAtIndex(index); }
protected virtual void CheckRedBoxForElement(Rect rect, SerializedProperty keyProp, int index) { if (KeysProperty.HasAnyElementSameValue(keyProp, index)) { DrawRedBox(rect, redBoxSize, redBoxStyle, redBoxOffset); hasDuplicatedKey = true; } }
protected float GetReorderableElementHeight(int index) { float keyHeight = EditorGUI.GetPropertyHeight(KeysProperty.GetArrayElementAtIndex(index)); float valueHeight = EditorGUI.GetPropertyHeight(ValuesProperty.GetArrayElementAtIndex(index)); float height = 8 + Math.Max(keyHeight, valueHeight); if (!IsDragging || (IsDragging && elementHeight < height)) { elementHeight = height; } return(elementHeight); }
protected virtual void DrawElement(Rect rect, int index, bool isActive, bool isFocused) { rect.position = new Vector2(rect.position.x + 10, rect.position.y); SerializedProperty key = KeysProperty.GetArrayElementAtIndex(index); SerializedProperty value = ValuesProperty.GetArrayElementAtIndex(index); float halfSizeX = rect.size.x / 2; float leftOffset = 100; float rightOffset = 58; Vector2 sizeKey = new Vector2(halfSizeX - leftOffset, rect.size.y); Vector2 sizeValue = new Vector2(halfSizeX + rightOffset, rect.size.y); Vector2 positionValue = rect.position + new Vector2(sizeKey.x + 25, 0); float oldWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 50; OnBeforeDrawProperties(); rect = DrawPropertiesForElement(new Rect(rect.position, sizeKey), new Rect(positionValue, sizeValue), key, value); OnAfterDrawProperties(); EditorGUIUtility.labelWidth = oldWidth; CheckRedBoxForElement(rect, key, index); }
protected void OnRemove(ReorderableList list) { KeysProperty.DeleteArrayElementAtIndex(SelectedIndex); ValuesProperty.DeleteArrayElementAtIndex(SelectedIndex); }
static ppy_video() { TableNameProperty.AddOwner(typeof(ppy_video), "ppy_video"); KeysProperty.AddOwner(typeof(ppy_video), new string[] { "Id" }); }
set => SetValue(KeysProperty, value);