Exemple #1
0
        /// <inheritdoc/>
        protected override void UpdateCellViewsHolder(MyCellViewsHolder newOrRecycled)
        {
            // Initialize the views from the associated model
            MyCellModel model = _Data[newOrRecycled.ItemIndex];

            newOrRecycled.UpdateViews(model);
        }
        IEnumerator SimulateDownloadChildItemsCoroutine(int num, int nextFreeId, Action <List <MyCellModel> > onDone)
        {
            yield return(null);            // at leas 1 frame

            yield return(_WaitForSecondsCached);

            var list = new List <MyCellModel>(num);

            for (int i = 0; i < num; i++)
            {
                if (i % 3 == 0)
                {
                    yield return(null);
                }
                var cellModel = new MyCellModel()
                {
                    title = nextFreeId + "",
                    image = _Params.availableChildItemsImages[UnityEngine.Random.Range(0, _Params.availableChildItemsImages.Length)]
                };
                ++nextFreeId;
                list.Add(cellModel);
            }
            if (onDone != null)
            {
                onDone(list);
            }
        }
        /// <inheritdoc/>
        protected override void UpdateCellViewsHolder(MyCellViewsHolder holder)
        {
            // Initialize the views from the associated model
            MyCellModel model = _Data[holder.ItemIndex];

            holder.UpdateViews(model);
        }
Exemple #4
0
 public void UpdateViews(MyCellModel model)
 {
     titleText.text = model.title;
     image.sprite   = model.image;
 }