コード例 #1
0
ファイル: UIGridWrap.cs プロジェクト: pikaqiufk/Client
 static int GetChildListEx(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UIGrid obj = (UIGrid)ToLua.CheckObject(L, 1, typeof(UIGrid));
         System.Collections.Generic.List <UnityEngine.Transform> o = obj.GetChildListEx();
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #2
0
    private void AddItem(int i)
    {
        var childList = mGrid.GetChildListEx();

        if (childList.Count == transform.childCount)
        {
            AddNewItem(i);
        }
        else
        {
            for (var j = 0; j < transform.childCount; j++)
            {
                var t = transform.GetChild(j);
                var b = t.GetComponent <BindDataRoot>();

                if (b.IsBind == false)
                {
                    t.gameObject.SetActive(true);
                    if (mGrid.enabled == false)
                    {
                        mGrid.enabled = true;
                    }
                    mGrid.AddChild(t);
                    break;
                }
            }
            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];
                }
            }
        }
    }