コード例 #1
0
        public GameModesPageViewModel(UserInteractionService userInteractionService, MenuGameModeItem[] gameModeItems)
        {
            _userInteractionService = userInteractionService;
            _gameModeItems = gameModeItems;
            InitializeComponent();

            gameModePage_listBox.ItemsSource = gameModeItems;
            gameModePage_listBox.SelectionChanged += OnGameModeItemClick;
        }
コード例 #2
0
        public BoxesPageViewModel(UserInteractionService userInteractionService, int gameModeId, MenuBoxItem[] boxItems)
        {
            _userInteractionService = userInteractionService;
            _gameModeId = gameModeId;
            _boxItems = boxItems;
            InitializeComponent();

            boxesPage_listBoxDataBinding.ItemsSource = _boxItems;
            boxesPage_listBoxDataBinding.SelectionChanged += OnBoxItemClick;
        }
コード例 #3
0
        public InteractionWindowViewModel()
        {
            //ниже перенести на экран загрузки!

            _gameModeItems = new MenuItemsProvider().GetMenuGameModeItems();

            _userInteractionService = new UserInteractionService(this, _gameModeItems);
            _gameModeItems = new MenuItemsProvider().GetMenuGameModeItems();

            InitializeComponent();

            _userInteractionService.SwitchToStartPage();
        }
コード例 #4
0
        public LevelsPageViewModel(UserInteractionService userInteractionService, int gameModeId, int boxId, MenuLevelItem[] levelItems)
        {
            _userInteractionService = userInteractionService;
            _gameFactory = new GameFactory();

            _gameModeId = gameModeId;
            _levelItems = levelItems;
            _boxId = boxId;
            InitializeComponent();

            levelsPage_listBoxDataBinding.ItemsSource = levelItems;
            levelsPage_listBoxDataBinding.SelectionChanged += OnLevelItemClick;
        }
コード例 #5
0
        public GamePageViewModel(UserInteractionService userInteractionService, GameSettings gameSettings)
        {
            _userInteractionService = userInteractionService;
            _gameSettings = gameSettings;

            InitializeComponent();

            _gameProcessor = new GameProcessor(_gameSettings);

            //перенести всё в xaml Binding
            gamePage_player1PreviewImage.Source = _gameSettings.Player1.SourceBitmap;
            gamePage_player2PreviewImage.Source = _gameSettings.Player2.SourceBitmap;
            gamePage_player3PreviewImage.Source = _gameSettings.Player3.SourceBitmap;
            gamePage_player4PreviewImage.Source = _gameSettings.Player4.SourceBitmap;

            gamePage_player1InkCanvas.Background = new SolidColorBrush(_gameSettings.Player1.PlayerColor);
            gamePage_player2InkCanvas.Background = new SolidColorBrush(_gameSettings.Player2.PlayerColor);
            gamePage_player3InkCanvas.Background = new SolidColorBrush(_gameSettings.Player3.PlayerColor);
            gamePage_player4InkCanvas.Background = new SolidColorBrush(_gameSettings.Player4.PlayerColor);

            gamePage_player1InkCanvas.Background.Opacity = 0.1;
            gamePage_player2InkCanvas.Background.Opacity = 0.1;
            gamePage_player3InkCanvas.Background.Opacity = 0.1;
            gamePage_player4InkCanvas.Background.Opacity = 0.1;

            gamePage_player1InkCanvas.DefaultDrawingAttributes.Color = _gameSettings.Player1.PlayerColor;
            gamePage_player2InkCanvas.DefaultDrawingAttributes.Color = _gameSettings.Player2.PlayerColor;
            gamePage_player3InkCanvas.DefaultDrawingAttributes.Color = _gameSettings.Player3.PlayerColor;
            gamePage_player4InkCanvas.DefaultDrawingAttributes.Color = _gameSettings.Player4.PlayerColor;

            gamePage_PauseDialog.Visibility = System.Windows.Visibility.Hidden;
            gamePage_PauseButton.Click += OnPauseButtonClick;
            gamePage_ResumeButton.Click += ResumeButtonClick;
            gamePage_ExitButton.Click += OnExitButtonClick;

            _gameProcessor.TopTimerTick += OnTopTimerTick;
            _gameProcessor.BottomTimerTick += OnBottomTimerTick;

            //поехали
            _gameProcessor.OnStart();
        }
コード例 #6
0
 public StartPageViewModel(UserInteractionService userInteractionService)
 {
     _userInteractionService = userInteractionService;
     InitializeComponent();
 }