//! //! @brief リスト //! public void List(Interface.ListElement list, Attribute.ListAttribute attr) { }
//! //! @brief リスト //! public void List(object selectable, Attribute.ListAttribute attr) { EditorGUILayout.LabelField(attr.label); Func <object, Type, object> getListObjectFromLazy = (sourceList, type) => { return(type.GetProperty("Value", BindingFlags.Public | BindingFlags.Instance).GetValue(sourceList)); }; var scrollKey = selectable.GetHashCode(); if (!scrollPositions.ContainsKey(scrollKey)) { scrollPositions[scrollKey] = Vector2.zero; } var height = attr.columnSize == -1 ? 60 : attr.columnSize * 60; scrollPositions[scrollKey] = GUILayout.BeginScrollView(scrollPositions[scrollKey], GUILayout.Height(height)); PushStackOrientation(Attribute.StackAttribute.Orientation.Horizontal, GUIStyle.none); if (selectable is Selectable <Texture2D> ) { var _selectable = selectable as Selectable <Texture2D>; var previews = _selectable.previews.Any() ? _selectable.previews : _selectable.resources; var selected = attr.columnSize == -1 ? RenderLayoutButton(previews, attr.useUnselect) : RenderButton(previews, attr.useUnselect); if (selected >= 0) { _selectable.selected = selected; } else if (selected == -1) { _selectable.Unselect(); } } if (selectable is Selectable <GameObject> ) { var _selectable = selectable as Selectable <GameObject>; var usePreview = _selectable.previews.Any(); var selected = -1; if (usePreview) { selected = attr.columnSize == -1 ? RenderLayoutButton(_selectable.previews, attr.useUnselect) : RenderButton(_selectable.previews, attr.useUnselect); } else { selected = attr.columnSize == -1 ? RenderLayoutButton(_selectable.resources.Select(r => r.name), attr.useUnselect) : RenderButton(_selectable.resources.Select(r => r.name), attr.useUnselect); } if (selected >= 0) { _selectable.selected = selected; } else if (selected == -1) { _selectable.Unselect(); } } if (selectable is Selectable <string> ) { var _selectable = selectable as Selectable <string>; var usePreview = _selectable.previews.Any(); var selected = -1; if (usePreview) { selected = attr.columnSize == -1 ? RenderLayoutButton(_selectable.previews, attr.useUnselect) : RenderButton(_selectable.previews, attr.useUnselect); } else { selected = attr.columnSize == -1 ? RenderLayoutButton(_selectable.resources, attr.useUnselect) : RenderButton(_selectable.resources, attr.useUnselect); } if (selected >= 0) { _selectable.selected = selected; } else if (selected == -1) { _selectable.Unselect(); } } PopStackOrientation(); GUILayout.EndScrollView(); }