示例#1
0
    void RefreshParent(string parentName)
    {
        List <IUIListObject> parentLists;

        if (allParents.TryGetValue(parentName, out parentLists))
        {
            foreach (IUIListObject item in parentLists)
            {
                list.RemoveItem(item, false);
            }

            UIListItemContainer parent = null;
            foreach (UIListItemContainer item in allParContainers)
            {
                if (item != null && item.gameObject.name == parentName)
                {
                    parent = item;
                    break;
                }
            }
            if (parent != null)
            {
                UIListItemContainer parContainer = parent.GetComponent <UIListItemContainer>();
                for (int i = 1; i <= parentLists.Count; i++)
                {
                    IUIListObject item = parentLists[i - 1];
                    list.InsertItem(item, parContainer.Index + i);
                }
            }
        }
    }