Exemple #1
0
        private void OnToggleSwitch(bool isOn)
        {
            if (!settingToggle && isOn && onSelection != null)
            {
                onSelection(new List <string> {
                    node.name
                });
            }

            if (childContent && rule.childCloseAble)
            {
                childContent.gameObject.SetActive(isOn);
            }

            if (title)
            {
                title.color = isOn ? rule.fontColor_mask : rule.fontColor_normal;
            }

            if (creater != null && creater.Group != null && creater.Group.AnyTogglesOn())
            {
                LineTreeItem item = creater.Group.ActiveToggles().First().GetComponentInParent <LineTreeItem>();
                item.SetToggleForce(isOn);
            }
        }
        public LineTreeItem[] CreateTreeSelectItems(TreeNode[] childNodes)
        {
            var prefab = option.prefab;
            var rule   = option.ruleGetter(deepth + 1);

            if (rule.makeGroup)
            {
                group = InitGroup();
            }

            created = new LineTreeItem[childNodes.Length];
            for (int i = 0; i < childNodes.Length; i++)
            {
                var          item = pool.GetPoolObject(prefab.gameObject, parent, false);
                LineTreeItem tsi  = item.GetComponent <LineTreeItem>();
                tsi.InitTreeSelecter(deepth + 1, childNodes[i], option);
                if (rule.makeGroup)
                {
                    tsi.SetGroup(group);
                }
                created[i] = tsi;
            }
            return(created);
        }