private void RefreshView(Player[] players, Food[] foods, PlayerScoreItem[] playerScoreItems) { GameObjectsView.Clear(); ScoreTable.Clear(); lock (_syncRootToGameResources) { playerScoreItems = playerScoreItems.OrderByDescending(t => t.Score).ToArray(); for (var i = 0; i < playerScoreItems.Length; i++) { ScoreTable.Add(new PlayerScore(playerScoreItems[i], i + 1)); } _player = players.FirstOrDefault(t => t.Id == _player.Id); _camera.ChangeCoordinates(_player); foreach (var i in players) { if (i != null) { GameObjectsView.Add(new GameObjectModel(i, _camera).View); } } foreach (var i in foods) { if (i != null) { GameObjectsView.Add(new GameObjectModel(i, _camera).View); } } } OnPropertyChanged(nameof(GameObjectsView)); OnPropertyChanged(nameof(ScoreTable)); }
public void Clear() { _scores.Clear(); }