/// <summary>
        /// Initializes a new instance of the <see cref="OptionsWindow"/> class.
        /// </summary>
        public OptionsWindow()
        {
            try
            {
                InitializeComponent();

                errorLogViewModel = new ErrorLogViewModel();

                ResolutionComboBox.Items.Add("580x420");
                ResolutionComboBox.Items.Add("640x480");
                ResolutionComboBox.Items.Add("800x600");

                optionsVM = new OptionsViewModel();
                this.DataContext = optionsVM;
                this.Width = optionsVM.HorizontalScaleNumber;
                this.Height = optionsVM.VerticalScaleNumber;

                ResolutionComboBox.SelectedItem = optionsVM.OptionModel.Resolution;

                SettingsUpdatedLabelHide.Interval = TimeSpan.FromSeconds(3);
                SettingsUpdatedLabelHide.Tick += SettingsUpdatedLabelHide_Tick;
            }
            catch
            { }
        }
Пример #2
0
        public GameOver()
        {
            InitializeComponent();

            optionsViewModel = new OptionsViewModel();
            this.Width = optionsViewModel.HorizontalScaleNumber;
            this.Height = optionsViewModel.VerticalScaleNumber;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="GameOverWindow"/> class.
        /// </summary>
        public GameOverWindow(int playerScore)
        {
            InitializeComponent();

            errorLogVireModel = new ErrorLogViewModel();
            gameOverViewModel = new GameOverViewModel();
            optionsViewModel = new OptionsViewModel();
            this.Width = optionsViewModel.HorizontalScaleNumber;
            this.Height = optionsViewModel.VerticalScaleNumber;
            ScoreLabel.Content = playerScore;
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindow"/> class.
        /// </summary>
        public MainWindow()
        {
            try
            {
                InitializeComponent();

                errorLogViewModel = new ErrorLogViewModel();
                optionsViewModel = new OptionsViewModel();
                this.Height = optionsViewModel.VerticalScaleNumber;
                this.Width = optionsViewModel.HorizontalScaleNumber;
            }
            catch
            { }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CreditsWindow"/> class.
        /// </summary>
        public CreditsWindow()
        {
            try
            {
                InitializeComponent();

                errorLogViewModel = new ErrorLogViewModel();
                optionsViewModel = new OptionsViewModel();
                this.Height = optionsViewModel.VerticalScaleNumber;
                this.Width = optionsViewModel.HorizontalScaleNumber;

                creditsViewModel = new CreditsViewModel();
                this.DataContext = creditsViewModel.LoadRawScores();
            }
            catch
            { }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="InformationsWindow"/> class.
        /// </summary>
        public InformationsWindow()
        {
            try
            {
                InitializeComponent();

                errorLogViewModel = new ErrorLogViewModel();
                optionsViewModel = new OptionsViewModel();
                this.Height = optionsViewModel.VerticalScaleNumber;
                this.Width = optionsViewModel.HorizontalScaleNumber;

                InfoTxtBlock.Text = "Name: Péter Zsolt" + "\n" + "Neptun: GZOG8N" + "\n" + "App: BrickBreaker";
                PressKeyTxtBlock.Text = "Press Esc to the Main Menu";
            }
            catch
            { }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NewGameWindow"/> class.
        /// </summary>
        public NewGameWindow()
        {
            try
            {
                InitializeComponent();

                errorLogViewModel = new ErrorLogViewModel();
                newGameViewModel = new NewGameViewModel();
                optionsViewModel = new OptionsViewModel();
                this.Height = optionsViewModel.VerticalScaleNumber;
                this.Width = optionsViewModel.HorizontalScaleNumber;

                firstMap_Diff.IsEnabled = newGameViewModel.FindMap(newGameViewModel.FirstMapPath);
                secondMap_Diff.IsEnabled = newGameViewModel.FindMap(newGameViewModel.SecondMapPath);
                thirdMap_Diff.IsEnabled = newGameViewModel.FindMap(newGameViewModel.ThirdMapPath);
                fourthmapMap_Diff.IsEnabled = newGameViewModel.FindMap(newGameViewModel.ForthMapPath);
                fifthmap_Diff.IsEnabled = newGameViewModel.FindMap(newGameViewModel.FifthMapPath);
            }
            catch
            { }
        }
        /// <summary>
        /// Handles the Loaded event of the Window control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            newGameViewModel = new NewGameViewModel(canvas.ActualWidth, canvas.ActualHeight);
            optionsViewModel = new OptionsViewModel();
            this.DataContext = newGameViewModel;
            newGameViewModel.PresetValues();

            foreach (var item in newGameViewModel.BallList)
            {
                Ball ujlabda = item;

                Ellipse ujLabdaEllipse = new Ellipse();
                ImageBrush myBrush = new ImageBrush();
                myBrush.ImageSource =
                    new BitmapImage(new Uri(item.ImagePath,UriKind.Relative));
                ujLabdaEllipse.Fill = myBrush;
                canvas.Children.Add(ujLabdaEllipse);

                Binding widthBinding = new Binding("Area.Width");
                widthBinding.Source = ujlabda;
                ujLabdaEllipse.SetBinding(Ellipse.WidthProperty, widthBinding);

                Binding heightBinding = new Binding("Area.Height");
                heightBinding.Source = ujlabda;
                ujLabdaEllipse.SetBinding(Ellipse.HeightProperty, heightBinding);

                Binding xBinding = new Binding("Area.X");
                xBinding.Source = ujlabda;
                ujLabdaEllipse.SetBinding(Canvas.LeftProperty, xBinding);

                Binding yBinding = new Binding("Area.Y");
                yBinding.Source = ujlabda;
                ujLabdaEllipse.SetBinding(Canvas.TopProperty, yBinding);
            }
            foreach (var item in newGameViewModel.BrickList)
            {
                Brick ujbrick = item;

                Rectangle ujBrickRect = new Rectangle();
                ImageBrush myBrush = new ImageBrush();
                myBrush.ImageSource =
                    new BitmapImage(new Uri(item.ImagePath, UriKind.Relative));
                ujBrickRect.Fill = myBrush;

                Binding widthBinding = new Binding("Area.Height");
                widthBinding.Source = ujbrick;
                ujBrickRect.SetBinding(Rectangle.WidthProperty, widthBinding);

                Binding heightBinding = new Binding("Area.Width");
                heightBinding.Source = ujbrick;
                ujBrickRect.SetBinding(Rectangle.HeightProperty, heightBinding);

                Binding xBinding = new Binding("Area.X");
                xBinding.Source = ujbrick;
                ujBrickRect.SetBinding(Canvas.LeftProperty, xBinding);

                Binding yBinding = new Binding("Area.Y");
                yBinding.Source = ujbrick;
                ujBrickRect.SetBinding(Canvas.TopProperty, yBinding);
                canvas.Children.Add(ujBrickRect);

            }

            foreach (var item in newGameViewModel.RacketList)
            {
                Racket racket = item;

                Rectangle ujracket = new Rectangle();
                ImageBrush myBrush = new ImageBrush();
                myBrush.ImageSource =
                    new BitmapImage(new Uri(item.ImagePath, UriKind.Relative));
                ujracket.Fill = myBrush;

                Binding widthBinding = new Binding("Area.Width");
                widthBinding.Source = racket;
                ujracket.SetBinding(Rectangle.WidthProperty, widthBinding);

                Binding heightBinding = new Binding("Area.Height");
                heightBinding.Source = racket;
                ujracket.SetBinding(Rectangle.HeightProperty, heightBinding);

                Binding xBinding = new Binding("Area.X");
                xBinding.Source = racket;
                ujracket.SetBinding(Canvas.LeftProperty, xBinding);

                Binding yBinding = new Binding("Area.Y");
                yBinding.Source = racket;
                ujracket.SetBinding(Canvas.TopProperty, yBinding);
                canvas.Children.Add(ujracket);
            }
        }
Пример #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NewGameViewModel"/> class.
        /// </summary>
        /// <param name="canvas">The canvas.</param>
        public NewGameViewModel(ref Canvas canvas)
        {
            mapTxtAccess = new MapTxtAccess();
            optionsViewModel = new OptionsViewModel();

            this.canvas = canvas;
            PresetValues1();
        }
Пример #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewGameViewModel"/> class.
 /// </summary>
 public NewGameViewModel()
 {
     try
     {
         errorLogViewModel = new ErrorLogViewModel();
         mapTxtAccess = new MapTxtAccess();
         scoreXmlAccess = new ScoresXmlAccess();
         optionsViewModel = new OptionsViewModel();
     }
     catch
     { }
 }
Пример #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NewGameViewModel"/> class.
        /// </summary>
        /// <param name="canvasWidth">The width of the canvas.</param>
        /// <param name="canvasHeight">The height of the canvas.</param>
        public NewGameViewModel(double canvasWidth, double canvasHeight)
        {
            mapTxtAccess = new MapTxtAccess();
            optionsViewModel = new OptionsViewModel();

            this.canvasWidth = canvasWidth;
            this.canvasHeight = canvasHeight;

            #region SetLabelValues

            //// Show the scorepoints.
            //ScoreLabel.Content = "Score: " + scoreValue;
            //// Show the lifepoints.
            //LifeLabel.Content = "Life: " + lifePoint;
            //// Show the time.
            //TimeLabel.Content = "Time: " + timeOfGame.ToString("HH:mm:ss");

            #endregion SetLabelValues
        }