Exemple #1
0
        /// <summary>
        /// 创建树型ui
        /// </summary>
        /// <param name="nodeBase"></param>
        public void CreateTree(TreeNode nodeBase)
        {
            this.rootNode = nodeBase;
            var created = creater.CreateTreeSelectItems(nodeBase.childern.ToArray());

            foreach (var item in created)
            {
                item.onSelection = OnSelectionChanged;
            }
        }
        public void InitTreeSelecter(GridLayoutGroup.Axis axis, int deepth, Func <int, TreeSelectRule> ruleget, TreeNode node, TreeSelectItem prefab)
        {
            this.deepth = deepth;
            this.node   = node;
            this.rule   = ruleget(deepth);

            if (node.childern != null && node.childern.Count > 0)
            {
                InitContent(axis);
                creater = new TreeNodeCreater(ruleget, deepth, childContent, prefab);
                var items = creater.CreateTreeSelectItems(axis, node.childern.ToArray());
                foreach (var item in items)
                {
                    item.onSelection = OnSelection;
                }
            }

            ChargeRule();
        }
        public void InitTreeSelecter(int deepth, TreeNode node, TreeOption option)
        {
            this.node = node;
            var ruleget = option.ruleGetter;

            this.rule = ruleget(deepth);

            if (node.childern != null && node.childern.Count > 0)
            {
                InitContent(option.axisType);
                creater = new TreeNodeCreater(deepth, childContent, option);
                var items = creater.CreateTreeSelectItems(node.childern.ToArray());
                foreach (var item in items)
                {
                    item.onSelection = OnSelection;
                }
            }
            else
            {
                //toggle.group = option.leafGroup;
            }

            ChargeRule();
        }