예제 #1
0
        public BevNode addChild(BevNode node)
        {
            if (_children == null)
                _children = new List<BevNode>();
            if (_children.Count == MAX_CHILDREN)
                throw new Exception(this + "overflow, max children number is " + MAX_CHILDREN);

            _children.Add(node);
            node._parent = this;
            return this;
        }
예제 #2
0
        public BevNode addChild(BevNode node)
        {
            if (_children == null)
            {
                _children = new List <BevNode>();
            }
            if (_children.Count == MAX_CHILDREN)
            {
                throw new Exception(this + "overflow, max children number is " + MAX_CHILDREN);
            }

            _children.Add(node);
            node._parent = this;
            return(this);
        }
예제 #3
0
        public BevNode AddChildAt(BevNode node, int index)
        {
            this.addChild(node);
            if (index < 0)
                index = 0;
            else if (index > _children.Count - 1)
                index = _children.Count;

            for (int i = _children.Count - 1; i > index; --i) { 
                _children[i] = _children[i-1];
            }

            _children[index] = node;

            return this;
        }
예제 #4
0
        public BevNode AddChildAt(BevNode node, int index)
        {
            this.addChild(node);
            if (index < 0)
            {
                index = 0;
            }
            else if (index > _children.Count - 1)
            {
                index = _children.Count;
            }

            for (int i = _children.Count - 1; i > index; --i)
            {
                _children[i] = _children[i - 1];
            }

            _children[index] = node;

            return(this);
        }