/// <inheritdoc/> public EnhancedScrollerCellView GetCellView( EnhancedScroller scroller, int dataIndex, int cellIndex) { var cell = scroller.GetCellView(this.cellPrefab) as ListViewCell; cell.refreshCell = () => { try { this.CellRefreshDel(cell, dataIndex, cellIndex); } catch (Exception e) { Debug.LogError(e); } }; try { this.CellRefreshDel(cell, dataIndex, cellIndex); } catch (Exception e) { Debug.LogError(e); } return(cell); }
public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { CellView cv = (CellView)scroller.GetCellView(cellView); cv.SetData(mDataLst[dataIndex], dataIndex); return(cv); }
/// <inheritdoc/> public float GetCellViewSize(EnhancedScroller scroller, int dataIndex) { if (this.CellSizeDel != null) { try { return(this.CellSizeDel(dataIndex)); } catch (Exception e) { Debug.LogError(e); } } if (this.cellPrefabRect != null) { if (this.scroller.scrollDirection == EnhancedScroller.ScrollDirectionEnum.Horizontal) { return(this.cellPrefabRect.rect.width); } else { return(this.cellPrefabRect.rect.height); } } return(10.0f); }
/// <summary> /// Gets the cell to be displayed. You can have numerous cell types, allowing variety in your list. /// Some examples of this would be headers, footers, and other grouping cells. /// </summary> /// <param name="scroller">The scroller requesting the cell</param> /// <param name="dataIndex">The index of the data that the scroller is requesting</param> /// <param name="cellIndex">The index of the list. This will likely be different from the dataIndex if the scroller is looping</param> /// <returns>The cell for the scroller to use</returns> public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { // first, we get a cell from the scroller by passing a prefab. // if the scroller finds one it can recycle it will do so, otherwise // it will create a new cell. NoteUiItem cellView = scroller.GetCellView(_cellViewPrefab) as NoteUiItem; // set the name of the game object to the cell's data index. // this is optional, but it helps up debug the objects in // the scene hierarchy. cellView.name = "Cell " + dataIndex.ToString(); // update data and view cellView.SetData(_data[dataIndex]); // set state if (_state == State.Default) { cellView.SetState(NoteUiItem.State.Normal); } else if (_state == State.Selection) { cellView.SetState(NoteUiItem.State.Selection); } // return the cell to the scroller return(cellView); }
/// <summary> /// This is the handler of each snapping in the scroller. The /// cell index will only be different from the data index if looping is on. /// </summary> /// <param name="scroller">The EnhancedScroller that fired the event</param> /// <param name="cellIndex">The index of the cell that snapped on</param> /// <param name="dataIndex">The data index of the cell that snapped on</param> private void ScrollerSnapped(EnhancedScroller scroller, int cellIndex, int dataIndex) { // if we are not playing, ignore this event if (GameState != GameStateEnum.Playing) { return; } // increment the snap count. We will need three total snaps to tally the score _snapCount++; // set the slot of the snapped scroller for use in tallying the score _snappedDataIndices[_snapCount - 1] = dataIndex; if (_snapCount == _slotControllers.Length) { // if we've reached the final snap count, then tally the score TallyScore(); // reenable the lever pullLeverButton.interactable = true; } if (Credits == 0) { // if we are out of credits after tallying the score, go to a game over state GameState = GameStateEnum.GameOver; } }
/// <summary> /// Gets the cell to be displayed. You can have numerous cell types, allowing variety in your list. /// Some examples of this would be headers, footers, and other grouping cells. /// </summary> /// <param name="scroller">The scroller requesting the cell</param> /// <param name="dataIndex">The index of the data that the scroller is requesting</param> /// <param name="cellIndex">The index of the list. This will likely be different from the dataIndex if the scroller is looping</param> /// <returns>The cell for the scroller to use</returns> public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { // first, we get a cell from the scroller by passing a prefab. // if the scroller finds one it can recycle it will do so, otherwise // it will create a new cell. PhotosBlockUiItem cellView = scroller.GetCellView(cellViewPrefab) as PhotosBlockUiItem; // set the name of the game object to the cell's data index. // this is optional, but it helps up debug the objects in // the scene hierarchy. cellView.name = "Cell " + dataIndex.ToString(); // in this example, we just pass the data to our cell's view which will update its UI Texture2D[] data = new Texture2D[cellViewPrefab.numOfItems]; // split to blocks int startIndex = dataIndex * data.Length; for (int i = 0; i < data.Length; i++) { if (startIndex + i < _data.Count) { data[i] = _data[startIndex + i]; } else { data[i] = null; } } cellView.SetData(data); // return the cell to the scroller return(cellView); }
/// <summary> /// Reuse the appropriate cell /// </summary> /// <param name="scroller"></param> /// <param name="dataIndex"></param> /// <param name="cellIndex"></param> /// <returns></returns> public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { CellViewChat cellView; if (dataIndex == 0) { // this is the first spacer cell cellView = scroller.GetCellView(spacerCellViewPrefab) as CellViewChat; cellView.name = "Spacer"; } else { // this is a chat cell if (_data[dataIndex].cellType == DataChat.CellType.MyText) { // this is one of our chat cells cellView = scroller.GetCellView(myTextCellViewPrefab) as CellViewChat; } else { // this is a chat cell from another person cellView = scroller.GetCellView(otherTextCellViewPrefab) as CellViewChat; } // set the cell's game object name. Not necessary, but nice for debugging. cellView.name = "Cell " + dataIndex.ToString(); // initialize the cell's data so that it can configure its view. cellView.SetData(_data[dataIndex], _calculateLayout); } return(cellView); }
/// <summary> /// Gets the cell to be displayed. You can have numerous cell types, allowing variety in your list. /// Some examples of this would be headers, footers, and other grouping cells. /// </summary> /// <param name="scroller">The scroller requesting the cell</param> /// <param name="dataIndex">The index of the data that the scroller is requesting</param> /// <param name="cellIndex">The index of the list. This will likely be different from the dataIndex if the scroller is looping</param> /// <returns>The cell for the scroller to use</returns> public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { if (dataIndex == _data.Count) { LoadingCellView loadingCellView = scroller.GetCellView(loadingCellViewPrefab) as LoadingCellView; loadingCellView.name = "Loading..."; return(loadingCellView); } else { // first, we get a cell from the scroller by passing a prefab. // if the scroller finds one it can recycle it will do so, otherwise // it will create a new cell. CellView cellView = scroller.GetCellView(cellViewPrefab) as CellView; // set the name of the game object to the cell's data index. // this is optional, but it helps up debug the objects in // the scene hierarchy. cellView.name = "Cell " + dataIndex.ToString(); // in this example, we just pass the data to our cell's view which will update its UI cellView.SetData(_data[dataIndex]); // return the cell to the scroller return(cellView); } }
public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { UIModuleInventoryMasterCellView masterCellView = scroller.GetCellView(masterCellViewPrefab) as UIModuleInventoryMasterCellView; masterCellView.SetData(_data[dataIndex], OnRightClickEvent); return(masterCellView); }
public int Length; //长度 public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { HomeCell cellView = scroller.GetCellView(cellViewPrefab) as HomeCell; cellView.SetData("6666"); return(cellView); }
public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { BallItemCellView ballItemCellView = scroller.GetCellView(m_CellViewPrefab) as BallItemCellView; ballItemCellView.SetData(m_Data[dataIndex]); return(ballItemCellView); }
public SEUIContainerItem GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { CellView cellView = scroller.GetCellView(cellViewPrefab) as CellView; cellView.SetData(_data[dataIndex]); return(cellView); }
public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { SelectQuizzCellView cellView = scroller.GetCellView(selectQuizzCellView) as SelectQuizzCellView; cellView.SetData(_data[dataIndex]); return(cellView); }
public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { // 在这里加载列表中的UI元素,初始化,设置按钮事件回调等,它们将是被循环使用的 PlayerCellView cellView = scroller.GetCellView(playerCellViewPrefab) as PlayerCellView; cellView.SetData(_data[dataIndex]); return(cellView); }
public float GetCellViewSize(EnhancedScroller scroller, int dataIndex) { if (cellSizeHandler != null) { return(cellSizeHandler(scroller, dataIndex)); } return(cellSize); }
public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { RankingCellView cellView = scroller.GetCellView(cellViewPrefab) as RankingCellView; cellView.name = "Cell " + dataIndex.ToString(); cellView.SetData(_dataList[dataIndex]); return(cellView); }
public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { ElementLineItemCellView elementLineItemCellView = scroller.GetCellView(m_CellViewPrefab) as ElementLineItemCellView; elementLineItemCellView.SetData(m_Data[dataIndex]); return(elementLineItemCellView); }
private void CellViewInstantiated(EnhancedScroller enhancedScroller, EnhancedScrollerCellView cellview) { NoteUiItem item = cellview as NoteUiItem; item.OnClick += ItemClickHandler; item.OnLongClick += ItemLongClickHandler; item.OnSelect += ItemSelectHandler; }
public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { var cellView = scroller.GetCellView(this.Template) as SimpleCellView; cellView.gameObject.SetActive(true); cellView.SetData(this.Datas[dataIndex], dataIndex, cellIndex); return(cellView); }
/// <summary> /// Capture the scroll position to use when the scroller is recycled /// </summary> private void ScrollerScrolled(EnhancedScroller scroller, Vector2 val, float scrollPosition) { _data.normalizedScrollPosition = scroller.NormalizedScrollPosition; if (detailScrollerScrolledDelegate != null) { detailScrollerScrolledDelegate(scroller, val, scrollPosition); } }
public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { MixedLineItemCellView mixedLineItemCellView = scroller.GetCellView(m_CellViewPrefab) as MixedLineItemCellView; mixedLineItemCellView.SetData(m_Data[dataIndex]); return(mixedLineItemCellView); }
public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { AnimalCellView cellView = scroller.GetCellView(animalCellViewPrefab) as AnimalCellView; cellView.SetData(_data[dataIndex]); return(cellView); }
public int GetNumberOfCells(EnhancedScroller scroller) { if (dataCountHandler != null) { return(dataCountHandler(scroller)); } return(dataCount); }
public float GetCellViewSize(EnhancedScroller scroller, int dataIndex) { // we pull the size of the cell from the model. // First pass (frame countdown 2): this size will be zero as set in the LoadData function // Second pass (frame countdown 1): this size will be set to the content size fitter in the cell view // Third pass (frmae countdown 0): this set value will be pulled here from the scroller return(_data[dataIndex].cellSize); }
/// <summary> /// Gets the number of cells in a list of data /// </summary> /// <param name="scroller"></param> /// <returns></returns> public int GetNumberOfCells(EnhancedScroller scroller) { if (dataSource != null) { return(dataSource.Count); } return(0); }
public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { RespondQuizzCellView cellView = scroller.GetCellView(respondQuizzCellViewPrefab) as RespondQuizzCellView; cellView.SetData(_data[dataIndex]); return(cellView); }
public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { InventoryCellView cellView = scroller.GetCellView(vCellViewPrefab) as InventoryCellView; cellView.name = "Vertical " + _data [dataIndex].monsterName; cellView.selected = CellViewSelected; cellView.SetData(dataIndex, _data[dataIndex], true); return(cellView); }
public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { cellViewPrefab = Resources.Load <GameObject>(path).GetComponent <ItemCell>(); ItemCell cellView = scroller.GetCellView(cellViewPrefab) as ItemCell; cellView.SetData(_data[dataIndex]); cellView.gameObject.SetActive(true); return(cellView); }
public float GetCellViewSize(EnhancedScroller scroller, int dataIndex) { //if (_data[dataIndex]) //{ //} //做数据判断 return(200f); }
private void Awake() { if (!Scroller) { Scroller = GetComponent <EnhancedScroller>(); } Scroller.Delegate = this; }