public override void Draw(GameTime gameTime) { base.Draw(gameTime); this.ScreenManager.FadeBackBufferToBlack((int)Math.Min(this.TransitionAlpha, (byte)150)); GuiData.startDraw(); float num = 1f - this.TransitionPosition; PatternDrawer.draw(this.contentRect, 1f, (this.isWinner ? this.winBacking : this.lossBacking) * num, (this.isWinner ? this.winPattern : this.lossPattern) * num, GuiData.spriteBatch); string text = this.isWinner ? "VICTORY" : "DEFEAT"; Vector2 pos = this.font.MeasureString(text); pos.X = (float)(this.contentRect.X + this.contentRect.Width / 2) - pos.X / 2f; pos.Y = (float)(this.contentRect.Y + this.contentRect.Height / 2) - pos.Y / 2f; TextItem.DrawShadow = false; TextItem.doFontLabel(pos, text, this.font, new Color?(Color.White * num), float.MaxValue, float.MaxValue, false); if (Button.doButton(1008, this.contentRect.X + 10, this.contentRect.Y + this.contentRect.Height - 60, 230, 55, LocaleTerms.Loc("Exit"), new Color?(Color.Black))) { if (OS.currentInstance != null) { OS.currentInstance.ExitScreen(); } this.ExitScreen(); this.ScreenManager.AddScreen((GameScreen) new MainMenu()); } GuiData.endDraw(); }
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(); }
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); }
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(); }
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(); }
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(); }
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(); } }
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(); }
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(); } }