示例#1
0
        /// <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);
        }
示例#2
0
        /// <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);
            }
        }
示例#3
0
        public SEUIContainerItem GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex)
        {
            CellView cellView = scroller.GetCellView(cellViewPrefab) as CellView;

            cellView.SetData(_data[dataIndex]);
            return(cellView);
        }
示例#4
0
        public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex)
        {
            CellView cv = (CellView)scroller.GetCellView(cellView);

            cv.SetData(mDataLst[dataIndex], dataIndex);
            return(cv);
        }
示例#5
0
    public int Length;                              //长度
    public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex)
    {
        HomeCell cellView = scroller.GetCellView(cellViewPrefab) as HomeCell;

        cellView.SetData("6666");
        return(cellView);
    }
示例#6
0
    /// <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);
    }
示例#7
0
    /// <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);
    }
    /// <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);
    }
示例#9
0
        public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex)
        {
            BallItemCellView ballItemCellView = scroller.GetCellView(m_CellViewPrefab) as BallItemCellView;

            ballItemCellView.SetData(m_Data[dataIndex]);
            return(ballItemCellView);
        }
示例#10
0
    public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex)
    {
        UIModuleInventoryMasterCellView masterCellView = scroller.GetCellView(masterCellViewPrefab) as UIModuleInventoryMasterCellView;

        masterCellView.SetData(_data[dataIndex], OnRightClickEvent);
        return(masterCellView);
    }
示例#11
0
    public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int
                                                dataIndex, int cellIndex)
    {
        SelectQuizzCellView cellView = scroller.GetCellView(selectQuizzCellView) as SelectQuizzCellView;

        cellView.SetData(_data[dataIndex]);
        return(cellView);
    }
示例#12
0
    public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex)
    {
        // 在这里加载列表中的UI元素,初始化,设置按钮事件回调等,它们将是被循环使用的
        PlayerCellView cellView = scroller.GetCellView(playerCellViewPrefab) as PlayerCellView;

        cellView.SetData(_data[dataIndex]);
        return(cellView);
    }
示例#13
0
    public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex)
    {
        AnimalCellView cellView = scroller.GetCellView(animalCellViewPrefab) as AnimalCellView;

        cellView.SetData(_data[dataIndex]);

        return(cellView);
    }
示例#14
0
        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)
        {
            var cellView = scroller.GetCellView(this.Template) as SimpleCellView;

            cellView.gameObject.SetActive(true);
            cellView.SetData(this.Datas[dataIndex], dataIndex, cellIndex);
            return(cellView);
        }
示例#16
0
        public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex)
        {
            ElementLineItemCellView elementLineItemCellView =
                scroller.GetCellView(m_CellViewPrefab) as ElementLineItemCellView;

            elementLineItemCellView.SetData(m_Data[dataIndex]);
            return(elementLineItemCellView);
        }
    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)
    {
        InventoryCellView cellView = scroller.GetCellView(vCellViewPrefab) as InventoryCellView;

        cellView.name     = "Vertical " + _data [dataIndex].monsterName;
        cellView.selected = CellViewSelected;
        cellView.SetData(dataIndex, _data[dataIndex], true);
        return(cellView);
    }
示例#19
0
    public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int
                                                dataIndex, int cellIndex)
    {
        RespondQuizzCellView cellView = scroller.GetCellView(respondQuizzCellViewPrefab) as
                                        RespondQuizzCellView;

        cellView.SetData(_data[dataIndex]);
        return(cellView);
    }
示例#20
0
    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);
    }
示例#21
0
        public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex)
        {
            // Debug.Log($"dataindex{dataIndex} cellIndex{cellIndex}");
            switch (cellIndex)
            {
            case 0:
            {
                var cellView = scroller.GetCellView(m_CellViewPrefabs[cellIndex]) as MixedListCellView;
                cellView.SetData(m_Data[dataIndex]);
                return(cellView);
            }

            case 1:
            {
                var cellView = scroller.GetCellView(m_CellViewPrefabs[cellIndex]) as MixedLineCellView;
                cellView.SetData(m_Data[dataIndex]);
                return(cellView);
            }

            case 2:
            {
                var cellView = scroller.GetCellView(m_CellViewPrefabs[cellIndex]) as PreviewCellView;
                cellView.SetData(m_Data[dataIndex]);
                return(cellView);
            }

            case 3:
            {
                var cellView = scroller.GetCellView(m_CellViewPrefabs[cellIndex]) as ElementLineCellView;
                cellView.SetData(m_Data[dataIndex]);
                return(cellView);
            }

            case 4:
            {
                var cellView = scroller.GetCellView(m_CellViewPrefabs[cellIndex]) as ElementListCellView;
                cellView.SetData(m_Data[dataIndex]);
                return(cellView);
            }
            }

            return(null);
        }
示例#22
0
        public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex)
        {
            CellView cellView = scroller.GetCellView(cellViewPrefab) as CellView;

            // tell the cell view to calculate its layout on the first pass,
            // otherwise just use the size set in the data.
            cellView.SetData(_data[dataIndex], _calculateLayout);

            return(cellView);
        }
示例#23
0
        public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex)
        {
            // Debug.Log($"dataindex{dataIndex} cellIndex{cellIndex}");
            switch (cellIndex)
            {
            case 0:
            {
                var cellView = scroller.GetCellView(m_CellViewPrefabs[cellIndex]) as ShopCellView;
                cellView.SetData(m_Data[dataIndex]);
                return(cellView);
            }

            case 1:
            {
                var cellView = scroller.GetCellView(m_CellViewPrefabs[cellIndex]) as BallCellView;
                cellView.SetData(m_Data[dataIndex]);
                return(cellView);
            }

            case 2:
            {
                var cellView = scroller.GetCellView(m_CellViewPrefabs[cellIndex]) as BattleCellView;
                cellView.SetData(m_Data[dataIndex]);
                return(cellView);
            }

            case 3:
            {
                var cellView = scroller.GetCellView(m_CellViewPrefabs[cellIndex]) as SocialCellView;
                cellView.SetData(m_Data[dataIndex]);
                return(cellView);
            }

            case 4:
            {
                var cellView = scroller.GetCellView(m_CellViewPrefabs[cellIndex]) as EventCellView;
                cellView.SetData(m_Data[dataIndex]);
                return(cellView);
            }
            }

            return(null);
        }
        public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex)
        {
            TV cellView = scroller.GetCellView(_cellPrefab) as TV;

            cellView.name = dataIndex.ToString();
            cellView.RefreshCellView();
            cellView.Collector.Clear();
            fillFactory?.Invoke(Data[dataIndex], cellView);
            return(cellView);
        }
示例#25
0
        public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex)
        {
            CellView cellView = scroller.GetCellView(cellViewPrefab) as CellView;

            cellView.name = "Cell " + dataIndex.ToString();

            cellView.SetData(_data[dataIndex], dataIndex, _data[dataIndex].collapsedSize, _data[dataIndex].expandedSize, InitializeTween, TweenUpdated, TweenEnd);

            return(cellView);
        }
        public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex)
        {
            LevelEntryView cellView = scroller.GetCellView(levelCellViewPrefab) as LevelEntryView;

            cellView.name = _levelList[dataIndex].name;
            cellView.RemoveAllEvents();
            cellView.onSelected += CellViewSelected;
            cellView.SetData(_levelList[dataIndex]);

            return(cellView);
        }
示例#27
0
        /// <summary>
        /// This callback gets the cell to be displayed by the scroller
        /// </summary>
        /// <param name="scroller">The scroller requesting the cell</param>
        /// <param name="dataIndex">The index of the data list</param>
        /// <param name="cellIndex">The cell index (This will be different from dataindex if looping is involved)</param>
        /// <returns>The cell to display</returns>
        public SEUIContainerItem GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex)
        {
            // get the cell view from the scroller, recycling if possible
            SlotCellView cellView = scroller.GetCellView(slotCellViewPrefab) as SlotCellView;

            // set the data for the cell
            cellView.SetData(_data[dataIndex]);

            // return the cell view to the scroller
            return(cellView);
        }
示例#28
0
    public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex)
    {
        Debug.Log(dataIndex);
        cellViewPrefab = Resources.Load <EnhancedScrollerCellView>(path);
        // it will create a new cell.
        FollowerCell cellView = scroller.GetCellView(cellViewPrefab) as FollowerCell;

        cellView.name = "Cell " + dataIndex.ToString();
        cellView.SetData(_data[dataIndex]);//
        cellView.gameObject.SetActive(true);
        return(cellView);
    }
 public override EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex)
 {
     if (Properties.CellViewProperties[dataIndex] is ExampleCellViewProperties exampleCellViewProperties)
     {
         ExampleCellViewController exampleCellView = scroller.GetCellView(exampleCellViewPrefab) as ExampleCellViewController;
         exampleCellView.SetProperties(exampleCellViewProperties);
         return(exampleCellView);
     }
     else
     {
         return(null);
     }
 }
示例#30
0
        /// <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.
            LogCell cellView = scroller.GetCellView(cellPrefab) as LogCell;

            // in this example, we just pass the data to our cell's view which will update its UI
            cellView.SetData(logInfos[dataIndex], cellIndex);

            // return the cell to the scroller
            return(cellView);
        }