public static DataBindingInvoker CreateInvoker(DataBindingNode node, MethodInfo method)
        {
            var invokerGo = new GameObject("Invoker");

            invokerGo.transform.parent = node.transform;
            var invoker = invokerGo.AddComponent <DataBindingInvoker>();

            invoker.parentNode = node;
            invoker.SetMethod(method);
            invoker.Awake();

            return(invoker);
        }
示例#2
0
        /// <summary>
        /// Creates a new data binding branch on a new gameobject parented to node's gameobject.
        /// Also initializes the branch bind target with the node (so the branch will bind to the node).
        /// </summary>
        public static DataBindingBranch CreateBranch(DataBindingNode node, string field)
        {
            var branchGo = new GameObject("Branch");

            branchGo.transform.parent = node.transform;
            var branch = branchGo.AddComponent <DataBindingBranch>();

            branch.parentNode = node;
            branch.field      = field;
            branch.Awake();

            return(branch);
        }
        public static DataBindingCollectionLeaf CreateCollectionLeaf(DataBindingNode node, string field, DataBindingCollectionElement prefab)
        {
            var leafGo = new GameObject("CollectionLeaf");

            leafGo.transform.parent = node.transform;

            var leaf = leafGo.AddComponent <DataBindingCollectionLeaf>();

            leaf.parentNode    = node;
            leaf.field         = field;
            leaf.elementPrefab = prefab;
            leaf.Awake();

            return(leaf);
        }
        public static DataBindingGenericTemplatedLeaf CreateUITextGenericTemplatedLeaf(DataBindingNode node, string field, out Text text)
        {
            var leafGo = new GameObject("UITextGenericTemplatedLeaf");

            leafGo.transform.parent = node.transform;
            var leaf = leafGo.AddComponent <DataBindingGenericTemplatedLeaf>();

            leaf.parentNode = node;
            leaf.field      = field;
            leaf.template   = uiTextGenericTemplate;
            leaf.bindTarget = text = leafGo.AddComponent <Text>();
            leaf.Awake();

            return(leaf);
        }