Пример #1
0
        /// <summary>
        /// 获取指定层级的规则
        /// </summary>
        /// <param name="deepth"></param>
        /// <returns></returns>
        private TreeSelectRule GetRule(int deepth)
        {
            var rule = rules.Find(x => x.deepth == deepth);

            if (rule == null)
            {
                if (rules.Count > 0)
                {
                    rule = rules[rules.Count - 1].CreateCopy(deepth);
                }
                else
                {
                    rule        = new TreeSelectRule();
                    rule.deepth = deepth;
                }
            }
            return(rule);
        }
Пример #2
0
        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();
        }