public void AddChild(Control control, int row, int col) { if (row >= table.rowAmount) { for (int i = table.rowAmount; i < row + 1; i++) { table.AddNewAutoRow(); } } if (col >= table.colAmount) { for (int i = table.colAmount; i < col + 1; i++) { table.AddNewAutoCol(); } } if (control == null) { return; } control.transform.SetParent(transform); control.Parent = this; TableCellData celldata; Type type = control.GetType(); if (type == typeof(Tabler)) { Tabler tbr = control as Tabler; int key = table.GetRowColKey(row, col); ctableDict[key] = tbr; table.AddCellChildTable(row, col, tbr.table); } else { celldata = new TableCellData(); celldata.type = TableCellDataType.FixedSize; celldata.data = control; celldata.rowIdx = row; celldata.colIdx = col; celldata.GetLayoutSize = GetLayoutSize; table.SetCellValue(row, col, celldata); } }
public void SetCellFixedSizeValue(int rowIdx, int colIdx, Vector2 fixedSize) { TableCellData cellData; cellData = new TableCellData(); cellData.type = TableCellDataType.FixedSize; cellData.fixedSize = fixedSize; int key = GetRowColKey(rowIdx, colIdx); if (cellValueInfoDict.ContainsKey(key) == false) { cellValueInfoDict.Add(key, cellData); } else { cellValueInfoDict[key] = cellData; } }
public void AddCellChildTable(int rowIdx, int colIdx, Table childTable) { TableCellData cellData; cellData = new TableCellData(); cellData.type = TableCellDataType.Table; cellData.data = childTable; cellData.rowIdx = rowIdx; cellData.colIdx = colIdx; int key = GetRowColKey(rowIdx, colIdx); if (cellValueInfoDict.ContainsKey(key) == false) { cellValueInfoDict.Add(key, cellData); } else { cellValueInfoDict[key] = cellData; } childTable.parentTable = this; childTable.inParentCellCoord = new CellCoord(rowIdx, colIdx); }