コード例 #1
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);
        }
コード例 #2
0
ファイル: MissionHubServer.cs プロジェクト: hochladen/Hacknet
        private void doUserListScreen(Rectangle bounds, SpriteBatch sb)
        {
            if (Button.doButton(101801, bounds.X + 2, bounds.Y + 20, bounds.Width / 4, 22, LocaleTerms.Loc("Back"), new Color?(this.themeColor)))
            {
                this.state = MissionHubServer.HubState.Menu;
            }
            Rectangle rectangle = new Rectangle(bounds.X + 30, bounds.Y + 50, bounds.Width / 2, 30);
            int       num1      = 18 + rectangle.Height - 8;
            int       num2      = (bounds.Height - 90) / num1;
            int       num3      = num2 * this.userListPageNumber;
            int       num4      = 0;

            for (int index1 = num2 * this.userListPageNumber; index1 < this.usersFolder.files.Count && index1 < num3 + num2; ++index1)
            {
                string[] strArray = this.usersFolder.files[index1].data.Split(Utils.newlineDelim);
                string   str1;
                string   str2 = str1 = "";
                string   str3 = str1;
                string   str4 = str1;
                string   str5 = str1;
                for (int index2 = 0; index2 < strArray.Length; ++index2)
                {
                    if (strArray[index2].StartsWith("USER"))
                    {
                        str5 = this.getDataFromConfigLine(strArray[index2], ": ");
                    }
                    if (strArray[index2].StartsWith("Rank"))
                    {
                        str2 = this.getDataFromConfigLine(strArray[index2], ": ");
                    }
                    if (strArray[index2].StartsWith("Handle"))
                    {
                        str4 = this.getDataFromConfigLine(strArray[index2], ": ");
                    }
                    if (strArray[index2].StartsWith("Date"))
                    {
                        str3 = this.getDataFromConfigLine(strArray[index2], ": ");
                    }
                }
                Rectangle destinationRectangle = new Rectangle(rectangle.X + (bounds.Width - 60) - 10, rectangle.Y + 2, rectangle.Height + 1, bounds.Width - 60);
                GuiData.spriteBatch.Draw(Utils.gradient, destinationRectangle, new Rectangle?(), this.themeColorLine, 1.570796f, Vector2.Zero, SpriteEffects.FlipHorizontally, 0.8f);
                TextItem.doSmallLabel(new Vector2((float)rectangle.X, (float)rectangle.Y), "#" + str5 + " - \"" + str4 + "\" Rank:" + str2, new Color?());
                rectangle.Y += 18;
                TextItem.doFontLabel(new Vector2((float)rectangle.X, (float)rectangle.Y), string.Format(LocaleTerms.Loc("Joined {0}"), (object)str3), GuiData.detailfont, new Color?(), float.MaxValue, float.MaxValue, false);
                rectangle.Y += rectangle.Height - 10;
                num4         = index1;
            }
            rectangle.Y += 16;
            if (this.userListPageNumber > 0 && Button.doButton(101005, rectangle.X, rectangle.Y, rectangle.Width / 2 - 20, 15, LocaleTerms.Loc("Previous Page"), new Color?()))
            {
                --this.userListPageNumber;
            }
            TextItem.doTinyLabel(new Vector2((float)(rectangle.X + rectangle.Width / 2 - 8), (float)rectangle.Y), string.Concat((object)this.userListPageNumber), new Color?());
            if (this.usersFolder.files.Count <= num4 + 1 || !Button.doButton(101010, rectangle.X + rectangle.Width / 2 + 10, rectangle.Y, rectangle.Width / 2 - 10, 15, LocaleTerms.Loc("Next Page"), new Color?()))
            {
                return;
            }
            ++this.userListPageNumber;
        }
コード例 #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
ファイル: 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);
        }
コード例 #5
0
ファイル: DebugDaemon.cs プロジェクト: oxygencraft/DebugMod
        private void DrawHome(Rectangle rect, Instance instance, float ticks, SpriteBatch sb)
        {
            string text = @"Welcome to the Debug Mod Daemon! This mod started off from an image, you can still find it by looking
up All ports open in Hacknet Steam Artwork. Later, I gave the mod early to someone and decided to do
more and more. After a while, I made the mod public. Ok, enough chatter about the history about this
mod, let's explain how to use this daemon.

The buttons with -> and <- are the forwards and backwards buttons. These will cycle from page to
page, there are five pages (unknown yet). In one of these pages, there will be a list of commands
you can use (not all are implemented yet or some aren't possible using this daemon). When you
select a command, you will be prompted with some info or the command will execute. If some info is
optional, you can skip it by typing null.";

            DrawPageRequirements(rect, instance, sb);
            Button.doButton(6, 673, 843, 25, 25, "<-", null);
            if (Button.doButton(49, 720, 843, 25, 25, "->", null))
            {
                State = DebugModState.Page1;
            }
            TextItem.doSmallLabel(new Vector2(300f, 120f), text, null);
        }
コード例 #6
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);
     }
 }
コード例 #7
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);
        }
コード例 #8
0
        public static string DrawGetStringControl(string prompt, Rectangle bounds, Action errorOccurs, Action cancelled, SpriteBatch sb, object os_obj, Color SearchButtonColor, Color CancelButtonColor, string upperPrompt = null, Color?BackingPanelColor = null)
        {
            OS os = (OS)os_obj;

            upperPrompt = upperPrompt == null ? prompt : upperPrompt;
            string  str  = "";
            int     x    = bounds.X + 6;
            int     y1   = bounds.Y + 2;
            Vector2 zero = Vector2.Zero;

            if (upperPrompt.Length > 0)
            {
                Vector2 vector2 = TextItem.doMeasuredSmallLabel(new Vector2((float)x, (float)y1), upperPrompt, new Color?());
                y1 += (int)vector2.Y + 10;
            }
            string[] separator = new string[1] {
                "#$#$#$$#$&$#$#$#$#"
            };
            string[] strArray = os.getStringCache.Split(separator, StringSplitOptions.None);
            if (strArray.Length > 1)
            {
                str = strArray[1];
                if (str.Equals(""))
                {
                    str = os.terminal.currentLine;
                }
            }
            Rectangle destinationRectangle = new Rectangle(x, y1, bounds.Width - 12, bounds.Height - 46);

            sb.Draw(Utils.white, destinationRectangle, BackingPanelColor.HasValue ? BackingPanelColor.Value : os.darkBackgroundColor);
            int     num              = y1 + 18;
            string  bracketedBit     = "";
            string  bracketedSection = Utils.ExtractBracketedSection(prompt, out bracketedBit);
            Vector2 vector2_1        = TextItem.doMeasuredSmallLabel(new Vector2((float)x, (float)num), bracketedSection + str, new Color?());

            TextItem.doSmallLabel(new Vector2((float)x, (float)((double)num + (double)vector2_1.Y + 2.0)), bracketedBit, new Color?());
            destinationRectangle.X      = x + (int)vector2_1.X + 2;
            destinationRectangle.Y      = num;
            destinationRectangle.Width  = 7;
            destinationRectangle.Height = 20;
            if ((double)os.timer % 1.0 < 0.300000011920929)
            {
                sb.Draw(Utils.white, destinationRectangle, os.outlineColor);
            }
            int y2 = num + (bounds.Height - 44);

            if (strArray.Length > 2 || Button.doButton(30, x, y2, 300, 22, LocaleTerms.Loc("Search"), new Color?(SearchButtonColor)))
            {
                if (strArray.Length <= 2)
                {
                    os.terminal.executeLine();
                }
                if (str.Length > 0)
                {
                    return(str);
                }
                errorOccurs();
                return((string)null);
            }
            if (Button.doButton(38, x, y2 + 24, 300, 22, LocaleTerms.Loc("Cancel"), new Color?(CancelButtonColor)))
            {
                cancelled();
                os.terminal.clearCurrentLine();
                os.terminal.executeLine();
            }
            return((string)null);
        }
コード例 #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
        private void drawEditDegreeState(Rectangle bounds, SpriteBatch sb)
        {
            if (Button.doButton(456010, bounds.X + 2, bounds.Y + 2, 160, 30, LocaleTerms.Loc("Back"), new Color?(this.darkThemeColor)))
            {
                this.state = AcademicDatabaseDaemon.ADDState.Entry;
            }
            Vector2 pos  = new Vector2((float)bounds.X + 10f, (float)bounds.Y + 60f);
            bool    flag = this.editedField == AcademicDatabaseDaemon.ADDEditField.None;

            TextItem.doSmallLabel(pos, LocaleTerms.Loc("University") + ":", new Color?());
            pos.X += 110f;
            TextItem.doSmallLabel(pos, this.searchedDegrees[this.editedIndex].uni, new Color?(this.editedField == AcademicDatabaseDaemon.ADDEditField.Uni ? this.themeColor : Color.White));
            Rectangle destinationRectangle;

            if (this.editedField == AcademicDatabaseDaemon.ADDEditField.Uni)
            {
                Vector2 vector2 = GuiData.smallfont.MeasureString(this.searchedDegrees[this.editedIndex].uni);
                destinationRectangle = new Rectangle((int)((double)pos.X + (double)vector2.X + 4.0), (int)pos.Y, 10, 16);
                if ((double)this.os.timer % 0.600000023841858 < 0.300000011920929)
                {
                    sb.Draw(Utils.white, destinationRectangle, Utils.AddativeWhite * 0.8f);
                }
            }
            pos.X -= 110f;
            pos.Y += 20f;
            if (flag && Button.doButton(46700, (int)pos.X, (int)pos.Y, 110, 20, LocaleTerms.Loc("Edit"), new Color?(this.darkThemeColor)))
            {
                this.editedField = AcademicDatabaseDaemon.ADDEditField.Uni;
                this.os.execute("getString University");
            }
            pos.Y += 30f;
            TextItem.doSmallLabel(pos, LocaleTerms.Loc("Degree") + ":", new Color?());
            pos.X += 110f;
            TextItem.doSmallLabel(pos, this.searchedDegrees[this.editedIndex].name, new Color?(this.editedField == AcademicDatabaseDaemon.ADDEditField.Degree ? this.themeColor : Color.White));
            if (this.editedField == AcademicDatabaseDaemon.ADDEditField.Degree)
            {
                Vector2 vector2 = GuiData.smallfont.MeasureString(this.searchedDegrees[this.editedIndex].name);
                destinationRectangle = new Rectangle((int)((double)pos.X + (double)vector2.X + 4.0), (int)pos.Y, 10, 16);
                if ((double)this.os.timer % 0.600000023841858 < 0.300000011920929)
                {
                    sb.Draw(Utils.white, destinationRectangle, Utils.AddativeWhite * 0.8f);
                }
            }
            pos.X -= 110f;
            pos.Y += 20f;
            if (flag && Button.doButton(46705, (int)pos.X, (int)pos.Y, 110, 20, LocaleTerms.Loc("Edit"), new Color?(this.darkThemeColor)))
            {
                this.editedField = AcademicDatabaseDaemon.ADDEditField.Degree;
                this.os.execute("getString Degree");
            }
            pos.Y += 30f;
            TextItem.doSmallLabel(pos, "GPA:", new Color?());
            pos.X += 110f;
            TextItem.doSmallLabel(pos, string.Concat((object)this.searchedDegrees[this.editedIndex].GPA), new Color?(this.editedField == AcademicDatabaseDaemon.ADDEditField.GPA ? this.themeColor : Color.White));
            if (this.editedField == AcademicDatabaseDaemon.ADDEditField.GPA)
            {
                Vector2 vector2 = GuiData.smallfont.MeasureString(string.Concat((object)this.searchedDegrees[this.editedIndex].GPA));
                destinationRectangle = new Rectangle((int)((double)pos.X + (double)vector2.X + 4.0), (int)pos.Y, 10, 16);
                if ((double)this.os.timer % 0.600000023841858 < 0.300000011920929)
                {
                    sb.Draw(Utils.white, destinationRectangle, Utils.AddativeWhite * 0.8f);
                }
            }
            pos.X -= 110f;
            pos.Y += 20f;
            if (flag && Button.doButton(46710, (int)pos.X, (int)pos.Y, 110, 20, LocaleTerms.Loc("Edit"), new Color?(this.darkThemeColor)))
            {
                this.editedField = AcademicDatabaseDaemon.ADDEditField.GPA;
                this.os.execute("getString GPA");
            }
            pos.Y += 30f;
            if (this.editedField != AcademicDatabaseDaemon.ADDEditField.None)
            {
                if (!this.doEditField())
                {
                    return;
                }
                this.editedField       = AcademicDatabaseDaemon.ADDEditField.None;
                this.os.getStringCache = "";
                this.saveChangesToEntry();
            }
            else if (Button.doButton(486012, bounds.X + 2, bounds.Y + bounds.Height - 40, 230, 30, LocaleTerms.Loc("Save And Return"), new Color?(this.backThemeColor)))
            {
                this.state = AcademicDatabaseDaemon.ADDState.Entry;
                this.comp.log("ACADEMIC_DATABASE::RecordEdit_:_#" + (object)this.editedIndex + "_: " + this.searchedName.Replace(" ", "_"));
            }
        }
コード例 #11
0
        private void doUserListScreen(Rectangle bounds, SpriteBatch sb)
        {
            if (Button.doButton(101801, bounds.X + 2, bounds.Y + 20, bounds.Width / 4, 22, "Back", themeColor))
            {
                state = HubState.Menu;
            }
            var rectangle = new Rectangle(bounds.X + 30, bounds.Y + 50, bounds.Width / 2, 30);
            var num1      = 18 + rectangle.Height - 8;
            var num2      = (bounds.Height - 90) / num1;
            var num3      = num2 * userListPageNumber;
            var num4      = 0;

            for (var index1 = num2 * userListPageNumber;
                 index1 < usersFolder.files.Count && index1 < num3 + num2;
                 ++index1)
            {
                var    strArray = usersFolder.files[index1].data.Split(Utils.newlineDelim);
                string str1;
                var    str2 = str1 = "";
                var    str3 = str1;
                var    str4 = str1;
                var    str5 = str1;
                for (var index2 = 0; index2 < strArray.Length; ++index2)
                {
                    if (strArray[index2].StartsWith("USER"))
                    {
                        str5 = getDataFromConfigLine(strArray[index2], ": ");
                    }
                    if (strArray[index2].StartsWith("Rank"))
                    {
                        str2 = getDataFromConfigLine(strArray[index2], ": ");
                    }
                    if (strArray[index2].StartsWith("Handle"))
                    {
                        str4 = getDataFromConfigLine(strArray[index2], ": ");
                    }
                    if (strArray[index2].StartsWith("Date"))
                    {
                        str3 = getDataFromConfigLine(strArray[index2], ": ");
                    }
                }
                var destinationRectangle = new Rectangle(rectangle.X + (bounds.Width - 60) - 10, rectangle.Y + 2,
                                                         rectangle.Height + 1, bounds.Width - 60);
                GuiData.spriteBatch.Draw(Utils.gradient, destinationRectangle, new Rectangle?(), themeColorLine,
                                         1.570796f, Vector2.Zero, SpriteEffects.FlipHorizontally, 0.8f);
                TextItem.doSmallLabel(new Vector2(rectangle.X, rectangle.Y),
                                      "#" + str5 + " - \"" + str4 + "\" Rank:" + str2, new Color?());
                rectangle.Y += 18;
                TextItem.doFontLabel(new Vector2(rectangle.X, rectangle.Y), "Joined " + str3, GuiData.detailfont,
                                     new Color?(), float.MaxValue, float.MaxValue);
                rectangle.Y += rectangle.Height - 10;
                num4         = index1;
            }
            rectangle.Y += 16;
            if (userListPageNumber > 0 &&
                Button.doButton(101005, rectangle.X, rectangle.Y, rectangle.Width / 2 - 20, 15, "Previous Page",
                                new Color?()))
            {
                --userListPageNumber;
            }
            TextItem.doTinyLabel(new Vector2(rectangle.X + rectangle.Width / 2 - 8, rectangle.Y),
                                 string.Concat(userListPageNumber), new Color?());
            if (usersFolder.files.Count <= num4 + 1 ||
                !Button.doButton(101010, rectangle.X + rectangle.Width / 2 + 10, rectangle.Y, rectangle.Width / 2 - 10, 15,
                                 "Next Page", new Color?()))
            {
                return;
            }
            ++userListPageNumber;
        }
コード例 #12
0
        public override void draw(Rectangle bounds, SpriteBatch sb)
        {
            base.draw(bounds, sb);
            int x    = bounds.X + 10;
            int num1 = bounds.Y + 10;

            TextItem.doFontLabel(new Vector2((float)x, (float)num1), "Email Verification", GuiData.font, new Color?(), (float)(bounds.Width - 20), (float)bounds.Height, false);
            int num2 = num1 + 50;

            switch (this.state)
            {
            case 1:
                Vector2  vector2_1 = TextItem.doMeasuredSmallLabel(new Vector2((float)x, (float)num2), "Enter a secure email address :\nEnsure that you are the only one with access to it", new Color?());
                int      y1        = num2 + ((int)vector2_1.Y + 10);
                string[] strArray  = this.os.getStringCache.Split(new string[1] {
                    "#$#$#$$#$&$#$#$#$#"
                }, StringSplitOptions.None);
                if (strArray.Length > 1)
                {
                    this.email = strArray[1];
                    if (this.email.Equals(""))
                    {
                        this.email = this.os.terminal.currentLine;
                    }
                }
                Rectangle destinationRectangle = new Rectangle(x, y1, bounds.Width - 20, 200);
                sb.Draw(Utils.white, destinationRectangle, this.os.darkBackgroundColor);
                int     num3      = y1 + 80;
                Vector2 vector2_2 = TextItem.doMeasuredSmallLabel(new Vector2((float)x, (float)num3), "Email: " + this.email, new Color?());
                destinationRectangle.X      = x + (int)vector2_2.X + 2;
                destinationRectangle.Y      = num3;
                destinationRectangle.Width  = 7;
                destinationRectangle.Height = 20;
                if ((double)this.os.timer % 1.0 < 0.300000011920929)
                {
                    sb.Draw(Utils.white, destinationRectangle, this.os.outlineColor);
                }
                int y2 = num3 + 122;
                if (strArray.Length <= 2 && !Button.doButton(30, x, y2, 300, 22, "Confirm", new Color?(this.os.highlightColor)))
                {
                    break;
                }
                if (strArray.Length <= 2)
                {
                    this.os.terminal.executeLine();
                }
                this.state = 2;
                break;

            case 2:
                int num4 = num2 + 20;
                TextItem.doSmallLabel(new Vector2((float)x, (float)num4), "Confirm this Email Address :\n" + this.email, new Color?());
                int y3 = num4 + 60;
                if (Button.doButton(21, x, y3, 200, 50, "Confirm Email", new Color?(this.os.highlightColor)))
                {
                    if (!Settings.isDemoMode)
                    {
                        this.sendEmail();
                    }
                    else
                    {
                        this.saveEmail();
                    }
                }
                if (!Button.doButton(20, x + 220, y3, 200, 50, "Re-Enter Email", new Color?()))
                {
                    break;
                }
                this.state = 1;
                this.email = "";
                this.os.execute("getString Email");
                break;

            default:
                int y4 = num2 + (bounds.Height / 2 - 60);
                if (this.state == 3)
                {
                    TextItem.doSmallLabel(new Vector2((float)x, (float)(y4 - 60)), "Error - Invalid Email Address", new Color?());
                }
                if (Button.doButton(10, x, y4, 300, 50, "Add Email", new Color?(this.os.highlightColor)))
                {
                    this.state = 1;
                    this.os.execute("getString Email");
                }
                if (!Button.doButton(12, x, y4 + 55, 300, 20, LocaleTerms.Loc("Exit"), new Color?(this.os.lockedColor)))
                {
                    break;
                }
                this.os.display.command = "connect";
                break;
            }
        }
コード例 #13
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;
                }
            }
        }
コード例 #14
0
        private void drawEditDegreeState(Rectangle bounds, SpriteBatch sb)
        {
            if (Button.doButton(456010, bounds.X + 2, bounds.Y + 2, 160, 30, "Back", darkThemeColor))
            {
                state = ADDState.Entry;
            }
            var pos  = new Vector2(bounds.X + 10f, bounds.Y + 60f);
            var flag = editedField == ADDEditField.None;

            TextItem.doSmallLabel(pos, "University:", new Color?());
            pos.X += 110f;
            TextItem.doSmallLabel(pos, searchedDegrees[editedIndex].uni,
                                  editedField == ADDEditField.Uni ? themeColor : Color.White);
            pos.X -= 110f;
            pos.Y += 20f;
            if (flag && Button.doButton(46700, (int)pos.X, (int)pos.Y, 80, 20, "Edit", darkThemeColor))
            {
                editedField = ADDEditField.Uni;
                os.execute("getString University");
            }
            pos.Y += 30f;
            TextItem.doSmallLabel(pos, "Degree:", new Color?());
            pos.X += 110f;
            TextItem.doSmallLabel(pos, searchedDegrees[editedIndex].name,
                                  editedField == ADDEditField.Degree ? themeColor : Color.White);
            pos.X -= 110f;
            pos.Y += 20f;
            if (flag && Button.doButton(46705, (int)pos.X, (int)pos.Y, 80, 20, "Edit", darkThemeColor))
            {
                editedField = ADDEditField.Degree;
                os.execute("getString Degree");
            }
            pos.Y += 30f;
            TextItem.doSmallLabel(pos, "GPA:", new Color?());
            pos.X += 110f;
            TextItem.doSmallLabel(pos, string.Concat(searchedDegrees[editedIndex].GPA),
                                  editedField == ADDEditField.GPA ? themeColor : Color.White);
            pos.X -= 110f;
            pos.Y += 20f;
            if (flag && Button.doButton(46710, (int)pos.X, (int)pos.Y, 80, 20, "Edit", darkThemeColor))
            {
                editedField = ADDEditField.GPA;
                os.execute("getString GPA");
            }
            pos.Y += 30f;
            if (editedField != ADDEditField.None)
            {
                if (!doEditField())
                {
                    return;
                }
                editedField       = ADDEditField.None;
                os.getStringCache = "";
                saveChangesToEntry();
            }
            else
            {
                if (
                    !Button.doButton(486012, bounds.X + 2, bounds.Y + bounds.Height - 40, 180, 30, "Save And Return",
                                     backThemeColor))
                {
                    return;
                }
                state = ADDState.Entry;
                comp.log(string.Concat("ACADEMIC_DATABASE::RecordEdit_:_#", editedIndex, "_: ",
                                       searchedName.Replace(" ", "_")));
            }
        }