Exemple #1
0
        public Filter(Filter f)
        {
            checks = new List<Check>();
            for (int i = 0; i < f.checks.Count; i++)
            {
                checks.Add(new Check(f.checks[i]));
            }

            invert = f.invert;
        }
Exemple #2
0
        public bool Equals(Filter f2)
        {
            if (f2 == null)
                return false;

            if (this.invert != f2.invert)
                return false;
            else
            {
                foreach (Check c1 in this.checks)
                {
                    if (!f2.checks.Any(c2 => c1.Equals(c2)))
                        return false;
                }
                return true;
            }
        }
 /// <summary>
 /// Draws all the checks associated with the given Filter
 /// </summary>
 void drawFilter(Filter filter)
 {
     bool tmpBool = GUILayout.Toggle(filter.invert, "Invert filter result", GUI.skin.button);
     if (filter.invert != tmpBool)
     {
         filter.invert = tmpBool;
         refresh();
     }
     GUILayout.Space(20);
     GUILayout.Label("Checks");
     Check toremove = null;
     foreach (Check c in filter.checks)
     {
         if (drawCheck(c))
         {
             toremove = c;
             refresh();
         }
     }
     if (toremove != null)
     {
         filter.checks.Remove(toremove);
         refresh();
     }
     if (GUILayout.Button("Add Check"))
     {
         filter.checks.Add(defaultCheck());
         refresh();
     }
 }