Exemplo n.º 1
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();
        }
Exemplo n.º 3
0
 /// <summary>
 /// 初始化环境
 /// </summary>
 private void InitRoot()
 {
     option.ruleGetter = GetRule;
     option.axisType   = root is HorizontalLayoutGroup ? GridLayoutGroup.Axis.Horizontal : GridLayoutGroup.Axis.Vertical;
     creater           = new TreeNodeCreater(0, root.transform, option);
 }
Exemplo n.º 4
0
 /// <summary>
 /// 初始化环境
 /// </summary>
 private void InitRoot()
 {
     creater = new TreeNodeCreater(GetRule, 0, root, prefab);
 }