Example #1
0
        protected void InitializeElement(string labelText)
        {
            label = new ListItemText(labelText);
            label.AddToClassList("list-item-label");

            objectDisplay = new ObjectField();
            objectDisplay.allowSceneObjects = false;
            objectDisplay.objectType        = typeof(GameObject);
            objectDisplay.value             = objectValue;
            objectDisplay.AddToClassList("list-item-input", "list-item-object-input", "second-alternate");

            button = new ListItemImage(caretIcon);
            button.AddToClassList("selectable", "hoverable");

            button.eventManager.AddListener <MouseClickEvent>(e => {
                if (e.button != 0)
                {
                    return;
                }
                HierarchySelector hierarchySelector = HierarchySelector.Open();
                hierarchySelector.eventManager.Raise <SetSelectorParameters <GameObject> >(new SetSelectorParameters <GameObject>(root));
                hierarchySelector.eventManager.AddListener <MainframeKeySelection <int[]> >(ev => {
                    this.value = ev.value;
                    this.objectDisplay.value = HierarchySelector.GetChildByHierarhcy(root, ev.value);
                    this.eventManager.Raise <MainframeKeySelection <int[]> >(ev);
                });
            });

            this.Add(label, objectDisplay, button);
        }
Example #2
0
 public static HierarchySelector Open()
 {
     HierarchySelector.Close <HierarchySelector>();
     return(HierarchySelector.GetWindow <HierarchySelector>());
 }