コード例 #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
        public PlayerViewModel(Player player, Notifier notifier)
        {
            this.player = player;
            notifier.SubscribeToViewModel(this);

            Icons icons = new Icons();
            switch (player.Role)
            {
                case "Dispatcher":
                    pawn = icons["pawnPurple"];
                    break;
                case "Medic":
                    pawn = icons["pawnOrange"];
                    break;
                case "Scientist":
                    pawn = icons["pawnWhite"];
                    break;
                case "Quarantine Specialist":
                    pawn = icons["pawnDarkGreen"];
                    break;
                case "Researcher":
                    pawn = icons["pawnBrown"];
                    break;
                case "Operations Expert":
                    pawn = icons["pawnGreen"];
                    break;
            }
        }
コード例 #3
0
 public CommandsViewModel(ActionManager actionManager, IContext<Player> selectedPlayer, IBoardViewModel boardViewModel, Notifier notifier)
 {
     if (actionManager == null)
         throw new ArgumentNullException();
     this.actionManager = actionManager;
     this.selectedPlayer = selectedPlayer;
     this.boardViewModel = boardViewModel;
     notifier.SubscribeToViewModel(this);
 }
コード例 #4
0
        public GameStatusViewModel(OutbreakCounter outbreakCounter, InfectionRateCounter infectionRateCounter, ResearchStationCounter researchStationCounter, IEnumerable<IDiseaseCounterViewModel> diseaseCounterViewModels, Notifier notifier)
        {
            if (diseaseCounterViewModels == null)
                throw new ArgumentNullException("DiseaseCounterViewModels");

            this.outbreakCounter = outbreakCounter;
            this.infectionRateCounter = infectionRateCounter;
            this.researchStationCounter = researchStationCounter;
            this.diseaseCounterViewModels = diseaseCounterViewModels;
            notifier.SubscribeToViewModel(this);
        }
コード例 #5
0
        public AnchorViewModel(Node node, IEnumerable<NodeDiseaseCounter> diseaseCounters, IBoardViewModel boardViewModel, Notifier notifier)
        {
            this.node = node;
            this.nodeDiseaseCounters = diseaseCounters;
            this.boardViewModel = boardViewModel;

            foreach (NodeDiseaseCounter ndc in diseaseCounters)
            {
                ndc.Infected += Ndc_Infected;
                ndc.Treated += Ndc_Treated;
            }

            notifier.SubscribeToViewModel(this);

            opacityTimer = new DispatcherTimer(DispatcherPriority.Render) { Interval = TimeSpan.FromMilliseconds(1) };
            opacityTimer.Tick += opacityTimer_Tick;

            GetAlertColors();
        }
コード例 #6
0
        public InfectionViewModel(InfectionManager infectionManager, IEnumerable<NodeDiseaseCounter> nodeCounters, IBoardViewModel boardViewModel, Notifier notifier)
        {
            this.boardViewModel = boardViewModel;
            this.infectionManager = infectionManager;
            notifier.SubscribeToViewModel(this);

            foreach (NodeDiseaseCounter ndc in nodeCounters)
            {
                ndc.Infected += Ndc_Infected;
            }

            timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(2);
            timer.Tick += Timer_Tick;

            animationTimer = new DispatcherTimer();
            animationTimer.Interval = TimeSpan.FromMilliseconds(1);
            animationTimer.Tick += TranslateTimer_Tick;
        }
コード例 #7
0
 public DiseaseCounterViewModel(DiseaseCounter counter, Notifier notifier)
 {
     this.counter = counter;
     notifier.SubscribeToViewModel(this);
 }
コード例 #8
0
 public NodeDiseaseCounterViewModel(NodeDiseaseCounter nodeDiseaseCounter, Notifier notifier)
 {
     this.nodeDiseaseCounter = nodeDiseaseCounter;
     notifier.SubscribeToViewModel(this);
 }
コード例 #9
0
 public NextTurnViewModel(Game game, IContext<Player> currentPlayer, Notifier notifier)
 {
     this.game = game;
     this.currentPlayer = currentPlayer;
     notifier.SubscribeToViewModel(this);
 }
コード例 #10
0
 public PlayersViewModel(IContext<Player> currentPlayer, IEnumerable<IPlayerViewModel> playerViewModels, Notifier notifier)
 {
     this.currentPlayer = currentPlayer;
     this.playerViewModels = playerViewModels;
     notifier.SubscribeToViewModel(this);
 }
コード例 #11
0
 public DrawViewModel(DrawManager drawManager, Notifier notifier)
 {
     this.drawManager = drawManager;
     notifier.SubscribeToViewModel(this);
 }