Exemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        HierachyData root = new HierachyData("root");
        UIHierachy   view = UIHierachy.Create(root);

        Debug.Log("Hi mom2");
        view.transform.SetParent(canvas.transform);
        view.name = root.Value;

        HierachyData node1 = new HierachyData("node1");

        root.Add(node1);
        UIHierachy view1 = UIHierachy.Create(node1);

        view1.name = node1.Value;

        HierachyData node2 = new HierachyData("node2");

        root.Add(node2);
        UIHierachy view2 = UIHierachy.Create(node2);

        view2.name = node2.Value;
        HierachyData node21 = new HierachyData("node21");

        node2.Add(node21);
        UIHierachy view21 = UIHierachy.Create(node21);

        view21.name = node21.Value;

        HierachyData node3 = new HierachyData("node3");

        root.Add(node3);
        UIHierachy view3 = UIHierachy.Create(node3);

        view3.name = node3.Value;
    }
Exemplo n.º 2
0
        private void Start()
        {
            HierachyData root = new HierachyData("root");
            UIHierachy   view = UIHierachy.Create(HierachyBase, root);

            Debug.Log("Hi mom2");
            view.transform.SetParent(Parent.transform);
            view.name = root.Value;
            RectTransform rect = (RectTransform)view.transform;

            rect.anchoredPosition = new Vector2();
            Vector2 size = rect.sizeDelta;

            size.x         = 128;
            size.y         = 32;
            rect.sizeDelta = size;

            //view.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);

            HierachyData node1 = new HierachyData("node1");

            root.Add(node1);
            UIHierachy view1 = UIHierachy.Create(HierachyBase, node1);

            rect           = (RectTransform)view1.transform;
            size           = rect.sizeDelta;
            size.x         = 128;
            size.y         = 32;
            rect.sizeDelta = size;
            //view1.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);

            HierachyData node2 = new HierachyData("node2");

            root.Add(node2);
            UIHierachy view2 = UIHierachy.Create(HierachyBase, node2);

            view2.name     = node2.Value;
            rect           = (RectTransform)view2.transform;
            size           = rect.sizeDelta;
            size.x         = 128;
            size.y         = 32;
            rect.sizeDelta = size;
            //view2.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);

            HierachyData node21 = new HierachyData("node21");

            node2.Add(node21);
            UIHierachy view21 = UIHierachy.Create(HierachyBase, node21);

            view21.name    = node21.Value;
            rect           = (RectTransform)view21.transform;
            size           = rect.sizeDelta;
            size.x         = 128;
            size.y         = 32;
            rect.sizeDelta = size;
            //view21.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);

            HierachyData node3 = new HierachyData("node3");

            root.Add(node3);
            UIHierachy view3 = UIHierachy.Create(HierachyBase, node3);

            view3.name     = node3.Value;
            rect           = (RectTransform)view3.transform;
            size           = rect.sizeDelta;
            size.x         = 128;
            size.y         = 32;
            rect.sizeDelta = size;
            //view3.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
        }