private void RefreshList() { int totalItemsCount = datahoster.GetItemsCount(); if (totalItemsCount == 0) { if (listEnabled) { listHolder.gameObject.SetActive(false); listEnabled = false; emptyListLabel.SetActive(true); scrollbar.gameObject.SetActive(false); } } else { buttonsCount = buttons.Length; if (totalItemsCount > buttonsCount) { if (!scrollbar.isActiveAndEnabled) { scrollbar.gameObject.SetActive(true); } activeButtonsCount = buttonsCount; // РАСШИРЕННЫЙ СПИСОК if (!datahoster.HaveSelectedObject()) { int sindex = GetListStartIndex(); for (int i = 0; i < buttonsCount; i++) { buttons[i].transform.GetChild(0).GetComponent <Text>().text = datahoster.GetName(i + sindex); buttons[i].SetActive(true); } } } else { if (scrollbar.isActiveAndEnabled) { scrollbar.gameObject.SetActive(false); } activeButtonsCount = totalItemsCount; // КОМПАКТНЫЙ СПИСОК int i = 0; for (; i < totalItemsCount; i++) { buttons[i].transform.GetChild(0).GetComponent <Text>().text = datahoster.GetName(i); buttons[i].SetActive(true); } if (i < buttons.Length) { for (; i < buttons.Length; i++) { buttons[i].SetActive(false); } } } if (!listEnabled) { listHolder.gameObject.SetActive(true); listEnabled = true; emptyListLabel.SetActive(false); } } }