Beispiel #1
0
        /// <summary>
        /// 添加数据并移动到底部
        /// </summary>
        /// <param name="linker">连接器</param>
        /// <param name="data">数据实例</param>
        /// <param name="h">数据高度</param>
        public void AddAndMoveEnd(Linker linker, object data, float h)
        {
            float       end     = End;
            BindingData binding = AddData(linker, data);

            binding.LoadLayout(linker.enityModel);
            binding.width  = Enity.SizeDelta.x;
            binding.offset = end;
            binding.high   = h;
            float y = end + h - Point - Enity.SizeDelta.y;

            if (y < 0)
            {
                y = 0;
            }
            Move(y);
        }
Beispiel #2
0
        UIElement UpdateItem(BindingData data, int index, float offset)
        {
            var mod = data.linker.PopItem(index);

            if (mod == null)
            {
                mod = data.linker.CreateUI();
                mod.main.SetParent(Enity);
            }
            mod.main.activeSelf = true;
            var son  = mod.main;
            var item = FindOrCreateItem(index);

            if (item.Index < 0)
            {
                mod.index = index;
                data.linker.RefreshItem(mod.UI, data.Data, index);
                item.mod     = mod;
                item.linker  = data.linker;
                item.Index   = index;
                item.binding = data;
                item.Data    = data.Data;
                item.UI      = mod.UI;
                item.offset  = data.offset;
                item.high    = data.high;
                item.main    = mod.main;
                son.SetParent(Enity);
                son.localScale = Vector3.one;
            }
            else
            {
                mod.index = index;
                item.mod  = mod;
            }
            items.Add(item);
            data.LoadLayout(son);
            son.localPosition = new Vector3(0, -offset, 0);
            return(son);
        }