예제 #1
0
        public BoardViewModel(Game game, IContext<Player> currentPlayer, IContext<Player> selectedPlayer, Notifier notifier)
        {
            this.currentPlayer = currentPlayer;
            this.selectedPlayer = selectedPlayer;

            this.selectedPlayer.ContextChanged += SelectedPlayer_ContextChanged;

            drawViewModel = new DrawViewModel(game.DrawManager, notifier);
            infectionViewModel = new InfectionViewModel(game.InfectionManager, game.NodeCounters, this, notifier);
            playerViewModels = CreatePlayerViewModels(game, notifier);
            playersViewModel = new PlayersViewModel(currentPlayer, playerViewModels, notifier);
            nextTurnViewModel = new NextTurnViewModel(game, currentPlayer, notifier);
            gameStatusViewModel = new GameStatusViewModel(game.OutbreakCounter, game.InfectionRateCounter, game.ResearchStationCounter, CreateDiseaseCounterViewModels(game, notifier), notifier);
            commandsViewModel = new CommandsViewModel(game.ActionManager, selectedPlayer, this, notifier);
            anchorViewModels = CreateAnchorViewModels(game.Nodes, game.NodeCounters, notifier);
            connectionViewModels = CreateConnectionViewModels(game.Nodes, AnchorViewModels);
            pathAnimationViewModel = new PathAnimationViewModel();
            pawnViewModel = new PawnViewModel(this, selectedPlayer);

            notifier.SubscribeToViewModel(this);

            nextTurnViewModel.TurnChanged += NextTurnViewModel_TurnChanged;

            selectedPlayer.Context = currentPlayer.Context;
        }
예제 #2
0
 /// <summary>
 ///     .ctor
 /// </summary>
 /// <param name="commandsViewModel">Commands view model which is registered as default top bar menu container</param>
 public MenuService(ICommandsViewModel commandsViewModel)
 {
     this.commandsViewModel = commandsViewModel;
 }