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)); }
private void ReadyPlayer(Mobile m) { if (!ScoreTable.ContainsKey(m.Serial)) { ScoreTable.Add(m.Serial, new ScoreKeeper(m)); } if (EventSupplier != null) { EventSupplier.OnMoveOver(m); } Contestants.Add(m); m.MoveToWorld(JoinLocation, JoinMap); m.Blessed = true; if (m.NetState != null) { m.SendMessage(38, "You have joined a tournament"); } }