Пример #1
0
        public void doEmailViewerDisplay(Rectangle bounds, SpriteBatch sb)
        {
            Vector2 vector2 = new Vector2((float)(bounds.X + 2), (float)(bounds.Y + 20));

            if (Button.doButton(800007, (int)vector2.X, (int)vector2.Y, bounds.Width - 20 - this.corner.Width, 30, LocaleTerms.Loc("Return to Inbox"), new Color?(this.os.darkBackgroundColor)))
            {
                this.state = 3;
            }
            vector2.Y += 35f;
            Rectangle tmpRect = GuiData.tmpRect;

            tmpRect.X      = bounds.X + 1;
            tmpRect.Y      = (int)vector2.Y;
            tmpRect.Width  = bounds.Width - 2;
            tmpRect.Height = 38;
            sb.Draw(Utils.white, tmpRect, this.textColor);
            vector2.Y += 3f;
            sb.DrawString(GuiData.UITinyfont, "<" + this.emailData[1] + ">", vector2, Color.Black);
            vector2.Y += 18f;
            sb.DrawString(GuiData.UITinyfont, LocaleTerms.Loc("Subject") + ": " + LocalizedFileLoader.SafeFilterString(this.emailData[2]), vector2, Color.Black);
            vector2.Y += 25f;
            vector2.X += 20f;
            int       num1       = 25;
            int       num2       = (this.emailData.Length - 4 + 1) * num1;
            Rectangle textBounds = new Rectangle((int)vector2.X, (int)vector2.Y, bounds.Width - 22, (int)((double)bounds.Height - ((double)vector2.Y - (double)bounds.Y) - (double)num2));
            string    str1;

            if (LocaleActivator.ActiveLocaleIsCJK())
            {
                string str2 = "\t";
                str1 = Utils.SuperSmartTwimForWidth(LocalizedFileLoader.SafeFilterString(this.emailData[3].Replace("。\n", str2).Replace("\n", "").Replace(str2, "。\n").Replace(str2, "!\n").Replace(str2, "!\n")), bounds.Width - 50, GuiData.tinyfont).Replace("\r\n\r\n\r\n", "\r\n\r\n");
            }
            else
            {
                str1 = Utils.SmartTwimForWidth(LocalizedFileLoader.SafeFilterString(this.emailData[3]), bounds.Width - 50, GuiData.tinyfont);
            }
            vector2.Y += (float)this.DrawMailMessageText(textBounds, sb, str1.Split(Utils.newlineDelim));
            vector2.Y += (float)(num1 - 5);
            int startingButtonIndex = 0;

            for (int index = 4; index < this.emailData.Length; ++index)
            {
                if (AttachmentRenderer.RenderAttachment(this.emailData[index], (object)this.os, vector2, startingButtonIndex, MailServer.buttonSound))
                {
                    ++startingButtonIndex;
                    vector2.Y += (float)num1;
                }
            }
            vector2.Y = (float)(bounds.Y + bounds.Height - 35);
            if (!Button.doButton(90200, (int)vector2.X, (int)vector2.Y, 300, 30, LocaleTerms.Loc("Reply"), new Color?()))
            {
                return;
            }
            this.emailReplyStrings.Clear();
            this.addingNewReplyString   = false;
            this.missionIncompleteReply = false;
            this.state = 5;
        }
Пример #2
0
 private void doCatDisplay()
 {
     if (this.os.hasConnectionPermission(false))
     {
         if (Button.doButton(299999, this.bounds.X + (this.bounds.Width - 41), this.bounds.Y + 12, 27, 29, "<-", new Color?()))
         {
             this.os.runCommand("ls");
         }
         Rectangle tmpRect = GuiData.tmpRect;
         tmpRect.Width  = this.bounds.Width;
         tmpRect.X      = this.bounds.X;
         tmpRect.Y      = this.bounds.Y + 1;
         tmpRect.Height = this.bounds.Height - 2;
         if (this.os.connectedComp != null && this.os.connectedComp.ip != this.LastDisplayedFileSourceIP && this.LastDisplayedFileSourceIP != this.os.thisComputer.ip)
         {
             this.command = "dc";
         }
         else
         {
             string data = "";
             for (int index = 1; index < this.commandArgs.Length; ++index)
             {
                 data = data + this.commandArgs[index] + " ";
             }
             string text1 = LocalizedFileLoader.SafeFilterString(data);
             if (this.LastDisplayedFileFolder.searchForFile(text1.Trim()) == null)
             {
                 this.os.postFXDrawActions += (Action)(() =>
                 {
                     Rectangle rectangle = new Rectangle(this.bounds.X + 1, this.bounds.Y + this.bounds.Height / 2 - 70, this.bounds.Width - 2, 140);
                     this.spriteBatch.Draw(Utils.white, rectangle, this.os.lockedColor);
                     TextItem.doCenteredFontLabel(rectangle, "File Not Found", GuiData.font, Color.White, false);
                 });
                 this.catScroll = Vector2.Zero;
             }
             else
             {
                 TextItem.doFontLabel(new Vector2((float)this.x, (float)(this.y + 3)), text1, GuiData.font, new Color?(Color.White), (float)(this.bounds.Width - 70), float.MaxValue, false);
                 int       num          = 55;
                 Rectangle dest         = new Rectangle(tmpRect.X + 4, tmpRect.Y + num, tmpRect.Width - 6, tmpRect.Height - num - 2);
                 string    displayCache = this.os.displayCache;
                 this.y += 70;
                 string text2 = Utils.SuperSmartTwimForWidth(LocalizedFileLoader.SafeFilterString(displayCache), this.bounds.Width - 40, GuiData.tinyfont);
                 this.catTextRegion.Draw(dest, text2, this.spriteBatch);
             }
         }
     }
     else
     {
         this.command = "connect";
     }
 }
Пример #3
0
        private int DrawMailMessageText(Rectangle textBounds, SpriteBatch sb, string[] text)
        {
            if (this.sectionedPanel == null || this.sectionedPanel.PanelHeight != this.GetRenderTextHeight())
            {
                this.sectionedPanel = new ScrollableSectionedPanel(this.GetRenderTextHeight(), sb.GraphicsDevice);
            }
            this.sectionedPanel.NumberOfPanels = text.Length;
            int itemsDrawn = 0;

            this.sectionedPanel.Draw((Action <int, Rectangle, SpriteBatch>)((index, dest, spBatch) =>
            {
                spBatch.DrawString(GuiData.tinyfont, LocalizedFileLoader.SafeFilterString(text[index]), new Vector2((float)dest.X, (float)dest.Y), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.8f);
                ++itemsDrawn;
            }), sb, textBounds);
            if (this.sectionedPanel.NumberOfPanels * this.sectionedPanel.PanelHeight < textBounds.Height)
            {
                return(this.sectionedPanel.NumberOfPanels * this.sectionedPanel.PanelHeight);
            }
            return(textBounds.Height);
        }
Пример #4
0
        public void getRenderText()
        {
            string data = AdvancedTutorial.feedbackSequence[this.state];

            char[] chArray = new char[1] {
                '\n'
            };
            string[] strArray = data.Split(this.hintButtonDelimiter, StringSplitOptions.RemoveEmptyEntries);
            if (strArray.Length > 1)
            {
                this.hintButtonText = DisplayModule.cleanSplitForWidth(strArray[1], 178).Split(chArray);
                data = strArray[0];
                this.hintTextFadeTimer = 0.0f;
            }
            else
            {
                this.hintButtonText = (string[])null;
            }
            this.renderText = Utils.SuperSmartTwimForWidth(LocalizedFileLoader.SafeFilterString(data), this.bounds.Width - 10, GuiData.tinyfont).Split(chArray);
        }
Пример #5
0
        private void doProbeDisplay()
        {
            Rectangle rectangle = Rectangle.Empty;
            Computer  computer  = this.os.connectedComp == null ? this.os.thisComputer : this.os.connectedComp;

            if (computer.proxyActive)
            {
                rectangle = this.bounds;
                ++rectangle.X;
                ++rectangle.Y;
                rectangle.Width  -= 2;
                rectangle.Height -= 2;
                PatternDrawer.draw(rectangle, 0.8f, Color.Transparent, this.os.superLightWhite, this.os.ScreenManager.SpriteBatch);
            }
            if (Button.doButton(299999, this.bounds.X + (this.bounds.Width - 50), this.bounds.Y + this.y, 27, 27, "<-", new Color?()))
            {
                this.command = "connect";
            }
            this.spriteBatch.DrawString(GuiData.font, LocaleTerms.Loc("Open Ports"), new Vector2((float)this.x, (float)this.y), Color.White);
            this.y += 40;
            this.spriteBatch.DrawString(GuiData.smallfont, computer.name + " @" + computer.ip, new Vector2((float)this.x, (float)this.y), Color.White);
            this.y += 30;
            int    num   = Math.Max(computer.portsNeededForCrack + 1, 0);
            string str   = string.Concat((object)num);
            bool   flag1 = num > 100;

            if (flag1)
            {
                if (this.invioableSecurityCacheString == null)
                {
                    StringBuilder stringBuilder = new StringBuilder();
                    for (int index = 0; index < str.Length; ++index)
                    {
                        stringBuilder.Append(Utils.getRandomChar());
                    }
                    this.invioableSecurityCacheString = stringBuilder.ToString();
                }
                else
                {
                    this.invioabilityCharChangeTimer -= (float)this.os.lastGameTime.ElapsedGameTime.TotalSeconds;
                    if ((double)this.invioabilityCharChangeTimer <= 0.0)
                    {
                        StringBuilder stringBuilder = new StringBuilder(this.invioableSecurityCacheString);
                        stringBuilder[Utils.random.Next(stringBuilder.Length)] = Utils.random.NextDouble() > 0.3 ? Utils.getRandomNumberChar() : Utils.getRandomChar();
                        this.invioableSecurityCacheString = stringBuilder.ToString();
                        this.invioabilityCharChangeTimer  = 0.025f;
                    }
                }
                str = this.invioableSecurityCacheString;
            }
            this.spriteBatch.DrawString(GuiData.smallfont, LocalizedFileLoader.SafeFilterString(LocaleTerms.Loc("Open Ports Required for Crack:")) + " " + str, new Vector2((float)this.x, (float)this.y), flag1 ? Color.Lerp(Color.Red, this.os.brightLockedColor, Utils.randm(0.5f) + 0.5f) : this.os.highlightColor);
            this.y += 40;
            if (flag1)
            {
                rectangle.X      = this.bounds.X + 2;
                rectangle.Y      = this.y;
                rectangle.Width  = this.bounds.Width - 4;
                rectangle.Height = 110;
                this.DrawInvioabilityEffect(rectangle);
                this.y += rectangle.Height + 10;
            }
            if (computer.hasProxy)
            {
                rectangle.X      = this.x;
                rectangle.Y      = this.y;
                rectangle.Width  = this.bounds.Width - 10;
                rectangle.Height = 40;
                PatternDrawer.draw(rectangle, 1f, computer.proxyActive ? this.os.topBarColor : Color.Lerp(this.os.unlockedColor, Color.Black, 0.2f), computer.proxyActive ? this.os.shellColor * 0.3f : this.os.unlockedColor, this.os.ScreenManager.SpriteBatch);
                if (computer.proxyActive)
                {
                    rectangle.Width = (int)((double)rectangle.Width * (1.0 - (double)computer.proxyOverloadTicks / (double)computer.startingOverloadTicks));
                    this.spriteBatch.Draw(Utils.white, rectangle, Color.Black * 0.5f);
                }
                this.spriteBatch.DrawString(GuiData.smallfont, computer.proxyActive ? LocaleTerms.Loc("Proxy Detected") : LocaleTerms.Loc("Proxy Bypassed"), new Vector2((float)(this.x + 4), (float)(this.y + 2)), Color.Black);
                this.spriteBatch.DrawString(GuiData.smallfont, computer.proxyActive ? LocaleTerms.Loc("Proxy Detected") : LocaleTerms.Loc("Proxy Bypassed"), new Vector2((float)(this.x + 3), (float)(this.y + 1)), computer.proxyActive ? Color.White : this.os.highlightColor);
                this.y += 60;
            }
            if (computer.firewall != null)
            {
                rectangle.X      = this.x;
                rectangle.Y      = this.y;
                rectangle.Width  = this.bounds.Width - 10;
                rectangle.Height = 40;
                bool flag2 = !computer.firewall.solved;
                PatternDrawer.draw(rectangle, 1f, flag2 ? this.os.topBarColor : Color.Lerp(this.os.unlockedColor, Color.Black, 0.2f), flag2 ? this.os.shellColor * 0.3f : this.os.unlockedColor, this.os.ScreenManager.SpriteBatch);
                this.spriteBatch.DrawString(GuiData.smallfont, flag2 ? LocaleTerms.Loc("Firewall Detected") : LocaleTerms.Loc("Firewall Solved"), new Vector2((float)(this.x + 4), (float)(this.y + 2)), Color.Black);
                this.spriteBatch.DrawString(GuiData.smallfont, flag2 ? LocaleTerms.Loc("Firewall Detected") : LocaleTerms.Loc("Firewall Solved"), new Vector2((float)(this.x + 3), (float)(this.y + 1)), flag2 ? Color.White : this.os.highlightColor);
                this.y += 60;
            }
            Vector2 zero = Vector2.Zero;

            rectangle.X      = this.x + 1;
            rectangle.Width  = 420;
            rectangle.Height = 41;
            Vector2 position = new Vector2((float)(rectangle.X + rectangle.Width - 36), (float)(rectangle.Y + 7));

            this.x += 10;
            for (int index = 0; index < computer.ports.Count; ++index)
            {
                rectangle.Y = this.y + 4;
                position.Y  = (float)(rectangle.Y + 4);
                this.spriteBatch.Draw(Utils.white, rectangle, (int)computer.portsOpen[index] > 0 ? this.os.unlockedColor : this.os.lockedColor);
                this.spriteBatch.Draw((int)computer.portsOpen[index] > 0 ? this.openLockSprite : this.lockSprite, position, Color.White);
                string  text1     = "Port#: " + (object)computer.GetDisplayPortNumberFromCodePort(computer.ports[index]);
                Vector2 vector2_1 = GuiData.font.MeasureString(text1);
                this.spriteBatch.DrawString(GuiData.font, text1, new Vector2((float)this.x, (float)(this.y + 3)), Color.White);
                string  text2     = " - " + PortExploits.services[computer.ports[index]];
                Vector2 vector2_2 = GuiData.smallfont.MeasureString(text2);
                float   scale     = Math.Min(1f, (float)((double)rectangle.Width - (double)vector2_1.X - 50.0) / vector2_2.X);
                this.spriteBatch.DrawString(GuiData.smallfont, text2, new Vector2((float)this.x + vector2_1.X, (float)(this.y + 4)), Color.White, 0.0f, Vector2.Zero, scale, SpriteEffects.None, 0.8f);
                this.y += 45;
            }
        }