Esempio n. 1
0
        // Retrieving <count> models from the data source and calling OnDataRetrieved after.
        // In a real case scenario, you'd query your server, your database or whatever is your data source and call OnDataRetrieved after
        IEnumerator FetchMoreItemsFromDataSourceAndUpdate(int count)
        {
            count = UDC.length;
            // Simulating data retrieving delay
            yield return(new WaitForSeconds(.5f));

            var newItems = new MyGridItemModel[count];

            // Retrieve your data here

            for (int i = 0; i < count; ++i)
            {
                var model = new MyGridItemModel()
                {
                    //    title = "Random item ",

                    GridTexture = UDC.showtexture[i],
                    counter     = i
                };

                newItems[i] = model;
            }


            OnDataRetrieved(newItems);
        }
Esempio n. 2
0
        // This is called anytime a previously invisible item become visible, or after it's created,
        // or when anything that requires a refresh happens
        // Here you bind the data from the model to the item's views
        // *For the method's full description check the base implementation
        protected override void UpdateCellViewsHolder(MyGridItemViewsHolder newOrRecycled)
        {
            // In this callback, "newOrRecycled.ItemIndex" is guaranteed to always reflect the
            // index of item that should be represented by this views holder. You'll use this index
            // to retrieve the model from your data set

            MyGridItemModel model = Data[newOrRecycled.ItemIndex];

            //    newOrRecycled.backgroundImage = model.Gridimage;
            //   newOrRecycled.titleText.text = model.title + " #" + newOrRecycled.ItemIndex;
            //   newOrRecycled.backgroundImage = model.Gridimage;
            newOrRecycled.backgroundImage.texture         = model.GridTexture;
            newOrRecycled.backgroundImage.gameObject.name = model.counter.ToString();
            // model.textureI
        }