void CreateAddButton() { addButtonCellContainer = GameObjectUtils.InstantiatePrefab(table.addButtonCellContainerPrefab, transform); addButtonCellContainer.Initialize(); ButtonCell cell = (ButtonCell)addButtonCellContainer.CreateCellContent(table.addCellPrefab); cell.Initialize(); }
protected virtual CellContainer CreateCell(int rowIndex) { TableCellContainer cellContainer = GameObjectUtils.InstantiatePrefab(table.cellContainerPrefab, transform); cellContainer.Initialize(rowIndex); cellContainers.Add(cellContainer); TableCell contentInstance = cellContainer.CreateCellContent(info.CellPrefab); contentInstance.Initialize(); return(cellContainer); }
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); }
public void MakeScrollable(bool scrollable) { if (scrollable) { if (IsScrollable) { return; } this.GetComponent <ContentSizeFitter>().enabled = false; ScrollRect scrollView = (ScrollRect)GameObjectUtils.InstantiatePrefab(scrollViewPrefab); scrollView.transform.SetParent(this.transform.parent, false); RectTransform tableRT = GetComponent <RectTransform>(); RectTransform scrollViewRT = scrollView.GetComponent <RectTransform>(); UnityEditorInternal.ComponentUtility.CopyComponent(tableRT); UnityEditorInternal.ComponentUtility.PasteComponentValues(scrollViewRT); tableRT.SetParent(scrollView.viewport, false); tableRT.sizeDelta = Vector2.zero; scrollView.content = tableRT; this.GetComponent <ContentSizeFitter>().enabled = true; EditorGUIUtility.PingObject(gameObject); } else { if (!IsScrollable) { return; } this.GetComponent <ContentSizeFitter>().enabled = false; ScrollRect scrollView = this.transform.parent.parent.GetComponent <ScrollRect>(); RectTransform tableRT = GetComponent <RectTransform>(); RectTransform scrollViewRT = scrollView.GetComponent <RectTransform>(); tableRT.parent = scrollViewRT.parent; UnityEditorInternal.ComponentUtility.CopyComponent(scrollViewRT); UnityEditorInternal.ComponentUtility.PasteComponentValues(tableRT); DestroyImmediate(scrollView.gameObject); this.GetComponent <ContentSizeFitter>().enabled = true; EditorGUIUtility.PingObject(gameObject); } }
protected virtual void CreateTitleCell() { titleButtonCellContainer = GameObjectUtils.InstantiatePrefab(table.columnTitlePrefab, transform); titleButtonCellContainer.transform.SetSiblingIndex(0); titleButtonCellContainer.Initialize(); }
protected virtual void CreateTitleCell() { HeaderCellContainer title = GameObjectUtils.InstantiatePrefab(table.columnTitlePrefab, transform); title.Initialize(); }
public TableCell CreateCellContent(TableCell cellPrefab) { cellInstance = GameObjectUtils.InstantiatePrefab(cellPrefab, content); return(cellInstance); }