public int GetIndex(HS_UIListViewCell cell) { for (int i = 0, count = mValues.Count - 1; i <= count; i++) { Value value = mValues[i]; if (value.cell.gameObject == cell.gameObject) { return(i); } } return(-1); }
public object GetData(HS_UIListViewCell cell) { for (int i = 0, count = mValues.Count - 1; i <= count; i++) { Value value = mValues[i]; if (value.cell.gameObject == cell.gameObject) { return(value.data); } } return(null); }
internal override void OnCellClick(HS_UIListViewCell cell, GameObject target) { if (cell.state == HS_UIListViewCell.State.Disable) { return; } base.OnCellClick(cell, target); if (onClick != null) { onClick(this, cell, target); } if (cell != null) { int index = GetIndex(cell); int changeState = 0; if (mSelections.IndexOf(index) >= 0) { if (mCancelable || mMaxSelection != 1) { changeState = 1; mSelections.Remove(index); } } else { if (mMaxSelection == 1) { changeState = 2; for (int i = mSelections.Count - 1; i >= 0; i--) { int slelectIndex = mSelections[i]; HS_UIListViewCell obj = GetCell(slelectIndex); if (obj != null) { obj.state = HS_UIListViewCell.State.Normal; } if (onDeselected != null) { onDeselected(this, slelectIndex); } } mSelections.Clear(); mSelections.Add(index); } else { if (mMaxSelection == 0 || mSelections.Count < mMaxSelection) { changeState = 2; mSelections.Add(index); } } } if (changeState > 0) { cell.state = changeState == 2 ? HS_UIListViewCell.State.Selected : HS_UIListViewCell.State.Normal; if (changeState == 2) { cell.state = HS_UIListViewCell.State.Selected; if (onSelected != null) { onSelected(this, index); } } else { cell.state = HS_UIListViewCell.State.Normal; if (onDeselected != null) { onDeselected(this, index); } } if (onSelectionChanged != null) { onSelectionChanged(this); } } } }
internal virtual void OnCellClick(HS_UIListViewCell cell, GameObject target) { }
internal virtual void OnCellScroll(PointerEventData eventData, HS_UIListViewCell cell) { //this.mScrollRect.OnScroll(eventData); }
virtual protected void OnListViewClick(HS_UIListView listView, HS_UIListViewCell cell, GameObject target) { }
// UIListView virtual protected void OnListViewInit(HS_ListViewBase listView, HS_UIListViewCell cell, object data) { }