예제 #1
0
        private static CheckState GetCheckState(LayerFolder layer)
        {
            bool hasUncheckedChild = false;
            bool hasCheckedChild   = false;

            foreach (LayerFolder subLayer in layer.Folders)
            {
                CheckState subCheckState = GetCheckState(subLayer);
                switch (subCheckState)
                {
                case CheckState.Checked:
                    hasCheckedChild = true;
                    break;

                case CheckState.Unchecked:
                    hasUncheckedChild = true;
                    break;

                case CheckState.Indeterminate:
                    hasCheckedChild   = true;
                    hasUncheckedChild = true;
                    break;
                }
            }

            foreach (Element gameObject in layer.GetElements())
            {
                IVisible iVisible = gameObject.As <IVisible>();
                if (iVisible != null)
                {
                    if (iVisible.Visible)
                    {
                        hasCheckedChild = true;
                    }
                    else
                    {
                        hasUncheckedChild = true;
                    }
                }
            }

            if (hasCheckedChild && !hasUncheckedChild)
            {
                return(CheckState.Checked);
            }
            if (hasUncheckedChild && !hasCheckedChild)
            {
                return(CheckState.Unchecked);
            }
            return(CheckState.Indeterminate);
        }
예제 #2
0
        private static void PropagateVisible(LayerFolder layer, bool visible)
        {
            // Recursive call to update all sub-layers
            foreach (LayerFolder subLayer in layer.Folders)
            {
                PropagateVisible(subLayer, visible);
            }

            // Set visibility for all GameObjects
            foreach (Element gameObject in layer.GetElements())
            {
                IVisible iVisible = gameObject.As <IVisible>();
                if (iVisible != null)
                {
                    iVisible.Visible = visible;
                }
            }
        }
예제 #3
0
        private static void PropagateVisible(LayerFolder layer, bool visible)
        {
            // Recursive call to update all sub-layers
            foreach (LayerFolder subLayer in layer.Folders)
                PropagateVisible(subLayer, visible);

            // Set visibility for all GameObjects
            foreach (Element gameObject in layer.GetElements())
            {
                IVisible iVisible = gameObject.As<IVisible>();
                if (iVisible != null)
                    iVisible.Visible = visible;
            }
        }
예제 #4
0
        private static CheckState GetCheckState(LayerFolder layer)
        {
            bool hasUncheckedChild = false;
            bool hasCheckedChild = false;

            foreach (LayerFolder subLayer in layer.Folders)
            {
                CheckState subCheckState = GetCheckState(subLayer);
                switch (subCheckState)
                {
                    case CheckState.Checked:
                        hasCheckedChild = true;
                        break;
                    case CheckState.Unchecked:
                        hasUncheckedChild = true;
                        break;
                    case CheckState.Indeterminate:
                        hasCheckedChild = true;
                        hasUncheckedChild = true;
                        break;
                }
            }

            foreach (Element gameObject in layer.GetElements())
            {
                IVisible iVisible = gameObject.As<IVisible>();
                if (iVisible != null)
                {
                    if (iVisible.Visible)
                        hasCheckedChild = true;
                    else
                        hasUncheckedChild = true;
                }
            }

            if (hasCheckedChild && !hasUncheckedChild)
                return CheckState.Checked;
            if (hasUncheckedChild && !hasCheckedChild)
                return CheckState.Unchecked;
            return CheckState.Indeterminate;
        }