コード例 #1
0
    public void SetRowNumber(int row, int cellNum, int dispNum)
    {
        cellItemNum        = cellNum;
        cellIndex          = row;
        cellDisplayItemNum = dispNum;
        if (dicItems.Count == 0)
        {
            return;
        }


        // m_rowNumberText.text = "Row " + rowNumber.ToString();
        // m_background.color = GetColorForRow(rowNumber);
        for (int i = 0; i < dicItems.Count; i++)
        {
            PayCellItem item = dicItems[i];

            // item.itemDelegate = this;
            item.index = cellIndex * cellItemNum + i;
            if (i < cellDisplayItemNum)
            {
                item.Hide(false);
            }
            else
            {
                item.Hide(true);
            }
        }
    }
コード例 #2
0
 public void UpdateItem(List <ItemInfo> list)
 {
     for (int i = 0; i < cellDisplayItemNum; i++)
     {
         PayCellItem item = dicItems[i];
         int         idx  = cellIndex * cellItemNum + i;
         if (idx < list.Count)
         {
             ItemInfo info = list[idx];
             item.UpdateInfo(info);
         }
     }
 }
コード例 #3
0
ファイル: UIPay.cs プロジェクト: mooncode163/unity_kidsgame2
    //Will be called by the TableView when a cell needs to be created for display
    public TableViewCell GetCellForRowInTableView(TableView tableView, int row)
    {
        PayCell cell = tableView.GetReusableCell(cellPrefab.reuseIdentifier) as PayCell;

        if (cell == null)
        {
            cell      = (PayCell)GameObject.Instantiate(cellPrefab);
            cell.name = "PayCell" + (++numInstancesCreated).ToString();
            Rect    rctable     = (tableView.transform as RectTransform).rect;
            Vector2 sizeCell    = (cellPrefab.transform as RectTransform).sizeDelta;
            Vector2 sizeTable   = (tableView.transform as RectTransform).sizeDelta;
            Vector2 sizeCellNew = sizeCell;
            sizeCellNew.x = rctable.width;



            for (int i = 0; i < oneCellNum; i++)
            {
                PayCellItem item = cellItemPrefab;
                item = (PayCellItem)GameObject.Instantiate(item);

                // item.iDelegate = this;
                item.transform.SetParent(cell.transform, false);
                item.index = row * oneCellNum + i;


                RectTransform rctran = item.GetComponent <RectTransform>();
                rctran.sizeDelta = new Vector2(rctran.sizeDelta.x, heightCell);

                Rect    rcItem = rctran.rect;
                Vector3 pos    = new Vector3(rcItem.width * i, 0, 0);

                rctran.anchoredPosition = pos;
                cell.AddItem(i, item);
            }
        }

        int cellNumCur = oneCellNum;

        if (row == GetNumberOfRowsForTableView(tableView) - 1)
        {
            cellNumCur = listItem.Count - (GetNumberOfRowsForTableView(tableView) - 1) * oneCellNum;
        }

        cell.SetRowNumber(row, oneCellNum, cellNumCur);
        cell.UpdateItem(listItem);
        return(cell);
    }
コード例 #4
0
 public void AddItem(int idx, PayCellItem item)
 {
     dicItems[idx] = item;
     //item.iDelegate = this;
 }
コード例 #5
0
 public void SetItem(PayCellItem item)
 {
 }