示例#1
0
        void SetFirtsItem()
        {
            int nn = 0;

            foreach (var ih in currentNode.Children)
            {
                ListboxItem3d li3d = ih.GameObject.GetComponent <ListboxItem3d>();
                if (nn <= firstItem)
                {
                    li3d.startPosition = firstItemDuoVector.Position;
                    li3d.startLookAt   = firstItemDuoVector.Forward;
                }
                else
                {
                    li3d.startPosition = Vector3.zero;
                }
                nn++;
            }
        }
示例#2
0
        public void Initiate()
        {
            pointers.Add(firstItemDuoVector);
            pointers.Add(middle1);
            pointers.Add(middle2);
            pointers.Add(end);
            controlScale = Vector3.Distance(pointers[1].Position, pointers[2].Position);
            if (navigation != null && !initialized)
            {
                navigation.transform.localScale *= controlScale;
                initialized = true;
            }

            clearItemHolders();
            firstItem = 0;
            if (items != null && Items.Count > 0)
            {
                firstItemDuoVector = getFirstItemDuoVector();
                GameObject prev = null;
                int        nn   = 0;
                foreach (var item in items)
                {
                    GameObject ga = new GameObject("subItem");
                    ga.transform.SetParent(transform);
                    ga.transform.localPosition = Vector3.zero;
                    ga.transform.localRotation = Quaternion.identity;
                    ListboxItem3d li = ga.AddComponent <ListboxItem3d>();
                    li.listbox3d                 = this;
                    item.transform.parent        = ga.transform;
                    item.transform.localPosition = Vector3.zero;
                    if (pointers[0].Forward != Vector3.zero)
                    {
                        item.transform.localRotation = Quaternion.LookRotation(pointers[0].Forward);
                    }
                    if (prev == null)
                    {
                        li.startLookAt   = firstItemDuoVector.Forward;
                        li.startPosition = firstItemDuoVector.Position;
                    }
                    else
                    {
                        li.previous = prev.transform;
                    }
                    if (nn == 0)
                    {
                        ga.transform.localPosition = firstItemDuoVector.Position;
                    }
                    else
                    {
                        ga.transform.localPosition = pointers[0].Position;// + nn * 0.1f * Vector3.up;
                    }
                    prev = ga;
                    Node node = new Node();
                    node.GameObject = ga;
                    currentNode.Children.Add(node);
                    //ga.transform.parent = transform;
                    nn++;
                }
            }
            InitiateNavigation();
        }