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();
 }
Exemplo n.º 3
0
        protected virtual void CreateTitleCell()
        {
            HeaderCellContainer title = GameObjectUtils.InstantiatePrefab(table.columnTitlePrefab, transform);

            title.Initialize();
        }
Exemplo n.º 4
0
 public TableCell CreateCellContent(TableCell cellPrefab)
 {
     cellInstance = GameObjectUtils.InstantiatePrefab(cellPrefab, content);
     return(cellInstance);
 }