private void BtnSaveGame_Click(object sender, RoutedEventArgs e) { SaveWindow saveWindow = new SaveWindow(homeWindow); WPF_Misc.FocusWindow(saveWindow); WPF_Misc.OpenNewWindow(this, saveWindow, false); }
private void BtnLoadGame_Click(object sender, RoutedEventArgs e) { LoadWindow loadWindow = new LoadWindow(homeWindow); WPF_Misc.FocusWindow(loadWindow); WPF_Misc.OpenNewWindow(this, loadWindow, false); }
// Кнопка "Пауза" void BtnPauseGame_Click(object sender, RoutedEventArgs e) { PauseWindow pauseWindow = new PauseWindow(this); WPF_Misc.FocusWindow(pauseWindow); WPF_Misc.OpenPauseWindow(this, pauseWindow); }
// Обновление рангов public void RefreshRanks() { if (person.CurrentTime.Days == 2 && person.Rank.Id <= 1) { person.Rank = new Rank(Rank.GetRankNameById(2)); } if (person.CurrentTime.Days == 4 && person.Rank.Id <= 2) { person.Rank = new Rank(Rank.GetRankNameById(3)); } if (person.WorkDay >= 10 && person.WorkDay < 25) { person.Rank = new Rank(Rank.GetRankNameById(4)); } if (person.WorkDay >= 25 && person.WorkDay < 50) { person.Rank = new Rank(Rank.GetRankNameById(5)); } if (person.WorkDay >= 50) { person.Rank = new Rank(Rank.GetRankNameById(6)); // Победа WinWindow winWindow = new WinWindow(homeWindow); WPF_Misc.FocusWindow(winWindow); WPF_Misc.OpenPauseWindow(homeWindow, winWindow, false); } }
private void BtnEndGame_Click(object sender, RoutedEventArgs e) { WPF_Misc.OpenNewWindow(this, new MainWindow(), false, false); // Вместе с этим окном закроется и окно паузы, т.к. это окно-родитель homeWindow.MainWindow.Close(); homeWindow.Close(); }
// Инициализация иконок характеристик void InitImages() { imgSatiety.Source = WPF_Misc.ImageSourceFromBitmap(DoctorSimulator.Properties.Resources.Satiety); imgMood.Source = WPF_Misc.ImageSourceFromBitmap(WPF_Misc.GetMoodImage(Person.Mood)); imgIntelect.Source = WPF_Misc.ImageSourceFromBitmap(DoctorSimulator.Properties.Resources.Intelect); imgGold.Source = WPF_Misc.ImageSourceFromBitmap(DoctorSimulator.Properties.Resources.Gold); imgRank.Source = WPF_Misc.ImageSourceFromBitmap(DoctorSimulator.Properties.Resources.Rank); }
// Обновление характеристик public void RefreshCharacteristics() { homeWindow.tblSatiety.Text = person.Satiety.ToString(); homeWindow.tblMood.Text = person.Mood.ToString(); homeWindow.imgMood.Source = WPF_Misc.ImageSourceFromBitmap(WPF_Misc.GetMoodImage(person.Mood)); homeWindow.tblIntelect.Text = person.Intelect.ToString(); homeWindow.tblGold.Text = person.Money.ToString(); homeWindow.cc.Text = person.Rank.Name; homeWindow.tblTime.Text = person.GetTimeString(); }
// Течение игрового времени public async void ProcessTime() { homeWindow.tblTime.Text = person.GetTimeString(); int i = 0; while (true) { if (homeWindow.IsActive) { if (breakCurrentTime) { breakCurrentTime = false; break; } person.CurrentTime = person.CurrentTime.Add(TimeSpan.FromMinutes(this.GameHoursPerOneRealMinute)); homeWindow.tblTime.Text = person.GetTimeString(); i++; if (i == (60 / this.GameHoursPerOneRealMinute)) { if (person.Satiety < 3) { // Поражение LostWindow lostWindow = new LostWindow(homeWindow); WPF_Misc.FocusWindow(lostWindow); WPF_Misc.OpenPauseWindow(homeWindow, lostWindow, false); } person.Satiety -= 3; i = 0; } RefreshCharacteristics(); RefreshRanks(); RefreshSomeUIElements(); await Task.Delay(1000); } else { await Task.Delay(1000); } } }
private void LoadProcess(string buttonContent) { List <Save> saves = Save.GetAllSaves(); for (int i = 0; i < saves.Count; i++) { if (saves[i].Name == buttonContent) { homeWindow.Game.BreakCurrentTime(); if (mainWindow != null) { WPF_Misc.OpenNewWindow(mainWindow, new HomeWindow(saves[i].Game, saves[i].Person, mainWindow)); } else { WPF_Misc.OpenNewWindow(homeWindow, new HomeWindow(saves[i].Game, saves[i].Person, homeWindow.MainWindow)); } this.Close(); break; } } }
public void btnBooks_Click(object sender, RoutedEventArgs e) { WPF_Misc.OpenPauseWindow(this, new LITER(Person)); }