Beispiel #1
0
        private void BtnLoadGame_Click(object sender, RoutedEventArgs e)
        {
            LoadWindow loadWindow = new LoadWindow(homeWindow);

            WPF_Misc.FocusWindow(loadWindow);
            WPF_Misc.OpenNewWindow(this, loadWindow, false);
        }
Beispiel #2
0
        private void BtnSaveGame_Click(object sender, RoutedEventArgs e)
        {
            SaveWindow saveWindow = new SaveWindow(homeWindow);

            WPF_Misc.FocusWindow(saveWindow);
            WPF_Misc.OpenNewWindow(this, saveWindow, false);
        }
Beispiel #3
0
        // Кнопка "Пауза"
        void BtnPauseGame_Click(object sender, RoutedEventArgs e)
        {
            PauseWindow pauseWindow = new PauseWindow(this);

            WPF_Misc.FocusWindow(pauseWindow);
            WPF_Misc.OpenPauseWindow(this, pauseWindow);
        }
Beispiel #4
0
        // Обновление рангов
        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);
            }
        }
Beispiel #5
0
        // Течение игрового времени
        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);
                }
            }
        }