コード例 #1
0
ファイル: WorldQueries.cs プロジェクト: yvanoff/nitrosharp
        public QueryResultsEnumerable <T> Query <T>(uint contextId, EntityQuery query)
            where T : Entity
        {
            SmallList <Entity> results = Query(contextId, query);

            return(new QueryResultsEnumerable <T>(results));
        }
コード例 #2
0
        void Start()
        {
            // set the scroller's cell view visbility changed delegate to a method in this controller
            scroller.cellViewVisibilityChanged = CellViewVisibilityChanged;
            scroller.cellViewWillRecycle       = CellViewWillRecycle;

            // preload the cells by looking ahead (both behind and after)
            if (preloadCells)
            {
                scroller.lookAheadBefore = 1000f;
                scroller.lookAheadAfter  = 1000f;
            }

            // set up some simple data
            _data = new SmallList <Data>();

            // set up a list of images with their dimensions
            for (var i = 0; i < imageURLList.Length; i++)
            {
                // add the image based on the image list text file
                _data.Add(new Data()
                {
                    imageUrl        = imageURLList[i],
                    imageDimensions = new Vector2(200f, 200f)
                });
            }

            // set the scroller's delegate to this controller
            scroller.Delegate = this;

            // tell the scroller to reload
            scroller.ReloadData();
        }
コード例 #3
0
    /// <summary>
    /// 任意の凸な四角形を描画する。
    /// マスクが設定されていればクリップする。
    /// </summary>
    public void FillRectangle(ref Vertex v0, ref Vertex v1, ref Vertex v2, ref Vertex v3)
    {
        if (!hasMask)
        {
            var vertexCount = VertexCount;

            AddVertex(ref v0);
            AddVertex(ref v1);
            AddVertex(ref v2);
            AddVertex(ref v3);
            AddIndices(vertexCount, vertexCount + 1, vertexCount + 2, vertexCount + 3);

            return;
        }

        var list = new SmallList <Vertex>();

        list.Add(ref v0);
        list.Add(ref v1);
        list.Add(ref v2);
        list.Add(ref v3);

        SutherlandHodgman(ref list);
        AddPolygon(ref list);
    }
コード例 #4
0
ファイル: Controller.cs プロジェクト: GengQiangQ/PETimer
        void Start()
        {
            // set the scroller's cell view visbility changed delegate to a method in this controller
            scroller.cellViewVisibilityChanged = CellViewVisibilityChanged;

            // set up some simple data
            _data = new SmallList <Data>();

            // set up a list of images with their dimensions
            for (var i = 0; i < imageURLList.Length; i++)
            {
                // add the image based on the image list text file
                _data.Add(new Data()
                {
                    imageUrl        = imageURLList[i],
                    imageDimensions = new Vector2(200f, 200f)
                });
            }

            // set the scroller's delegate to this controller
            scroller.Delegate = this;

            // tell the scroller to reload
            scroller.ReloadData();
        }
コード例 #5
0
        /// <summary>
        /// Be sure to set up your references to the scroller after the Awake function. The
        /// scroller does some internal configuration in its own Awake function. If you need to
        /// do this in the Awake function, you can set up the script order through the Unity editor.
        /// In this case, be sure to set the EnhancedScroller's script before your delegate.
        ///
        /// In this example, we are calling our initializations in the delegate's Start function,
        /// but it could have been done later, perhaps in the Update function.
        /// </summary>
        void Start()
        {
            // tell the scroller that this script will be its delegate
            scroller.Delegate = this;

            _data = new SmallList <DataParticipant>();
        }
コード例 #6
0
    public void Reload()
    {
        jsonMonsterFile = Resources.Load("monsters") as TextAsset;
        jsonMonsters    = JsonMapper.ToObject(jsonMonsterFile.text);

        if (_data != null)
        {
            for (var i = 0; i < _data.Count; i++)
            {
                _data[i].selectedChanged = null;
            }
        }

        _data = new SmallList <InventoryData>();

        for (int i = 0; i < jsonMonsters["monsters"].Count; i++)
        {
            _data.Add(new InventoryData()
            {
                monsterName = jsonMonsters["monsters"][i]["image"].ToString()
            });
        }

        vScroller.ReloadData();
        if (listMonsterSelected.Count != 0)
        {
            ReloadMonsterSelected();
        }
    }
コード例 #7
0
ファイル: Controller.cs プロジェクト: clacina/Dragon1
        /// <summary>
        /// Populates the data with a lot of records
        /// </summary>
        private void LoadData()
        {
            // if the data existed previously, loop through
            // and remove the selection change handlers before
            // clearing out the data.
            if (_data != null)
            {
                for (var i = 0; i < _data.Count; i++)
                {
                    _data[i].selectedChanged = null;
                }
            }

            // set up some simple data
            _data = new SmallList <Data>();
            for (var i = 0; i < 1000; i++)
            {
                _data.Add(new Data()
                {
                    someText = i.ToString()
                });
            }

            // tell the scroller to reload now that we have the data
            scroller.ReloadData();
        }
コード例 #8
0
    private void Reload()
    {
        jsonTeamFile = Resources.Load("teams") as TextAsset;
        jsonTeam     = JsonMapper.ToObject(jsonTeamFile.text);

        if (_data != null)
        {
            for (var i = 0; i < _data.Count; i++)
            {
                _data[i].selectedChanged = null;
            }
        }

        _data = new SmallList <TeamData>();

        for (int i = 0; i < jsonTeam["teams"].Count; i++)
        {
            _data.Add(new TeamData()
            {
                Selected     = System.Convert.ToBoolean(jsonTeam["teams"][i]["selected"].ToString()),
                Created      = System.Convert.ToBoolean(jsonTeam["teams"][i]["created"].ToString()),
                monsterName1 = jsonTeam["teams"][i]["monsters"][0]["name"].ToString(),
                monsterName2 = jsonTeam["teams"][i]["monsters"][1]["name"].ToString(),
                monsterName3 = jsonTeam["teams"][i]["monsters"][2]["name"].ToString(),
                monsterName4 = jsonTeam["teams"][i]["monsters"][3]["name"].ToString()
            });
        }

        vScroller.ReloadData();
    }
コード例 #9
0
ファイル: WorldQueries.cs プロジェクト: yvanoff/nitrosharp
            static bool match(World world, ref SmallList <EntityQueryPart> queryParts, string entityPath)
            {
                var pathParts = new EntityQuery(entityPath).EnumerateParts();
                ReadOnlySpan <EntityQueryPart> remainingQueryParts = queryParts.AsSpan();
                bool matches = false;

                foreach (EntityQueryPart pathPart in pathParts)
                {
                    if (remainingQueryParts.IsEmpty)
                    {
                        return(false);
                    }
                    EntityQueryPart queryPart = remainingQueryParts[0];
                    if (!queryPart.SearchInAliases && !matchParts(queryPart, pathPart))
                    {
                        return(false);
                    }
                    if (queryPart.SearchInAliases && queryPart.IsLast)
                    {
                        var path = new EntityPath(queryPart.Value.ToString());
                        return(world._aliases.TryGetValue(path, out EntityId id) &&
                               id.Path.Equals(entityPath, StringComparison.Ordinal));
                    }

                    remainingQueryParts = remainingQueryParts[1..];
コード例 #10
0
    protected void AddPolygon(ref SmallList <Vertex> vertices)
    {
        if (vertices.Count <= 2)
        {
            return;
        }

        int    vertexCount = VertexCount;
        Vertex vertex;

        vertices.Get(0, out vertex);
        AddVertex(ref vertex);
        vertices.Get(1, out vertex);
        AddVertex(ref vertex);

        for (int i = 3; i < vertices.Count; i += 2)
        {
            vertices.Get(i - 1, out vertex);
            AddVertex(ref vertex);
            vertices.Get(i, out vertex);
            AddVertex(ref vertex);
            AddIndices(vertexCount, vertexCount + i - 2, vertexCount + i - 1, vertexCount + i);
        }

        if (vertices.Count % 2 == 1)
        {
            vertices.Get(vertices.Count - 1, out vertex);
            AddVertex(ref vertex);
            AddIndices(vertexCount, vertexCount + vertices.Count - 2, vertexCount + vertices.Count - 1);
        }
    }
コード例 #11
0
 private void Reset()
 {
     _tail      = new SmallList <T[]>();
     _head      = Array.Empty <T>();
     _headCount = 0;
     _count     = 0;
     _capacity  = 0;
 }
コード例 #12
0
 private void Awake()
 {
     _dataList = new SmallList <List <Data> >();
     if (instance == null)
     {
         instance = this;
     }
 }
コード例 #13
0
        /// <summary>
        /// This function sets up our inventory data and tells the scrollers to reload
        /// </summary>
        private void Reload()
        {
            // if the data existed previously, loop through
            // and remove the selection change handlers before
            // clearing out the data.
            if (_data != null)
            {
                for (var i = 0; i < _data.Count; i++)
                {
                    _data[i].selectedChanged = null;
                }
            }

            // set up a new inventory list
            _data = new SmallList <InventoryData>();

            // add inventory items to the list
            _data.Add(new InventoryData()
            {
                itemName = "Sword", itemCost = 123, itemDamage = 50, itemDefense = 0, itemWeight = 10, spritePath = resourcePath + "/sword", itemDescription = "Broadsword with a double-edged blade"
            });
            _data.Add(new InventoryData()
            {
                itemName = "Shield", itemCost = 80, itemDamage = 0, itemDefense = 60, itemWeight = 50, spritePath = resourcePath + "/shield", itemDescription = "Steel shield to deflect your enemy's blows"
            });
            _data.Add(new InventoryData()
            {
                itemName = "Amulet", itemCost = 260, itemDamage = 0, itemDefense = 0, itemWeight = 1, spritePath = resourcePath + "/amulet", itemDescription = "Magic amulet restores your health points gradually over time"
            });
            _data.Add(new InventoryData()
            {
                itemName = "Helmet", itemCost = 50, itemDamage = 0, itemDefense = 20, itemWeight = 20, spritePath = resourcePath + "/helmet", itemDescription = "Standard helm will decrease your vulnerability"
            });
            _data.Add(new InventoryData()
            {
                itemName = "Boots", itemCost = 40, itemDamage = 0, itemDefense = 10, itemWeight = 5, spritePath = resourcePath + "/boots", itemDescription = "Boots of speed will double your movement points"
            });
            _data.Add(new InventoryData()
            {
                itemName = "Bracers", itemCost = 30, itemDamage = 0, itemDefense = 20, itemWeight = 10, spritePath = resourcePath + "/bracers", itemDescription = "Bracers will upgrade your overall armor"
            });
            _data.Add(new InventoryData()
            {
                itemName = "Crossbow", itemCost = 100, itemDamage = 40, itemDefense = 0, itemWeight = 30, spritePath = resourcePath + "/crossbow", itemDescription = "Crossbow can attack from long range"
            });
            _data.Add(new InventoryData()
            {
                itemName = "Fire Ring", itemCost = 300, itemDamage = 100, itemDefense = 0, itemWeight = 1, spritePath = resourcePath + "/fireRing", itemDescription = "Fire ring gives you the magical ability to cast fireball spells"
            });
            _data.Add(new InventoryData()
            {
                itemName = "Knapsack", itemCost = 22, itemDamage = 0, itemDefense = 0, itemWeight = 0, spritePath = resourcePath + "/knapsack", itemDescription = "Knapsack will increase your carrying capacity by twofold"
            });

            // tell the scrollers to reload
            vScroller.ReloadData();
            hScroller.ReloadData();
        }
コード例 #14
0
ファイル: CellView.cs プロジェクト: GengQiangQ/PETimer
 /// <summary>
 /// This function just takes the Demo data and displays it
 /// </summary>
 /// <param name="data"></param>
 public void SetData(ref SmallList <Data> data, int startingIndex)
 {
     // loop through the sub cells to display their data (or disable them if they are outside the bounds of the data)
     for (var i = 0; i < rowCellViews.Length; i++)
     {
         // if the sub cell is outside the bounds of the data, we pass null to the sub cell
         rowCellViews[i].SetData(startingIndex + i < data.Count ? data[startingIndex + i] : null);
     }
 }
コード例 #15
0
 public ExampleScrollerProperties(List <int> values)
 {
     this.values        = values;
     CellViewProperties = new SmallList <ICellViewProperties>();
     foreach (var value in values)
     {
         CellViewProperties.Add(new ExampleCellViewProperties(value));
     }
 }
コード例 #16
0
        /// <summary>
        /// Populates the data with a lot of records
        /// </summary>
        private void LoadLargeData()
        {
            // set up some simple data
            _data = new SmallList<Data>();
            for (var i = 0; i < 1000; i++)
                _data.Add(new Data() { someText = "Cell Data Index " + i.ToString() });

            // tell the scroller to reload now that we have the data
            scroller.ReloadData();
        }
コード例 #17
0
ファイル: CellView.cs プロジェクト: clacina/Dragon1
        /// <summary>
        /// This function just takes the Demo data and displays it
        /// </summary>
        /// <param name="data"></param>
        public void SetData(ref SmallList <Data> data, int startingIndex, SelectedDelegate selected)
        {
            // loop through the sub cells to display their data (or disable them if they are outside the bounds of the data)
            for (var i = 0; i < rowCellViews.Length; i++)
            {
                var dataIndex = startingIndex + i;

                // if the sub cell is outside the bounds of the data, we pass null to the sub cell
                rowCellViews[i].SetData(dataIndex, dataIndex < data.Count ? data[dataIndex] : null, selected);
            }
        }
コード例 #18
0
        /// <summary>
        /// Populates the data with a small set of records
        /// </summary>
        private void LoadSmallData()
        {
            // set up some simple data
            _data = new SmallList<Data>();

            _data.Add(new Data() { someText = "A" });
            _data.Add(new Data() { someText = "B" });
            _data.Add(new Data() { someText = "C" });

            // tell the scroller to reload now that we have the data
            scroller.ReloadData();
        }
コード例 #19
0
ファイル: Controller.cs プロジェクト: clacina/Dragon1
        /// <summary>
        /// Be sure to set up your references to the scroller after the Awake function. The
        /// scroller does some internal configuration in its own Awake function. If you need to
        /// do this in the Awake function, you can set up the script order through the Unity editor.
        /// In this case, be sure to set the EnhancedScroller's script before your delegate.
        ///
        /// In this example, we are calling our initializations in the delegate's Start function,
        /// but it could have been done later, perhaps in the Update function.
        /// </summary>
        void Start()
        {
            // tell the scroller that this script will be its delegate
            scroller.Delegate         = this;
            scroller.scrollerScrolled = ScrollerScrolled;

            // initialize the data
            _data = new SmallList <Data>();

            // load in the first page of data
            LoadData(0);
        }
コード例 #20
0
        /// <summary>
        /// Populates the data with a lot of records
        /// </summary>
        private void LoadData()
        {
            // set up some simple data
            _data = new SmallList <Data>();
            for (var i = 0; i < 50; i++)
            {
                if (i % 2 == 0)
                {
                    _data.Add(new Data()
                    {
                        headerText        = "Multiple Expand",
                        descriptionText   = "Expanding this cell will not collapse other cells. This allows you to have multiple cells expanded at once.\n\nClick the cell again to collapse.",
                        isExpanded        = false,
                        expandedSize      = 200f,
                        collapsedSize     = 20f * ((i % 3) + 3),
                        tweenType         = Tween.TweenType.immediate,
                        tweenTimeExpand   = 0,
                        tweenTimeCollapse = 0
                    });
                }
                else if (i % 3 == 0)
                {
                    _data.Add(new Data()
                    {
                        headerText        = "Tween Expand",
                        descriptionText   = "This cell will animate its size when clicked.\n\nClick the cell again to collapse.",
                        isExpanded        = false,
                        expandedSize      = 200f,
                        collapsedSize     = 20f * ((i % 3) + 3),
                        tweenType         = Tween.TweenType.easeInOutSine,
                        tweenTimeExpand   = 0.5f,
                        tweenTimeCollapse = 0.5f
                    });
                }
                else
                {
                    _data.Add(new Data()
                    {
                        headerText        = "Single Expand",
                        descriptionText   = "Expanding this cell will collapse other cells.\n\nClick the cell again to collapse.",
                        isExpanded        = false,
                        expandedSize      = 200f,
                        collapsedSize     = 30f * ((i % 3) + 3),
                        tweenType         = Tween.TweenType.immediate,
                        tweenTimeExpand   = 0,
                        tweenTimeCollapse = 0
                    });
                }
            }

            // tell the scroller to reload now that we have the data
            scroller.ReloadData();
        }
コード例 #21
0
ファイル: SimpleDemo.cs プロジェクト: arvindixonos/Zain360
        /// <summary>
        /// Populates the data with a lot of records
        /// </summary>
        private void LoadLargeData()
        {
            // set up some simple data
            _data = new SmallList <DataParticipant>();
            for (var i = 0; i < 1000; i++)
            {
                _data.Add(new DataParticipant()
                {
                    someText = "Arvind"
                });
            }

            // tell the scroller to reload now that we have the data
            scroller.ReloadData();
        }
コード例 #22
0
    private void SetState(State state)
    {
        _state = state;

        if (_state == State.Default)
        {
            _selectedNotesData.Clear();
            _selectedNoteData = null;
            _addAndEditScreen.SetActive(false);
            _deleteButton.SetActive(false);
            _addButton.SetActive(true);

            SmallList <EnhancedScrollerCellView> list = _scroller.GetActiveCellViews();
            for (int i = 0; i < list.Count; i++)
            {
                (list[i] as NoteUiItem).SetState(NoteUiItem.State.Normal);
            }
        }
        else if (_state == State.Selection)
        {
            _deleteButton.SetActive(true);
            _addButton.SetActive(false);
            SmallList <EnhancedScrollerCellView> list = _scroller.GetActiveCellViews();
            for (int i = 0; i < list.Count; i++)
            {
                (list[i] as NoteUiItem).SetState(NoteUiItem.State.Selection);
            }
        }
        else if (_state == State.Edit)
        {
            if (_selectedNoteData != null)
            {
                _editScrenTopBarTitle.text = _selectedNoteData.GetDate().ToString("d MMMM, yyyy");
                _noteInput.text            = _selectedNoteData.noteText;
            }
            else
            {
                _editScrenTopBarTitle.text = _targetDate.ToString("d MMMM, yyyy");
                _noteInput.text            = "";
            }

            _addAndEditScreen.SetActive(true);

            // activate input field and show mobile keyboard automatically
            _noteInput.ActivateInputField();
            _noteInput.MoveTextEnd(false);
        }
    }
コード例 #23
0
ファイル: Controller.cs プロジェクト: clacina/Dragon1
        /// <summary>
        /// Populates the data with a lot of records
        /// </summary>
        private void LoadData()
        {
            // set up some simple data
            _data = new SmallList <Data>();
            for (var i = 0; i < 31; i++)
            {
                _data.Add(new Data()
                {
                    someText   = i.ToString(),
                    isSelected = i == _selectedIndex
                });
            }

            // tell the scroller to reload now that we have the data
            scroller.ReloadData();
        }
コード例 #24
0
        /// <summary>
        /// Populates the data with a small set of records
        /// </summary>
        public void ParticipantsListReceived(List <string> participantsList)
        {
            _data = new SmallList <DataParticipant>();

            foreach (string participantName in participantsList)
            {
                _data.Add(new DataParticipant()
                {
                    someText = participantName
                });
            }

            scroller.ClearAll();

            // tell the scroller to reload now that we have the data
            scroller.ReloadData();
        }
コード例 #25
0
    public List <int> GetSelectedPhotosIndexes()
    {
        List <int> indexes = new List <int>();
        SmallList <EnhancedScrollerCellView> activeItems = scroller.GetActiveCellViews();

        PhotosUiItem[] items;
        for (int i = 0; i < activeItems.Count; i++)
        {
            PhotosBlockUiItem blockUiItem = activeItems[i].GetComponent <PhotosBlockUiItem>();
            items = blockUiItem.GetSelectedItems();

            for (int j = 0; j < items.Length; j++)
            {
                int index = _data.IndexOf(items[j].GetTexture());
                indexes.Add(index);
                Debug.Log($"Index added as selected photo index: {index}");
            }
        }

        return(indexes);
    }
コード例 #26
0
        private void LoadData()
        {
            _data = new SmallList <DataPista>();

            foreach (Pista pista in enigma.Pistas)
            {
                if (pista.image != null)
                {
                    _data.Add(new DataPista()
                    {
                        headerText        = pista.PistaName,
                        descriptionText   = pista.TextRich,
                        imageOptional     = pista.image,
                        isExpanded        = false,
                        expandedSize      = pista.sizeText,
                        collapsedSize     = 60f,
                        tweenType         = Tween.TweenType.easeInOutSine,
                        tweenTimeExpand   = 0.5f,
                        tweenTimeCollapse = 0.5f
                    });
                }
                else
                {
                    _data.Add(new DataPista()
                    {
                        headerText        = pista.PistaName,
                        descriptionText   = pista.TextRich,
                        isExpanded        = false,
                        expandedSize      = pista.sizeText,
                        collapsedSize     = 60f,
                        tweenType         = Tween.TweenType.easeInOutSine,
                        tweenTimeExpand   = 0.5f,
                        tweenTimeCollapse = 0.5f
                    });
                }
            }

            scroller.ReloadData();
        }
コード例 #27
0
        void Start()
        {
            // set the scroller's delegate to this controller
            scroller.Delegate = this;

            // set the scroller's cell view visbility changed delegate to a method in this controller
            scroller.cellViewVisibilityChanged = CellViewVisibilityChanged;

            // set up some simple data
            _data = new SmallList <Data>();

            // set up a list of images with their dimensions
            for (var i = 0; i <= 12; i++)
            {
                _data.Add(new Data()
                {
                    imageUrl = string.Format("http://echo17.com/support/enhancedscroller/{0}.jpg", i), imageDimensions = new Vector2(200f, 200f)
                });
            }

            // tell the scroller to reload now that we have the data
            scroller.ReloadData();
        }
コード例 #28
0
    private SmallList <RankingData> _parseRankingJson(string jsonString)
    {
        // parse json
        var rankingData = new SmallList <RankingData>();
        var json        = Json.Deserialize(jsonString) as List <object>;

        string score;
        int    rank;
        int    lastRank  = 1;
        string lastScore = "";

        for (int i = 0; i < json.Count; ++i)
        {
            var row = json[i] as Dictionary <string, object>;
            // 順位計算
            score = row["score"].ToString();
            if (score == lastScore)
            {
                rank = lastRank;
            }
            else
            {
                rank     = i + 1;
                lastRank = i + 1;
            }
            lastScore = score;
            // リストに格納
            rankingData.Add(new RankingData()
            {
                rank  = rank,
                name  = row["name"].ToString(),
                score = float.Parse(score),
            });
        }
        return(rankingData);
    }
コード例 #29
0
ファイル: EnhancedScroller.cs プロジェクト: Genesic/prototype
        /// <summary>
        /// This sets up the visible cells, adding and recycling as necessary
        /// </summary>
        private void _ResetVisibleCellViews()
        {
            int startIndex;
            int endIndex;

            // calculate the range of the visible cells
            _CalculateCurrentActiveCellRange(out startIndex, out endIndex);

            // go through each previous active cell and recycle it if it no longer falls in the range
            var i = 0;
            SmallList<int> remainingCellIndices = new SmallList<int>();
            while (i < _activeCellViews.Count)
            {
                if (_activeCellViews[i].cellIndex < startIndex || _activeCellViews[i].cellIndex > endIndex)
                {
                    _RecycleCell(_activeCellViews[i]);
                }
                else
                {
                    // this cell index falls in the new range, so we add its
                    // index to the reusable list
                    remainingCellIndices.Add(_activeCellViews[i].cellIndex);
                    i++;
                }
            }

            if (remainingCellIndices.Count == 0)
            {
                // there were no previous active cells remaining,
                // this list is either brand new, or we jumped to
                // an entirely different part of the list.
                // just add all the new cell views

                for (i = startIndex; i <= endIndex; i++)
                {
                    _AddCellView(i, ListPositionEnum.Last);
                }
            }
            else
            {
                // we are able to reuse some of the previous
                // cell views

                // first add the views that come before the
                // previous list, going backward so that the
                // new views get added to the front
                for (i = endIndex; i >= startIndex; i--)
                {
                    if (i < remainingCellIndices.First())
                    {
                        _AddCellView(i, ListPositionEnum.First);
                    }
                }

                // next add teh views that come after the
                // previous list, going forward and adding
                // at the end of the list
                for (i = startIndex; i <= endIndex; i++)
                {
                    if (i > remainingCellIndices.Last())
                    {
                        _AddCellView(i, ListPositionEnum.Last);
                    }
                }
            }

            // update the start and end indices
            _activeCellViewsStartIndex = startIndex;
            _activeCellViewsEndIndex = endIndex;

            // adjust the padding elements to offset the cell views correctly
            _SetPadders();
        }
コード例 #30
0
 public void LoadData(SmallList <RankingData> dataList)
 {
     _dataList = dataList;
     scroller.ReloadData();
 }
コード例 #31
0
        /// <summary>
        /// Populates the data with a lot of records
        /// </summary>
        private void LoadData()
        {
            // create some data
            // note we are using different data class fields for the header, row, and footer rows. This works due to polymorphism.

            _data = new SmallList <Data>();

            _data.Add(new HeaderData()
            {
                category = "Platinum Players"
            });
            _data.Add(new RowData()
            {
                userName = "******", userAvatarSpritePath = resourcePath + "/avatar_male", userHighScore = 21323199
            });
            _data.Add(new RowData()
            {
                userName = "******", userAvatarSpritePath = resourcePath + "/avatar_female", userHighScore = 20793219
            });
            _data.Add(new RowData()
            {
                userName = "******", userAvatarSpritePath = resourcePath + "/avatar_female", userHighScore = 19932132
            });
            _data.Add(new FooterData());

            _data.Add(new HeaderData()
            {
                category = "Gold Players"
            });
            _data.Add(new RowData()
            {
                userName = "******", userAvatarSpritePath = resourcePath + "/avatar_male", userHighScore = 1002132
            });
            _data.Add(new RowData()
            {
                userName = "******", userAvatarSpritePath = resourcePath + "/avatar_female", userHighScore = 991234
            });
            _data.Add(new FooterData());

            _data.Add(new HeaderData()
            {
                category = "Silver Players"
            });
            _data.Add(new RowData()
            {
                userName = "******", userAvatarSpritePath = resourcePath + "/avatar_male", userHighScore = 905723
            });
            _data.Add(new RowData()
            {
                userName = "******", userAvatarSpritePath = resourcePath + "/avatar_male", userHighScore = 702318
            });
            _data.Add(new RowData()
            {
                userName = "******", userAvatarSpritePath = resourcePath + "/avatar_female", userHighScore = 697767
            });
            _data.Add(new RowData()
            {
                userName = "******", userAvatarSpritePath = resourcePath + "/avatar_male", userHighScore = 409393
            });
            _data.Add(new RowData()
            {
                userName = "******", userAvatarSpritePath = resourcePath + "/avatar_female", userHighScore = 104352
            });
            _data.Add(new RowData()
            {
                userName = "******", userAvatarSpritePath = resourcePath + "/avatar_male", userHighScore = 88321
            });
            _data.Add(new RowData()
            {
                userName = "******", userAvatarSpritePath = resourcePath + "/avatar_female", userHighScore = 20826
            });
            _data.Add(new RowData()
            {
                userName = "******", userAvatarSpritePath = resourcePath + "/avatar_female", userHighScore = 17389
            });
            _data.Add(new RowData()
            {
                userName = "******", userAvatarSpritePath = resourcePath + "/avatar_male", userHighScore = 2918
            });
            _data.Add(new FooterData());

            // tell the scroller to reload now that we have the data
            scroller.ReloadData();
        }