private void BackToMenu()
 {
     backgroundMusic.Stop();
     var startScreen = new StartScreen();
     startScreen.Owner = this.Owner;
     startScreen.Show();
     this.Close();
 }
예제 #2
0
        private void WinButton_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (((sender as Image).Parent as Border).Name == "Back")
            {
                backgroundMusic.Stop();
                ResetState();
                var startScreen = new StartScreen();
                startScreen.Owner = this.Owner;
                startScreen.Show();
                this.Close();
            }
            else if (((sender as Image).Parent as Border).Name == "HordeButton")
            {
                isTurnSelected = true;
                turn = false;
                ChangeRaceChooseToRace();

                Task.Factory.StartNew(() =>
                {
                    MediaPlayer hordeChoose = new MediaPlayer();
                    var path = System.IO.Path.GetFullPath(@"..\..\Resources\Unit_Sounds\Horde\horde_choose.mp3");
                    hordeChoose.Open(new Uri(path));
                    hordeChoose.Play();
                });

                SetTurn();
            }
            else if (((sender as Image).Parent as Border).Name == "AllianceButton")
            {
                isTurnSelected = true;
                turn = true;
                ChangeRaceChooseToRace();

                Task.Factory.StartNew(() =>
                {
                    MediaPlayer allianceChoose = new MediaPlayer();
                    var path = System.IO.Path.GetFullPath(@"..\..\Resources\Unit_Sounds\Alliance\alliance_choose.mp3");
                    allianceChoose.Open(new Uri(path));
                    allianceChoose.Play();
                });

                SetTurn();
            }
        }