コード例 #1
0
        void HeaderGUI(Rect headerRect, string label, GroupNodeItem item)
        {
            headerRect.y += 1f;
            HeaderInfos(headerRect, item);

            // Do toggle
            Rect toggleRect = headerRect;

            toggleRect.width = 16;
            EditorGUI.BeginChangeCheck();
            if (!imgDic.ContainsKey(item.id))
            {
                imgDic[item.id] = false;
            }
            imgDic[item.id] = EditorGUI.Toggle(toggleRect, imgDic[item.id]); // hide when outside cell rect
            if (EditorGUI.EndChangeCheck())
            {
                RefreshCustomRowHeights();
            }

            Rect labelRect = headerRect;

            labelRect.xMin += toggleRect.width + 2f;
            GUI.Label(labelRect, label);
        }
コード例 #2
0
 public void AddChild(GroupNodeItem item)
 {
     base.AddChild(item);
     if (!data.children.Contains(item))
     {
         data.children.Add(item.data);
     }
 }
コード例 #3
0
 protected override TreeViewItem BuildRoot()
 {
     if (root == null)
     {
         root = new GroupNodeItem(new Rect(), 0, -1);
     }
     return(root);
 }
コード例 #4
0
        private void ControlsGUI(Rect controlsRect, GroupNodeItem item)
        {
            var rectRect = new Rect(controlsRect.x, controlsRect.y, 120, controlsRect.width * 0.2f);

            item.rect = EditorGUI.RectField(rectRect, item.rect);
            if (!imgListDic.ContainsKey(item.id))
            {
                var reorder = new ReorderableList(item.images, typeof(Data.ImgNode), true, true, true, true);
                reorder.elementHeight       = imgNodeHeight;
                reorder.drawHeaderCallback  = (r) => { EditorGUI.LabelField(r, "Contents"); };
                reorder.drawElementCallback = (rect, index, isActive, isFocused) => DrawElementCallBack(item.images, rect, index, isActive, isFocused);
                reorder.onChangedCallback   = (x) => { Reload(); };
                imgListDic.Add(item.id, reorder);
            }
            var imgsRect = new Rect(controlsRect.x + 120, controlsRect.y, controlsRect.width - 120, controlsRect.height);

            imgListDic[item.id].DoList(imgsRect);
        }
コード例 #5
0
        void HeaderInfos(Rect rect, GroupNodeItem item)
        {
            var typeRect = new Rect(EditorGUIUtility.currentViewWidth - 110, rect.y, 100, rect.height);

            AnalysisUtility.InitEnviroment(ruleObj);
            UGUI.LayerImportGUI layerImportEditor = AnalysisUtility.GetLayerEditor(item.data.suffix);
            //Debug.Log(layerImportEditor);

            var index = Array.IndexOf(AnalysisUtility.layerImportEditorOptions, item.data.suffix);

            index = EditorGUI.Popup(typeRect, index, AnalysisUtility.layerImportEditorOptions, EditorStyles.miniLabel);
            if (index >= 0)
            {
                item.data.suffix = AnalysisUtility.layerImportEditorOptions[index];
            }

            var dirRect = new Rect(EditorGUIUtility.currentViewWidth - 210, rect.y, 100, rect.height);

            layerImportEditor.HeadGUI(dirRect, item.data);
        }
コード例 #6
0
        public virtual void OnDropDraggedElementsAtIndex(List <TreeViewItem> draggedRows, GroupNodeItem parent, int insertIndex)
        {
            var draggedElements = new List <TreeViewItem>();

            foreach (var x in draggedRows)
            {
                draggedElements.Add(((GroupNodeItem)x));
            }

            var selectedIDs = draggedElements.Select(x => x.id).ToArray();

            MoveElements(parent, insertIndex, draggedElements);
            SetSelection(selectedIDs, TreeViewSelectionOptions.RevealAndFrame);
        }