private void PreloadingComputer() { if (GameEnvironment.Computers.CurrentPlayerComputer == null) { Desktop.Visibility = Visibility.Collapsed; DesktopWidgets.Visibility = Visibility.Collapsed; NoComputerPanel.Visibility = Visibility.Visible; if (GameEnvironment.Computers.PlayerComputers.Count == 0) { NoComputerText.Text = "О ужас, у вас нет компьютера! Нужно это срочно исправить, вот вам пошаговое руководство как исправить это недоразумение:" + Environment.NewLine + "1. Раздобудьте денег (можно устроиться на работу, можно взять кредит тут уж сами решайте)" + Environment.NewLine + "2. Закупитесь комплектующими в магазине \"" + Properties.Resources.ComponentStoreName + "\", при покупке обращайте внимание на совместимость компонентов" + Environment.NewLine + "3. В меню \"Установка комплектуюющих\" создай новую сборку и добавь к ней купленные компоненты" + Environment.NewLine + "4. В игре можно собирать и хранить несколько компьютеров, однако единовременно работать можно только за одним. Поэтому не забудь созданную сборку установить как сборку по умолчанию." + Environment.NewLine + "5. Теперь пришла пора проверить правильно ли был собран компьютер и запустить его, сделать это можно в меню \"Тестирование и запуск\"" + Environment.NewLine + "6. Наслаждаться гудением свежесобранного компьютера!"; state = ComputerStates.NoComputer; } else { NoComputerText.Text = "У вас есть компьютерная сборка но она не установлена по умолчанию."; state = ComputerStates.NoDefaultBuild; } } else { if (!GameEnvironment.Computers.CurrentPlayerComputer.IsEnable) { Desktop.Visibility = Visibility.Collapsed; DesktopWidgets.Visibility = Visibility.Collapsed; NoComputerPanel.Visibility = Visibility.Visible; NoComputerText.Text = ""; state = ComputerStates.СomputerNotTurnedOn; return; } if (state == ComputerStates.СomputerNotTurnedOn) { ComputerBootPanel.Visibility = Visibility.Visible; OutputFromComputer.Text = new BIOS().GetBIOSText(MotherboardBIOS.AMI) + Environment.NewLine + GameEnvironment.Computers.CurrentPlayerComputer.Motherboard.Name + " BIOS Date:" + GameEnvironment.GameEvents.GameTimer.DateAndTime.ToString("MM/dd/yy") + Environment.NewLine + "CPU : " + GameEnvironment.Computers.CurrentPlayerComputer.CPU.Name + " @ " + GameEnvironment.Computers.CurrentPlayerComputer.CPU.Properties.MinCPUFrequency + "MHz"; GameEnvironment.GameEvents.Events.Add(new GameEvent("ComputerBoot", GameEnvironment.GameEvents.GameTimer.DateAndTime.AddHours(1), Periodicity.Hour, 1, ComputerBoot)); state = ComputerStates.Loading; } } }
private void LoadFromCD(GameEvent @event) { Collection <OpticalDisc> opticalDiscs = new Collection <OpticalDisc>(); foreach (OpticalDrive opticalDrive in GameEnvironment.Computers.CurrentPlayerComputer.OpticalDrives) { if (opticalDrive.Properties.OpticalDisc != null) { opticalDiscs.Add(opticalDrive.Properties.OpticalDisc); } } if (opticalDiscs.Count != 0) { OutputFromComputer.Visibility = Visibility.Collapsed; ComputerBootPanel.Children.RemoveRange(1, ComputerBootPanel.Children.Count); ComputerBootPanel.Children.Add(new OSInstallation(GameEnvironment)); state = ComputerStates.InstallationOS; } else { OutputFromComputer.Text = "Reboot and Select proper Boot device \r or Insert Boot Media in selected Boot device"; } }
private void ComputerBoot(GameEvent @event) { if (state < ComputerStates.Loading) { return; } if (state == ComputerStates.LoadedOS) { return; } if (state == ComputerStates.InstallationOS) { return; } OutputFromComputer.Visibility = Visibility.Visible; ComputerBootPanel.Visibility = Visibility.Collapsed; foreach (HDD hdd in GameEnvironment.Computers.CurrentPlayerComputer.HDDs) { bool isInstalledOS = false; foreach (Partition partition in hdd.Properties.Partitions) { if (partition.OperatingSystem != null) { isInstalledOS = true; break; } } if (isInstalledOS) { // = ЗАГРУЗКА ВИДЖЕТОВ ============================================================ // WidgetPanel.Children.Clear(); Widgets.PlayerWidgets.Clear(); Widgets.PlayerWidgets.Add(new Widget(new PlayerWidget(GameEnvironment))); Widgets.PlayerWidgets.Add(new Widget(new MoneyWidget(GameEnvironment))); Widgets.PlayerWidgets.Add(new Widget(new ComputerWidget(GameEnvironment))); Widgets.Draw(WidgetPanel); // ================================================================================ // ImageBrush brush = new ImageBrush { ImageSource = new BitmapImage(new Uri("pack://application:,,,/Resources/agriculture.jpg")), Stretch = Stretch.UniformToFill }; this.Background = brush; NoComputerPanel.Visibility = Visibility.Collapsed; Desktop.Visibility = Visibility.Visible; DesktopWidgets.Visibility = Visibility.Visible; DrawDesktop(); state = ComputerStates.LoadedOS; return; } } if (state == ComputerStates.BootFromDisk) { return; } ComputerBootPanel.Visibility = Visibility.Visible; Collection <OpticalDisc> opticalDiscs = new Collection <OpticalDisc>(); foreach (OpticalDrive opticalDrive in GameEnvironment.Computers.CurrentPlayerComputer.OpticalDrives) { if (opticalDrive.Properties.OpticalDisc != null) { opticalDiscs.Add(opticalDrive.Properties.OpticalDisc); break; } } if (opticalDiscs.Count == 0) { OutputFromComputer.Text = "Reboot and Select proper Boot device \r or Insert Boot Media in selected Boot device"; } else { OutputFromComputer.Text = "Load from CD..."; GameEnvironment.GameEvents.Events.Add(new GameEvent("", GameEnvironment.GameEvents.GameTimer.DateAndTime.AddHours(1), Periodicity.Hour, 1, LoadFromCD)); state = ComputerStates.BootFromDisk; } }