Esempio n. 1
0
 public void SetData(Data data)
 {
     if (data is DataUnitStage)
     {
         DataUnitStage dataUnitStage = data as DataUnitStage;
         level.text = "Level " + (dataUnitStage.indexUnitStage + 1).ToString();
         _index     = dataUnitStage.indexUnitStage;
         LoadImage(dataUnitStage.indexStage);
     }
 }
Esempio n. 2
0
    //public override void LoadLargeData()
    //{
    //    int amount = 20;
    //    // set up some simple data
    //    _data = new SmallList<Data>();
    //    for (var i = 0; i < amount; i++)
    //    {
    //        _data.Add(new DataUnitStage() { index = i });
    //    }
    //    // tell the scroller to reload now that we have the data
    //    scroller.ReloadData();
    //}
    //public void LoadLargeData(int amount, int indexStage)
    //{
    //    _data.Clear();
    //    // set up some simple data
    //    for (var i = 0; i < amount; i++)
    //    {
    //        _data.Add(new DataUnitStage() { indexStage = indexStage, indexUnitStage = i });
    //    }
    //    // tell the scroller to reload now that we have the data
    //    scroller.ReloadData();
    //}
    public void LoadData(int amount, int _indexStage)
    {
        Debug.Log("amount: " + amount + ", " + _indexStage);
        int size = 20;

        _dataList.Clear();
        int temp = amount / size;

        // set up some simple data
        if (temp != 0)
        {
            int j = 0;
            Debug.Log(j);
            for (var i = 0; i <= temp; i++)
            {
                List <Data> data = new List <Data>();

                for (; j < amount && j < (size * (i + 1)); j++)
                {
                    Debug.Log(j);
                    DataUnitStage _data = new DataUnitStage()
                    {
                        indexStage = _indexStage, indexUnitStage = j
                    };
                    data.Add(_data);
                }
                if (data.Count != 0)
                {
                    _dataList.Add(data);
                }
            }
        }
        else
        {
            List <Data> data = new List <Data>();
            for (int k = 0; k < amount; k++)
            {
                data.Add(new DataUnitStage()
                {
                    indexStage = _indexStage, indexUnitStage = k
                });
            }
            _dataList.Add(data);
        }
        // tell the scroller to reload now that we have the data
        scroller.ReloadData();
    }