Example #1
0
 public void CreateFromFilterGroup(PredefineFilterGroup filterGroup)
 {
     Clear(true);
     //首先设置自身,然后设置子节点
     if (filterGroup != null && filterGroup.filterCfgGroup != null && filterGroup.filterCfgGroup.Length > 0)
     {
         FilterItemCfg cfg = filterGroup.filterCfgGroup[0];
         InitFilterByCfg(this, cfg);
         CreateFilterFromCfg(this, filterGroup, 1);
     }
 }
Example #2
0
        public void SaveFilterAsCfg(List <FilterItemCfg> cfgList)
        {
            FilterItemCfg cfg = new FilterItemCfg();

            cfg.checkItemName = filterArray[currentFliterType].title;
            cfg.filterString  = currentFilterStr;
            cfg.positive      = positive;
            cfgList.Add(cfg);
            if (nextFilterNode != null)
            {
                nextFilterNode.SaveFilterAsCfg(cfgList);
            }
        }
Example #3
0
        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);
        }
Example #4
0
        //不用反射获取原生风格的搜索框了,在多个检查器切换时,数据切换了,显示得不对,怀疑是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);
        }