Пример #1
0
    protected override void ItemAddListion(UGUIItemFunction func)
    {
        base.ItemAddListion(func);
        ProductItemFunction itemFunc = func as ProductItemFunction;

        itemFunc.onClickByShowCAD = OnItemClick;
    }
Пример #2
0
    public override void RefreshDisplay(List <ItemData> data = null, bool restPos = false, bool isChange = false)
    {
        //base.RefreshDisplay(data, restPos, isChange);
        foreach (UGUIItemFunction item in itemDic.Values)
        {
            item.gameObject.SetActive(false);
            skinList.Push(item.gameObject);
        }
        itemDic.Clear();
        if (restPos == true)
        {
            ResetPostion();
        }
        if (data != null)
        {
            this.Msgs = data;
        }
        if (data != null || isChange)
        {
            SetContentSize(this.Msgs.Count + 2);
        }
        for (int i = 0; i < this.Msgs.Count; i++)
        {
            if ((i < CurrentIndex - UpperLimitIndex) && (CurrentIndex > LowerLimitIndex) && !isChange)
            {
                return;
            }
            skinClone = GetInstance();
            skinClone.transform.SetParent(ContentRectTrans);
            skinClone.transform.localPosition = GetLoaclPosByIndex(i);
            skinClone.transform.localScale    = Vector3.one;
            skinClone.GetComponent <RectTransform>().SetSiblingIndex(i);
            ProductItemFunction func = skinClone.GetComponent <ProductItemFunction>();
            func.scroRect = ScroRect;
            func.data     = this.Msgs[i];
            func.index    = i;
            itemDic.Add(i, func);
            ItemAddListion(func);
            ItemChildGameObject(skinClone);
        }

        //// 容器的区域限制
        //if (data != null || isChange == true)
        //{
        //    int length = Msgs.Count;
        //    if (length >= 6)
        //    {
        //        ScrollRectTrans.sizeDelta = new Vector2(ContentRectTrans.sizeDelta.x, CellHeight * 6 + CellHeightSpace * (6));
        //    }
        //    else
        //    {
        //        ScrollRectTrans.sizeDelta = new Vector2(ContentRectTrans.sizeDelta.x, CellHeight * (length + 1) + CellHeightSpace * (length + 1));
        //    }
        //}
    }