Exemple #1
0
        protected virtual void InvokeLayerTopToDown(bool turnOn)
        {
            Queue <SwitchNode> switchNodes = new Queue <SwitchNode>(m_ChildNodes.Count + 1);

            switchNodes.Enqueue(this);

            while (switchNodes.Count > 0)
            {
                var switchNode = switchNodes.Dequeue();
                var enumerator = switchNode.GetEnumerator();

                if (switchNode.SwitchTurnMode == TurnMode.LayerTopToDown)
                {
                    while (enumerator.MoveNext())
                    {
                        if (enumerator.Current.IsOpen != turnOn)
                        {
                            switchNodes.Enqueue(enumerator.Current);
                        }
                    }
                }

                if (switchNode.SwitchTurnMode == TurnMode.LayerTopToDown)
                {
                    SwitchNodeList.ChangeSwitchNodeState(switchNode, turnOn);
                }
                else
                {
                    SwitchNodeList.InvokeSwitch(switchNode, turnOn);
                }
            }
        }
Exemple #2
0
        protected virtual void InvokeLayerReverseDownToTop(bool turnOn)
        {
            var count = m_ChildNodes.Count + 1;
            Queue <SwitchNode> switchNodes             = new Queue <SwitchNode>(count);
            Stack <SwitchNode> switchOrderNodes        = new Stack <SwitchNode>(count);
            Stack <SwitchNode> switchReverseOrderNodes = new Stack <SwitchNode>(count);

            switchNodes.Enqueue(this);

            while (switchNodes.Count > 0)
            {
                var switchNode = switchNodes.Dequeue();
                switchOrderNodes.Push(switchNode);
                var enumerator = switchNode.GetEnumerator();

                if (switchNode.SwitchTurnMode == TurnMode.LayerReverseDownToTop)
                {
                    while (enumerator.MoveNext())
                    {
                        if (enumerator.Current.IsOpen != turnOn)
                        {
                            switchReverseOrderNodes.Push(enumerator.Current);
                        }
                    }
                }

                while (switchReverseOrderNodes.Count > 0)
                {
                    switchNodes.Enqueue(switchReverseOrderNodes.Pop());
                }
            }

            while (switchOrderNodes.Count > 0)
            {
                var switchNode = switchOrderNodes.Pop();
                if (switchNode.SwitchTurnMode == TurnMode.LayerReverseDownToTop)
                {
                    SwitchNodeList.ChangeSwitchNodeState(switchNode, turnOn);
                }
                else
                {
                    SwitchNodeList.InvokeSwitch(switchNode, turnOn);
                }
            }
        }
Exemple #3
0
        protected virtual void InvokeTreeReverseMode(bool turnOn)
        {
            if (SwitchTurnMode == TurnMode.TreeReverseTopToDown)
            {
                SwitchNodeList.ChangeSwitchNodeState(this, turnOn);
            }

            for (var i = m_ChildNodes.Count - 1; i >= 0; --i)
            {
                if (m_ChildNodes[i].IsOpen != turnOn)
                {
                    SwitchNodeList.InvokeSwitch(m_ChildNodes[i], turnOn);
                }
            }

            if (SwitchTurnMode == TurnMode.TreeReverseDownToTop)
            {
                SwitchNodeList.ChangeSwitchNodeState(this, turnOn);
            }
        }