示例#1
0
        public HierarchyNodeUI(Object nodeObject)
        {
            this.nodeObject = nodeObject;
            float height = Theme.LayoutHeight;

            selectButton = new ButtonUI(nodeObject.Name)
            {
                label =
                {
                    Align = LabelUI.Alignment.left
                }
            };

            expandButton = new ButtonUI
            {
                transform =
                {
                    LeftPercent = 1f,
                    LeftMargin  = -height
                }
            };

            selectButton.OnPressedMethods += OnSelectButtonPressed;
            expandButton.OnPressedMethods += OnExpandButtonPressed;

            container = new AutoLayoutAreaUI
            {
                Margins        = false,
                NegativeMargin = height
            };

            Add(selectButton);
            Add(container);

            selectButton.Add(expandButton);
            SetExpanded(nodeObject is Scene);

            Margins = false;

            foreach (Object child in nodeObject.LoopChildren(false))
            {
                container.Add(new HierarchyNodeUI(child));
            }
        }