public void AddData(Linker linker, object data, float high)
        {
            BindingData binding = new BindingData();

            binding.linker = linker;
            binding.Data   = data;
            binding.high   = high;
            //binding.offset = end;
            datas.Add(binding);
        }
예제 #2
0
        /// <summary>
        /// 添加数据
        /// </summary>
        /// <param name="linker">连接器</param>
        /// <param name="data">数据实例</param>
        /// <returns></returns>
        public BindingData AddData(Linker linker, object data)
        {
            BindingData binding = new BindingData();

            binding.linker  = linker;
            binding.Data    = data;
            binding.layouts = new BaseLayout[linker.ElementCount];
            datas.Add(binding);
            return(binding);
        }
예제 #3
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="linker">连接器</param>
        /// <param name="data">数据实例</param>
        /// <returns></returns>
        public BindingData InsertData(Linker linker, object data)
        {
            BindingData binding = new BindingData();

            binding.linker  = linker;
            binding.Data    = data;
            binding.layouts = new BaseLayout[linker.ElementCount];
            datas.Insert(0, binding);
            index++;
            return(binding);
        }
예제 #4
0
        public void AddData(Linker linker, object data, float high)
        {
            BindingData binding = new BindingData();

            binding.linker = linker;
            binding.Data   = data;
            binding.high   = high;
            binding.offset = end;
            datas.Add(binding);
            end += high;
            ch   = end - start;
            if (ch < View.data.sizeDelta.y)
            {
                ch = View.data.sizeDelta.y;
            }
        }
예제 #5
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);
        }
        void UpdateItem(BindingData data, int index, float start)
        {
            var mod = data.linker.PopItem(index);

            if (mod == null)
            {
                mod = data.linker.CreateUI();
                mod.main.SetParent(View);
            }
            mod.main.activeSelf = true;
            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;
                var son = mod.main;
                son.SetParent(View);
                son.data.localScale = Vector3.one;
                son.IsChanged       = true;
            }
            else
            {
                mod.index = index;
                item.mod  = mod;
            }
            items.Add(item);
            float os = model.data.sizeDelta.y * 0.5f;

            os -= start;
            os -= data.high * 0.5f;
            mod.main.data.localPosition.y = os;
            mod.main.IsChanged            = true;
            data.offset = os;
        }
예제 #7
0
        void UpdateItem(BindingData data, int index)
        {
            for (int i = 0; i < items.Count; i++)
            {
                if (index == items[i].Index)
                {
                    return;
                }
            }
            var item = CreateItem(data, index);

            items.Add(item);
            float vy = View.sizeDelta.y;
            float oy = 0.5f * vy - data.offset + point;

            item.pos.y = oy;
            item.pos   = new Vector3(0, oy, 0);
            item.main.transform.localPosition = item.pos;
            item.main.transform.localScale    = Vector3.one;
        }
예제 #8
0
        Item CreateItem(BindingData data, int index)
        {
            var ui = data.linker.CreateUI();

            data.linker.RefreshItem(ui.UI, data.Data, index);
            Item item = new Item();

            item.linker  = data.linker;
            item.Index   = index;
            item.binding = data;
            item.Data    = data.Data;
            item.UI      = ui.UI;
            item.offset  = data.offset;
            item.high    = data.high;
            item.main    = ui.main;
            var son = ui.main.transform;

            son.SetParent(View);
            son.localScale = Vector3.one;
            return(item);
        }
예제 #9
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);
        }
예제 #10
0
        void UpdateItem(BindingData data, int index, float offset)
        {
            var mod = data.linker.PopItem(index);

            if (mod == null)
            {
                mod = data.linker.CreateUI();
                mod.main.transform.SetParent(Enity.transform);
            }
            mod.main.SetActive(true);
            var son  = mod.main.transform;
            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.transform);
                son.localScale = Vector3.one;
            }
            else
            {
                mod.index = index;
                item.mod  = mod;
            }
            data.ApplayLayout(son);
            items.Add(item);
            son.localPosition = new Vector3(0, -offset, 0);
        }