-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml.cs
More file actions
71 lines (64 loc) · 2.54 KB
/
MainWindow.xaml.cs
File metadata and controls
71 lines (64 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace WpfApp1
{
public partial class MainWindow : Window
{
public static MediaPlayer player = new MediaPlayer {Volume = 0.1};
public MainWindow()
{
InitializeComponent();
Backgr.ImageSource = new BitmapImage(new Uri("images/main.jpg", UriKind.Relative));
player.Open(new Uri("sounds/menu.mp3", UriKind.RelativeOrAbsolute));
player.Play();
player.MediaEnded += (s, e) =>
{
player.Stop();
player.Play();
};
}
private void SinglePlayerButtonClick(object sender, RoutedEventArgs e)
{
SingleplayerWindow window = new SingleplayerWindow();
window.Owner = this;
Hide();
window.Show();
player.Stop();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Settings window = new Settings();
window.Owner = this;
Hide();
window.Show();
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
Scores window = new Scores();
window.Owner = this;
Hide();
window.Show();
}
private void Button_Click_2(object sender, RoutedEventArgs e)
{
MultiPlayer window = new MultiPlayer();
window.Owner = this;
Hide();
window.Show();
player.Stop();
}
private void RulesButton(object sender, RoutedEventArgs e)
{
MessageBox.Show(
"В одиночной игре: не врезайтесь в края карты и себя. Собирайте как можно больше яблок и растите! За каждое яблоко дается 10 очков!" +
"\nВ мультиплеере: игра оканчивается если: " +
"\n1) Какой-либо игрок растратил все жизни" +
"\n2) Какой-либо игрок съел подряд 15 яблок" +
"\nНе дайте противнику съесть нужное количество яблок!" +
"\nТакже нельзя врезаться в противника. У каждого игрока по 3 жизни." +
"\nУдачи!", "Правила игры");
}
}
}