private RegisterDropdownItem CreateItem(int indexPosition) { RegisterDropdownItem newName = ((NameRegister)ListItemPrefab).CreateName((ItensHolder.position + (Vector3.down * indexPosition * _elementsDistance)), ItensHolder, _createdItens.Count); newName.Mask = _mask; newName.transform.localScale = Vector3.one; _createdItens.Add(newName); return(newName); }
/// TODO: Instanciar elementos em tempo de execução /// TODO: Melhorar Paginação de para filtros public override void Initialize() { if (_initialized) { return; } _initialized = true; _itensHolderPosition = ItensHolder.transform.localPosition; BoxCollider2D coll = gameObject.AddComponent <BoxCollider2D>(); coll.size = _maskSize; coll.offset = MaskTransform.localPosition; ContentDrag.Content = ItensHolder; List <string> classes = NamesManagerPopup.Instance.GetClassList(); if (_createdItens.Count == 0) { for (int i = 0; i < classes.Count; i++) { RegisterDropdownItem newItem = Instantiate(ListItemPrefab, ItensHolder.position + (Vector3.down * i * _elementsDistance), Quaternion.identity) as RegisterDropdownItem; newItem.transform.SetParent(ItensHolder); newItem.MyButton.onClick.AddListener(ItemClicked); newItem.ListIndex = _createdItens.Count; newItem.Mask = _mask; _createdItens.Add(newItem); } } else { foreach (RegisterDropdownItem name in _createdItens) { name.RemoveItem(); } } SetItens(classes); }
private void ClassSelectedOnList(RegisterDropdownItem item) { ClassWindow.LabelText = item.Text; ClassWindow.List.Close(); _noClassConfirmation = true; }