コード例 #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;
            }
        }
コード例 #2
0
        public override void Draw(int x, int y)
        {
            TextItem.doLabel(new Vector2(x, y), Name, null, 200);
            Value = CheckBox.doCheckBox(ButtonID, x, y + 34, Value, null);

            TextItem.doSmallLabel(new Vector2(x + 32, y + 30), Description, null);
        }
コード例 #3
0
ファイル: DebugDaemon.cs プロジェクト: oxygencraft/DebugMod
        private void DrawPageRequirements(Rectangle rect, Instance instance, SpriteBatch sb)
        {
            const string title           = "Debug Mod";
            const string newVersion      = "New version of Debug Mod is available";
            string       newVersionLine2 = "You are currently running: " + DebugMod.version + " New version: " + DebugMod.newVersion;

            TextItem.doLabel(new Vector2(280f, 55f), title, null);
            if (DebugMod.newVersion != DebugMod.version)
            {
                TextItem.doSmallLabel(new Vector2(500f, 55f), newVersion, themeColour);
                TextItem.doSmallLabel(new Vector2(500f, 70f), newVersionLine2, themeColour);
            }
        }
コード例 #4
0
ファイル: OptionsMenu.cs プロジェクト: strangea/OpenHacknet
        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();
        }
コード例 #5
0
 public override void Draw(GameTime gameTime)
 {
     ScreenManager.SpriteBatch.Begin();
     ScreenManager.SpriteBatch.Draw(Utils.white, new Rectangle(0, 0, ScreenManager.SpriteBatch.GraphicsDevice.Viewport.Width, GuiData.spriteBatch.GraphicsDevice.Viewport.Height), new Color(0, 0, 0, 0.65f));
     ScreenManager.SpriteBatch.Draw(Utils.white, new Rectangle(400, 250, 800, 150), Color.Black);
     TextItem.doLabel(new Vector2(550, 260), $"Do you want to restart the game?", Color.White);
     NoRestartPrompt.Draw(675, 300);
     if (AcceptVersion.Do())
     {
         PathfinderUpdaterPlugin.RestartForUpdate();
         ExitScreen();
     }
     else if (DenyVersion.Do())
     {
         ExitScreen();
     }
     ScreenManager.SpriteBatch.End();
 }
コード例 #6
0
ファイル: DebugDaemon.cs プロジェクト: oxygencraft/DebugMod
        private void DrawDebug(Rectangle rect, Instance instance, float ticks, SpriteBatch sb)
        {
            OS           os      = instance.os;
            Color        colour  = new Color(45, 180, 231);
            const string doLabel = "doLabel";
            const string doMeasuredSmallLabel = "doMeasuredSmallLabel";
            const string doMeasuredTinyLabel  = "doMeasuredTinyLabel";
            const string doSmallLabel         = "doSmallLabel";

            TextItem.doLabel(new Vector2(500f, 400f), doLabel, null);
            TextItem.doMeasuredSmallLabel(new Vector2(500f, 500f), doMeasuredSmallLabel, null);
            TextItem.doMeasuredTinyLabel(new Vector2(500f, 600f), doMeasuredTinyLabel, null);
            TextItem.doSmallLabel(new Vector2(500f, 300f), doSmallLabel, null);
            if (Button.doButton(1, 800, 100, 200, 75, "Button", null))
            {
                State = DebugModState.HomePage;
            }
            Button.doButton(2, 685, 843, 25, 25, "<-", null);
            Button.doButton(2, 733, 843, 25, 25, "->", null);
        }
コード例 #7
0
 public void doGui()
 {
     PatternDrawer.draw(new Rectangle(180, 160, 500, 85), 1f, darkgrey, dark_ish_gray, GuiData.spriteBatch);
     TextItem.doSmallLabel(new Vector2(200f, 170f), "IP To Connect to:", new Color?());
     destination = TextBox.doTextBox(100, 200, 200, 300, 1, destination, GuiData.smallfont);
     if (Button.doButton(123, 510, 201, 120, 23, "Connect", new Color?()) || TextBox.BoxWasActivated)
     {
         ConnectToServer(destination);
     }
     else
     {
         if (isConnecting)
         {
             drawConnectingGui();
         }
         TextItem.doLabel(new Vector2(200f, 300f), "Local IPs: " + myIP, new Color?());
         var y = 340f;
         for (var index = 0; index < allLocalIPs.Count - 1; ++index)
         {
             TextItem.doLabel(new Vector2(351f, y), allLocalIPs[index], new Color?());
             y += 40f;
         }
         TextItem.doLabel(new Vector2(200f, y + 40f), "Extrn IP: " + externalIP, new Color?());
         var pos = new Vector2(610f, 280f);
         TextItem.doLabel(pos, "Info:", new Color?());
         pos.Y += 40f;
         var text =
             DisplayModule.cleanSplitForWidth(
                 "To Begin a multiplayer session, type in the IP of the computer you want to connect to and press enter or connect. Both players must be on this screen. To connect over the internet, use the extern IP address and ensure port 3030 is open.",
                 400);
         TextItem.doFontLabel(pos, text, GuiData.tinyfont, Color.DarkGray, float.MaxValue, float.MaxValue);
         if (!Button.doButton(999, 10, 10, 200, 30, "<- Back to Menu", Color.Gray))
         {
             return;
         }
         ExitScreen();
         ScreenManager.AddScreen(new MainMenu(), ScreenManager.controllingPlayer);
     }
 }
コード例 #8
0
        public void doRespondDisplay(Rectangle bounds, SpriteBatch sb)
        {
            Vector2 pos   = new Vector2((float)(bounds.X + 2), (float)(bounds.Y + 20));
            string  str   = (string)null;
            int     width = bounds.Width - 20 - this.corner.Width;

            if (Button.doButton(800007, (int)pos.X, (int)pos.Y, width, 30, LocaleTerms.Loc("Return to Inbox"), new Color?(this.os.darkBackgroundColor)))
            {
                this.state = 3;
            }
            pos.Y += 50f;
            int num1 = 24;

            TextItem.doFontLabel(pos, LocaleTerms.Loc("Additional Details") + " :", GuiData.smallfont, new Color?(), (float)bounds.Width - (float)(((double)pos.X - (double)bounds.Width) * 1.20000004768372), float.MaxValue, false);
            pos.Y += (float)num1;
            for (int index = 0; index < this.emailReplyStrings.Count; ++index)
            {
                TextItem.doFontLabel(pos + new Vector2(25f, 0.0f), this.emailReplyStrings[index], GuiData.tinyfont, new Color?(), (float)((double)bounds.Width - ((double)pos.X - (double)bounds.X) * 2.0 - 20.0), float.MaxValue, false);
                float num2 = Math.Min(GuiData.tinyfont.MeasureString(this.emailReplyStrings[index]).X, (float)((double)bounds.Width - ((double)pos.X - (double)bounds.X) * 2.0 - 20.0));
                if (Button.doButton(80000 + index * 100, (int)((double)pos.X + (double)num2 + 30.0), (int)pos.Y, 20, 20, "-", new Color?()))
                {
                    this.emailReplyStrings.RemoveAt(index);
                }
                pos.Y += (float)num1;
            }
            if (this.addingNewReplyString)
            {
                string data             = (string)null;
                bool   getStringCommand = Programs.parseStringFromGetStringCommand(this.os, out data);
                if (data == null)
                {
                    data = "";
                }
                pos.Y += 5f;
                GuiData.spriteBatch.Draw(Utils.white, new Rectangle(bounds.X + 1, (int)pos.Y, bounds.Width - 2 - bounds.Width / 9, 40), this.os.indentBackgroundColor);
                pos.Y += 10f;
                TextItem.doFontLabel(pos + new Vector2(25f, 0.0f), data, GuiData.tinyfont, new Color?(), float.MaxValue, float.MaxValue, false);
                Vector2 vector2 = GuiData.tinyfont.MeasureString(data);
                vector2.Y = 0.0f;
                if ((double)this.os.timer % 1.0 <= 0.5)
                {
                    GuiData.spriteBatch.Draw(Utils.white, new Rectangle((int)((double)pos.X + (double)vector2.X + 2.0) + 25, (int)pos.Y, 4, 20), Color.White);
                }
                int num2 = bounds.Width - 1 - bounds.Width / 10;
                if (getStringCommand || Button.doButton(8000094, bounds.X + num2 - 4, (int)pos.Y - 10, bounds.Width / 9 - 3, 40, LocaleTerms.Loc("Add"), new Color?(this.os.highlightColor)))
                {
                    if (!getStringCommand)
                    {
                        this.os.terminal.executeLine();
                    }
                    this.addingNewReplyString = false;
                    this.emailReplyStrings.Add(data);
                    str = (string)null;
                }
                else
                {
                    str = data;
                }
            }
            else if (Button.doButton(8000098, (int)((double)pos.X + 25.0), (int)pos.Y, 20, 20, "+", new Color?()))
            {
                this.addingNewReplyString = true;
                this.os.execute("getString Detail");
                this.os.terminal.executionPreventionIsInteruptable = true;
            }
            pos.Y += 50f;
            if (Button.doButton(800008, (int)pos.X, (int)pos.Y, width, 30, LocaleTerms.Loc("Send"), new Color?()) && this.os.currentMission != null)
            {
                if (str != null)
                {
                    this.os.terminal.executeLine();
                    this.addingNewReplyString = false;
                    if (!string.IsNullOrEmpty(str))
                    {
                        this.emailReplyStrings.Add(str);
                    }
                }
                ActiveMission currentMission = this.os.currentMission;
                bool          flag           = this.attemptCompleteMission(this.os.currentMission);
                if (!flag)
                {
                    for (int index = 0; index < this.os.branchMissions.Count && !flag; ++index)
                    {
                        flag = this.attemptCompleteMission(this.os.branchMissions[index]);
                        if (flag)
                        {
                            this.os.branchMissions.Clear();
                        }
                    }
                }
                if (!flag)
                {
                    this.missionIncompleteReply = true;
                }
                else
                {
                    this.AddSentEmailRecordFileForMissionCompletion(currentMission, this.emailReplyStrings);
                }
            }
            pos.Y += 45f;
            if (Settings.forceCompleteEnabled && Button.doButton(800009, (int)pos.X, (int)pos.Y, width, 30, LocaleTerms.Loc("Force Complete"), new Color?()))
            {
                if (this.os.currentMission != null)
                {
                    this.os.currentMission.finish();
                    this.os.MissionCompleteFlashTime = 3f;
                }
                this.state = 3;
            }
            pos.Y += 70f;
            if (!this.missionIncompleteReply || !(this.comp.idName == "jmail"))
            {
                return;
            }
            PatternDrawer.draw(new Rectangle(bounds.X + 2, (int)pos.Y, bounds.Width - 4, 128), 1f, this.os.lockedColor * 0.1f, this.os.brightLockedColor, sb, PatternDrawer.errorTile);
            string  text      = LocaleTerms.Loc("Mission Incomplete");
            Vector2 vector2_1 = GuiData.font.MeasureString(text);

            TextItem.doLabel(new Vector2((float)(bounds.X + bounds.Width / 2) - vector2_1.X / 2f, pos.Y + 40f), text, new Color?());
        }
コード例 #9
0
        public override void draw(Rectangle bounds, SpriteBatch sb)
        {
            base.draw(bounds, sb);
            PatternDrawer.draw(new Rectangle(bounds.X + 1, bounds.Y + 1, bounds.Width - 2, bounds.Height - 2), 0.28f,
                               Color.Transparent, themeColor * 0.1f, sb, PatternDrawer.thinStripe);
            drawTopBar(bounds, sb);
            if (!hasSysfile())
            {
                if (Button.doButton(800003, bounds.X + 10, bounds.Y + topBar.Height + 10, 300, 30, "Exit", themeColor))
                {
                    os.display.command = "connect";
                }
                PatternDrawer.draw(
                    new Rectangle(bounds.X + 1, bounds.Y + 1 + 64, bounds.Width - 2, bounds.Height - 2 - 64), 1f,
                    Color.Transparent, os.lockedColor, sb, PatternDrawer.errorTile);
                var num1 = bounds.X + 20;
                var num2 = bounds.Y + bounds.Height / 2 - 20;
                TextItem.doLabel(new Vector2(num1, num2), "CRITICAL ERROR", new Color?());
                var num3 = num2 + 40;
                TextItem.doSmallLabel(new Vector2(num1, num3),
                                      "ERROR #4040408 - NULL_SYSFILE\nUnhandled Exception - IOException@L 2217 :R 28\nSystem Files Corrupted and/or Destroyed\nContact the System Administrator",
                                      new Color?());
            }
            else
            {
                switch (state)
                {
                case 0:
                    if (Button.doButton(800003, bounds.X + 10, bounds.Y + topBar.Height + 10, 300, 30, "Exit",
                                        themeColor))
                    {
                        os.display.command = "connect";
                    }
                    sb.Draw(logo, new Rectangle(bounds.X + 30, bounds.Y + 115, 128, 128), Color.White);
                    TextItem.doFontLabel(new Vector2(bounds.X + 40 + 128, bounds.Y + 115),
                                         groupName + " Group\nMessage Board", GuiData.font, new Color?(), bounds.Width - 40, 60f);
                    if (
                        !Button.doButton(800004, bounds.X + 30, bounds.Y + bounds.Height / 2, 300, 40, "Login",
                                         themeColor))
                    {
                        break;
                    }
                    startLogin();
                    state = 3;
                    break;

                case 1:
                    if (Button.doButton(800003, bounds.X + 10, bounds.Y + topBar.Height + 10, 300, 30, "Exit",
                                        themeColor))
                    {
                        os.display.command = "connect";
                    }
                    var num4 = bounds.X + 10;
                    var num5 = bounds.Y + topBar.Height + 50;
                    logoRect.X = num4;
                    logoRect.Y = num5;
                    sb.Draw(logo, logoRect, Color.White);
                    var x = num4 + (logoRect.Width + 5);
                    TextItem.doLabel(new Vector2(x, num5), listingTitle, new Color?());
                    var y = num5 + 40;
                    for (var index = 0; index < missions.Count; ++index)
                    {
                        if (hasListingFile(missions[index].postingTitle))
                        {
                            if (Button.doButton(87654 + index, x, y, (int)(bounds.Width * 0.800000011920929), 30,
                                                missions[index].postingTitle, new Color?()))
                            {
                                state       = 2;
                                targetIndex = index;
                            }
                            y += 35;
                        }
                    }
                    break;

                case 2:
                    if (Button.doButton(800003, bounds.X + 10, bounds.Y + topBar.Height + 10, 300, 30, "Back",
                                        themeColor))
                    {
                        state = 1;
                    }
                    var num6 = 60;
                    var num7 = 84;
                    var destinationRectangle = new Rectangle(bounds.X + 30, bounds.Y + topBar.Height + num6, num7,
                                                             num7);
                    sb.Draw(logo, destinationRectangle, themeColor);
                    var num8 = num6 + 30;
                    TextItem.doFontLabel(new Vector2(bounds.X + 34 + num7, bounds.Y + topBar.Height + num8),
                                         missions[targetIndex].postingTitle, GuiData.font, new Color?(),
                                         bounds.Width - (36 + num7 + 6), 40f);
                    var num9 = num8 + 40;
                    PatternDrawer.draw(
                        new Rectangle(destinationRectangle.X + destinationRectangle.Width + 2,
                                      bounds.Y + topBar.Height + num9 - 8,
                                      bounds.Width - (destinationRectangle.X - bounds.X + destinationRectangle.Width + 10),
                                      PatternDrawer.warningStripe.Height / 2), 1f, Color.Transparent, themeColor, sb,
                        PatternDrawer.warningStripe);
                    var num10 = num9 + 36;
                    var text  = Utils.SuperSmartTwimForWidth(missions[targetIndex].postingBody, bounds.Width - 60,
                                                             GuiData.tinyfont);
                    TextItem.doFontLabel(new Vector2(bounds.X + 30, bounds.Y + topBar.Height + num10), text,
                                         GuiData.tinyfont, new Color?(), bounds.Width, bounds.Height - num10 - topBar.Height - 10);
                    var flag = os.currentFaction.idName.ToLower() == groupName.ToLower();
                    if (missionAssigner && os.currentMission == null &&
                        (flag &&
                         Button.doButton(800005, bounds.X + bounds.Width / 2 - 10, bounds.Y + bounds.Height - 35,
                                         bounds.Width / 2, 30, "Accept", os.highlightColor)))
                    {
                        os.currentMission = missions[targetIndex];
                        var activeMission =
                            (ActiveMission)ComputerLoader.readMission(missions[targetIndex].reloadGoalsSourceFile);
                        missions[targetIndex].sendEmail(os);
                        missions[targetIndex].ActivateSuppressedStartFunctionIfPresent();
                        removeMission(targetIndex);
                        state = 1;
                        break;
                    }
                    if (missionAssigner && os.currentMission != null)
                    {
                        if (os.currentMission.wasAutoGenerated &&
                            Button.doButton(8000105, bounds.X + 6, bounds.Y + bounds.Height - 29, 210, 25,
                                            "Abandon Current Contract", os.lockedColor))
                        {
                            os.currentMission = null;
                            os.currentFaction.contractAbbandoned(os);
                        }
                        TextItem.doFontLabel(new Vector2(bounds.X + 10, bounds.Y + bounds.Height - 52),
                                             "Mission Unavaliable : " +
                                             (flag ? "Complete Existing Contracts" : "user ID Assigned to Different Faction "),
                                             GuiData.smallfont, new Color?(), bounds.Width - 20, 30f);
                        break;
                    }
                    if (!missionAssigner || flag)
                    {
                        break;
                    }
                    TextItem.doFontLabel(new Vector2(bounds.X + 10, bounds.Y + bounds.Height - 52),
                                         "Mission Unavaliable : User ID Assigned to Different Faction ", GuiData.smallfont,
                                         new Color?(), bounds.Width - 20, 30f);
                    break;

                case 3:
                    doLoginDisplay(bounds, sb);
                    break;
                }
            }
        }
コード例 #10
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();
        }
コード例 #11
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();
        }
コード例 #12
0
ファイル: MailServer.cs プロジェクト: strangea/OpenHacknet
        public void doRespondDisplay(Rectangle bounds, SpriteBatch sb)
        {
            var    pos   = new Vector2(bounds.X + 2, bounds.Y + 20);
            string str   = null;
            var    width = bounds.Width - 20 - corner.Width;

            if (Button.doButton(800007, (int)pos.X, (int)pos.Y, width, 30, "Return to Inbox", os.darkBackgroundColor))
            {
                state = 3;
            }
            pos.Y += 50f;
            var num1 = 24;

            TextItem.doFontLabel(pos, "Additional Details :", GuiData.smallfont, new Color?(),
                                 bounds.Width - (float)((pos.X - (double)bounds.Width) * 2.0), float.MaxValue);
            pos.Y += num1;
            for (var index = 0; index < emailReplyStrings.Count; ++index)
            {
                TextItem.doFontLabel(pos + new Vector2(25f, 0.0f), emailReplyStrings[index], GuiData.tinyfont,
                                     new Color?(), (float)(bounds.Width - (pos.X - (double)bounds.X) * 2.0 - 20.0), float.MaxValue);
                var num2 = Math.Min(GuiData.tinyfont.MeasureString(emailReplyStrings[index]).X,
                                    (float)(bounds.Width - (pos.X - (double)bounds.X) * 2.0 - 20.0));
                if (Button.doButton(80000 + index * 100, (int)(pos.X + (double)num2 + 30.0), (int)pos.Y, 20, 20, "-",
                                    new Color?()))
                {
                    emailReplyStrings.RemoveAt(index);
                }
                pos.Y += num1;
            }
            if (addingNewReplyString)
            {
                string data          = null;
                var    stringCommand = Programs.parseStringFromGetStringCommand(os, out data);
                if (data == null)
                {
                    data = "";
                }
                pos.Y += 5f;
                GuiData.spriteBatch.Draw(Utils.white,
                                         new Rectangle(bounds.X + 1, (int)pos.Y, bounds.Width - 2 - bounds.Width / 9, 40),
                                         os.indentBackgroundColor);
                pos.Y += 10f;
                TextItem.doFontLabel(pos + new Vector2(25f, 0.0f), data, GuiData.tinyfont, new Color?(), float.MaxValue,
                                     float.MaxValue);
                var vector2 = GuiData.tinyfont.MeasureString(data);
                vector2.Y = 0.0f;
                if (os.timer % 1.0 <= 0.5)
                {
                    GuiData.spriteBatch.Draw(Utils.white,
                                             new Rectangle((int)(pos.X + (double)vector2.X + 2.0) + 25, (int)pos.Y, 4, 20), Color.White);
                }
                var num2 = bounds.Width - 1 - bounds.Width / 10;
                if (stringCommand ||
                    Button.doButton(8000094, bounds.X + num2 - 4, (int)pos.Y - 10, bounds.Width / 9 - 3, 40, "Add",
                                    os.highlightColor))
                {
                    if (!stringCommand)
                    {
                        os.terminal.executeLine();
                    }
                    addingNewReplyString = false;
                    emailReplyStrings.Add(data);
                    str = null;
                }
                else
                {
                    str = data;
                }
            }
            else if (Button.doButton(8000098, (int)(pos.X + 25.0), (int)pos.Y, 20, 20, "+", new Color?()))
            {
                addingNewReplyString = true;
                os.execute("getString Detail");
                os.terminal.executionPreventionIsInteruptable = true;
            }
            pos.Y += 50f;
            if (Button.doButton(800008, (int)pos.X, (int)pos.Y, width, 30, "Send", new Color?()) &&
                os.currentMission != null)
            {
                if (str != null)
                {
                    os.terminal.executeLine();
                    addingNewReplyString = false;
                    if (!string.IsNullOrEmpty(str))
                    {
                        emailReplyStrings.Add(str);
                    }
                }
                var flag = attemptCompleteMission(os.currentMission);
                if (!flag)
                {
                    for (var index = 0; index < os.branchMissions.Count && !flag; ++index)
                    {
                        flag = attemptCompleteMission(os.branchMissions[index]);
                        if (flag)
                        {
                            os.branchMissions.Clear();
                        }
                    }
                }
                if (!flag)
                {
                    missionIncompleteReply = true;
                }
            }
            pos.Y += 45f;
            if (OS.DEBUG_COMMANDS && Settings.forceCompleteEnabled &&
                Button.doButton(800009, (int)pos.X, (int)pos.Y, width, 30, "Force Complete", new Color?()))
            {
                if (os.currentMission != null)
                {
                    os.currentMission.finish();
                }
                state = 3;
            }
            pos.Y += 70f;
            if (!missionIncompleteReply)
            {
                return;
            }
            PatternDrawer.draw(new Rectangle(bounds.X + 2, (int)pos.Y, bounds.Width - 4, 128), 1f, os.lockedColor * 0.1f,
                               os.brightLockedColor, sb, PatternDrawer.errorTile);
            var text      = "Mission Incomplete";
            var vector2_1 = GuiData.font.MeasureString(text);

            TextItem.doLabel(new Vector2(bounds.X + bounds.Width / 2 - vector2_1.X / 2f, pos.Y + 40f), text, new Color?());
        }
コード例 #13
0
 public void drawConnectingGui()
 {
     PatternDrawer.draw(new Rectangle(100, 200, 600, 250), 1.4f, Color.DarkGreen * 0.3f, Color.DarkGreen,
                        GuiData.spriteBatch);
     TextItem.doLabel(new Vector2(110f, 210f), "Connecting...", new Color?());
 }
コード例 #14
0
ファイル: DisplayModule.cs プロジェクト: strangea/OpenHacknet
        private void doLoginDisplay()
        {
            var strArray = os.displayCache.Split(new string[1]
            {
                "#$#$#$$#$&$#$#$#$#"
            }, StringSplitOptions.None);
            var text1 = "";
            var text2 = "";
            var num1  = -1;
            var num2  = 0;

            if (strArray[0].Equals("loginData"))
            {
                text1 = !(strArray[1] != "") ? os.terminal.currentLine : strArray[1];
                if (strArray.Length > 2)
                {
                    num2  = 1;
                    text2 = strArray[2];
                    if (text2.Equals(""))
                    {
                        for (var index = 0; index < os.terminal.currentLine.Length; ++index)
                        {
                            text2 += "*";
                        }
                    }
                    else
                    {
                        var str = "";
                        for (var index = 0; index < text2.Length; ++index)
                        {
                            str += "*";
                        }
                        text2 = str;
                    }
                }
                if (strArray.Length > 3)
                {
                    num2 = 2;
                    num1 = Convert.ToInt32(strArray[3]);
                }
            }
            doConnectHeader();
            var destinationRectangle = GuiData.tmpRect;

            destinationRectangle.X      = bounds.X + 2;
            destinationRectangle.Y      = this.y;
            destinationRectangle.Height = 200;
            destinationRectangle.Width  = bounds.Width - 4;
            spriteBatch.Draw(Utils.white, destinationRectangle, num1 == 0 ? os.lockedColor : os.indentBackgroundColor);
            destinationRectangle.Height = 22;
            this.y += 30;
            var vector2 = TextItem.doMeasuredLabel(new Vector2(this.x, this.y), "Login ", Color.White);

            if (num1 == 0)
            {
                x += (int)vector2.X;
                TextItem.doLabel(new Vector2(x, y), "Failed", os.brightLockedColor);
                x -= (int)vector2.X;
            }
            else if (num1 != -1)
            {
                x += (int)vector2.X;
                TextItem.doLabel(new Vector2(x, y), "Successful", os.brightUnlockedColor);
                x -= (int)vector2.X;
            }
            this.y += 60;
            if (num2 == 0)
            {
                destinationRectangle.Y = y;
                spriteBatch.Draw(Utils.white, destinationRectangle, os.subtleTextColor);
            }
            spriteBatch.DrawString(GuiData.smallfont, "username :"******"password :"******"Complete" : "Back",
                                    os.indentBackgroundColor))
                {
                    command = "connect";
                }
                if (num1 > 0 || !Button.doButton(123456, x + 75, y, 70, 30, "Retry", os.indentBackgroundColor))
                {
                    return;
                }
                os.runCommand("login");
            }
            else
            {
                this.y += 65;
                var x        = this.x;
                var y        = this.y;
                var computer = os.connectedComp == null ? os.thisComputer : os.connectedComp;
                for (var index = 0; index < computer.users.Count; ++index)
                {
                    if (computer.users[index].known && Daemon.validUser(computer.users[index].type))
                    {
                        x = this.x + 320;
                        if (Button.doButton(123457 + index, this.x, this.y, 300, 25,
                                            "Login - User: "******" Pass: "******"Cancel", os.lockedColor))
                {
                    return;
                }
                forceLogin("", "");
                command = "connect";
            }
        }
コード例 #15
0
        public override void draw(Rectangle bounds, SpriteBatch sb)
        {
            base.draw(bounds, sb);
            PatternDrawer.draw(new Rectangle(bounds.X + 1, bounds.Y + 1, bounds.Width - 2, bounds.Height - 2), 0.28f, Color.Transparent, this.themeColor * 0.1f, sb, PatternDrawer.thinStripe);
            this.drawTopBar(bounds, sb);
            if (!this.hasSysfile())
            {
                if (Button.doButton(800003, bounds.X + 10, bounds.Y + this.topBar.Height + 10, 300, 30, LocaleTerms.Loc("Exit"), new Color?(this.themeColor)))
                {
                    this.os.display.command = "connect";
                }
                PatternDrawer.draw(new Rectangle(bounds.X + 1, bounds.Y + 1 + 64, bounds.Width - 2, bounds.Height - 2 - 64), 1f, Color.Transparent, this.os.lockedColor, sb, PatternDrawer.errorTile);
                int num1 = bounds.X + 20;
                int num2 = bounds.Y + bounds.Height / 2 - 20;
                TextItem.doLabel(new Vector2((float)num1, (float)num2), LocaleTerms.Loc("CRITICAL ERROR"), new Color?());
                int num3 = num2 + 40;
                TextItem.doSmallLabel(new Vector2((float)num1, (float)num3), "ERROR #4040408 - NULL_SYSFILE\nUnhandled Exception - IOException@L 2217 :R 28\nSystem Files Corrupted and/or Destroyed\nContact the System Administrator", new Color?());
            }
            else
            {
                switch (this.state)
                {
                case 0:
                    if (Button.doButton(800003, bounds.X + 10, bounds.Y + this.topBar.Height + 10, 300, 30, LocaleTerms.Loc("Exit"), new Color?(this.themeColor)))
                    {
                        this.os.display.command = "connect";
                    }
                    sb.Draw(this.logo, new Rectangle(bounds.X + 30, bounds.Y + 115, 128, 128), Color.White);
                    string text1 = string.IsNullOrWhiteSpace(this.listingTitle) ? string.Format(LocaleTerms.Loc("{0} Group"), (object)this.groupName) + "\n" + LocaleTerms.Loc("Message Board") : this.listingTitle;
                    TextItem.doFontLabel(new Vector2((float)(bounds.X + 40 + 128), (float)(bounds.Y + 115)), text1, GuiData.font, new Color?(), (float)(bounds.Width - 40), 60f, false);
                    if (!Button.doButton(800004, bounds.X + 30, bounds.Y + bounds.Height / 2, 300, 40, LocaleTerms.Loc("Login"), new Color?(this.themeColor)))
                    {
                        break;
                    }
                    this.startLogin();
                    this.state = 3;
                    break;

                case 1:
                    if (Button.doButton(800003, bounds.X + 10, bounds.Y + this.topBar.Height + 10, 300, 30, LocaleTerms.Loc("Exit"), new Color?(this.themeColor)))
                    {
                        this.os.display.command = "connect";
                    }
                    int num4 = bounds.X + 10;
                    int num5 = bounds.Y + this.topBar.Height + 50;
                    this.logoRect.X = num4;
                    this.logoRect.Y = num5;
                    sb.Draw(this.logo, this.logoRect, Color.White);
                    int x = num4 + (this.logoRect.Width + 5);
                    TextItem.doLabel(new Vector2((float)x, (float)num5), this.listingTitle, new Color?());
                    int y = num5 + 40;
                    for (int index = 0; index < this.missions.Count; ++index)
                    {
                        if (this.hasListingFile(this.missions[index].postingTitle))
                        {
                            Rectangle rectangle = new Rectangle(x, y, (int)((double)bounds.Width * 0.800000011920929), 30);
                            rectangle        = Utils.InsetRectangle(rectangle, 1);
                            rectangle.X     += 12;
                            rectangle.Width -= 12;
                            if (this.missions[index].postingTitle.StartsWith("#"))
                            {
                                PatternDrawer.draw(rectangle, 1f, Color.Black * 1f, Color.DarkRed * 0.3f, sb, PatternDrawer.warningStripe);
                            }
                            if (Button.doButton(87654 + index, x, y, (int)((double)bounds.Width * 0.800000011920929), 30, this.missions[index].postingTitle, new Color?()))
                            {
                                this.state       = 2;
                                this.targetIndex = index;
                            }
                            y += 35;
                        }
                    }
                    break;

                case 2:
                    if (Button.doButton(800003, bounds.X + 10, bounds.Y + this.topBar.Height + 10, 300, 30, LocaleTerms.Loc("Back"), new Color?(this.themeColor)))
                    {
                        this.state = 1;
                    }
                    int       num6 = 60;
                    int       num7 = 84;
                    Rectangle destinationRectangle = new Rectangle(bounds.X + 30, bounds.Y + this.topBar.Height + num6, num7, num7);
                    sb.Draw(this.logo, destinationRectangle, this.themeColor);
                    int num8 = num6 + 30;
                    TextItem.doFontLabel(new Vector2((float)(bounds.X + 34 + num7), (float)(bounds.Y + this.topBar.Height + num8)), this.missions[this.targetIndex].postingTitle, GuiData.font, new Color?(), (float)(bounds.Width - (36 + num7 + 6)), 40f, false);
                    int num9 = num8 + 40;
                    PatternDrawer.draw(new Rectangle(destinationRectangle.X + destinationRectangle.Width + 2, bounds.Y + this.topBar.Height + num9 - 8, bounds.Width - (destinationRectangle.X - bounds.X + destinationRectangle.Width + 10), PatternDrawer.warningStripe.Height / 2), 1f, Color.Transparent, this.themeColor, sb, PatternDrawer.warningStripe);
                    int    num10 = num9 + 36;
                    string text2 = Utils.SuperSmartTwimForWidth(this.missions[this.targetIndex].postingBody, bounds.Width - 60, GuiData.tinyfont);
                    if (this.TextRegion == null)
                    {
                        this.TextRegion = new ScrollableTextRegion(sb.GraphicsDevice);
                    }
                    this.TextRegion.Draw(new Rectangle(bounds.X + 30, bounds.Y + this.topBar.Height + num10, bounds.Width - 50, bounds.Height - num10 - this.topBar.Height - 10), text2, sb);
                    bool flag = this.os.currentFaction != null && this.os.currentFaction.idName.ToLower() == this.groupName.ToLower();
                    if (this.missionAssigner && this.os.currentMission == null && flag && Button.doButton(800005, bounds.X + bounds.Width / 2 - 10, bounds.Y + bounds.Height - 35, bounds.Width / 2, 30, LocaleTerms.Loc("Accept"), new Color?(this.os.highlightColor)))
                    {
                        this.os.currentMission = this.missions[this.targetIndex];
                        ActiveMission activeMission = (ActiveMission)ComputerLoader.readMission(this.missions[this.targetIndex].reloadGoalsSourceFile);
                        this.missions[this.targetIndex].sendEmail(this.os);
                        this.missions[this.targetIndex].ActivateSuppressedStartFunctionIfPresent();
                        this.removeMission(this.targetIndex);
                        this.state = 1;
                        break;
                    }
                    if (this.missionAssigner && this.os.currentMission != null)
                    {
                        if (this.os.currentMission.wasAutoGenerated && Button.doButton(8000105, bounds.X + 6, bounds.Y + bounds.Height - 29, 210, 25, LocaleTerms.Loc("Abandon Current Contract"), new Color?(this.os.lockedColor)))
                        {
                            this.os.currentMission = (ActiveMission)null;
                            this.os.currentFaction.contractAbbandoned((object)this.os);
                        }
                        TextItem.doFontLabel(new Vector2((float)(bounds.X + 10), (float)(bounds.Y + bounds.Height - 52)), LocaleTerms.Loc("Mission Unavailable") + " : " + (flag ? LocaleTerms.Loc("Complete Existing Contracts") : LocaleTerms.Loc("User ID Assigned to Different Faction") + " "), GuiData.smallfont, new Color?(), (float)(bounds.Width - 20), 30f, false);
                        break;
                    }
                    if (!this.missionAssigner || flag)
                    {
                        break;
                    }
                    TextItem.doFontLabel(new Vector2((float)(bounds.X + 10), (float)(bounds.Y + bounds.Height - 52)), LocaleTerms.Loc("Mission Unavailable") + " : " + LocaleTerms.Loc("User ID Assigned to Different Faction") + " ", GuiData.smallfont, new Color?(), (float)(bounds.Width - 20), 30f, false);
                    break;

                case 3:
                    this.doLoginDisplay(bounds, sb);
                    break;
                }
            }
        }
コード例 #16
0
        public void doLoginDisplay(Rectangle bounds, SpriteBatch sb)
        {
            int num1 = bounds.X + 20;
            int num2 = bounds.Y + 100;

            string[] strArray = this.os.displayCache.Split(new string[1] {
                "#$#$#$$#$&$#$#$#$#"
            }, StringSplitOptions.None);
            string text1 = "";
            string text2 = "";
            int    num3  = -1;
            int    num4  = 0;

            if (strArray[0].Equals("loginData"))
            {
                text1 = !(strArray[1] != "") ? this.os.terminal.currentLine : strArray[1];
                if (strArray.Length > 2)
                {
                    num4  = 1;
                    text2 = strArray[2];
                    if (text2.Equals(""))
                    {
                        for (int index = 0; index < this.os.terminal.currentLine.Length; ++index)
                        {
                            text2 += "*";
                        }
                    }
                    else
                    {
                        string str = "";
                        for (int index = 0; index < text2.Length; ++index)
                        {
                            str += "*";
                        }
                        text2 = str;
                    }
                }
                if (strArray.Length > 3)
                {
                    num4 = 2;
                    num3 = Convert.ToInt32(strArray[3]);
                }
            }
            Rectangle tmpRect = GuiData.tmpRect;

            tmpRect.X      = bounds.X + 2;
            tmpRect.Y      = num2;
            tmpRect.Height = 200;
            tmpRect.Width  = bounds.Width - 4;
            sb.Draw(Utils.white, tmpRect, num3 == 0 ? this.os.lockedColor : this.os.indentBackgroundColor);
            if (num3 != 0 && num3 != -1)
            {
                for (int index1 = 0; index1 < this.comp.users.Count; ++index1)
                {
                    if (this.comp.users[index1].name.Equals(text1))
                    {
                        this.user = this.comp.users[index1];
                        for (int index2 = 0; index2 < this.accounts.folders.Count; ++index2)
                        {
                            if (this.accounts.folders[index2].name.Equals(this.user.name))
                            {
                                this.userFolder = this.accounts.folders[index2];
                                break;
                            }
                        }
                        break;
                    }
                }
                this.state = 3;
            }
            tmpRect.Height = 22;
            int     num5    = num2 + 30;
            Vector2 vector2 = TextItem.doMeasuredLabel(new Vector2((float)num1, (float)num5), LocaleTerms.Loc("Login") + " ", new Color?(this.textColor));

            if (num3 == 0)
            {
                int num6 = num1 + (int)vector2.X;
                TextItem.doLabel(new Vector2((float)num6, (float)num5), LocaleTerms.Loc("Failed"), new Color?(this.os.brightLockedColor));
                num1 = num6 - (int)vector2.X;
            }
            int num7 = num5 + 60;

            if (num4 == 0)
            {
                tmpRect.Y = num7;
                sb.Draw(Utils.white, tmpRect, this.os.subtleTextColor);
            }
            sb.DrawString(GuiData.smallfont, LocaleTerms.Loc("username") + " :", new Vector2((float)num1, (float)num7), this.textColor);
            int num8 = num1 + 100;

            sb.DrawString(GuiData.smallfont, text1, new Vector2((float)num8, (float)num7), this.textColor);
            int num9  = num8 - 100;
            int num10 = num7 + 30;

            if (num4 == 1)
            {
                tmpRect.Y = num10;
                sb.Draw(Utils.white, tmpRect, this.os.subtleTextColor);
            }
            sb.DrawString(GuiData.smallfont, LocaleTerms.Loc("password") + " :", new Vector2((float)num9, (float)num10), this.textColor);
            int num11 = num9 + 100;

            sb.DrawString(GuiData.smallfont, text2, new Vector2((float)num11, (float)num10), this.textColor);
            int y1 = num10 + 30;
            int x  = num11 - 100;

            if (num3 != -1)
            {
                if (Button.doButton(12345, x, y1, 70, 30, LocaleTerms.Loc("Back"), new Color?(this.os.indentBackgroundColor)))
                {
                    this.state = 0;
                }
                if (!Button.doButton(123456, x + 75, y1, 70, 30, LocaleTerms.Loc("Retry"), new Color?(this.os.indentBackgroundColor)))
                {
                    return;
                }
                this.os.displayCache = "";
                this.os.execute("login");
                do
                {
                    ;
                }while (this.os.displayCache.Equals(""));
                this.os.display.command = this.name;
            }
            else
            {
                int y2 = y1 + 65;
                for (int index = 0; index < this.comp.users.Count; ++index)
                {
                    if (this.comp.users[index].known && MailServer.validUser(this.comp.users[index].type))
                    {
                        if (Button.doButton(123457 + index, x, y2, 300, 25, "User: "******" Pass: " + this.comp.users[index].pass, new Color?(this.os.darkBackgroundColor)))
                        {
                            this.forceLogin(this.comp.users[index].name, this.comp.users[index].pass);
                        }
                        y2 += 27;
                    }
                }
            }
        }
コード例 #17
0
ファイル: MailServer.cs プロジェクト: strangea/OpenHacknet
        public void doLoginDisplay(Rectangle bounds, SpriteBatch sb)
        {
            var num1     = bounds.X + 20;
            var num2     = bounds.Y + 100;
            var strArray = os.displayCache.Split(new string[1]
            {
                "#$#$#$$#$&$#$#$#$#"
            }, StringSplitOptions.None);
            var text1 = "";
            var text2 = "";
            var num3  = -1;
            var num4  = 0;

            if (strArray[0].Equals("loginData"))
            {
                text1 = !(strArray[1] != "") ? os.terminal.currentLine : strArray[1];
                if (strArray.Length > 2)
                {
                    num4  = 1;
                    text2 = strArray[2];
                    if (text2.Equals(""))
                    {
                        for (var index = 0; index < os.terminal.currentLine.Length; ++index)
                        {
                            text2 += "*";
                        }
                    }
                    else
                    {
                        var str = "";
                        for (var index = 0; index < text2.Length; ++index)
                        {
                            str += "*";
                        }
                        text2 = str;
                    }
                }
                if (strArray.Length > 3)
                {
                    num4 = 2;
                    num3 = Convert.ToInt32(strArray[3]);
                }
            }
            var destinationRectangle = GuiData.tmpRect;

            destinationRectangle.X      = bounds.X + 2;
            destinationRectangle.Y      = num2;
            destinationRectangle.Height = 200;
            destinationRectangle.Width  = bounds.Width - 4;
            sb.Draw(Utils.white, destinationRectangle, num3 == 0 ? os.lockedColor : os.indentBackgroundColor);
            if (num3 != 0 && num3 != -1)
            {
                for (var index1 = 0; index1 < comp.users.Count; ++index1)
                {
                    if (comp.users[index1].name.Equals(text1))
                    {
                        user = comp.users[index1];
                        for (var index2 = 0; index2 < accounts.folders.Count; ++index2)
                        {
                            if (accounts.folders[index2].name.Equals(user.name))
                            {
                                userFolder = accounts.folders[index2];
                                break;
                            }
                        }
                        break;
                    }
                }
                state = 3;
            }
            destinationRectangle.Height = 22;
            var num5    = num2 + 30;
            var vector2 = TextItem.doMeasuredLabel(new Vector2(num1, num5), "Login ", textColor);

            if (num3 == 0)
            {
                var num6 = num1 + (int)vector2.X;
                TextItem.doLabel(new Vector2(num6, num5), "Failed", os.brightLockedColor);
                num1 = num6 - (int)vector2.X;
            }
            var num7 = num5 + 60;

            if (num4 == 0)
            {
                destinationRectangle.Y = num7;
                sb.Draw(Utils.white, destinationRectangle, os.subtleTextColor);
            }
            sb.DrawString(GuiData.smallfont, "username :"******"password :"******"Back", os.indentBackgroundColor))
                {
                    state = 0;
                }
                if (!Button.doButton(123456, x + 75, y1, 70, 30, "Retry", os.indentBackgroundColor))
                {
                    return;
                }
                os.displayCache = "";
                os.execute("login");
                do
                {
                    ;
                } while (os.displayCache.Equals(""));
                os.display.command = name;
            }
            else
            {
                var y2 = y1 + 65;
                for (var index = 0; index < comp.users.Count; ++index)
                {
                    if (comp.users[index].known && validUser(comp.users[index].type))
                    {
                        if (Button.doButton(123457 + index, x, y2, 300, 25,
                                            "User: "******" Pass: " + comp.users[index].pass,
                                            os.darkBackgroundColor))
                        {
                            forceLogin(comp.users[index].name, comp.users[index].pass);
                        }
                        y2 += 27;
                    }
                }
            }
        }
コード例 #18
0
        private void doLoginDisplay()
        {
            string[] separator = new string[1] {
                "#$#$#$$#$&$#$#$#$#"
            };
            if (!this.lockLoginDisplayCache)
            {
                this.loginDetailsCache = this.os.displayCache;
            }
            string[] strArray = this.loginDetailsCache.Split(separator, StringSplitOptions.None);
            string   text1    = "";
            string   text2    = "";
            int      num1     = -1;
            int      num2     = 0;

            if (strArray[0].Equals("loginData"))
            {
                text1 = !(strArray[1] != "") ? this.os.terminal.currentLine : strArray[1];
                if (strArray.Length > 2)
                {
                    num2  = 1;
                    text2 = strArray[2];
                    if (text2.Equals(""))
                    {
                        for (int index = 0; index < this.os.terminal.currentLine.Length; ++index)
                        {
                            text2 += "*";
                        }
                    }
                    else
                    {
                        string str = "";
                        for (int index = 0; index < text2.Length; ++index)
                        {
                            str += "*";
                        }
                        text2 = str;
                    }
                }
                if (strArray.Length > 3)
                {
                    num2 = 2;
                    num1 = Convert.ToInt32(strArray[3]);
                }
            }
            this.doConnectHeader();
            Rectangle tmpRect = GuiData.tmpRect;

            tmpRect.X      = this.bounds.X + 2;
            tmpRect.Y      = this.y;
            tmpRect.Height = 200;
            tmpRect.Width  = this.bounds.Width - 4;
            this.spriteBatch.Draw(Utils.white, tmpRect, num1 == 0 ? this.os.lockedColor : this.os.indentBackgroundColor);
            if (num1 != 0)
            {
                ;
            }
            tmpRect.Height = 22;
            this.y        += 30;
            Vector2 vector2 = TextItem.doMeasuredLabel(new Vector2((float)this.x, (float)this.y), LocaleTerms.Loc("Login "), new Color?(Color.White));

            if (num1 == 0)
            {
                this.x += (int)vector2.X;
                TextItem.doLabel(new Vector2((float)this.x, (float)this.y), LocaleTerms.Loc("Failed"), new Color?(this.os.brightLockedColor));
                this.x -= (int)vector2.X;
                this.lockLoginDisplayCache = true;
            }
            else if (num1 != -1)
            {
                this.x += (int)vector2.X;
                TextItem.doLabel(new Vector2((float)this.x, (float)this.y), LocaleTerms.Loc("Successful"), new Color?(this.os.brightUnlockedColor));
                this.x -= (int)vector2.X;
                this.lockLoginDisplayCache = true;
            }
            this.y += 60;
            if (num2 == 0)
            {
                tmpRect.Y = this.y;
                this.spriteBatch.Draw(Utils.white, tmpRect, this.os.subtleTextColor);
            }
            int    num3  = 100;
            string text3 = LocaleTerms.Loc("username :"******"password :"******"Complete") : LocaleTerms.Loc("Back"), new Color?(this.os.indentBackgroundColor)))
                {
                    this.command = "connect";
                }
                if (num1 > 0 || !Button.doButton(123456, this.x + width + 5, this.y, width, 30, LocaleTerms.Loc("Retry"), new Color?(this.os.indentBackgroundColor)))
                {
                    return;
                }
                this.lockLoginDisplayCache = false;
                this.loginDetailsCache     = (string)null;
                this.os.runCommand("login");
            }
            else
            {
                this.y += 65;
                int      x        = this.x;
                int      y        = this.y;
                Computer computer = this.os.connectedComp == null ? this.os.thisComputer : this.os.connectedComp;
                for (int index = 0; index < computer.users.Count; ++index)
                {
                    if (computer.users[index].known && Daemon.validUser(computer.users[index].type))
                    {
                        x = this.x + 320;
                        if (Button.doButton(123457 + index, this.x, this.y, 300, 25, "Login - User: "******" Pass: "******"Cancel"), new Color?(this.os.lockedColor)))
                {
                    this.forceLogin("", "");
                    this.command = "connect";
                }
            }
        }