private void DrawListElement(ReorderableList list, Rect rect, int index, bool isActive, bool isFocused) { if (list.serializedProperty.arraySize == index) { return; } var element = list.serializedProperty.GetArrayElementAtIndex(index); rect.y += 2; EditorGUI.PropertyField(new Rect(rect.x, rect.y, 256f, EditorGUIUtility.singleLineHeight), element, GUIContent.none); ItemManagementUtility.DoListElementBehaviours(list, index, isFocused, this); }
private void DrawItemPropertyValue(Rect rect, int index, bool isActive, bool isFocused) { var list = m_CurItemProperties; if (list.serializedProperty.arraySize == index) { return; } var element = list.serializedProperty.GetArrayElementAtIndex(index); rect.y += 2f; rect.height -= 2f; ItemManagementUtility.DrawItemProperty(rect, element, m_PropertyList); ItemManagementUtility.DoListElementBehaviours(list, index, isFocused, this); }
private void DrawItemDescription(Rect rect, int index, bool isActive, bool isFocused) { var list = m_CurItemDescriptions; if (list.serializedProperty.arraySize == index) { return; } var element = list.serializedProperty.GetArrayElementAtIndex(index); rect.y += 2f; rect.height -= 2f; element.stringValue = EditorGUI.TextArea(rect, element.stringValue); ItemManagementUtility.DoListElementBehaviours(list, index, isFocused, this); }
private void DrawRequiredItem(Rect rect, int index, bool isActive, bool isFocused) { var list = m_CurItemRequiredItems; if (list.serializedProperty.arraySize == index) { return; } var element = list.serializedProperty.GetArrayElementAtIndex(index); var name = element.FindPropertyRelative("m_Name"); var amount = element.FindPropertyRelative("m_Amount"); rect.y += 2f; rect.height -= 2f; // Name field. rect.width = 128f; rect.height = 16f; int selectedIndex = ItemManagementUtility.GetItemIndex(m_CategoryList.serializedProperty, name.stringValue); selectedIndex = EditorGUI.Popup(rect, selectedIndex, m_ItemNamesFull); name.stringValue = m_ItemNames[Mathf.Clamp(selectedIndex, 0, 9999999)]; // Amount. rect.x = rect.xMax + 4f; rect.width = 16f; GUI.Label(rect, "x"); rect.x = rect.xMax; rect.width = 64f; amount.intValue = EditorGUI.IntField(rect, amount.intValue); amount.intValue = Mathf.Clamp(amount.intValue, 1, 9999999); ItemManagementUtility.DoListElementBehaviours(list, index, isFocused, this); }