예제 #1
0
 public void Draw(RenderTarget target)
 {
     _window.Clear();
     Widgets.Draw(target);
     PopupStack.Draw(target);
     _window.Display();
 }
예제 #2
0
 public virtual void Draw(SpriteBatch spriteBatch)
 {
     FrameSprite?.Draw(spriteBatch, Position);
     Widgets.Draw(spriteBatch);
 }
예제 #3
0
        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;
            }
        }