Esempio n. 1
0
        public static void init(GraphicsDevice gDevice, SpriteBatch spriteBatch, ContentManager content)
        {
            PostProcessor.device = gDevice;
            PostProcessor.GenerateMainTarget(gDevice);
            GraphicsDevice graphicsDevice1 = gDevice;
            Viewport       viewport1       = gDevice.Viewport;
            int            width1          = viewport1.Width;

            viewport1 = gDevice.Viewport;
            int height1 = viewport1.Height;

            PostProcessor.backTarget = new RenderTarget2D(graphicsDevice1, width1, height1);
            GraphicsDevice graphicsDevice2 = gDevice;
            Viewport       viewport2       = gDevice.Viewport;
            int            width2          = viewport2.Width;

            viewport2 = gDevice.Viewport;
            int height2 = viewport2.Height;

            PostProcessor.dangerBufferTarget = new RenderTarget2D(graphicsDevice2, width2, height2);
            PostProcessor.sb     = spriteBatch;
            PostProcessor.bloom  = content.Load <Effect>("Shaders/Bloom");
            PostProcessor.blur   = content.Load <Effect>("Shaders/DOFBlur");
            PostProcessor.danger = content.Load <Effect>("Shaders/DangerEffect");
            PostProcessor.blur.CurrentTechnique   = PostProcessor.blur.Techniques["SmoothGaussBlur"];
            PostProcessor.danger.CurrentTechnique = PostProcessor.danger.Techniques["PostProcess"];
            PostProcessor.bloomColor = new Color(90, 90, 90, 0);
            PostProcessor.bloomAbsenceHighlighterColor = new Color(70, 70, 70, 0);
            PostProcessor.dangerLineColor    = new Color((int)byte.MaxValue, (int)byte.MaxValue, (int)byte.MaxValue, 0);
            PostProcessor.dangerLineColorAlt = new Color(240, 0, 0, 0);
        }
Esempio n. 2
0
        public void apply()
        {
            bool flag = false;

            if (this.windowed != this.getIfWindowed())
            {
                Game1.getSingleton().graphics.ToggleFullScreen();
                Settings.windowed = this.getIfWindowed();
                flag = true;
            }
            if (this.resolutionChanged)
            {
                string[] strArray = this.resolutions[this.currentResIndex].Split(this.xArray);
                int      int32_1 = Convert.ToInt32(strArray[0]);
                int      int32_2 = Convert.ToInt32(strArray[1]);
                Game1.getSingleton().graphics.PreferredBackBufferWidth = int32_1;
                Game1.getSingleton().graphics.PreferredBackBufferHeight = int32_2;
                Game1.getSingleton().graphics.PreferMultiSampling = SettingsLoader.ShouldMultisample;
                PostProcessor.GenerateMainTarget(Game1.getSingleton().graphics.GraphicsDevice);
            }
            GuiData.ActivateFontConfig(this.fontConfigs[this.currentFontIndex]);
            if (this.resolutionChanged || flag)
            {
                Game1.getSingleton().graphics.ApplyChanges();
                Game1.getSingleton().setNewGraphics();
            }
            else
            {
                this.ExitScreen();
            }
            SettingsLoader.writeStatusFile();
        }
Esempio n. 3
0
 protected void LoadGraphicsContent()
 {
     this.spriteBatch = new SpriteBatch(this.GraphicsDevice);
     if (this.NeedsSettingsLocaleActivation)
     {
         SettingsLoader.ShouldMultisample = this.GraphicsDevice.Adapter.IsProfileSupported(GraphicsProfile.HiDef);
     }
     PostProcessor.init(this.graphics.GraphicsDevice, this.spriteBatch, this.Content);
     WebRenderer.init(this.graphics.GraphicsDevice);
 }
Esempio n. 4
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();
        }
Esempio n. 5
0
        public static void SendErrorEmail(Exception ex, string postfix = "", string extraData = "")
        {
            var body =
                string.Concat(
                    GenerateReportFromException(ex) + "\r\n White:" + white + "\r\n WhiteDisposed:" +
                    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 + "\r\n Extra:\r\n" + extraData + "\r\n";

            SendRealWorldEmail(
                "Hackent " + postfix + MainMenu.OSVersion + " Crash " + DateTime.Now.ToShortDateString() + " " +
                DateTime.Now.ToShortTimeString(), "*****@*****.**", body);
        }
Esempio n. 6
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            if (drawingWithEffects)
            {
                PostProcessor.begin();
            }
            GuiData.startDraw();
            var viewport = ScreenManager.GraphicsDevice.Viewport;

            GuiData.spriteBatch.Draw(Utils.white, new Rectangle(0, 0, viewport.Width, viewport.Height), backgroundColor);
            var x    = 80;
            var num1 = 80;

            TextItem.doFontLabel(new Vector2(x, num1), "HACKNET RELAY SERVER", GuiData.titlefont, new Color?(), 500f,
                                 50f);
            var y1 = num1 + 55;

            if (canCloseServer && Button.doButton(800, x, y1, 160, 30, "Shut Down Server", new Color?()))
            {
                server.closeServer();
                ExitScreen();
            }
            var num2 = y1 + 35;

            for (var index = 0; index < MultiplayerLobby.allLocalIPs.Count; ++index)
            {
                TextItem.doFontLabel(new Vector2(x, num2), "IP: " + MultiplayerLobby.allLocalIPs[index],
                                     GuiData.smallfont, new Color?(), float.MaxValue, float.MaxValue);
                num2 += 20;
            }
            var y2 = num2 + 30;

            drawMessageLog(x, y2);
            GuiData.endDraw();
            if (!drawingWithEffects)
            {
                return;
            }
            PostProcessor.end();
        }
Esempio n. 7
0
        public static void end()
        {
            PostProcessor.device.SetRenderTarget(PostProcessor.backTarget);
            PostProcessor.sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.AnisotropicClamp, DepthStencilState.Default, RasterizerState.CullNone, PostProcessor.blur);
            PostProcessor.sb.Draw((Texture2D)PostProcessor.target, Vector2.Zero, Color.White);
            PostProcessor.sb.End();
            RenderTarget2D renderTarget = PostProcessor.dangerModeEnabled ? PostProcessor.dangerBufferTarget : (RenderTarget2D)null;

            PostProcessor.device.SetRenderTarget(renderTarget);
            if (PostProcessor.EndingSequenceFlashOutActive)
            {
                PostProcessor.device.Clear(Color.Black);
            }
            PostProcessor.sb.Begin();
            Rectangle fullscreenRect = PostProcessor.GetFullscreenRect();

            if (PostProcessor.EndingSequenceFlashOutActive)
            {
                FlickeringTextEffect.DrawFlickeringSprite(PostProcessor.sb, fullscreenRect, (Texture2D)PostProcessor.target, 12f, 0.0f, (object)null, Color.White);
            }
            else
            {
                PostProcessor.sb.Draw((Texture2D)PostProcessor.target, fullscreenRect, Color.White);
            }
            if (PostProcessor.bloomEnabled)
            {
                PostProcessor.sb.Draw((Texture2D)PostProcessor.backTarget, fullscreenRect, PostProcessor.bloomColor);
            }
            else
            {
                PostProcessor.sb.Draw((Texture2D)PostProcessor.target, fullscreenRect, PostProcessor.bloomAbsenceHighlighterColor);
            }
            PostProcessor.sb.End();
            if (!PostProcessor.dangerModeEnabled)
            {
                return;
            }
            PostProcessor.DrawDangerModeFliters();
        }
Esempio n. 8
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            PostProcessor.begin();
            GuiData.startDraw();
            GuiData.spriteBatch.Draw(Utils.white, this.Fullscreen, Color.Black);
            if (this.IsDLCDemoScreen)
            {
                this.HexBackground.Draw(Utils.GetFullscreen(), GuiData.spriteBatch, Utils.AddativeRed * 0.2f, Color.Black, HexGridBackground.ColoringAlgorithm.OutlinedSinWash, 0.0f);
                this.pointEffect.Render(Utils.GetFullscreen(), GuiData.spriteBatch);
                GuiData.spriteBatch.Draw(Utils.white, this.Fullscreen, Color.Black * 0.5f);
            }
            Rectangle dest = Utils.InsetRectangle(this.Fullscreen, 200);

            dest.Y      = dest.Y + dest.Height / 2 - 200;
            dest.Height = 400;
            Rectangle destinationRectangle = new Rectangle(this.Fullscreen.X, dest.Y + 50, this.Fullscreen.Width, dest.Height - 148);

            GuiData.spriteBatch.Draw(Utils.white, destinationRectangle, Utils.AddativeRed * (0.5f + Utils.randm(0.1f)));
            string text = "HACKNET";

            FlickeringTextEffect.DrawLinedFlickeringText(dest, text, this.IsDLCDemoScreen ? 5f : 18f, this.IsDLCDemoScreen ? 0.8f : 0.7f, GuiData.titlefont, (object)null, Color.White, 6);
            dest.Y     += 400;
            dest.Height = 120;
            SpriteFont font = GuiData.titlefont;

            if (Settings.ActiveLocale != "en-us")
            {
                font = GuiData.font;
            }
            string input = this.IsDLCDemoScreen ? "EXPANSION COMING DECEMBER" : "MORE SOON";

            FlickeringTextEffect.DrawFlickeringText(dest, Utils.FlipRandomChars(LocaleTerms.Loc(input), this.IsDLCDemoScreen ? 0.0045 : 0.008), -8f, 0.7f, font, (object)null, Color.Gray);
            FlickeringTextEffect.DrawFlickeringText(dest, Utils.FlipRandomChars(LocaleTerms.Loc(input), 0.03), -8f, 0.7f, font, (object)null, Utils.AddativeWhite * 0.15f);
            GuiData.endDraw();
            PostProcessor.end();
        }
Esempio n. 9
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            try
            {
                PostProcessor.begin();
                this.ScreenManager.FadeBackBufferToBlack((int)byte.MaxValue);
                GuiData.startDraw();
                Rectangle dest1 = new Rectangle(0, 0, this.ScreenManager.GraphicsDevice.Viewport.Width, this.ScreenManager.GraphicsDevice.Viewport.Height);
                Rectangle destinationRectangle = new Rectangle(-20, -20, this.ScreenManager.GraphicsDevice.Viewport.Width + 40, this.ScreenManager.GraphicsDevice.Viewport.Height + 40);
                Rectangle 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);
                if (Settings.DrawHexBackground)
                {
                    this.hexBackground.Draw(dest1, GuiData.spriteBatch, Color.Transparent, Settings.lighterColorHexBackground ? new Color(20, 20, 20) : new Color(15, 15, 15, 0), HexGridBackground.ColoringAlgorithm.NegaitiveSinWash, 0.0f);
                }
                TextItem.DrawShadow = false;
                switch (this.State)
                {
                case MainMenu.MainMenuState.NewUser:
                    this.DrawLoginScreen(dest2, true);
                    break;

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

                case MainMenu.MainMenuState.Extensions:
                    this.DrawBackgroundAndTitle();
                    this.extensionsScreen.Draw(new Rectangle(180, 150, Math.Min(700, dest1.Width / 2), (int)((double)dest1.Height * 0.699999988079071)), GuiData.spriteBatch, this.ScreenManager);
                    break;

                default:
                    if (Settings.isLockedDemoMode)
                    {
                        this.attractModeScreen.Draw(dest1, GuiData.spriteBatch);
                        break;
                    }
                    bool canRun = this.DrawBackgroundAndTitle();
                    if (Settings.isLockedDemoMode)
                    {
                        this.drawDemoModeButtons(canRun);
                    }
                    else
                    {
                        this.drawMainMenuButtons(canRun);
                        if (Settings.testingMenuItemsEnabled)
                        {
                            this.drawTestingMainMenuButtons(canRun);
                        }
                    }
                    break;
                }
                GuiData.endDraw();
                PostProcessor.end();
                this.ScreenManager.FadeBackBufferToBlack((int)byte.MaxValue - (int)this.TransitionAlpha);
            }
            catch (ObjectDisposedException ex)
            {
                if (this.hasSentErrorEmail)
                {
                    throw ex;
                }
                string body = Utils.GenerateReportFromException((Exception)ex) + "\r\n Font:" + (object)this.titleFont + "\r\n White:" + (object)Utils.white + "\r\n WhiteDisposed:" + (object)Utils.white.IsDisposed + "\r\n SmallFont:" + (object)GuiData.smallfont + "\r\n TinyFont:" + (object)GuiData.tinyfont + "\r\n LineEffectTarget:" + FlickeringTextEffect.GetReportString() + "\r\n PostProcessort stuff:" + PostProcessor.GetStatusReportString() + "\r\nRESOLUTION:\r\n " + (object)Game1.getSingleton().GraphicsDevice.PresentationParameters.BackBufferWidth + "x" + (object)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.Adapter.DeviceName + "\r\n Status: " + (object)Game1.getSingleton().GraphicsDevice.GraphicsDeviceStatus;
                Utils.SendRealWorldEmail("Hacknet " + MainMenu.OSVersion + " Crash " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(), "*****@*****.**", body);
                this.hasSentErrorEmail = true;
                SettingsLoader.writeStatusFile();
            }
        }
Esempio n. 10
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            PostProcessor.begin();
            this.ScreenManager.FadeBackBufferToBlack((int)byte.MaxValue);
            GuiData.startDraw();
            int      x        = 0;
            int      y        = 0;
            Viewport viewport = this.ScreenManager.GraphicsDevice.Viewport;
            int      width    = viewport.Width;

            viewport = this.ScreenManager.GraphicsDevice.Viewport;
            int height = viewport.Height;

            PatternDrawer.draw(new Rectangle(x, y, width, height), 0.5f, Color.Black, new Color(2, 2, 2), GuiData.spriteBatch);
            if (Button.doButton(999, 10, 10, 220, 30, "<- " + LocaleTerms.Loc("Back"), new Color?(Color.Gray)))
            {
                SettingsLoader.writeStatusFile();
                this.ExitScreen();
            }
            if (Button.doButton(9907, 10, 44, 220, 20, LocaleTerms.Loc("Apply Changes"), new Color?(Color.LightBlue)))
            {
                this.needsApply = true;
            }
            int num1 = 100;

            TextItem.doLabel(new Vector2(400f, (float)num1), LocaleTerms.Loc("Resolutions"), new Color?(), 200f);
            int currentResIndex = this.currentResIndex;

            this.currentResIndex = SelectableTextList.doFancyList(10, 400, num1 + 36, 200, 450, this.resolutions, this.currentResIndex, new Color?(), false);
            if (!this.mouseHasBeenReleasedOnThisScreen)
            {
                this.currentResIndex = currentResIndex;
            }
            else if (SelectableTextList.wasActivated)
            {
                this.resolutionChanged = true;
            }
            if (!this.startedFromGameContext)
            {
                TextItem.doLabel(new Vector2(620f, (float)num1), LocaleTerms.Loc("Language"), new Color?(), 200f);
                int currentLocaleIndex = this.currentLocaleIndex;
                this.currentLocaleIndex = SelectableTextList.doFancyList(1013, 620, num1 + 36, 200, 450, this.localeNames, this.currentLocaleIndex, new Color?(), false);
                if (!this.mouseHasBeenReleasedOnThisScreen)
                {
                    this.currentLocaleIndex = currentLocaleIndex;
                }
                else if (SelectableTextList.wasActivated)
                {
                    LocaleActivator.ActivateLocale(LocaleActivator.SupportedLanguages[this.currentLocaleIndex].Code, Game1.getSingleton().Content);
                    Settings.ActiveLocale = LocaleActivator.SupportedLanguages[this.currentLocaleIndex].Code;
                }
            }
            int   num2     = 64;
            float MaxWidth = 280f;
            int   num3;

            TextItem.doLabel(new Vector2(100f, (float)(num3 = num2 + 36)), LocaleTerms.Loc("Fullscreen"), new Color?(), MaxWidth);
            int num4;

            this.windowed = CheckBox.doCheckBox(20, 100, num4 = num3 + 34, this.windowed, new Color?());
            int num5;

            TextItem.doLabel(new Vector2(100f, (float)(num5 = num4 + 32)), LocaleTerms.Loc("Bloom"), new Color?(), MaxWidth);
            int num6;

            PostProcessor.bloomEnabled = CheckBox.doCheckBox(21, 100, num6 = num5 + 34, PostProcessor.bloomEnabled, new Color?());
            int num7;

            TextItem.doLabel(new Vector2(100f, (float)(num7 = num6 + 32)), LocaleTerms.Loc("Scanlines"), new Color?(), MaxWidth);
            int num8;

            PostProcessor.scanlinesEnabled = CheckBox.doCheckBox(22, 100, num8 = num7 + 34, PostProcessor.scanlinesEnabled, new Color?());
            int num9;

            TextItem.doLabel(new Vector2(100f, (float)(num9 = num8 + 32)), LocaleTerms.Loc("Multisampling"), new Color?(), MaxWidth);
            bool shouldMultisample = SettingsLoader.ShouldMultisample;
            int  num10;

            SettingsLoader.ShouldMultisample = CheckBox.doCheckBox(221, 100, num10 = num9 + 34, SettingsLoader.ShouldMultisample, new Color?());
            if (shouldMultisample != SettingsLoader.ShouldMultisample)
            {
                this.resolutionChanged = true;
            }
            int num11;

            TextItem.doLabel(new Vector2(100f, (float)(num11 = num10 + 32)), LocaleTerms.Loc("Audio Visualiser"), new Color?(), MaxWidth);
            int num12;

            SettingsLoader.ShouldDrawMusicVis = CheckBox.doCheckBox(223, 100, num12 = num11 + 34, SettingsLoader.ShouldDrawMusicVis, new Color?());
            int num13;

            TextItem.doLabel(new Vector2(100f, (float)(num13 = num12 + 32)), LocaleTerms.Loc("Sound Enabled"), new Color?(), MaxWidth);
            int num14;

            MusicManager.setIsMuted(!CheckBox.doCheckBox(23, 100, num14 = num13 + 34, !MusicManager.isMuted, new Color?()));
            int num15;

            TextItem.doLabel(new Vector2(100f, (float)(num15 = num14 + 32)), LocaleTerms.Loc("Music Volume"), new Color?(), MaxWidth);
            int num16;

            MusicManager.setVolume(SliderBar.doSliderBar(24, 100, num16 = num15 + 34, 210, 30, 1f, 0.0f, MusicManager.getVolume(), 1f / 1000f));
            int num17;

            TextItem.doLabel(new Vector2(100f, (float)(num17 = num16 + 32)), LocaleTerms.Loc("Text Size"), new Color?(), MaxWidth);
            int currentFontIndex = this.currentFontIndex;
            int num18;

            this.currentFontIndex = SelectableTextList.doFancyList(25, 100, num18 = num17 + 34, 200, 160, this.fontConfigs, this.currentFontIndex, new Color?(), false);
            if (this.currentFontIndex != currentFontIndex && this.startedFromGameContext)
            {
                try
                {
                    if (OS.currentInstance != null)
                    {
                        OS.currentInstance.terminal.reset();
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine((object)ex);
                    Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex));
                }
            }
            if (Button.doButton(990, 10, num18 + 150, 220, 30, LocaleTerms.Loc("Apply Changes"), new Color?(Color.LightBlue)))
            {
                this.needsApply = true;
            }
            GuiData.endDraw();
            PostProcessor.end();
        }
Esempio n. 11
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();
            }
        }
Esempio n. 12
0
 protected void LoadGraphicsContent()
 {
     spriteBatch = new SpriteBatch(GraphicsDevice);
     PostProcessor.init(graphics.GraphicsDevice, spriteBatch, Content);
     WebRenderer.init(graphics.GraphicsDevice);
 }