private void UpdateItem(T data) { ListItemView <T> view = views.Find(itemView => itemView.data.id == data.id); if (view) { view.Setup(data); } }
private void AddItem(T data) { GameObject go = Instantiate(itemPrefab); ListItemView <T> itemView = go.GetComponentInChildren <ListItemView <T> >(); go.transform.SetParent(layout, false); itemView.Setup(data); views.Add(itemView); }
private bool HasItem(T data) { ListItemView <T> view = views.Find(itemView => itemView.data.id == data.id); if (view) { return(true); } return(false); }
private void RemoveItem(T data) { ListItemView <T> view = views.Find(itemView => itemView.data.id == data.id); if (view) { views.Remove(view); Destroy(view.gameObject); } }