public void AddFilterNode(FilterItem item)
 {
     if (nextFilterNode == null)
     {
         nextFilterNode        = item;
         item.parentFilterNode = this;
     }
     else
     {
         nextFilterNode.AddFilterNode(item);
     }
 }
Exemple #2
0
        public ObjectChecker()
        {
            previewItem  = new CheckItem(this, "预览", 40, CheckType.Texture); previewItem.order = -99; //previewItem.show = false;
            nameItem     = new CheckItem(this, "名称", 200, CheckType.String, OnNameButtonClick);
            refItem      = new CheckItem(this, "引用", 80, CheckType.List, OnRefButtonClick);
            totalRefItem = new CheckItem(this, "具体引用", 80, CheckType.List, OnDetailRefButton);
            activeItem   = new CheckItem(this, "引用对象全部激活", 120); activeItem.order = 98;
            pathItem     = new CheckItem(this, "路径", 999); pathItem.order = 99;

            InitCheckItem();
            //根据配置文件反射初始化的扩展项,暂时注掉
            InitCustomCheckItem();

            checkItem.Sort(delegate(CheckItem item1, CheckItem item2) { return(item1.order - item2.order); });
            filterItem = new FilterItem(this);
        }
        private bool InitFilterByCfg(FilterItem item, FilterItemCfg cfg)
        {
            if (cfg == null)
            {
                return(false);
            }
            CheckItem cItem = checker.GetCheckItemByName(cfg.checkItemName);

            if (cItem != null)
            {
                item.currentFliterType = ArrayUtility.IndexOf(item.filterArray, cItem);
                item.currentFilterStr  = cfg.filterString;
                item.positive          = cfg.positive;
                return(true);
            }
            return(false);
        }
        //不用反射获取原生风格的搜索框了,在多个检查器切换时,数据切换了,显示得不对,怀疑是static实现?
        //public string SearchField(string value, params GUILayoutOption[] options)
        //{
        //    MethodInfo info = typeof(EditorGUILayout).GetMethod("ToolbarSearchField", BindingFlags.NonPublic | BindingFlags.Static, null, new System.Type[] { typeof(string), typeof(GUILayoutOption[]) }, null);
        //    if (info != null)
        //    {
        //        value = (string)info.Invoke(null, new object[] { value, options });
        //    }
        //    return value;
        //}

        public void CreateFilterFromCfg(FilterItem item, PredefineFilterGroup filterGroup, int index)
        {
            FilterItemCfg cfg = null;

            if (index < filterGroup.filterCfgGroup.Length)
            {
                cfg = filterGroup.filterCfgGroup[index];
            }
            else
            {
                return;
            }
            FilterItem newItem = new FilterItem(checker);

            if (InitFilterByCfg(newItem, cfg))
            {
                item.AddFilterNode(newItem);
            }
            CreateFilterFromCfg(newItem, filterGroup, ++index);
        }