Exemplo n.º 1
0
        protected override void Update(GameTime gameTime)
        {
            if (!this.HasLoadedContent)
            {
                this.LoadContent();
            }
            if (WebRenderer.Enabled)
            {
                XNAWebRenderer.XNAWR_Update();
            }
            if (!this.resolutionSet)
            {
                this.setNewGraphics();
                this.resolutionSet = true;
            }
            TimeSpan elapsedGameTime = gameTime.ElapsedGameTime;

            PatternDrawer.update((float)elapsedGameTime.TotalSeconds);
            elapsedGameTime = gameTime.ElapsedGameTime;
            GuiData.setTimeStep((float)elapsedGameTime.TotalSeconds);
            elapsedGameTime = gameTime.ElapsedGameTime;
            MusicManager.Update((float)elapsedGameTime.TotalSeconds);
            elapsedGameTime = gameTime.ElapsedGameTime;
            ThemeManager.Update((float)elapsedGameTime.TotalSeconds);
            AlienwareFXManager.UpdateForOS((object)OS.currentInstance);
            base.Update(gameTime);
        }
Exemplo 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();
        }
        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();
        }
Exemplo n.º 4
0
        public void apply()
        {
            var flag = false;

            if (windowed != getIfWindowed())
            {
                Game1.getSingleton().graphics.ToggleFullScreen();
                Settings.windowed = getIfWindowed();
                flag = true;
            }
            if (resolutionChanged)
            {
                var strArray = resolutions[currentResIndex].Split(xArray);
                var num1 = Convert.ToInt32(strArray[0]);
                var num2 = Convert.ToInt32(strArray[1]);
                Game1.getSingleton().graphics.PreferredBackBufferWidth = num1;
                Game1.getSingleton().graphics.PreferredBackBufferHeight = num2;
            }
            GuiData.ActivateFontConfig(fontConfigs[currentFontIndex]);
            if (resolutionChanged || flag)
            {
                Game1.getSingleton().graphics.ApplyChanges();
                Game1.getSingleton().setNewGraphics();
            }
            else
            {
                ExitScreen();
            }
            SettingsLoader.writeStatusFile();
        }
Exemplo n.º 5
0
        public override void HandleInput(InputState input)
        {
            PlayerIndex playerIndex;

            if (input.IsMenuSelect(this.ControllingPlayer, out playerIndex))
            {
                if (this.Accepted != null)
                {
                    this.Accepted((object)this, new PlayerIndexEventArgs(playerIndex));
                }
                if (this.AcceptedClicked != null)
                {
                    this.AcceptedClicked();
                }
                this.ExitScreen();
            }
            else if (input.IsMenuCancel(this.ControllingPlayer, out playerIndex))
            {
                if (this.Cancelled != null)
                {
                    this.Cancelled((object)this, new PlayerIndexEventArgs(playerIndex));
                }
                if (this.CancelClicked != null)
                {
                    this.CancelClicked();
                }
                this.ExitScreen();
            }
            GuiData.doInput(input);
        }
        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();
        }
Exemplo n.º 7
0
 public static bool DebugGoFast()
 {
     if (Settings.debugCommandsEnabled)
     {
         return(GuiData.getKeyboadState().IsKeyDown(Keys.LeftAlt));
     }
     return(false);
 }
Exemplo n.º 8
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);
 }
Exemplo n.º 9
0
 public override void HandleInput(InputState input)
 {
     base.HandleInput(input);
     GuiData.doInput(input);
     if (!Settings.debugCommandsEnabled || !Utils.keyPressed(input, Keys.F8, new PlayerIndex?()))
     {
         return;
     }
     ExitScreen();
     Game1.getSingleton().Exit();
 }
Exemplo n.º 10
0
        public static void InitFontOptions(ContentManager content)
        {
            string name = GuiData.ActiveFontConfig.name;

            GuiData.FontConfigs.Clear();
            GuiData.FontConfigs.Add(new GuiData.FontCongifOption()
            {
                name               = "default",
                smallFont          = content.Load <SpriteFont>("Font12"),
                tinyFont           = content.Load <SpriteFont>("Font10"),
                bigFont            = content.Load <SpriteFont>("Font23"),
                tinyFontCharHeight = 10f
            });
            if (string.IsNullOrEmpty(name))
            {
                GuiData.ActiveFontConfig = GuiData.FontConfigs[0];
            }
            GuiData.FontConfigs.Add(new GuiData.FontCongifOption()
            {
                name               = "medium",
                smallFont          = content.Load <SpriteFont>("Font14"),
                tinyFont           = content.Load <SpriteFont>("Font12"),
                bigFont            = content.Load <SpriteFont>("Font23"),
                tinyFontCharHeight = 14f
            });
            GuiData.FontConfigs.Add(new GuiData.FontCongifOption()
            {
                name               = "large",
                smallFont          = content.Load <SpriteFont>("Font16"),
                tinyFont           = content.Load <SpriteFont>("Font14"),
                bigFont            = content.Load <SpriteFont>("Font23"),
                tinyFontCharHeight = 16f
            });
            bool flag = false;

            for (int index = 0; index < GuiData.FontConfigs.Count; ++index)
            {
                if (GuiData.FontConfigs[index].name == name)
                {
                    GuiData.ActivateFontConfig(GuiData.FontConfigs[index]);
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                GuiData.ActivateFontConfig(GuiData.FontConfigs[0]);
            }
            if (GuiData.LocaleFontConfigs.ContainsKey("en-us"))
            {
                return;
            }
            GuiData.LocaleFontConfigs.Add("en-us", GuiData.FontConfigs);
        }
Exemplo n.º 11
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();
        }
Exemplo n.º 12
0
 protected override void Update(GameTime gameTime)
 {
     if (!HasLoadedContent)
     {
         LoadContent();
     }
     if (!resolutionSet)
     {
         setNewGraphics();
         resolutionSet = true;
     }
     PatternDrawer.update((float)gameTime.ElapsedGameTime.TotalSeconds);
     GuiData.setTimeStep((float)gameTime.ElapsedGameTime.TotalSeconds);
     MusicManager.Update((float)gameTime.ElapsedGameTime.TotalSeconds);
     ThemeManager.Update((float)gameTime.ElapsedGameTime.TotalSeconds);
     base.Update(gameTime);
 }
Exemplo n.º 13
0
        public static void ActivateFontConfig(string configName)
        {
            List <GuiData.FontCongifOption> fontCongifOptionList = GuiData.FontConfigs;

            if (GuiData.LocaleFontConfigs.ContainsKey(Settings.ActiveLocale))
            {
                fontCongifOptionList = GuiData.LocaleFontConfigs[Settings.ActiveLocale];
            }
            for (int index = 0; index < fontCongifOptionList.Count; ++index)
            {
                if (fontCongifOptionList[index].name == configName)
                {
                    GuiData.ActivateFontConfig(fontCongifOptionList[index]);
                    break;
                }
            }
        }
Exemplo n.º 14
0
        protected override void LoadContent()
        {
            if (!CanLoadContent)
            {
                return;
            }
            PortExploits.populate();
            sman.controllingPlayer = PlayerIndex.One;
            if (Settings.isConventionDemo)
            {
                setWindowPosition(new Vector2(200f, 200f));
            }
            LoadGraphicsContent();
            LoadRegenSafeContent();
            var content = Content;

            GuiData.font        = content.Load <SpriteFont>("Font23");
            GuiData.titlefont   = content.Load <SpriteFont>("Kremlin");
            GuiData.smallfont   = Content.Load <SpriteFont>("Font12");
            GuiData.UISmallfont = GuiData.smallfont;
            GuiData.tinyfont    = Content.Load <SpriteFont>("Font10");
            GuiData.UITinyfont  = GuiData.tinyfont;
            GuiData.detailfont  = Content.Load <SpriteFont>("Font7");
            GuiData.spriteBatch = sman.SpriteBatch;
            GuiData.font        = content.Load <SpriteFont>("Font23");
            GuiData.titlefont   = content.Load <SpriteFont>("Kremlin");
            GuiData.smallfont   = Content.Load <SpriteFont>("Font12");
            GuiData.UISmallfont = GuiData.smallfont;
            GuiData.tinyfont    = Content.Load <SpriteFont>("Font10");
            GuiData.UITinyfont  = GuiData.tinyfont;
            GuiData.detailfont  = Content.Load <SpriteFont>("Font7");
            GuiData.init(Window);
            GuiData.InitFontOptions(Content);
            VehicleInfo.init();
            WorldLocationLoader.init();
            ThemeManager.init(content);
            MissionGenerationParser.init();
            MissionGenerator.init(content);
            UsernameGenerator.init();
            MusicManager.init(content);
            SFX.init(content);
            OldSystemSaveFileManifest.Load();
            SaveFileManager.Init();
            HasLoadedContent = true;
            LoadInitialScreens();
        }
Exemplo n.º 15
0
        public override void PostDrawStep()
        {
            base.PostDrawStep();
            if (!this.inputLocked)
            {
                return;
            }
            GuiData.blockingInput = false;
            GuiData.blockingInput = this.guiInputLockStatus;
            Rectangle bounds = this.bounds;

            if (bounds.Contains(GuiData.getMousePoint()))
            {
                GuiData.spriteBatch.Draw(Utils.white, bounds, Color.Gray * 0.5f);
                Vector2 position = new Vector2((float)(bounds.X + bounds.Width / 2 - CoreModule.LockSprite.Width / 2), (float)(bounds.Y + bounds.Height / 2 - CoreModule.LockSprite.Height / 2));
                GuiData.spriteBatch.Draw(CoreModule.LockSprite, position, Color.White);
            }
        }
Exemplo n.º 16
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();
        }
Exemplo n.º 17
0
        public override void PostDrawStep()
        {
            base.PostDrawStep();
            if (!inputLocked)
            {
                return;
            }
            GuiData.blockingInput = false;
            GuiData.blockingInput = guiInputLockStatus;
            var destinationRectangle = bounds;

            if (!destinationRectangle.Contains(GuiData.getMousePoint()))
            {
                return;
            }
            GuiData.spriteBatch.Draw(Utils.white, destinationRectangle, Color.Gray * 0.5f);
            var position = new Vector2(destinationRectangle.X + destinationRectangle.Width / 2 - LockSprite.Width / 2,
                                       destinationRectangle.Y + destinationRectangle.Height / 2 - LockSprite.Height / 2);

            GuiData.spriteBatch.Draw(LockSprite, position, Color.White);
        }
Exemplo n.º 18
0
        public override void HandleInput(InputState input)
        {
            PlayerIndex playerIndex;

            if (input.IsMenuSelect(ControllingPlayer, out playerIndex))
            {
                if (Accepted != null)
                {
                    Accepted(this, new PlayerIndexEventArgs(playerIndex));
                }
                ExitScreen();
            }
            else if (input.IsMenuCancel(ControllingPlayer, out playerIndex))
            {
                if (Cancelled != null)
                {
                    Cancelled(this, new PlayerIndexEventArgs(playerIndex));
                }
                ExitScreen();
            }
            GuiData.doInput(input);
        }
Exemplo n.º 19
0
        public override void Update(float t)
        {
            base.Update(t);
            string lastRunCommand = this.os.terminal.getLastRunCommand();

            if (this.lastCommand != lastRunCommand)
            {
                this.lastCommand = lastRunCommand;
                this.parseCommand();
            }
            else if (GuiData.getKeyboadState().IsKeyDown(Keys.F8))
            {
                this.lastCommand = "";
            }
            this.flashTimer -= t;
            this.flashTimer  = Math.Max(this.flashTimer, 0.0f);
            this.bounceEffect.Update(t, (Action <Vector2>)(nodePos =>
            {
                this.bounceEffect.NodeHitDelay       = Math.Max(0.0f, Utils.randm(0.5f) - 0.2f);
                this.bounceEffect.TimeBetweenBounces = 0.15f + Utils.randm(0.7f);
            }));
            this.hintTextFadeTimer = Math.Max(0.0f, this.hintTextFadeTimer - t);
        }
Exemplo n.º 20
0
        public override void Update(float t)
        {
            base.Update(t);
            var lastRunCommand = os.terminal.getLastRunCommand();

            if (lastCommand != lastRunCommand)
            {
                lastCommand = lastRunCommand;
                parseCommand();
            }
            else if (GuiData.getKeyboadState().IsKeyDown(Keys.F8))
            {
                lastCommand = "";
            }
            flashTimer -= t;
            flashTimer  = Math.Max(flashTimer, 0.0f);
            bounceEffect.Update(t, nodePos =>
            {
                bounceEffect.NodeHitDelay       = Math.Max(0.0f, Utils.randm(0.5f) - 0.2f);
                bounceEffect.TimeBetweenBounces = 0.15f + Utils.randm(0.7f);
            });
            hintTextFadeTimer = Math.Max(0.0f, hintTextFadeTimer - t);
        }
Exemplo n.º 21
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();
        }
Exemplo n.º 22
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();
            }
        }
Exemplo n.º 23
0
        private void DrawUpgrades(Rectangle bounds, SpriteBatch sb)
        {
            int panelHeight = 28;

            if (this.scrollerPanel == null)
            {
                this.scrollerPanel = new ScrollableSectionedPanel(panelHeight, sb.GraphicsDevice);
            }
            this.scrollerPanel.NumberOfPanels = this.upgradeNames.Count;
            Button.outlineOnly    = true;
            Button.drawingOutline = false;
            int  drawnThisCycle    = 0;
            bool needsButtonChecks = bounds.Contains(GuiData.getMousePoint());

            this.scrollerPanel.Draw((Action <int, Rectangle, SpriteBatch>)((index, drawAreaFull, sprBatch) =>
            {
                Rectangle destinationRectangle = new Rectangle(drawAreaFull.X, drawAreaFull.Y, drawAreaFull.Width - 12, drawAreaFull.Height);
                int myID = 115700 + index * 111;
                if (needsButtonChecks && Button.doButton(myID, destinationRectangle.X, destinationRectangle.Y, destinationRectangle.Width, destinationRectangle.Height, "", new Color?(Color.Transparent)))
                {
                    this.PurchaseUpgrade(index);
                }
                else if (!needsButtonChecks && GuiData.hot == myID)
                {
                    GuiData.hot = -1;
                }
                bool flag1 = (double)this.upgradeCosts[index] <= (double)this.activeState.points;
                bool flag2 = flag1 && GuiData.hot == myID;
                if (GuiData.hot == myID)
                {
                    this.hoverIndex = index;
                }
                if (flag2)
                {
                    int height = destinationRectangle.Height;
                    int num1   = 0;
                    int num2   = 0;
                    if (drawAreaFull.X == 0 && drawAreaFull.Y == 0)
                    {
                        if (drawnThisCycle == 0)
                        {
                            num1 = bounds.X;
                            num2 = bounds.Y;
                        }
                        else
                        {
                            num1 = bounds.X;
                            num2 = bounds.Y + bounds.Height - panelHeight / 2;
                        }
                    }
                    Rectangle rectangle = new Rectangle(num1 + destinationRectangle.X - height, num2 + destinationRectangle.Y - height, destinationRectangle.Width + 2 * height, destinationRectangle.Height + 2 * height);
                    for (int index1 = 0; index1 < this.Stars.Count; ++index1)
                    {
                        this.DrawStar(rectangle, sb, this.Stars[index1]);
                    }
                    sb.Draw(this.scanlinesTextBackground, rectangle, this.ThemeColor * (GuiData.active == myID ? 0.6f : 0.3f));
                }
                sprBatch.Draw(this.scanlinesTextBackground, destinationRectangle, new Rectangle?(new Rectangle(this.scanlinesTextBackground.Width / 2, this.scanlinesTextBackground.Height / 9 * 4, this.scanlinesTextBackground.Width / 2, this.scanlinesTextBackground.Height / 4)), flag1 ? this.ThemeColor * 0.2f : Utils.AddativeWhite * 0.08f);
                if (GuiData.hot == myID)
                {
                    RenderedRectangle.doRectangle(destinationRectangle.X + 1, destinationRectangle.Y + 1, destinationRectangle.Width - 2, destinationRectangle.Height - 2, new Color?(flag2 ? (GuiData.active == myID ? Color.Black : this.ThemeColorBacking) : Color.Black));
                }
                if (index == 0)
                {
                    Utils.drawLine(sprBatch, new Vector2((float)(destinationRectangle.X + 1), (float)(destinationRectangle.Y + 1)), new Vector2((float)(destinationRectangle.X + destinationRectangle.Width - 2), (float)(destinationRectangle.Y + 1)), Vector2.Zero, this.ThemeColor, 0.8f);
                }
                Utils.drawLine(sprBatch, new Vector2((float)(destinationRectangle.X + 1), (float)(destinationRectangle.Y + destinationRectangle.Height - 2)), new Vector2((float)(destinationRectangle.X + destinationRectangle.Width - 2), (float)(destinationRectangle.Y + destinationRectangle.Height - 2)), Vector2.Zero, this.ThemeColor, 0.8f);
                if (flag1)
                {
                    sprBatch.Draw(Utils.white, new Rectangle(destinationRectangle.X, destinationRectangle.Y + 1, 8, destinationRectangle.Height - 2), this.ThemeColor);
                }
                string text = "[" + this.activeState.upgradeCounts[index].ToString("000") + "] " + this.upgradeNames[index];
                TextItem.doFontLabel(new Vector2((float)(destinationRectangle.X + 4 + (flag1 ? 10 : 0)), (float)(destinationRectangle.Y + 4)), text, GuiData.UISmallfont, new Color?(flag2 ? (GuiData.active == myID ? this.ThemeColor : (flag1 ? Color.White : Color.Gray)) : (flag1 ? Utils.AddativeWhite : Color.Gray)), (float)(destinationRectangle.Width - 6), float.MaxValue, false);
                ++drawnThisCycle;
            }), sb, bounds);
            Button.outlineOnly    = false;
            Button.drawingOutline = true;
        }
Exemplo n.º 24
0
        private void DrawUpgrades(Rectangle bounds, SpriteBatch sb)
        {
            var panelHeight = 28;

            if (scrollerPanel == null)
            {
                scrollerPanel = new ScrollableSectionedPanel(panelHeight, sb.GraphicsDevice);
            }
            scrollerPanel.NumberOfPanels = upgradeNames.Count;
            Button.outlineOnly           = true;
            Button.drawingOutline        = false;
            var drawnThisCycle    = 0;
            var needsButtonChecks = bounds.Contains(GuiData.getMousePoint());

            scrollerPanel.Draw((index, drawAreaFull, sprBatch) =>
            {
                var destinationRectangle = new Rectangle(drawAreaFull.X, drawAreaFull.Y, drawAreaFull.Width - 12,
                                                         drawAreaFull.Height);
                var myID = 115700 + index * 111;
                if (needsButtonChecks &&
                    Button.doButton(myID, destinationRectangle.X, destinationRectangle.Y, destinationRectangle.Width,
                                    destinationRectangle.Height, "", Color.Transparent))
                {
                    PurchaseUpgrade(index);
                }
                else if (!needsButtonChecks && GuiData.hot == myID)
                {
                    GuiData.hot = -1;
                }
                var flag1 = upgradeCosts[index] <= (double)activeState.points;
                var flag2 = flag1 && GuiData.hot == myID;
                if (GuiData.hot == myID)
                {
                    hoverIndex = index;
                }
                if (flag2)
                {
                    var num1 = destinationRectangle.Height;
                    var num2 = 0;
                    var num3 = 0;
                    if (drawAreaFull.X == 0 && drawAreaFull.Y == 0)
                    {
                        if (drawnThisCycle == 0)
                        {
                            num2 = bounds.X;
                            num3 = bounds.Y;
                        }
                        else
                        {
                            num2 = bounds.X;
                            num3 = bounds.Y + bounds.Height - panelHeight / 2;
                        }
                    }
                    var rectangle = new Rectangle(num2 + destinationRectangle.X - num1,
                                                  num3 + destinationRectangle.Y - num1, destinationRectangle.Width + 2 * num1,
                                                  destinationRectangle.Height + 2 * num1);
                    for (var index1 = 0; index1 < Stars.Count; ++index1)
                    {
                        DrawStar(rectangle, sb, Stars[index1]);
                    }
                    sb.Draw(scanlinesTextBackground, rectangle, ThemeColor * (GuiData.active == myID ? 0.6f : 0.3f));
                }
                sprBatch.Draw(scanlinesTextBackground, destinationRectangle,
                              new Rectangle(scanlinesTextBackground.Width / 2, scanlinesTextBackground.Height / 9 * 4,
                                            scanlinesTextBackground.Width / 2, scanlinesTextBackground.Height / 4),
                              flag1 ? ThemeColor * 0.2f : Utils.AddativeWhite * 0.08f);
                if (GuiData.hot == myID)
                {
                    RenderedRectangle.doRectangle(destinationRectangle.X + 1, destinationRectangle.Y + 1,
                                                  destinationRectangle.Width - 2, destinationRectangle.Height - 2,
                                                  flag2 ? (GuiData.active == myID ? Color.Black : ThemeColorBacking) : Color.Black);
                }
                if (index == 0)
                {
                    Utils.drawLine(sprBatch, new Vector2(destinationRectangle.X + 1, destinationRectangle.Y + 1),
                                   new Vector2(destinationRectangle.X + destinationRectangle.Width - 2, destinationRectangle.Y + 1),
                                   Vector2.Zero, ThemeColor, 0.8f);
                }
                Utils.drawLine(sprBatch,
                               new Vector2(destinationRectangle.X + 1, destinationRectangle.Y + destinationRectangle.Height - 2),
                               new Vector2(destinationRectangle.X + destinationRectangle.Width - 2,
                                           destinationRectangle.Y + destinationRectangle.Height - 2), Vector2.Zero, ThemeColor, 0.8f);
                if (flag1)
                {
                    sprBatch.Draw(Utils.white,
                                  new Rectangle(destinationRectangle.X, destinationRectangle.Y + 1, 8,
                                                destinationRectangle.Height - 2), ThemeColor);
                }
                var text = "[" + activeState.upgradeCounts[index].ToString("000") + "] " + upgradeNames[index];
                TextItem.doFontLabel(
                    new Vector2(destinationRectangle.X + 4 + (flag1 ? 10 : 0), destinationRectangle.Y + 4), text,
                    GuiData.UISmallfont,
                    flag2
                        ? (GuiData.active == myID ? ThemeColor : (flag1 ? Color.White : Color.Gray))
                        : (flag1 ? Utils.AddativeWhite : Color.Gray), destinationRectangle.Width - 6, float.MaxValue);
                ++drawnThisCycle;
            }, sb, bounds);
            Button.outlineOnly    = false;
            Button.drawingOutline = true;
        }
Exemplo n.º 25
0
        public override void Update(float t)
        {
            base.Update(t);
            double timer = (double)this.timer;

            this.timer += t;
            float num1 = Settings.isDemoMode ? IntroTextModule.DEMO_DELAY_FROM_START_MUSIC_TIMER : IntroTextModule.DELAY_FROM_START_MUSIC_TIMER;

            if (Settings.IsInExtensionMode)
            {
                num1 = ExtensionLoader.ActiveExtensionInfo.IntroStartupSongDelay;
            }
            if (timer < (double)num1 && (double)this.timer >= (double)num1)
            {
                MusicManager.playSong();
            }
            float num2 = 1f;

            if (LocaleActivator.ActiveLocaleIsCJK())
            {
                num2 = 0.6f;
            }
            if (this.finishedText)
            {
                if ((double)this.timer <= (double)IntroTextModule.STAY_ONSCREEN_TIME || (double)this.timer <= (double)IntroTextModule.STAY_ONSCREEN_TIME + (double)IntroTextModule.MODULE_FLASH_TIME)
                {
                    return;
                }
                this.complete = true;
            }
            else if ((double)this.timer > (double)IntroTextModule.FLASH_TIME)
            {
                this.charTimer += t * num2;
                if ((double)this.charTimer < (double)IntroTextModule.CHAR_TIME)
                {
                    return;
                }
                KeyboardState keyboadState;
                double        num3;
                if (!Settings.isConventionDemo)
                {
                    num3 = 0.0;
                }
                else
                {
                    double charTime = (double)IntroTextModule.CHAR_TIME;
                    keyboadState = GuiData.getKeyboadState();
                    double num4 = keyboadState.IsKeyDown(Keys.LeftShift) ? 0.990000009536743 : 0.5;
                    num3 = charTime * num4;
                }
                this.charTimer = (float)num3;
                ++this.charIndex;
                if (this.charIndex >= this.text[this.textIndex].Length)
                {
                    this.charTimer  = IntroTextModule.CHAR_TIME;
                    this.charIndex  = this.text[this.textIndex].Length - 1;
                    this.lineTimer += t;
                    if ((double)this.lineTimer >= (double)IntroTextModule.LINE_TIME)
                    {
                        double num4;
                        if (!Settings.isConventionDemo)
                        {
                            num4 = 0.0;
                        }
                        else
                        {
                            double lineTime = (double)IntroTextModule.LINE_TIME;
                            keyboadState = GuiData.getKeyboadState();
                            double num5 = keyboadState.IsKeyDown(Keys.LeftShift) ? 0.990000009536743 : 0.200000002980232;
                            num4 = lineTime * num5;
                        }
                        this.lineTimer = (float)num4;
                        ++this.textIndex;
                        this.charIndex = 0;
                        if (this.textIndex >= this.text.Length)
                        {
                            if (!MusicManager.isPlaying)
                            {
                                MusicManager.playSong();
                            }
                            this.finishedText = true;
                            this.timer        = 0.0f;
                        }
                    }
                }
            }
            else if (Settings.isConventionDemo && GuiData.getKeyboadState().IsKeyDown(Keys.LeftShift))
            {
                this.timer += t + t;
            }
        }
Exemplo n.º 26
0
        public override void Update(float t)
        {
            base.Update(t);
            var num1 = timer;

            timer += t;
            var num2 = Settings.isDemoMode ? DEMO_DELAY_FROM_START_MUSIC_TIMER : DELAY_FROM_START_MUSIC_TIMER;

            if (num1 < (double)num2 && timer >= (double)num2)
            {
                MusicManager.playSong();
            }
            if (finishedText)
            {
                if (timer <= (double)STAY_ONSCREEN_TIME || timer <= STAY_ONSCREEN_TIME + (double)MODULE_FLASH_TIME)
                {
                    return;
                }
                complete = true;
            }
            else if (timer > (double)FLASH_TIME)
            {
                charTimer += t;
                if (charTimer < (double)CHAR_TIME)
                {
                    return;
                }
                charTimer = Settings.isConventionDemo
                    ? CHAR_TIME * (GuiData.getKeyboadState().IsKeyDown(Keys.LeftShift) ? 0.99f : 0.5f)
                    : 0.0f;
                ++charIndex;
                if (charIndex < text[textIndex].Length)
                {
                    return;
                }
                charIndex  = text[textIndex].Length - 1;
                lineTimer += t;
                if (lineTimer < (double)LINE_TIME)
                {
                    return;
                }
                lineTimer = Settings.isConventionDemo
                    ? LINE_TIME * (GuiData.getKeyboadState().IsKeyDown(Keys.LeftShift) ? 0.99f : 0.2f)
                    : 0.0f;
                ++textIndex;
                charIndex = 0;
                if (textIndex < text.Length)
                {
                    return;
                }
                if (!MusicManager.isPlaying)
                {
                    MusicManager.playSong();
                }
                finishedText = true;
                timer        = 0.0f;
            }
            else
            {
                if (!Settings.isConventionDemo || !GuiData.getKeyboadState().IsKeyDown(Keys.LeftShift))
                {
                    return;
                }
                timer += t + t;
            }
        }
Exemplo n.º 27
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();
            }
        }
Exemplo n.º 28
0
 public override void HandleInput(InputState input)
 {
     base.HandleInput(input);
     GuiData.doInput(input);
 }
Exemplo n.º 29
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();
        }
Exemplo n.º 30
0
        protected override void LoadContent()
        {
            if (!this.CanLoadContent)
            {
                return;
            }
            PortExploits.populate();
            this.sman.controllingPlayer = PlayerIndex.One;
            if (Settings.isConventionDemo)
            {
                this.setWindowPosition(new Vector2(200f, 200f));
            }
            this.LoadGraphicsContent();
            this.LoadRegenSafeContent();
            ContentManager content = this.Content;

            GuiData.font        = content.Load <SpriteFont>("Font23");
            GuiData.titlefont   = content.Load <SpriteFont>("Kremlin");
            GuiData.smallfont   = this.Content.Load <SpriteFont>("Font12");
            GuiData.UISmallfont = GuiData.smallfont;
            GuiData.tinyfont    = this.Content.Load <SpriteFont>("Font10");
            GuiData.UITinyfont  = this.Content.Load <SpriteFont>("Font10");
            GuiData.detailfont  = this.Content.Load <SpriteFont>("Font7");
            GuiData.spriteBatch = this.sman.SpriteBatch;
            GuiData.InitFontOptions(this.Content);
            GuiData.init(this.Window);
            DLC1SessionUpgrader.CheckForDLCFiles();
            VehicleInfo.init();
            WorldLocationLoader.init();
            ThemeManager.init(content);
            MissionGenerationParser.init();
            MissionGenerator.init(content);
            UsernameGenerator.init();
            MusicManager.init(content);
            SFX.init(content);
            OldSystemSaveFileManifest.Load();
            try
            {
                SaveFileManager.Init(true);
            }
            catch (UnauthorizedAccessException ex)
            {
                MainMenu.AccumErrors += " ---- WARNING ---\nHacknet cannot access the Save File Folder (Path Below) to read/write save files.\nNO PROGRESS WILL BE SAVED.\n";
                MainMenu.AccumErrors += "Check folder permissions, run Hacknet.exe as Administrator, and try again.\n";
                MainMenu.AccumErrors += "If Errors Persist, search for \"Hacknet Workaround\" for a steam forums thread with more options.\n";
                MainMenu.AccumErrors  = MainMenu.AccumErrors + ":: Error Details ::\n" + Utils.GenerateReportFromException((Exception)ex);
            }
            if (this.NeedsSettingsLocaleActivation)
            {
                if (!Settings.ForceEnglish)
                {
                    string forActiveLanguage = PlatformAPISettings.GetCodeForActiveLanguage(LocaleActivator.SupportedLanguages);
                    LocaleActivator.ActivateLocale(forActiveLanguage, this.Content);
                    Settings.ActiveLocale = forActiveLanguage;
                }
            }
            else if (SettingsLoader.didLoad && Settings.ActiveLocale != "en-us")
            {
                LocaleActivator.ActivateLocale(Settings.ActiveLocale, this.Content);
            }
            Helpfile.init();
            FileEntry.init(this.Content);
            this.HasLoadedContent = true;
            this.LoadInitialScreens();
            if (!WebRenderer.Enabled)
            {
                return;
            }
            XNAWebRenderer.XNAWR_Initialize("file:///nope.html", WebRenderer.textureUpdated, 512, 512);
            WebRenderer.setSize(512, 512);
        }