public void AddTargetDrawers(IEnumerable <Drawer> drawers, DrawerActionScope scope, bool updateResult)
 {
     foreach (var d in drawers)
     {
         AddTargetDrawer(d, scope, updateResult);
     }
 }
Esempio n. 2
0
 public void SaveState(DrawerActionScope scope)
 {
     foreach (var drawer in EnumerateByScope(scope))
     {
         DrawerStates.Set(drawer.HierarchicalName, drawer.CreateState());
     }
 }
Esempio n. 3
0
 public void ResetVisiblity(DrawerActionScope scope, bool bySavedStates = true)
 {
     if (scope == DrawerActionScope.Self)
     {
         ResetVisibility(bySavedStates); // Avoid heap alloc from EnumerateByScope.
     }
     else
     {
         foreach (var drawer in EnumerateByScope(scope))
         {
             drawer.ResetVisibility(bySavedStates);
         }
     }
 }
Esempio n. 4
0
        /// <summary>
        ///     Enumerate related drawers of current instance by specific scope.
        /// </summary>
        /// <param name="scope">Scope that indicates what drawers to enumerate.</param>
        /// <returns>An enumerable collection that enumerate all drawers refered by specific scope.</returns>
        public IEnumerable <Drawer> EnumerateByScope(DrawerActionScope scope)
        {
            switch (scope)
            {
            case DrawerActionScope.Self:
                return(this.ToEnumerable());

            case DrawerActionScope.Children:
                return(Children);

            case DrawerActionScope.ChildrenInHierarchy:
                return(ChildrenInHierarchy);

            case DrawerActionScope.SelfAndChildren:
                return(this.ToEnumerable().Concat(Children));

            case DrawerActionScope.SelfAndChildrenInHierarchy:
                return(this.ToEnumerable().Concat(ChildrenInHierarchy));

            default:
                throw new ArgumentOutOfRangeException("scope", scope, null);
            }
        }
 public void AddTargetDrawer(Drawer drawer, DrawerActionScope scope, bool updateResult)
 {
     Ensure.Argument.NotNull(drawer, "drawer");
     AddTargetDrawersWithIteratingCheck(drawer.EnumerateByScope(scope), updateResult);
 }
Esempio n. 6
0
 public Drawer[] ListByScope(DrawerActionScope scope)
 {
     return(EnumerateByScope(scope).ToArray());
 }
Esempio n. 7
0
 public static void LogDrawerHierarchy(Drawer drawer, DrawerActionScope scope)
 {
     Debug.Log(StringUtil.Join(drawer.EnumerateByScope(scope), d => d.HierarchicalName, "\n"));
 }
Esempio n. 8
0
        public static void LogDrawerHierarchy(IEnumerable <Drawer> drawers, DrawerActionScope scope)
        {
            var list = drawers.SelectMany(d => d.EnumerateByScope(scope));

            Debug.Log(StringUtil.Join(list, d => d.HierarchicalName, "\n"));
        }