Exemplo n.º 1
0
        public void InitFocusing(UIScrollView focusScroll, UITableLayout grid, Action <Transform> focusCallback = null)
        {
            scalingCoverage = Vector3.Distance(focusCenter.position, coverRadius.position);
            if (focusScroll == null)
            {
                return;
            }
            if (scroll != null)
            {
                scroll.onDragFinished -= FocusTarget;
            }

            this.grid          = grid;
            this.scroll        = focusScroll;
            this.focusCallback = focusCallback;

            if (scroll.isActiveAndEnabled)
            {
                FocusTarget();
                scroll.onDragFinished += FocusTarget;
            }

            if (null == restrictObj)
            {
                CreateRestrictObject();
            }
        }
Exemplo n.º 2
0
        protected override void Preprocess(Component comp)
        {
            UITableLayout layout = comp as UITableLayout;

            Deactivate(layout.rowPrefab);
            Deactivate(layout.columnPrefab);
            Deactivate(layout.defaultPrefab);
        }
Exemplo n.º 3
0
        void OnEnable()
        {
            UITableLayout grid = (UITableLayout)target;

            inspector = new UITableLayoutInspectorImpl(grid);
            inspector.OnEnable();
            SerializedObject obj = new SerializedObject(grid);

            varInspector = new SerializedInspector(obj, "gizmoColor");
        }
Exemplo n.º 4
0
 void OnEnable()
 {
     if (grid == null)
     {
         grid = GetComponent <UITableLayout>();
     }
     if (grid != null)
     {
         grid.AddListener(this);
     }
 }
Exemplo n.º 5
0
        public override void OnEnable()
        {
            GameObject sel = Selection.activeGameObject;

            if (sel != null)
            {
                UITableLayout layout = sel.GetComponent <UITableLayout>();
                if (layout != null)
                {
                    grid = layout;
                    SetLayout(grid);
                }
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Default behaviour for the Label, Slider, Sprite
 /// </summary>
 /// <param name="t">T.</param>
 /// <param name="val">Value.</param>
 /// <param name="status">Status.</param>
 public static void SetValue(UITableLayout grid, UITableCell c, int row, int column, object val, Action <UITableCell> initFunc = null)
 {
     if (c != null)
     {
         c.containerGrid = grid;
         c.row           = row;
         c.column        = column;
         c.SetCell(val, initFunc);
     }
     else
     {
         c.go.SetActive(val != null);
     }
 }
Exemplo n.º 7
0
        /**
         * Row중 UILabel인 경우 text color를 바꾸어준다.
         * @param row row 값은 title row를 포함한 실제 row번호(zero-based)
         */
        public static void SetRowColor(this UITableLayout table, int row, Color color)
        {
            string colorStr = NGUIUtil.ConvertColor2Str(color);

            for (int col = table.columnHeader; col < table.columnCount; col++)
            {
                UITableCell c = table.GetCell(row + table.rowHeader, col);
                if (c != null)
                {
                    UILabel label = c.GetComponent <UILabel>();
                    if (label != null)
                    {
                        label.SetText(colorStr + label.text);
                    }
                }
            }
        }
Exemplo n.º 8
0
        public static void RepositionNow(Transform trans)
        {
            UILayout layout = trans.GetComponent <UILayout>();

            /*  Grid일 경우 Grid에 추가된 순서대로 update한다. */
            if (layout is UITableLayout)
            {
                UITableLayout grid = (UITableLayout)layout;
                foreach (var child in grid.components)
                {
                    if (child == null)
                    {
                        continue;
                    }
                    if (child.go.activeSelf)
                    {
                        RepositionNow(child.transform);
                    }
                }
            }
            else
            {
                for (int i = 0; i < trans.childCount; i++)
                {
                    Transform child = trans.GetChild(i);
                    if (child.gameObject.activeSelf)
                    {
                        RepositionNow(child);
                    }
                }
            }
            if (layout != null && layout.enabled)
            {
                layout.Reposition();
            }
        }
Exemplo n.º 9
0
 public void SetLayout(UITableLayout grid)
 {
     this.grid      = grid;
     this.inspector = new UITableLayoutInspectorImpl(grid);
     this.inspector.OnEnable();
 }
Exemplo n.º 10
0
 public void SetLayout(UITableLayout table)
 {
     this.table     = table;
     this.inspector = new UITableLayoutInspectorImpl(table);
     this.inspector.OnEnable();
 }
Exemplo n.º 11
0
 public UITableLayoutInspectorImpl(UITableLayout grid)
 {
     this.grid = grid;
 }