コード例 #1
0
        /// <summary>
        /// Set data.
        /// </summary>
        /// <param name="item">Item.</param>
        public void SetData(IGroupedListItem item)
        {
            MovedToCache();

            CurrentComponent = Templates[item.GetType()].IInstance(ComponentParent);
            CurrentComponent.SetData(item);
        }
コード例 #2
0
 /// <summary>
 /// Free current component.
 /// </summary>
 public override void MovedToCache()
 {
     if (CurrentComponent != null)
     {
         CurrentComponent.Free(GroupTemplate.transform.parent);
         CurrentComponent = null;
     }
 }
コード例 #3
0
        /// <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);
        }