Beispiel #1
0
        private static void OnDrawMainMenu(DrawMainMenuEvent args)
        {
            if (needsApproval == null)
            {
                return;
            }

            GuiData.spriteBatch.Draw(Utils.white,
                                     new Rectangle(0, 0, GuiData.spriteBatch.GraphicsDevice.Viewport.Width,
                                                   GuiData.spriteBatch.GraphicsDevice.Viewport.Height), new Color(0, 0, 0, 0.75f));

            TextItem.doLabel(new Vector2(650, 230), "Arbitary Code Warning", new Color(255, 130, 130));
            var endPfMessage = (int)TextItem.doMeasuredSmallLabel(new Vector2(650, 270),
                                                                  Utils.SuperSmartTwimForWidth(
                                                                      $"The extension {needsApproval.Name} contains DLLs inside the plugin folder that Pathfinder will attempt to load.\nThis will allow whatever code is in that DLL to be ran on your machine.\nPlease confirm that you acknowledge this and are comfortable with loading these plugins.\n\nLoading from {needsApproval.GetFullFolderPath()}",
                                                                      GuiData.spriteBatch.GraphicsDevice.Viewport.Width - 660, GuiData.smallfont), Color.White).Y + 280;
            var messageTextEnd = (int)TextItem.doMeasuredTinyLabel(new Vector2(650, endPfMessage), messages, Color.White).Y +
                                 endPfMessage + 10;

            Continue.Y = messageTextEnd;
            Cancel.Y   = messageTextEnd;
            if (Continue.Do())
            {
                approvedInfo  = needsApproval;
                needsApproval = null;
                screen.ActivateExtensionPage(approvedInfo);
            }
            else if (Cancel.Do())
            {
                needsApproval = null;
            }
        }
Beispiel #2
0
        private static void DrawMain(DrawMainMenuEvent e)
        {
            Rectangle dest = new Rectangle(180, 120, 340, 100);

            ResetForLogin();
            SpriteFont titleFont  = (SpriteFont)e.MainMenu.GetType().GetField("titleFont", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(e.MainMenu);
            Color      titleColor = (Color)e.MainMenu.GetType().GetField("titleColor", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(e.MainMenu);

            Hacknet.Effects.FlickeringTextEffect.DrawLinedFlickeringText(dest, "HACK ON NET", 7f, 0.55f, titleFont, null, titleColor, 2);
            Hacknet.Gui.TextItem.doFontLabel(new Vector2(520f, 178f), "Hack On Net v0.1", GuiData.smallfont, new Color?(titleColor * 0.5f), 600f, 26f, false);

            logIn.Draw();

            if (Hacknet.Gui.Button.doButton(3, 180, 305, 450, 40, LocaleTerms.Loc("Settings"), Color.LightSkyBlue))
            {
                e.MainMenu.ScreenManager.AddScreen(new OptionsMenu(), new PlayerIndex?(e.MainMenu.ScreenManager.controllingPlayer));
            }

            if (Hacknet.Gui.Button.doButton(15, 180, 360, 450, 28, LocaleTerms.Loc("Back to Main Menu"), Color.Gray))
            {
                preset = RPHandler.State.OGMenu;
                RPCHandler.PresencePresetSet(preset);
                currentState = MenuState.OG_MENU;
            }
        }
 internal static void DrawNewReleaseGraphic(DrawMainMenuEvent e)
 {
     if (e.GameTime.ElapsedGameTime.Seconds % 3 != 0)
     {
         TextItem.doFontLabel(new Vector2(300, 100), "New Release Up", GuiData.font, Color.White);
     }
 }
Beispiel #4
0
 public static void DrawMainMenu(DrawMainMenuEvent e)
 {
     if (bMenu == null)
     {
         bMenu = e.MainMenu;
     }
     if (currentState == MenuState.OG_MENU)
     {
         string[] cmdArgs = Environment.GetCommandLineArgs();
         if (cmdArgs.Contains("-hackonnet") && cmdArgs.Contains("-username") && cmdArgs.Contains("-password") && !autoLoadLogin)
         {
             ResetForLogin();
             ChangeState(MenuState.LOGIN);
             MainMenu.StartGame(cmdArgs[3], cmdArgs[5]);
         }
         else if (cmdArgs.Contains("-hackonnet") && !autoLoadLogin)
         {
             ResetForLogin();
             ChangeState(MenuState.LOGIN);
         }
         autoLoadLogin = true;
         return;
     }
     e.IsCancelled = true;
     if (currentState == MenuState.MAIN_MENU)
     {
         DrawMain(e);
     }
     else if (currentState == MenuState.LOGIN)
     {
         DrawLogin(e);
     }
 }
Beispiel #5
0
 public static void Init(DrawMainMenuEvent e)
 {
     if (File.Exists(Path.Combine(Environment.CurrentDirectory, "Mods", "discord-rpc.dll")))
     {
         _enabled  = true;
         _handlers = new DiscordRpc.EventHandlers();
         DiscordRpc.Initialize(clientId, ref _handlers, true, null);
     }
     else
     {
         Console.WriteLine(@"Mods/discord-rpc.dll does not exist! Please download it from https://drive.google.com/open?id=1rJvhzQojvlLmM0Hngr5KaQZvuuEMqGTa !");
     }
 }
        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);
            }
        }
Beispiel #7
0
        public static void DrawMainMenu(DrawMainMenuEvent e)
        {
            Modules.MusicManager.Check();

            if (bMenu == null)
            {
                bMenu = e.MainMenu;
            }
            if (currentState == MenuState.OG_MENU)
            {
                preset = RPHandler.State.OGMenu;
                RPCHandler.PresencePresetSet(preset);
                openHackOnNet.Draw();

                string[] cmdArgs = Environment.GetCommandLineArgs();
                if (cmdArgs.Contains("-hackonnet") && cmdArgs.Contains("-username") && cmdArgs.Contains("-password") && !autoLoadLogin)
                {
                    ResetForLogin();
                    ChangeState(MenuState.LOGIN);
                    preset = RPHandler.State.MPLogIn;
                    RPCHandler.PresencePresetSet(preset);
                    MainMenu.StartGame(cmdArgs[3], cmdArgs[5]);
                }
                else if (cmdArgs.Contains("-hackonnet") && !autoLoadLogin)
                {
                    ResetForLogin();
                    preset = RPHandler.State.MPLogIn;
                    RPCHandler.PresencePresetSet(preset);
                    ChangeState(MenuState.LOGIN);
                }
                autoLoadLogin = true;
                return;
            }
            e.IsCancelled = true;
            if (currentState == MenuState.MAIN_MENU)
            {
                preset = RPHandler.State.MainMenu;
                RPCHandler.PresencePresetSet(preset);
                DrawMain(e);
            }
            else if (currentState == MenuState.LOGIN)
            {
                preset = RPHandler.State.MPLogIn;
                RPCHandler.PresencePresetSet(preset);
                DrawLogin(e);
            }
        }
Beispiel #8
0
        public static void DrawNewReleaseGraphic(DrawMainMenuEvent e)
        {
            var          val     = e.GameTime.TotalGameTime.TotalMilliseconds;
            const double passed  = 950;
            const double epsilon = 20;

            RawtimePass(val, passed, e: epsilon);
            RawtimePass(val, passed, passed / 2, epsilon);
            if (isOn && RawtimePass(val, passed, e: epsilon) || !isOn && RawtimePass(val, passed / 2, e: epsilon))
            {
                isOn = !isOn;
            }
            if (isOn)
            {
                TextItem.doFontLabel(new Vector2(180, 100), "New Pathfinder Release", GuiData.font, Color.White);
            }
        }
Beispiel #9
0
        public static void DrawModList(DrawMainMenuEvent e)
        {
            if (GameHandled)
            {
                return;
            }
            e.IsCancelled = true;

            PrepareButtons();
            returnButton.Draw();
            Gui.TextItem.doFontLabel(new V2(125f, 50), "Pathfinder Mod Load Order", GuiData.font, Color.White);

            var    yPos  = 120f;
            var    index = 0;
            string title = null;

            foreach (var id in Manager.LoadedModIds)
            {
                title = Manager.GetLoadedMod(id).GetType().GetFirstAttribute <ModInfoAttribute>()?.PublicTitle;
                Gui.TextItem.doFontLabel(new V2(200f, yPos),
                                         (++index) + ". " + (title != null ? title + " | " : "") + id,
                                         GuiData.smallfont,
                                         Color.White);
                UnloadButtons[id].Position = new Vec2(500, yPos);
                UnloadButtons[id].Draw();
                yPos += 30;
            }
            Manager.UnloadMarkedMods();
            if (Manager.UnloadedModIds.Count < 1)
            {
                return;
            }
            Gui.TextItem.doFontLabel(new V2(200, yPos), "Disabled Mods", GuiData.font, Color.White);
            yPos += 50;
            index = 0;
            foreach (var id in Manager.UnloadedModIds)
            {
                Gui.TextItem.doFontLabel(new V2(200f, yPos), (++index) + ". " + id, GuiData.smallfont, Color.White);
                LoadButtons[id].Position = new Vec2(500, yPos);
                LoadButtons[id].Draw();
                yPos += 30;
            }
            Manager.LoadMarkedMods();
        }
Beispiel #10
0
 public static void DrawMainMenu(DrawMainMenuEvent e)
 {
     if (bMenu == null)
     {
         bMenu = e.MainMenu;
     }
     if (currentState == MenuState.OG_MENU)
     {
         return;
     }
     e.IsCancelled = true;
     if (currentState == MenuState.MAIN_MENU)
     {
         DrawMain(e);
     }
     else if (currentState == MenuState.LOGIN)
     {
         DrawLogin(e);
     }
 }
Beispiel #11
0
        private static void DrawLogin(DrawMainMenuEvent e)
        {
            RequestGoBack += (Action)(() => ChangeState(MenuState.MAIN_MENU));
            Rectangle  dest      = new Rectangle(bMenu.ScreenManager.GraphicsDevice.Viewport.Width / 4, bMenu.ScreenManager.GraphicsDevice.Viewport.Height / 4, bMenu.ScreenManager.GraphicsDevice.Viewport.Width / 2, bMenu.ScreenManager.GraphicsDevice.Viewport.Height / 4);
            SpriteFont smallfont = GuiData.smallfont;
            int        y1        = dest.Y + dest.Height + 12;
            int        y2        = y1 + 10;
            int        num1      = (int)((double)smallfont.MeasureString(currentPrompt).X + 4.0);
            int        num2      = dest.Y + dest.Height - 18;
            int        num3      = y2 - 60;
            float      num4      = GuiData.ActiveFontConfig.tinyFontCharHeight + 8f;
            Vector2    position  = new Vector2((float)dest.X, false ? (float)y2 : (float)(dest.Y + dest.Height - 20) - num4);

            GuiData.spriteBatch.Draw(Utils.white, new Rectangle(dest.X, y1, dest.Width / 2, 1), Utils.SlightlyDarkGray);
            GuiData.spriteBatch.DrawString(GuiData.UISmallfont, loginMessage, new Vector2(position.X, position.Y + 125), MainMenu.CancelColor);
            GuiData.spriteBatch.DrawString(smallfont, currentPrompt, new Vector2((float)dest.X, (float)num2), Color.White);

            if (IsReady)
            {
                if (!GuiData.getKeyboadState().IsKeyDown(Keys.Enter))
                {
                    CanReturnEnter = true;
                }
                if ((!HasOverlayScreen && (!IsLoginMode || Hacknet.Gui.Button.doButton(16392804, dest.X, y2, dest.Width / 3, 28, LocaleTerms.Loc("CONFIRM"), new Color?(Color.White))) || CanReturnEnter && Utils.keyPressed(GuiData.lastInput, Keys.Enter, new PlayerIndex?())) && !PreventAdvancing)
                {
                    if (IsLoginMode)
                    {
                        if (Answers.Count < 2)
                        {
                            ResetForLogin();
                        }
                        else
                        {
                            string username = Answers[Answers.Count - 2];
                            string password = Answers[Answers.Count - 1];
                            Hacknet.Gui.TextBox.MaskingText = false;
                            StartGame(username, password);
                        }
                    }
                    else
                    {
                        Hacknet.Gui.TextBox.MaskingText = false;
                        Console.Write("An Error has occured! Fixing now");
                        History.Clear();
                        currentPrompt = "";
                        ResetForLogin();
                        IsLoginMode = true;
                    }
                    PreventAdvancing = true;
                }
                y2 += 36;
            }
            else
            {
                Hacknet.Gui.TextBox.MaskingText = InPasswordMode;
                terminalString = Hacknet.Gui.TextBox.doTerminalTextField(16392802, dest.X + num1, num2 - 2, dest.Width, 20, 1, terminalString, GuiData.UISmallfont);
            }

            if (!HasOverlayScreen && Hacknet.Gui.TextBox.BoxWasActivated)
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.Append(currentPrompt);
                stringBuilder.Append(" ");
                string str1 = terminalString;
                if (InPasswordMode)
                {
                    string str2 = "";
                    for (int index = 0; index < str1.Length; ++index)
                    {
                        str2 += "*";
                    }
                    str1 = str2;
                }
                stringBuilder.Append(str1);
                History.Add(stringBuilder.ToString());
                Advance(terminalString);
                terminalString = "";
                Hacknet.Gui.TextBox.cursorPosition  = 0;
                Hacknet.Gui.TextBox.BoxWasActivated = false;
            }
            if (!HasOverlayScreen && Hacknet.Gui.Button.doButton(16392806, dest.X, y2, dest.Width / 3, 22, LocaleTerms.Loc("CANCEL"), new Color?(CancelColor)) && RequestGoBack != null)
            {
                InPasswordMode = false;
                Hacknet.Gui.TextBox.MaskingText = false;
                RequestGoBack();
            }

            for (int index = History.Count - 1; index >= 0; --index)
            {
                GuiData.spriteBatch.DrawString(GuiData.UISmallfont, History[index], position, Color.White);
                position.Y -= num4 * (1f);
            }
        }