Esempio n. 1
0
        internal static bool Draw(ref OptionsMenu __instance, GameTime gameTime)
        {
            if (!isInPathfinderMenu)
            {
                return(true);
            }

            PostProcessor.begin();
            GuiData.startDraw();
            PatternDrawer.draw(new Rectangle(0, 0, __instance.ScreenManager.GraphicsDevice.Viewport.Width, __instance.ScreenManager.GraphicsDevice.Viewport.Height), 0.5f, Color.Black, new Color(2, 2, 2), GuiData.spriteBatch);

            if (ReturnButton.Do())
            {
                currentTabName     = null;
                isInPathfinderMenu = false;
                GuiData.endDraw();
                PostProcessor.end();
                var saveEvent = new CustomOptionsSaveEvent();
                EventManager <CustomOptionsSaveEvent> .InvokeAll(saveEvent);

                return(false);
            }

            var tabs = OptionsManager.Tabs;

            int tabX = 10;

            foreach (var tab in tabs.Values)
            {
                if (currentTabName == null)
                {
                    currentTabName = tab.Name;
                }
                var active = currentTabName == tab.Name;
                // Display tab button
                if (Button.doButton(tab.ButtonID, tabX, 70, 128, 20, tab.Name, active ? Color.Green : Color.Gray))
                {
                    currentTabName = tab.Name;
                    break;
                }
                tabX += 128 + 10;

                if (currentTabName != tab.Name)
                {
                    continue;
                }

                // Display options
                int optX = 80, optY = 110;
                foreach (var option in tab.Options)
                {
                    option.Draw(optX, optY);
                    optY += 10 + option.SizeY;
                }
            }

            GuiData.endDraw();
            PostProcessor.end();
            return(false);
        }
Esempio n. 2
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            PostProcessor.begin();
            GuiData.startDraw();
            GuiData.spriteBatch.Draw(Utils.white, Fullscreen, Color.Black);
            var dest = Utils.InsetRectangle(Fullscreen, 200);

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

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

            FlickeringTextEffect.DrawLinedFlickeringText(dest, text, 18f, 0.7f, GuiData.titlefont, null, Color.White, 6);
            dest.Y     += 400;
            dest.Height = 120;
            FlickeringTextEffect.DrawFlickeringText(dest, Utils.FlipRandomChars("MORE SOON", 0.008), -8f, 0.7f,
                                                    GuiData.titlefont, null, Color.Gray);
            FlickeringTextEffect.DrawFlickeringText(dest, Utils.FlipRandomChars("MORE SOON", 0.03), -8f, 0.7f,
                                                    GuiData.titlefont, null, Utils.AddativeWhite * 0.15f);
            GuiData.endDraw();
            PostProcessor.end();
        }
Esempio n. 3
0
        public override void Draw(GameTime gameTime)
        {
            try
            {
                float t = (float)gameTime.ElapsedGameTime.TotalSeconds;
                if (this.lastGameTime == null)
                {
                    this.lastGameTime = gameTime;
                }

                PostProcessor.begin();
                GuiData.startDraw();
                try
                {
                    Overlay onlyOverlay = null;
                    foreach (Overlay overlay in this.overlays)
                    {
                        if (overlay.PreventsDrawing())
                        {
                            onlyOverlay = overlay;
                            break;
                        }
                    }
                    if (onlyOverlay == null)
                    {
                        this.drawBackground();
                        this.drawModules(gameTime);
                        SFX.Draw(GuiData.spriteBatch);
                        foreach (Overlay overlay in this.overlays)
                        {
                            overlay.Draw();
                        }
                    }
                    else
                    {
                        onlyOverlay.Draw();
                    }
                }
                catch (System.Exception ex)
                {
                    Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex) + "\r\n\r\n");
                }
                GuiData.endDraw();
                PostProcessor.end();
                GuiData.startDraw();
                if (this.postFXDrawActions != null)
                {
                    this.postFXDrawActions();
                    this.postFXDrawActions = null;
                }
                this.drawScanlines();
                GuiData.endDraw();
            }
            catch (System.Exception ex)
            {
                Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex));
            }
        }
        public static void MainMenuTextPatch()
        {
            if (bruhButton == null)
            {
                return;
            }

            GuiData.startDraw();
            bruhButton.Do();
            GuiData.endDraw();
        }
Esempio n. 5
0
        public static bool onOptionsMenuDraw(OptionsMenu self, ref GameTime time)
        {
            var optionsMenuDrawEvent = new Event.OptionsMenuDrawEvent(self, time);

            optionsMenuDrawEvent.CallEvent();
            if (optionsMenuDrawEvent.IsCancelled)
            {
                GuiData.endDraw();
                PostProcessor.end();
                return(true);
            }
            return(false);
        }
        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);
            }
        }
Esempio n. 7
0
        // Hook location : MainMenu.Draw()
        public static bool onMainMenuDraw(MainMenu self, GameTime gameTime)
        {
            var drawMainMenuEvent = new Event.DrawMainMenuEvent(self, gameTime);

            drawMainMenuEvent.CallEvent();
            if (drawMainMenuEvent.IsCancelled)
            {
                GuiData.endDraw();
                PostProcessor.end();
                self.ScreenManager.FadeBackBufferToBlack(255 - self.TransitionAlpha);
                return(true);
            }
            return(false);
        }
Esempio n. 8
0
        public static bool onOSDraw(OS self, ref GameTime time)
        {
            var osStartDrawEvent = new Event.OSStartDrawEvent(self, time);

            Event.OSEndDrawEvent osEndDrawEvent = null;
            try
            {
                if (self.lastGameTime == null)
                {
                    self.lastGameTime = time;
                }
                switch (osStartDrawEvent.DrawType)
                {
                case Event.OSDrawEvent.Type.Standard:
                    PostProcessor.begin();
                    GuiData.startDraw();
                    osStartDrawEvent.CallEvent();
                    if (osStartDrawEvent.IsCancelled)
                    {
                        break;
                    }
                    try
                    {
                        if (!self.TraceDangerSequence.PreventOSRendering)
                        {
                            self.drawBackground();
                            if (self.terminalOnlyMode)
                            {
                                self.terminal.Draw((float)time.ElapsedGameTime.TotalSeconds);
                            }
                            else
                            {
                                self.drawModules(time);
                            }
                            SFX.Draw(GuiData.spriteBatch);
                        }
                        if (self.TraceDangerSequence.IsActive)
                        {
                            self.TraceDangerSequence.Draw();
                        }
                    }
                    catch (Exception ex)
                    {
                        self.drawErrorCount++;
                        if (self.drawErrorCount < 5)
                        {
                            Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex) + "\r\n\r\n");
                        }
                    }
                    break;

                case Event.OSDrawEvent.Type.BootingSequence:
                    osStartDrawEvent.IgnoreScanlines = true;
                    goto case Event.OSDrawEvent.Type.EndingSequence;

                case Event.OSDrawEvent.Type.BootAssistance:
                case Event.OSDrawEvent.Type.EndingSequence:
                    PostProcessor.begin();
                    osStartDrawEvent.CallEvent();
                    if (osStartDrawEvent.IsCancelled)
                    {
                        break;
                    }
                    self.ScreenManager.SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
                    switch (osStartDrawEvent.DrawType)
                    {
                    case Event.OSDrawEvent.Type.BootAssistance:
                        self.BootAssitanceModule.Draw((float)time.ElapsedGameTime.TotalSeconds);
                        break;

                    case Event.OSDrawEvent.Type.BootingSequence:
                        if (self.thisComputer.disabled)
                        {
                            self.RequestRemovalOfAllPopups();
                            if (self.TraceDangerSequence.IsActive)
                            {
                                self.TraceDangerSequence.CancelTraceDangerSequence();
                            }
                            self.crashModule.Draw((float)time.ElapsedGameTime.TotalSeconds);
                        }
                        else
                        {
                            self.introTextModule.Draw((float)time.ElapsedGameTime.TotalSeconds);
                        }
                        break;

                    case Event.OSDrawEvent.Type.EndingSequence:
                        self.endingSequence.Draw((float)time.ElapsedGameTime.TotalSeconds);
                        break;
                    }
                    if (!osStartDrawEvent.IgnoreScanlines)
                    {
                        self.drawScanlines();
                    }
                    break;

                case Event.OSDrawEvent.Type.Loading:
                    GuiData.startDraw();
                    osStartDrawEvent.CallEvent();
                    if (osStartDrawEvent.IsCancelled)
                    {
                        break;
                    }
                    TextItem.doSmallLabel(new Vector2(0f, 700f), LocaleTerms.Loc("Loading..."), null);
                    break;

                case Event.OSDrawEvent.Type.Custom:
                    osStartDrawEvent.CallEvent();
                    if (osStartDrawEvent.IsCancelled)
                    {
                        return(true);
                    }
                    break;
                }
                osEndDrawEvent = new Event.OSEndDrawEvent(self, time, osStartDrawEvent.DrawType);
                switch (osEndDrawEvent.DrawType)
                {
                case Event.OSDrawEvent.Type.Standard:
                    GuiData.endDraw();
                    PostProcessor.end();
                    if (!osStartDrawEvent.IgnorePostFXDraw)
                    {
                        GuiData.startDraw();
                        if (self.postFXDrawActions != null)
                        {
                            self.postFXDrawActions.Invoke();
                            self.postFXDrawActions = null;
                        }
                        if (!osStartDrawEvent.IgnoreScanlines)
                        {
                            self.drawScanlines();
                        }
                        GuiData.endDraw();
                    }
                    break;

                case Event.OSDrawEvent.Type.BootAssistance:
                case Event.OSDrawEvent.Type.BootingSequence:
                case Event.OSDrawEvent.Type.EndingSequence:
                    self.ScreenManager.SpriteBatch.End();
                    PostProcessor.end();
                    break;

                case Event.OSDrawEvent.Type.Loading:
                    GuiData.endDraw();
                    break;

                default:
                    osEndDrawEvent.CallEvent();
                    break;
                }
            }
            catch (Exception ex)
            {
                osEndDrawEvent = new Event.OSEndDrawEvent(self, time, Event.OSDrawEvent.Type.Error);
                osEndDrawEvent.CallEvent();
                if (osEndDrawEvent.IsCancelled)
                {
                    return(true);
                }
                self.drawErrorCount++;
                if (self.drawErrorCount >= 3)
                {
                    self.handleDrawError();
                }
                else
                {
                    Utils.AppendToErrorFile(Utils.GenerateReportFromException(ex));
                }
            }
            return(true);
        }
Esempio n. 9
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            PostProcessor.begin();
            ScreenManager.FadeBackBufferToBlack(255);
            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("Back".GetHashCode(), 10, 10, 220, 30, "<- " + LocaleTerms.Loc("Back"), Color.Gray))
            {
                if (IsChange && !Saved)
                {
                    ScreenManager.AddScreen(MessageBox_NeedSave, ScreenManager.controllingPlayer);
                }
                SettingsLoader.writeStatusFile();
                ExitScreen();
            }
            if (Button.doButton("Save".GetHashCode(), 10, 45, 220, 30, "ModsCore.Mods.Save".Translate(), Color.Blue))
            {
                Save();
            }

            TextItem.doLabel(new Vector2(75, 100), $"Mods ({"ModsCore.Mods.Activate".Translate()})", null, 300);

            //打开了Setting界面不允许修改选定的Mod
            if (OpenSettingUI)
            {
                SelectableTextList.doFancyList(25, 50, 140, 300, ScreenManager.GraphicsDevice.Viewport.Height - 190, m_ActivatedMods.ToArray(), currentActMods, Color.White);
            }
            else
            {
                currentActMods = SelectableTextList.doFancyList(25, 50, 140, 300, ScreenManager.GraphicsDevice.Viewport.Height - 50, m_ActivatedMods.ToArray(), currentActMods, Color.White);
            }

            if (OpenSettingUI && Button.doButton("CloseSettingUI".GetHashCode(), 400, 210, 150, 30, "ModsCore.Mods.CloseSettingUI".Translate(), Color.BlueViolet))
            {
                OpenSettingUI = false;
            }
            if (currentActMods > 0 && Button.doButton("Up".GetHashCode(), 400, 250, 150, 30, "ModsCore.Mods.Up".Translate(), Color.BlueViolet))
            {
                MoveUp();
                IsChange = true;
                Saved    = false;
            }
            if (currentActMods >= 0 && currentActMods != m_ActivatedMods.Count - 1 && Button.doButton("Down".GetHashCode(), 400, 290, 150, 30, "ModsCore.Mods.Down".Translate(), Color.BlueViolet))
            {
                MoveDown();
                IsChange = true;
                Saved    = false;
            }
            if (!OpenSettingUI && currentActMods != -1 && Button.doButton("OpenSettingUI".GetHashCode(), 400, 210, 150, 30, "ModsCore.Mods.OpenSettingUI".Translate(), Color.BlueViolet))
            {
                OpenSettingUI = true;
            }

            if (currentActMods >= 0 && Button.doButton("DeactivateMod".GetHashCode(), 400, 330, 150, 30, "ModsCore.Mods.DeactivateMod".Translate(), Color.BlueViolet))
            {
                IsChange = true;
                Saved    = false;
                m_DeactivatedMods.Add(m_ActivatedMods[currentActMods]);
                m_DeactDicModModEntries.Add(m_ActivatedMods[currentActMods].GetHashCode(), m_ActDicModEntries[m_ActivatedMods[currentActMods].GetHashCode()]);
                m_ActDicModEntries.Remove(m_ActivatedMods[currentActMods].GetHashCode());
                m_ActivatedMods.RemoveAt(currentActMods);

                ModManager.ModsConfig ModsConfig = (ModManager.ModsConfig)ModsConfig_FieldInfo.GetValue(new ModManager());
                ModsConfig.EnabledMod.RemoveAt(currentActMods);
                ModsConfig_FieldInfo.SetValue(null, ModsConfig);
                currentDeactMods = m_DeactivatedMods.Count - 1;
                currentActMods   = -1;
            }

            if (!OpenSettingUI && currentDeactMods >= 0 && Button.doButton("ActivateMod".GetHashCode(), 400, 370, 150, 30, "ModsCore.Mods.ActivateMod".Translate(), Color.BlueViolet))
            {
                IsChange = true;
                Saved    = false;
                m_ActivatedMods.Add(m_DeactivatedMods[currentDeactMods]);
                m_ActDicModEntries.Add(m_DeactivatedMods[currentDeactMods].GetHashCode(), m_DeactDicModModEntries[m_DeactivatedMods[currentDeactMods].GetHashCode()]);


                ModManager.ModsConfig ModsConfig = (ModManager.ModsConfig)ModsConfig_FieldInfo.GetValue(new ModManager());
                ModsConfig.EnabledMod.Add(Path.GetFileName(m_DeactDicModModEntries[m_DeactivatedMods[currentDeactMods].GetHashCode()].Path));
                ModsConfig_FieldInfo.SetValue(null, ModsConfig);

                m_DeactDicModModEntries.Remove(m_DeactivatedMods[currentDeactMods].GetHashCode());
                m_DeactivatedMods.RemoveAt(currentDeactMods);
                currentActMods   = m_ActivatedMods.Count - 1;
                currentDeactMods = -1;
            }

            if (OpenSettingUI && m_ActDicModEntries[m_ActivatedMods[currentActMods].GetHashCode()].Started && m_ActDicModEntries[m_ActivatedMods[currentActMods].GetHashCode()].DrawSettingUIMethod != null)
            {
                RenderedRectangle.doRectangleOutline(570, 100, ScreenManager.GraphicsDevice.Viewport.Width - 50 - 570, ScreenManager.GraphicsDevice.Viewport.Height - 100 - 50, 2, Color.White);
                m_ActDicModEntries[m_ActivatedMods[currentActMods].GetHashCode()].DrawSettingUIMethod(m_ActDicModEntries[m_ActivatedMods[currentActMods].GetHashCode()], new object[] { ScreenManager, 575, 100, ScreenManager.GraphicsDevice.Viewport.Width - 50 - 570, ScreenManager.GraphicsDevice.Viewport.Height - 100 - 50 });
            }
            else
            {
                TextItem.doLabel(new Vector2(600, 100), $"Mods ({"ModsCore.Mods.Deactivate".Translate()})", null, 300);
                currentDeactMods = SelectableTextList.doFancyList(25, 575, 140, 300, ScreenManager.GraphicsDevice.Viewport.Height - 50, m_DeactivatedMods.ToArray(), currentDeactMods, null);
            }
            GuiData.endDraw();
            PostProcessor.end();
        }
 public static void MainMenuTextPatch()
 {
     GuiData.startDraw();
     bruhButton.Do();
     GuiData.endDraw();
 }