Selectable GetSelectableFromCellAt(int columnIndex, int rowIndex)
        {
            TableColumn   column = tableColumns[columnIndex];
            CellContainer cc     = column.GetCellAt(rowIndex);

            return((cc == null) ? null : cc.GetComponentInChildren <Selectable>());
        }
        void CreateAddButton()
        {
            addButtonCellContainer = GameObjectUtils.InstantiatePrefab(table.addButtonCellContainerPrefab, transform);
            addButtonCellContainer.Initialize();
            ButtonCell cell = (ButtonCell)addButtonCellContainer.CreateCellContent(table.addCellPrefab);

            cell.Initialize();
        }
 void UpdateCellsActiveState()
 {
     for (int i = 0; i < cellContainers.Count; i++)
     {
         CellContainer cell = cellContainers[i];
         cell.gameObject.SetActive(Application.isPlaying || !table.limitRowsInEditMode || i < table.nbRowsInEditMode || cell == addButtonCellContainer);
     }
 }
 protected void Awake()
 {
     // Auto-fix compatibility issue between 1.6 and 1.7
     if (table.hasTitles && titleButtonCellContainer == null)
     {
         titleButtonCellContainer = TryFindTitleCell();
     }
 }
        protected CellContainer AddEmptyCell(string name)
        {
            GameObject    emptyTitleGO = transform.CreateChildGameObject(name);
            CellContainer emptyCell    = emptyTitleGO.AddComponent <CellContainer>();

            emptyCell.Initialize();
            return(emptyCell);
        }
Beispiel #6
0
        protected override CellContainer CreateCell(int rowIndex)
        {
            CellContainer cellContainer = GameObjectUtils.InstantiatePrefab(table.emptyCellContainerPrefab, transform);

            cellContainer.Initialize(rowIndex);
            cellContainers.Add(cellContainer);
            ButtonCell cell = (ButtonCell)cellContainer.CreateCellContent(info.CellPrefab);

            cell.Initialize();
            return(cellContainer);
        }
Beispiel #7
0
 protected override CellContainer TryFindTitleCell()
 {
     if (transform.childCount > 0)
     {
         CellContainer firstCell = transform.GetChild(0).GetComponent <CellContainer>();
         if (firstCell != cellContainers[0])
         {
             return(firstCell);
         }
     }
     return(null);
 }
        Selectable FindNextSelectable(Selectable selectable, TabDirection direction)
        {
            int           columnIndex = -1, rowIndex = -1;
            CellContainer cellContainer = selectable.GetComponentInParent <CellContainer>();

            for (int i = 0; i < tableColumns.Count; i++)
            {
                int row = tableColumns[i].IndexOf(cellContainer);
                if (row >= 0)
                {
                    columnIndex = i;
                    rowIndex    = row;
                    break;
                }
            }
            if (columnIndex < 0 || rowIndex < 0)
            {
                return(null);
            }
            if (direction == TabDirection.Forward)
            {
                for (int i = rowIndex; i < ElementCount; i++)
                {
                    int startIndex = (i == rowIndex) ? columnIndex + 1 : 0;
                    for (int j = startIndex; j < tableColumns.Count; j++)
                    {
                        Selectable s = GetSelectableFromCellAt(j, i);
                        if (s != null)
                        {
                            return(s);
                        }
                    }
                }
            }
            else
            {
                for (int i = rowIndex; i >= 0; i--)
                {
                    int startIndex = (i == rowIndex) ? columnIndex - 1 : tableColumns.Count - 1;
                    for (int j = startIndex; j >= 0; j--)
                    {
                        Selectable s = GetSelectableFromCellAt(j, i);
                        if (s != null)
                        {
                            return(s);
                        }
                    }
                }
            }
            return(null);
        }
 protected virtual void CreateTitleCell()
 {
     titleButtonCellContainer = GameObjectUtils.InstantiatePrefab(table.columnTitlePrefab, transform);
     titleButtonCellContainer.transform.SetSiblingIndex(0);
     titleButtonCellContainer.Initialize();
 }
 public int IndexOf(CellContainer cellContainer)
 {
     return(cellContainers.IndexOf(cellContainer));
 }
 protected void AddEmptyAddButtonRowCell()
 {
     addButtonCellContainer = AddEmptyCell("Empty Add Row Cell");
 }