コード例 #1
0
 /// Sets the given game as the currently played game, using the given ID.
 /// The previous game is discarded.
 public void Load(GameId id, Game game)
 {
     PrimaryGame = game;
     GameId      = id;
     BoardViewModel.Reset(PrimaryGame.State);
     PlayModeToolBarViewModel.Game = PrimaryGame;
     Player1Tag.Player             = PrimaryGame.Player1;
     Player2Tag.Player             = PrimaryGame.Player2;
     ActiveMode = ViewMode.Play;
     UpdatePlayerTags(PrimaryGame.State);
 }
コード例 #2
0
        public LoadGameScreenViewModel(IMessenger messenger)
        {
            MessengerInstance = messenger;

            DeleteSaveInViewMessage.Register(MessengerInstance, this, item => { Saves.Remove(item); });

            // disconnect the messenger of this one from the messenger of the game screen
            BoardViewModel = new BoardViewModel(new Messenger(), MockUtil.AnyGame(7, 0).State)
            {
                UnlockedPlayer = null
            };

            BackToMainMenuCommand = new RelayCommand(() => ShowMainMenuMessage.Send(MessengerInstance));
        }
コード例 #3
0
        public GameScreenViewModel(IMessenger UImessenger, Game game)
        {
            PrimaryGame       = game;
            MessengerInstance = UImessenger;

            BoardViewModel             = new BoardViewModel(MessengerInstance, PrimaryGame.State);
            PlayModeToolBarViewModel   = new PlayModeToolBarViewModel(MessengerInstance, PrimaryGame);
            ReplayModeToolBarViewModel = new ReplayModeToolBarViewModel(MessengerInstance);
            Player1Tag             = new PlayerTagViewModel(PrimaryGame.Player1);
            Player2Tag             = new PlayerTagViewModel(PrimaryGame.Player2);
            VictoryBannerViewModel = new VictoryBannerViewModel(MessengerInstance);


            UpdatePlayerTags(game.State);

            InitMessageHandlers();
        }