public void BindItem(object item) { int index = IndexOf(item); RecycledListItem listItem = GetListItem(index); OnBindItem?.Invoke(index, item, listItem); }
private void UpdateItemContentsBetweenIndicies(int topIndex, int bottomIndex) { for (int i = topIndex; i <= bottomIndex; i++) { RecycledListItem item = items[i]; item.Position = i; OnBindItem?.Invoke(i, itemsSource[i], item); } }
private void OnBindListItem(int index, object item, RecycledListItem listItem) { if (listItem is ListToggle toggle) { toggle.Index = index; toggle.Label.text = Path.GetFileNameWithoutExtension((string)item); toggle.SetToggledWithoutNotify(index == selectedLevel); toggle.Interactable = index != selectedLevel; } }
private void DestroyItemsBetweenIndicies(int topIndex, int bottomIndex) { for (int i = topIndex; i <= bottomIndex; i++) { RecycledListItem item = items[i]; item.gameObject.SetActive(false); pooledItems.Push(item); } }
private void OnBindListItem(int index, object item, RecycledListItem listItem) { if (listItem is ListToggle toggle) { toggle.Index = index; toggle.SetToggledWithoutNotify(false); toggle.Interactable = true; if (item is UnityObject obj) { toggle.Label.text = obj.name; } else { toggle.Label.text = "None"; } } }
protected virtual void BindItem(int index, object obj, RecycledListItem item) { throw new NotImplementedException("Make sure to override BindItem!"); }