示例#1
0
        protected override void OnAttach()
        {
            base.OnAttach();
            sep = "\t";
            //CONTAINING SLOT AND BASE CANVAS
            mainSlot = this.LocalUserSpace.AddSlot("LogiX Node Browser");
            NeosPanel neosPanel = mainSlot.AttachComponent <NeosPanel>(true, (Action <NeosPanel>)null);

            neosPanel.Title           = "Logix/Componer browser";
            neosPanel.Padding.Value   = 0.005f;
            neosPanel.ZPadding.Value  = 0.005f;
            neosPanel.Thickness.Value = 0.01f;
            neosPanel.AddCloseButton();
            neosPanel.AddParentButton();
            UIBuilder uiBuilder1 = new UIBuilder(neosPanel.ContentSlot, 1000f, 1000f, 0.0005f);
            //Canvas component = neosPanel.ContentSlot.GetComponent<Canvas>((Predicate<Canvas>)null, false);
            color color1 = new color(1f, 1f, 1f, 0.2f);

            uiBuilder1.Panel(in color1, false);

            //Search Footer
            RectTransform searchFooter, mainContent;

            uiBuilder1.HorizontalFooter(64f, out searchFooter, out mainContent);
            UIBuilder searchUI     = new UIBuilder(searchFooter);
            TextField textfield    = searchUI.TextField();
            Action    sendRequest  = this.BuildSearchLogix(textfield.Text.Content.ReferenceID);
            var       editorEvents = textfield.Slot.AddSlot("logix").AttachComponent <Interaction.TextEditorEvents>();

            editorEvents.Source.Value           = textfield.Editor;
            editorEvents.EditingFinished.Target = sendRequest;


            //MAIN CONTENT
            //Horizontal split
            List <RectTransform> rectTransformList = (new UIBuilder(mainContent)).SplitHorizontally(0.4f, 0.6f);

            //RIGHT SIDE
            Slot rightSlot = rectTransformList[1].Slot;

            logixNodeSelector = rightSlot.AttachComponent <LogixNodeSelector2>();
            Slot contentSlot   = rightSlot.FindChild(s => s.Name == "Content");
            Slot containerSlot = contentSlot[0];

            nodesContainerSlot     = containerSlot;
            contentSlot.ActiveSelf = false;
            rightSlot.FindChild(s => s.Name == "Panel").Destroy();
            rightSlot.FindChild(s => s.Name == "Handle").Destroy();
            rightSlot.FindChild(s => s.Name == "Header").Destroy();
            rightSlot.FindChild(s => s.Name == "HandleAnchor").Destroy();
            containerSlot.Parent = rightSlot;


            //LEFT SIDE
            RectTransform hierarchyHeader, nodeHierarchy;
            Slot          leftSlot   = rectTransformList[0].Slot;
            UIBuilder     uiBuilder2 = new UIBuilder(leftSlot);

            //header
            uiBuilder2.HorizontalHeader(64f, out hierarchyHeader, out nodeHierarchy);
            UIBuilder uiBuilder3 = new UIBuilder(hierarchyHeader);

            uiBuilder3.HorizontalLayout(4f, 0.0f, 4f, 0.0f, 4f, new Alignment?());
            uiBuilder3.Style.FlexibleWidth = 100f;
            //hierarchyHeader = uiBuilder3.CurrentRect;
            uiBuilder3.HorizontalLayout(4f, 0.0f, 0.0f, 4.0f, 0.0f);

            //hierarchy container
            UIBuilder uiBuilderContent = new UIBuilder(nodeHierarchy);
            color     color2           = new color(1f, 1f, 1f, 0.2f);

            uiBuilderContent.Panel(in color2, false);
            //nodeHierarchy = uiBuilderContent.CurrentRect;
            uiBuilderContent.ScrollArea(new Alignment?());
            uiBuilderContent.VerticalLayout(4.0f, 0.0f, Alignment.TopLeft);
            uiBuilderContent.FitContent(SizeFit.Disabled, SizeFit.MinSize);
            componentHierarchy = uiBuilderContent.CurrentRect.Slot;
            logixHierarchy     = componentHierarchy.Duplicate();

            //Logix/Comp buttons
            uiBuilder3.Style.FlexibleWidth = -1f;
            uiBuilder3.Style.MinWidth      = 64f;
            Button logixButton = uiBuilder3.Button("LogiX");
            var    component1  = logixButton.Slot.AttachComponent <ButtonValueSet <bool> >();

            component1.TargetValue.Target = logixHierarchy.ActiveSelf_Field;
            component1.SetValue.Value     = true;
            var component2 = logixButton.Slot.AttachComponent <ButtonValueSet <bool> >();

            component2.TargetValue.Target = componentHierarchy.ActiveSelf_Field;
            component2.SetValue.Value     = false;
            Button compButton = uiBuilder3.Button("Comps");
            var    component3 = compButton.Slot.AttachComponent <ButtonValueSet <bool> >();

            component3.TargetValue.Target = logixHierarchy.ActiveSelf_Field;
            component3.SetValue.Value     = false;
            var component4 = compButton.Slot.AttachComponent <ButtonValueSet <bool> >();

            component4.TargetValue.Target = componentHierarchy.ActiveSelf_Field;
            component4.SetValue.Value     = true;

            components_string2 = "NiceName" + sep + "Name" + sep + "FullName" + sep + "Folder" + sep + "Description" + sep + "Type\n";
            logix_string2      = components_string2;
            buildLayer("", componentHierarchy);
            buildLayer("/LogiX", logixHierarchy);

            componentHierarchy.ActiveSelf = false;
            logixHierarchy.ActiveSelf     = true;

            components_string += "\n ";
            logix_string      += "\n ";
            //components_string2 += "\n ";
            //logix_string2 += "\n ";
            System.IO.File.WriteAllText(@"C:\Program Files (x86)\Steam\steamapps\common\NeosVR\components_string.txt", components_string);
            System.IO.File.WriteAllText(@"C:\Program Files (x86)\Steam\steamapps\common\NeosVR\logix_string.txt", logix_string);
            System.IO.File.WriteAllText(@"C:\Program Files (x86)\Steam\steamapps\common\NeosVR\components_string2.txt", components_string2);
            System.IO.File.WriteAllText(@"C:\Program Files (x86)\Steam\steamapps\common\NeosVR\logix_string2.txt", logix_string2);

            //this.MakeVariableSelector();
        }