/// <summary> /// Set data. /// </summary> /// <param name="item">Item.</param> public void SetData(IGroupedListItem item) { MovedToCache(); CurrentComponent = Templates[item.GetType()].IInstance(ComponentParent); CurrentComponent.SetData(item); }
/// <summary> /// Free current component. /// </summary> public override void MovedToCache() { if (CurrentComponent != null) { CurrentComponent.Free(GroupTemplate.transform.parent); CurrentComponent = null; } }
/// <summary> /// Set data. /// </summary> /// <param name="item">Item.</param> public void SetData(IGroupedListItem item) { // move current component to cache MovedToCache(); // get template by type (or by any other item value) var template = GetTemplate(item.GetType()); // instantiate template copy, ComponentParent can be DefaultItem itself or one of it children gameobjects CurrentComponent = template.IInstance(ComponentParent); // set data to display item CurrentComponent.SetData(item); }