public GameSettings GetSettings(int modeId, int boxId, int levelId) { GameSettings gameSettings = new GameSettings(); //разграничить логику в зависимости от режима gameSettings.LevelId = levelId; gameSettings.ModeID = modeId; gameSettings.BoxId = boxId; //Таймеры? gameSettings.TopTimerTimeSpan = new TimeSpan(0,2,0); gameSettings.BottomTimerTimeSpan = new TimeSpan(0, 1, 0); gameSettings.Player1 = GetPlayer(0, modeId, boxId, levelId); gameSettings.Player2 = GetPlayer(1, modeId, boxId, levelId); gameSettings.Player3 = GetPlayer(2, modeId, boxId, levelId); gameSettings.Player4 = GetPlayer(3, modeId, boxId, levelId); return gameSettings; }
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(); }
public GameProcessor(GameSettings settings) { _settings = settings; OnCreate(); }
public void SwitchToGamePage(GameSettings gameSettings) { _parentWindow.Content = new GamePageViewModel(this, gameSettings); }