public static void drawMainMenu(PathfinderEvent pathfinderEvent)
        {
            DrawMainMenuEvent drawMainMenuEvent = (DrawMainMenuEvent)pathfinderEvent;

            if (mainMenuState != MainMenuState.PathfinderModList)
            {
                return;
            }
            drawMainMenuEvent.IsCancelled = true;

            GameScreen baseS = ((GameScreen)drawMainMenuEvent.MainMenuInstance);

            try
            {
                PostProcessor.begin();
                baseS.ScreenManager.FadeBackBufferToBlack(255);
                GuiData.startDraw();
                Rectangle dest = new Rectangle(0, 0, baseS.ScreenManager.GraphicsDevice.Viewport.Width, baseS.ScreenManager.GraphicsDevice.Viewport.Height);
                Rectangle destinationRectangle = new Rectangle(-20, -20, baseS.ScreenManager.GraphicsDevice.Viewport.Width + 40, baseS.ScreenManager.GraphicsDevice.Viewport.Height + 40);
                Rectangle dest2 = new Rectangle(dest.X + dest.Width / 4, dest.Height / 4, dest.Width / 2, dest.Height / 4);
                GuiData.spriteBatch.Draw(Utils.white, destinationRectangle, Color.Black);
                if (Settings.DrawHexBackground)
                {
                    HexGridBackground hexBack = (HexGridBackground)drawMainMenuEvent.MainMenuInstance.GetType().GetField("hexBackground", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(drawMainMenuEvent.MainMenuInstance);
                    hexBack.Draw(dest, GuiData.spriteBatch, Color.Transparent, Settings.lighterColorHexBackground ? new Color(20, 20, 20) : new Color(15, 15, 15, 0), HexGridBackground.ColoringAlgorithm.NegaitiveSinWash, 0f);
                }
                TextItem.DrawShadow = false;

                if (Button.doButton(15, 180, 650, 250, 28, "Return", new Color?(MainMenu.exitButtonColor)))
                {
                    mainMenuState = MainMenuState.GameHandled;
                }

                TextItem.doFontLabel(new Vector2(125f, (float)50), "Loaded Pathfinder Mods", GuiData.font, new Color?(Color.White), 3.40282347E+38f, 3.40282347E+38f, false);

                float yPos = 120;
                foreach (string modIdentifier in Pathfinder.LoadedModIdentifiers)
                {
                    TextItem.doFontLabel(new Vector2(200f, (float)yPos), modIdentifier, GuiData.smallfont, new Color?(Color.White), 3.40282347E+38f, 3.40282347E+38f, false);
                    yPos += 30;
                }

                GuiData.endDraw();
                PostProcessor.end();
                baseS.ScreenManager.FadeBackBufferToBlack((int)(255 - baseS.TransitionAlpha));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
예제 #2
0
        public static void drawBackgroundImage(SpriteBatch sb, Rectangle area)
        {
            switch (currentTheme)
            {
            case OSTheme.HacknetYellow:
                sb.Draw(Utils.white, area, new Color(51, 38, 0, byte.MaxValue));
                var dest = new Rectangle(area.X - 30, area.Y - 20, area.Width + 60, area.Height + 40);
                hexGrid.Draw(dest, sb, Color.Transparent, new Color(byte.MaxValue, 217, 105) * 0.2f,
                             HexGridBackground.ColoringAlgorithm.CorrectedSinWash, 0.0f);
                break;

            default:
                sb.Draw(backgroundImage, area,
                        currentTheme == OSTheme.HackerGreen ? new Color(100, 150, 100) : Color.White);
                break;
            }
        }
예제 #3
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();
            }
        }