public MainWindow() { InitializeComponent(); DataContext = this; WindowState = WindowState.Maximized; _restartCmd = new RestartCmd(this); _soundChangeCmd = new SoundChangeCmd(this); _gamemodeChangeCmd = new GamemodeChangeCmd(this); _secondWindowCmd = new SecondWindowCmd(this); _arenaChangeCmd = new ArenaChangeCmd(this); _exitCmd = new ExitCmd(this); timer = new DispatcherTimer(); timer.Interval = new TimeSpan(T); timer.Tick += TimerTick; RegisterGamemodes(); SetupGamemodeMenu(); sound = new SoundPlayer("Sound/timeout2.wav"); sound.Load(); leftScore = 0; rightScore = 0; UpdateScore(); arena = 1; this.KeyDown += new KeyEventHandler(OnButtonKeyDown); }
public MainWindow() { InitializeComponent(); DataContext = this; WindowState = WindowState.Maximized; _restartCmd = new RestartCmd(this); _soundChangeCmd = new SoundChangeCmd(this); _gamemodeChangeCmd = new GamemodeChangeCmd(this); _secondWindowCmd = new SecondWindowCmd(this); _arenaChangeCmd = new ArenaChangeCmd(this); _exitCmd = new ExitCmd(this); timer = new DispatcherTimer(); timer.Interval = new TimeSpan(T); timer.Tick += TimerTick; gamemodes = new Dictionary <string, Gamemode>(); gamemodes.Add("Классика", new Gamemode("Классика", 45, false, 10)); gamemodes.Add("Военная сабля", new Gamemode("Военная сабля", 120, true, 7, 4)); gamemodes.Add("Длинный меч", new Gamemode("Длинный меч", 180, true, 10, 4)); _gamemodeChangeCmd.Execute("Классика"); sound = new SoundPlayer("Sound/timeout2.wav"); sound.Load(); leftScore = 0; rightScore = 0; UpdateScore(); arena = 1; this.KeyDown += new KeyEventHandler(OnButtonKeyDown); }