Exemplo n.º 1
0
        public virtual void DrawNode(SpriteBatch batch)
        {
            if (_isClose)
            {
                return;
            }
            if (!this._visible)
            {
                return;
            }
            for (int i = this._childCount - 1; i >= 0; i--)
            {
                if (childs[i] != null && childs[i].GetZOrder() < 0)
                {
                    childs[i].DrawNode(batch);
                }
            }
            this.Draw(batch);
            int zOrder = 0;

            for (int i = this._childCount - 1; i >= 0; i--)
            {
                LNNode o = this.childs[i];
                if (o != null)
                {
                    if (o.GetZOrder() >= 0)
                    {
                        if (zOrder == 0)
                        {
                            zOrder = o.GetZOrder();
                        }
                        else
                        {
                            zOrder = o.GetZOrder();
                        }

                        o.DrawNode(batch);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public virtual void AddNode(LNNode node, int z)
        {
            if (this.Contains(node))
            {
                return;
            }
            if (node.GetContainer() != null)
            {
                node.SetContainer(null);
            }
            node.SetContainer(this);
            int  index = 0;
            bool flag  = false;

            for (int i = 0; i < this._childCount; i++)
            {
                LNNode node2 = this.childs[i];
                int    zd    = 0;
                if (node2 != null)
                {
                    zd = node2.GetZOrder();
                }
                if (zd > z)
                {
                    flag        = true;
                    this.childs = (LNNode[])CollectionUtils.Expand(this.childs, 1,
                                                                   false);
                    childs[index] = node;
                    _childCount++;
                    node.SetScreen(_screen);
                    this.latestInserted = node;
                    break;
                }
                index++;
            }
            if (!flag)
            {
                this.childs = (LNNode[])CollectionUtils.Expand(this.childs, 1,
                                                               false);
                this.childs[0] = node;
                this._childCount++;
                node.SetScreen(_screen);
                this.latestInserted = node;
            }
            node.SetZOrder(z);
            node.SetParent(this);
            Arrays.Sort(childs, comparator);
        }