Ejemplo n.º 1
0
        void UpdateItem(TreeViewNode node)
        {
            float dy = node.offset.y - m_point;

            if (dy <= Size.y)
            {
                if (dy + ItemHigh > 0)
                {
                    var item = swap.Exchange((o, e) => { return(o.node == e); }, node);
                    if (item == null)
                    {
                        item = CreateItem();
                        swap.Push(item);
                        item.node = node;
                        if (item.text != null)
                        {
                            if (node.child.Count > 0)
                            {
                                item.text.text = "▷ " + node.content;
                            }
                            else
                            {
                                item.text.text = node.content;
                            }
                        }
                    }
                    item.callBack.Target.localPosition = new Vector3(node.offset.x, hy - dy - ItemHigh * 0.5f, 0);
                }
            }
        }
Ejemplo n.º 2
0
        void UpdateItem(TreeViewNode node)
        {
            float dy = node.offset.y - m_pointY;

            if (dy <= Size.y)
            {
                if (dy + ItemHigh > 0)
                {
                    var item = swap.Exchange((o, e) => { return(o.node == e); }, node);
                    if (item == null)
                    {
                        item = CreateItem();
                        swap.Push(item);
                        item.node = node;
                    }
                    if (creator != null)
                    {
                        creator.Update(item, node);
                    }
                    if (item.Text != null)
                    {
                        if (node.child.Count > 0)
                        {
                            if (node.expand)
                            {
                                item.Text.Text = "▼ " + node.content;
                            }
                            else
                            {
                                item.Text.Text = "► " + node.content;
                            }
                        }
                        else
                        {
                            item.Text.Text = node.content;
                        }
                    }
                    var m = item.Item.Context;
                    m.transform.localPosition = new Vector3(node.offset.x, hy - dy - ItemHigh * 0.5f, 0);
                }
            }
        }