Beispiel #1
0
        public void RemoveItem(ItemMemo item)
        {
            item.Dispose();

            item.Active = false;

            _items.Enqueue(item);
        }
Beispiel #2
0
        private void RemoveItem(int index)
        {
            ItemMemo item = null;

            if (_itemMemoList.TryGetValue(index, out item))
            {
                _itemMemoList.TryRemove(index);

                item?.Shrink(() =>
                {
                    _itemPool.RemoveItem(item);
                });
            }
        }
Beispiel #3
0
        private ItemMemo CreateItem(string content, bool active = true)
        {
            ItemMemo itemMemo = _itemPool.GetItem(active, _scrollMemo.content);

            _itemMemoList.Add(itemMemo);

            itemMemo.OnDeleteButtonClickEvent += () =>
            {
                _viewModel.DeleteItem(_itemMemoList.IndexOf(itemMemo));
            };

            itemMemo.SetAsLastSibling();

            itemMemo.Content = content;

            return(itemMemo);
        }
Beispiel #4
0
        public ItemMemo GetItem(bool active = true, Transform parent = null)
        {
            ItemMemo item = null;

            if (_items.Count > 0)
            {
                item = _items.Dequeue();
            }
            else
            {
                RectTransform root = RectTransform.Instantiate(_template, parent);

                root.name = "ItemMemo";

                item = new ItemMemo(root);
            }

            item.Active = active;

            return(item);
        }
Beispiel #5
0
        private void AddItem(string content)
        {
            ItemMemo item = CreateItem(content);

            item?.Expands();
        }