Exemple #1
0
    protected virtual GListItem TryCreateItem()
    {
        if (CellTemplate == null)
        {
            return(null);
        }

        GListItem rv = null;

        rv = _CellPool.TakeOut();

        if (rv == null)
        {
            GameObject item    = CUnityUtil.Instantiate(CellTemplate.gameObject) as GameObject;
            GListItem  itemCon = GListItem.Get(item);
            itemCon.RectTrans.SetParent(_Content, false);

            rv = itemCon;

            if (HasChildButton && this.ClickItemButtonCallBack != null)
            {
                itemCon.OnItemClickButton = this.OnClickItemButton;
            }
        }

        GNewUITools.SetVisible(rv.RectTrans, true);

        return(rv);
    }
Exemple #2
0
    protected override GListItem TryCreateItem()
    {
        if (CellTemplate == null)
        {
            return(null);
        }

        GListItem rv = null;

        rv = _CellPool.TakeOut();

        if (rv == null)
        {
            GameObject item    = CUnityUtil.Instantiate(CellTemplate.gameObject) as GameObject;
            GListItem  itemCon = GListItem.Get(item);
            rv = itemCon;

            if (HasChildButton && ClickItemButtonCallBack != null)
            {
                rv.OnItemClickButton = OnClickItemButton;
            }

            //register events
            if (InitItemCallBack != null)
            {
                rv.OnItemInit = OnShowItem;
            }

            if (ClickItemCallBack != null)
            {
                rv.OnItemClick = OnClickItem;
            }
        }

        rv.RectTrans.SetParent(_Content, false);
        GNewUITools.SetVisible(rv.RectTrans, true);

        return(rv);
    }