Beispiel #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);
        }
Beispiel #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;
                }
            }
        }
Beispiel #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;
            }
        }
Beispiel #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;
        }