Ejemplo n.º 1
0
        public Slot buildLayerUI(string name, string type, Slot slot, int depth)
        {
            UIBuilder uiBuilder3 = new UIBuilder(slot);

            uiBuilder3.Style.ForceExpandHeight = false;
            uiBuilder3.Style.ChildAlignment    = Alignment.TopLeft;
            uiBuilder3.HorizontalLayout(4f, 0.0f, new Alignment?());
            uiBuilder3.Style.MinHeight = 32f;
            uiBuilder3.Style.MinWidth  = 32f;
            Button              button1             = uiBuilder3.Button();
            Expander            expander            = button1.Slot.AttachComponent <Expander>(true);
            TextExpandIndicator textExpandIndicator = button1.Slot.AttachComponent <TextExpandIndicator>(true);

            textExpandIndicator.Text.Target = (IField <string>)button1.Slot.GetComponentInChildren <Text>((Predicate <Text>)null, false).Content;
            uiBuilder3.Style.FlexibleWidth  = 100f;
            Text       text       = uiBuilder3.Text(name, true, Alignment.MiddleLeft, true, (string)null);
            Button     button2    = text.Slot.AttachComponent <Button>(true, (Action <Button>)null);
            MethodInfo privMethod = logixNodeSelector.GetType().GetMethod("OnOpenCategoryPressed", BindingFlags.NonPublic | BindingFlags.Instance);
            ButtonEventHandler <string> action = (ButtonEventHandler <string>)Delegate.CreateDelegate(typeof(ButtonEventHandler <string>), logixNodeSelector, privMethod);

            button2.SetupAction <string>(action, type, 0.3f);
            InteractionElement.ColorDriver colorDriver = button2.ColorDrivers.Add();
            colorDriver.ColorDrive.Target    = (IField <color>)text.Color;
            colorDriver.NormalColor.Value    = color.Black;
            colorDriver.HighlightColor.Value = color.Blue;
            colorDriver.PressColor.Value     = color.Cyan;
            //button2.SetupAction(new ButtonEventHandler(this.OnSlotNamePressed), 0.0f);
            //this._slotNameText.Target = text;
            uiBuilder3.Style.FlexibleWidth = -1f;
            uiBuilder3.NestOut();
            uiBuilder3.Style.MinHeight = -1f;
            HorizontalLayout horizontalLayout = uiBuilder3.HorizontalLayout(4f, 0.0f, new Alignment?());

            uiBuilder3.Style.MinWidth = 32f;
            uiBuilder3.Empty("Spacer");
            uiBuilder3.Style.FlexibleWidth = 100f;
            //uiBuilder3.VerticalLayout(4f, 0.0f, new Alignment?());
            Slot childrenSlot = uiBuilder3.VerticalLayout(4f, 0.0f, new Alignment?()).Slot;

            expander.SectionRoot.Target             = horizontalLayout.Slot;
            textExpandIndicator.SectionRoot.Target  = horizontalLayout.Slot;
            textExpandIndicator.ChildrenRoot.Target = childrenSlot;
            //if (depth<2) buildHierarchyLevel(childrenSlot, depth+1);
            expander.IsExpanded = false;
            //slot.ActiveSelf = depth == 0;
            return(childrenSlot);
        }