public virtual void CellViewVisibilityChanged(EnhancedScrollerCellView cellView) { CellViewBase view = cellView as CellViewBase; if (cellView.active) { view.RefreshCellView(); } }
protected override void onCellViewClick(CellViewBase cellViewBase) { BtnCellView btnCellView = cellViewBase.toOtherType <BtnCellView>(); if (curShowTuChe != btnCellView.dataIndex) { curShowTuChe = btnCellView.dataIndex; SetRole(btnCellView.mTransform); if (OnCellViewClick != null) { OnCellViewClick(btnCellView); } } }
public virtual EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { CellViewBase cellView = scroller.GetCellView(cellViewPrefab) as CellViewBase; if (isGridModel == false) { cellView.name = "Cell " + dataIndex.ToString(); cellView.setData(lisData[dataIndex]); cellView.onCellViewClick = this.onCellViewClick; } else { cellView.name = "Cell " + (dataIndex * numberOfCellsPerRow).ToString() + " to " + ((dataIndex * numberOfCellsPerRow) + numberOfCellsPerRow - 1).ToString(); cellView.setData(ref lisData, dataIndex * numberOfCellsPerRow); } return(cellView); }
public static T toOtherType <T>(this CellViewBase cellViewBase) where T : CellViewBase { return(cellViewBase as T); }
/// <summary> /// single模式 格子被点击 /// </summary> protected virtual void onCellViewClick(CellViewBase cellViewBase) { }