Exemplo n.º 1
0
    private void RemoveItem(int i)
    {
        var childList = mGrid.GetChildListEx();
        var remove    = childList[i];

        mGrid.RemoveChild(remove);

        remove.gameObject.SetActive(false);

        var b = remove.GetComponent <BindDataRoot>();

        if (b != null)
        {
            b.RemoveBinding();
        }


        var mList = Source as IList;

        childList = mGrid.GetChildListEx();
        for (var j = i; j < childList.Count; j++)
        {
            var t       = childList[j];
            var binding = t.GetComponent <BindDataRoot>();
            if (binding != null)
            {
                binding.SetBindDataSource(mList[j]);
            }

            var itemLogic = t.GetComponent <ListItemLogic>();
            if (itemLogic != null)
            {
                itemLogic.Index = j;
                itemLogic.Item  = mList[j];
            }
        }
    }