/**
         * 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);
                    }
                }
            }
        }
Beispiel #2
0
        void Update()
        {
            if (grid == null || !invalid)
            {
                return;
            }
            float delta = Time.deltaTime;

            if (rowCount == 0)
            {
                Init();
            }
            for (int r = 0; r < rowCount; r++)
            {
                float old = rowDelay[r];
                rowDelay[r] = Math.Min(rowDelay[r] + delta * speed, 1);
                float time          = Math.Max(0, rowDelay[r]);
                float interpolation = TweenEasingFunctions.GetFunction(easeType)(time);
                for (int c = 0; c < colCount; c++)
                {
                    Transform t = grid.GetCell(r, c);
                    if (t != null)
                    {
                        animator(r, t, cellScales[r, c], cellPos[r, c], interpolation);
                    }
                }
                if (animateBackground)
                {
                    Transform bg = grid.GetBackground(r);
                    if (bg != null)
                    {
                        animator(r, bg, bgScales[r], bgPos[r], interpolation);
                    }
                }
                if (r >= grid.rowHeader && old <= 0 && time > 0)
                {
                    foreach (UITableAnimEventListener l in listeners)
                    {
                        l.OnRowAnimBegin(r - grid.rowHeader);
                    }
                }
                if (r >= grid.rowHeader && old < 1 && time >= 1)
                {
                    foreach (UITableAnimEventListener l in listeners)
                    {
                        l.OnRowAnimEnd(r - grid.rowHeader);
                    }
                }
            }
            if (rowCount > 0 && rowDelay[rowCount - 1] >= 1)
            {
                for (int r = 0; r < rowCount; r++)
                {
                    Transform bg = grid.GetBackground(r);
                    if (bg != null)
                    {
                        NGUIUtil.UpdateCollider(bg);
                    }
                }
                invalid = false;
                foreach (UITableAnimEventListener l in listeners)
                {
                    l.OnAnimEnd();
                }
            }
        }