public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            ScreenManager.FadeBackBufferToBlack(Math.Min(TransitionAlpha, (byte)150));
            GuiData.startDraw();
            var num = 1f - TransitionPosition;

            PatternDrawer.draw(contentRect, 1f, (isWinner ? winBacking : lossBacking) * num,
                               (isWinner ? winPattern : lossPattern) * num, GuiData.spriteBatch);
            var text = isWinner ? "VICTORY" : "DEFEAT";
            var pos  = font.MeasureString(text);

            pos.X = contentRect.X + contentRect.Width / 2 - pos.X / 2f;
            pos.Y = contentRect.Y + contentRect.Height / 2 - pos.Y / 2f;
            TextItem.DrawShadow = false;
            TextItem.doFontLabel(pos, text, font, Color.White * num, float.MaxValue, float.MaxValue);
            if (Button.doButton(1008, contentRect.X + 10, contentRect.Y + contentRect.Height - 60, 230, 55, "Exit",
                                Color.Black))
            {
                if (OS.currentInstance != null)
                {
                    OS.currentInstance.ExitScreen();
                }
                ExitScreen();
                ScreenManager.AddScreen(new MainMenu());
            }
            GuiData.endDraw();
        }
Пример #2
0
 public override void Draw(GameTime gameTime)
 {
     base.Draw(gameTime);
     GuiData.startDraw();
     ScreenManager.SpriteBatch.Draw(Utils.white, fullscreen, isConnecting ? Color.Gray : Color.Black);
     doGui();
     GuiData.endDraw();
     ScreenManager.FadeBackBufferToBlack(byte.MaxValue - TransitionAlpha);
 }
Пример #3
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            PostProcessor.begin();
            ScreenManager.FadeBackBufferToBlack(byte.MaxValue);
            GuiData.startDraw();
            PatternDrawer.draw(
                new Rectangle(0, 0, ScreenManager.GraphicsDevice.Viewport.Width,
                              ScreenManager.GraphicsDevice.Viewport.Height), 0.5f, Color.Black, new Color(2, 2, 2),
                GuiData.spriteBatch);
            if (Button.doButton(999, 10, 10, 200, 30, "<- Back", Color.Gray))
            {
                SettingsLoader.writeStatusFile();
                ExitScreen();
            }
            TextItem.doLabel(new Vector2(400f, 65f), "Resolutions", new Color?());
            var num = currentResIndex;

            currentResIndex = SelectableTextList.doFancyList(10, 400, 100, 200, 450, resolutions, currentResIndex,
                                                             new Color?(), false);
            if (!mouseHasBeenReleasedOnThisScreen)
            {
                currentResIndex = num;
            }
            else if (SelectableTextList.wasActivated)
            {
                resolutionChanged = true;
            }
            TextItem.doLabel(new Vector2(100f, 64f), "Fullscreen", new Color?());
            windowed = CheckBox.doCheckBox(20, 100, 100, windowed, new Color?());
            TextItem.doLabel(new Vector2(100f, 124f), "Bloom", new Color?());
            PostProcessor.bloomEnabled = CheckBox.doCheckBox(21, 100, 160, PostProcessor.bloomEnabled, new Color?());
            TextItem.doLabel(new Vector2(100f, 184f), "Scanlines", new Color?());
            PostProcessor.scanlinesEnabled = CheckBox.doCheckBox(22, 100, 220, PostProcessor.scanlinesEnabled,
                                                                 new Color?());
            TextItem.doLabel(new Vector2(100f, 244f), "Sound Enabled", new Color?());
            MusicManager.setIsMuted(!CheckBox.doCheckBox(23, 100, 280, !MusicManager.isMuted, new Color?()));
            TextItem.doLabel(new Vector2(100f, 305f), "Music Volume", new Color?());
            MusicManager.setVolume(SliderBar.doSliderBar(24, 100, 350, 210, 30, 1f, 0.0f, MusicManager.getVolume(),
                                                         1.0f / 1000.0f));
            TextItem.doLabel(new Vector2(100f, 384f), "Text Size", new Color?());
            currentFontIndex = SelectableTextList.doFancyList(25, 100, 414, 200, 160, fontConfigs, currentFontIndex,
                                                              new Color?(), false);
            if (Button.doButton(990, 10, ScreenManager.GraphicsDevice.Viewport.Height - 120, 200, 30, "Apply Changes",
                                Color.LightBlue))
            {
                needsApply = true;
            }
            GuiData.endDraw();
            PostProcessor.end();
        }
Пример #4
0
        public override void Draw(GameTime gameTime)
        {
            var spriteBatch = ScreenManager.SpriteBatch;
            var spriteFont  = GuiData.font;

            ScreenManager.FadeBackBufferToBlack(Math.Min(TransitionAlpha, (byte)140));
            var    viewport = ScreenManager.GraphicsDevice.Viewport;
            var    position = new Vector2(viewport.Width, viewport.Height) / 2f - spriteFont.MeasureString(message) / 2f;
            var    color    = new Color(22, 22, 22, byte.MaxValue);
            double num      = TransitionPosition;

            if (ScreenState == ScreenState.TransitionOff)
            {
                return;
            }
            spriteBatch.Begin();
            spriteBatch.Draw(top, topLeft, color);
            spriteBatch.Draw(mid, contentBounds, color);
            spriteBatch.Draw(top, topLeft + new Vector2(0.0f, top.Height + contentBounds.Height), color);
            spriteBatch.DrawString(spriteFont, message, position, Color.White);
            var x = contentBounds.X + contentBounds.Width - 125;
            var y = contentBounds.Y + contentBounds.Height + top.Height - 40;

            if (Button.doButton(331, x, y, 120, 27, "Resume", new Color?()))
            {
                if (Cancelled != null)
                {
                    Cancelled(this, new PlayerIndexEventArgs(ScreenManager.controllingPlayer));
                }
                ExitScreen();
            }
            if (Button.doButton(332, contentBounds.X + 5, y, 120, 27, "Quit Hacknet", new Color?()))
            {
                if (Accepted != null)
                {
                    Accepted(this, new PlayerIndexEventArgs(ScreenManager.controllingPlayer));
                }
                ExitScreen();
            }
            spriteBatch.End();
        }
Пример #5
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            try
            {
                PostProcessor.begin();
                ScreenManager.FadeBackBufferToBlack(byte.MaxValue);
                GuiData.startDraw();
                var dest1 = new Rectangle(0, 0, ScreenManager.GraphicsDevice.Viewport.Width,
                                          ScreenManager.GraphicsDevice.Viewport.Height);
                var destinationRectangle = new Rectangle(-20, -20, ScreenManager.GraphicsDevice.Viewport.Width + 40,
                                                         ScreenManager.GraphicsDevice.Viewport.Height + 40);
                var dest2 = new Rectangle(dest1.X + dest1.Width / 4, dest1.Height / 4, dest1.Width / 2, dest1.Height / 4);
                GuiData.spriteBatch.Draw(Utils.white, destinationRectangle, Color.Black);
                hexBackground.Draw(dest1, GuiData.spriteBatch, Color.Transparent,
                                   Settings.lighterColorHexBackground ? new Color(20, 20, 20) : new Color(10, 10, 10, 0),
                                   HexGridBackground.ColoringAlgorithm.NegaitiveSinWash, 0.0f);
                TextItem.DrawShadow = false;
                switch (State)
                {
                case MainMenuState.NewUser:
                    DrawLoginScreen(dest2, true);
                    break;

                case MainMenuState.Login:
                    DrawLoginScreen(dest2, false);
                    break;

                default:
                    if (Settings.isLockedDemoMode)
                    {
                        attractModeScreen.Draw(dest1, GuiData.spriteBatch);
                        break;
                    }
                    FlickeringTextEffect.DrawLinedFlickeringText(new Rectangle(180, 120, 340, 100), "HACKNET", 7f,
                                                                 0.55f, titleFont, null, titleColor, 2);
                    TextItem.doFontLabel(new Vector2(520f, 178f), "OS " + OSVersion, GuiData.smallfont,
                                         titleColor * 0.5f, 600f, 26f);
                    var canRun = true;
                    if (Settings.IsExpireLocked)
                    {
                        var    timeSpan = Settings.ExpireTime - DateTime.Now;
                        string text;
                        if (timeSpan.TotalSeconds < 1.0)
                        {
                            text   = "TEST BUILD EXPIRED - EXECUTION DISABLED";
                            canRun = false;
                        }
                        else
                        {
                            text = "Test Build : Expires in " + timeSpan;
                        }
                        TextItem.doFontLabel(new Vector2(180f, 105f), text, GuiData.smallfont, Color.Red * 0.8f, 600f,
                                             26f);
                    }
                    if (Settings.isLockedDemoMode)
                    {
                        drawDemoModeButtons(canRun);
                        break;
                    }
                    drawMainMenuButtons(canRun);
                    if (Settings.testingMenuItemsEnabled)
                    {
                        drawTestingMainMenuButtons(canRun);
                    }
                    break;
                }
                GuiData.endDraw();
                PostProcessor.end();
                ScreenManager.FadeBackBufferToBlack(byte.MaxValue - TransitionAlpha);
            }
            catch (ObjectDisposedException ex)
            {
                if (hasSentErrorEmail)
                {
                    throw ex;
                }
                var body =
                    string.Concat(
                        Utils.GenerateReportFromException(ex) + "\r\n Font:" + titleFont +
                        "\r\n White:" + Utils.white + "\r\n WhiteDisposed:" + Utils.white.IsDisposed +
                        "\r\n SmallFont:" + GuiData.smallfont + "\r\n TinyFont:" + GuiData.tinyfont +
                        "\r\n LineEffectTarget:" + FlickeringTextEffect.GetReportString() + "\r\n PostProcessort stuff:" +
                        PostProcessor.GetStatusReportString(), "\r\nRESOLUTION:\r\n ",
                        Game1.GetSingleton().GraphicsDevice.PresentationParameters.BackBufferWidth, "x") +
                    Game1.GetSingleton().GraphicsDevice.PresentationParameters.BackBufferHeight + "\r\nFullscreen: " +
                    (Game1.GetSingleton().graphics.IsFullScreen ? "true" : "false") + "\r\n Adapter: " +
                    Game1.GetSingleton().GraphicsDevice.Adapter.Description + "\r\n Device Name: " +
                    Game1.GetSingleton().GraphicsDevice.GraphicsDeviceStatus;
                Utils.SendRealWorldEmail(
                    "Hackent " + OSVersion + " Crash " + DateTime.Now.ToShortDateString() + " " +
                    DateTime.Now.ToShortTimeString(), "*****@*****.**", body);
                hasSentErrorEmail = true;
                SettingsLoader.writeStatusFile();
            }
        }