Пример #1
0
        /// <summary>
        /// 获得节点树,用于web页面显示节点树
        /// </summary>
        /// <param name="model"></param>
        /// <param name="root"></param>
        public static void GetRootTree(NodeModel model, UiNode root)
        {
            for (var i = 0; i < root.ChildCount; i++)
            {
                var child = root.Child(i);

                if (child == null)
                {
                    continue;
                }

                if (!child.VisibleToUser)
                {
                    continue;
                }

                var node = GetModel(child);

                model.Children.Add(node);

                if (child.ChildCount > 0)
                {
                    GetRootTree(node, child);
                }

                child.Recycle();
            }
        }