예제 #1
0
 void SetTextBlock(char answer)
 {
     WAVPlayer.StopSound();
     timer.IsEnabled    = false;
     TextBlockCall.Text = string.Format("{0} считает, что правильный ответ - \"{1}\".", TextBlockFriend.Text, answer);
     next = true;
 }
예제 #2
0
 private void LabelD_MouseDown(object sender, MouseButtonEventArgs e)
 {
     WAVPlayer.PlaySound(Properties.Resources.кто_хочет_стать_миллионером_ответ_принят);
     EnabledControls(false);
     SetColor(LabelD, Brushes.White);
     answerOfPlayer  = LabelD;
     timer.IsEnabled = true;
 }
예제 #3
0
 public HelpPeaple(Data currentQuestion)
 {
     InitializeComponent();
     WAVPlayer.PlaySound(Properties.Resources.кто_хочет_стать_миллионером_помощь_зала);
     this.currentQuestion = currentQuestion;
     voices = new int[4];
     ColumnSeries.LabelPoint = point => point.Y + "%";
 }
예제 #4
0
 private void Window_Closing(object sender, CancelEventArgs e)
 {
     if (DialogResult == null && !exit)
     {
         DialogResult = true;
         Save();
     }
     WAVPlayer.StopSound();
 }
예제 #5
0
 void Processing(Image image, TextBlock textBlock, TextBlock description, double koef)
 {
     ImageFriend.Source        = image.Source;
     TextBlockFriend.Text      = textBlock.Text;
     TextBlockDescription.Text = description.Text;
     timer.IsEnabled           = true;
     WAVPlayer.PlaySound(Properties.Resources.gudok);
     GridCall.Visibility = Visibility.Visible;
     this.koef           = koef;
 }
예제 #6
0
 private void Cell_Opened()
 {
     cellOpenedCount++;
     if (width * height - cellOpenedCount == allBombCount)
     {
         WAVPlayer.PlaySound(Properties.Resource.win);
         EnableTimer(false);
         OpenBombs();
         GameGrid.UpdateLayout();
         EndGame(true);
     }
 }
예제 #7
0
        private void timerTick(object sender, EventArgs e)
        {
            timer.IsEnabled = false;
            if (answerOfPlayer.Content.ToString().EndsWith(currentQuestion.TrueAnswer))
            {
                WAVPlayer.PlaySound(Properties.Resources.кто_хочет_стать_миллионером_правильный_ответ);
                SetColor(answerOfPlayer, Brushes.Green);
                indexOfQuestion++;
                ListBox.SelectedIndex = ListBox.Items.Count - indexOfQuestion;
                switch (indexOfQuestion)
                {
                case 5:
                    player.Score = 500;
                    break;

                case 10:
                    player.Score = 5000;
                    break;

                case 15:
                    player.Score = 50000;
                    endOfGame    = true;
                    break;

                default:
                    break;
                }
            }
            else
            {
                WAVPlayer.PlaySound(Properties.Resources.кто_хочет_стать_миллионером_неправильный_ответ);
                SetColor(answerOfPlayer, Brushes.Red);
                if (LabelA.Content.ToString().EndsWith(currentQuestion.TrueAnswer))
                {
                    SetColor(LabelA, Brushes.Green);
                }
                else if (LabelB.Content.ToString().EndsWith(currentQuestion.TrueAnswer))
                {
                    SetColor(LabelB, Brushes.Green);
                }
                else if (LabelC.Content.ToString().EndsWith(currentQuestion.TrueAnswer))
                {
                    SetColor(LabelC, Brushes.Green);
                }
                else
                {
                    SetColor(LabelD, Brushes.Green);
                }
                endOfGame = true;
            }
            timer2.IsEnabled = true;
        }
예제 #8
0
 private void imageSound_MouseDown(object sender, MouseButtonEventArgs e)
 {
     if (WAVPlayer.sound)
     {
         WAVPlayer.StopSound();
         imageSound.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/soundOff.png"));
     }
     else
     {
         imageSound.Source = new BitmapImage(new Uri("pack://application:,,,/Resources/soundOn.png"));
     }
     WAVPlayer.sound = !WAVPlayer.sound;
 }
예제 #9
0
 private void NewGame()
 {
     WAVPlayer.PlaySound(Properties.Resources.кто_хочет_стать_миллионером_начало_игры);
     data = new List <Data>();
     data.AddRange(GetData(data1));
     data.AddRange(GetData(data2));
     data.AddRange(GetData(data3));
     player          = new Record();
     player.Score    = 0;
     indexOfQuestion = 0;
     EnabledControls(true);
     Reset();
     NewQuestion();
     GameGrid.Visibility = Visibility.Visible;
 }
예제 #10
0
 private void Millionaire_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     WAVPlayer.StopSound();
 }
예제 #11
0
 private void HelpPeapleWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     WAVPlayer.StopSound();
 }
예제 #12
0
        private void image_MouseUp(object sender, MouseButtonEventArgs e)
        {
            Image image = sender as Image;
            Cell  cell  = image.Tag as Cell;

            if (e.ChangedButton == MouseButton.Left && cell.ExtState != CellExtState.Flag)
            {
                if (firstStep)
                {
                    Random r         = new Random();
                    int    bombCount = 0;
                    do
                    {
                        int x = r.Next(width);
                        int y = r.Next(height);
                        if (map[x, y].IntState != CellIntState.Bomb && x != cell.X && y != cell.Y)
                        {
                            map[x, y].IntState = CellIntState.Bomb;
                            bombCount++;
                        }
                    } while (bombCount != allBombCount);
                    for (int i = 0; i < width; i++)
                    {
                        for (int j = 0; j < height; j++)
                        {
                            if (map[i, j].IntState != CellIntState.Bomb)
                            {
                                bombCount          = 0;
                                map[i, j].IntState = CellIntState.Number;
                                bombCount         += (CheckCellIntState(i - 1, j - 1, CellIntState.Bomb)) ? 1 : 0;
                                bombCount         += (CheckCellIntState(i - 1, j, CellIntState.Bomb)) ? 1 : 0;
                                bombCount         += (CheckCellIntState(i - 1, j + 1, CellIntState.Bomb)) ? 1 : 0;
                                bombCount         += (CheckCellIntState(i, j - 1, CellIntState.Bomb)) ? 1 : 0;
                                bombCount         += (CheckCellIntState(i, j + 1, CellIntState.Bomb)) ? 1 : 0;
                                bombCount         += (CheckCellIntState(i + 1, j - 1, CellIntState.Bomb)) ? 1 : 0;
                                bombCount         += (CheckCellIntState(i + 1, j, CellIntState.Bomb)) ? 1 : 0;
                                bombCount         += (CheckCellIntState(i + 1, j + 1, CellIntState.Bomb)) ? 1 : 0;
                                switch (bombCount)
                                {
                                case 1:
                                    map[i, j].IntImage = Images.NumberOne;
                                    break;

                                case 2:
                                    map[i, j].IntImage = Images.NumberTwo;
                                    break;

                                case 3:
                                    map[i, j].IntImage = Images.NumberThree;
                                    break;

                                case 4:
                                    map[i, j].IntImage = Images.NumberFour;
                                    break;

                                case 5:
                                    map[i, j].IntImage = Images.NumberFive;
                                    break;

                                case 6:
                                    map[i, j].IntImage = Images.NumberSix;
                                    break;

                                case 7:
                                    map[i, j].IntImage = Images.NumberSeven;
                                    break;

                                case 8:
                                    map[i, j].IntImage = Images.NumberEight;
                                    break;

                                default:
                                    map[i, j].IntState = CellIntState.Empty;
                                    break;
                                }
                            }
                            (GameGrid.Children[i * height + j] as Image).Tag = map[i, j];
                        }
                    }
                    firstStep = false;
                    image_MouseUp(sender, e);
                }
                else if (!cell.IsOpen)
                {
                    if (cell.IntState == CellIntState.Bomb)
                    {
                        WAVPlayer.PlaySound(Properties.Resource.small_blast);
                        EnableTimer(false);
                        OpenBombs();
                        EndGame(false);
                    }
                    else
                    {
                        WAVPlayer.PlaySound(Properties.Resource.opencell);
                        OpenCell(cell.X, cell.Y);
                        EnableTimer(true);
                    }
                }
            }
            else if (e.ChangedButton == MouseButton.Right && !cell.IsOpen)
            {
                switch (cell.ExtState)
                {
                case CellExtState.Empty:
                    map[cell.X, cell.Y].ExtState = CellExtState.Flag;
                    image.Tag    = map[cell.X, cell.Y];
                    image.Source = map[cell.X, cell.Y].ExtImage;
                    bombFlagCount++;
                    break;

                case CellExtState.Flag:
                    map[cell.X, cell.Y].ExtState = CellExtState.Question;
                    image.Tag    = map[cell.X, cell.Y];
                    image.Source = map[cell.X, cell.Y].ExtImage;
                    bombFlagCount--;
                    break;

                case CellExtState.Question:
                    map[cell.X, cell.Y].ExtState = CellExtState.Empty;
                    image.Tag    = map[cell.X, cell.Y];
                    image.Source = map[cell.X, cell.Y].ExtImage;
                    break;
                }
                bombText.Text = (allBombCount - bombFlagCount).ToString();
            }
        }