コード例 #1
0
        private void DrawPhaseTitle(float t, Rectangle dest)
        {
            this.BackgroundEffect.Update(t);
            this.BackgroundEffect.Draw(dest, this.spriteBatch, Color.Black, this.themeColor * 0.2f, HexGridBackground.ColoringAlgorithm.CorrectedSinWash, 0.0f);
            int height = 40;

            if (dest.Height <= height)
            {
                return;
            }
            Rectangle rectangle1 = new Rectangle(dest.X, dest.Y + (int)((double)dest.Height / 2.8) - height / 2, dest.Width, height);

            this.spriteBatch.Draw(Utils.white, rectangle1, Color.Black * 0.6f);
            TextItem.doFontLabelToSize(rectangle1, this.PhaseTitle, Utils.GetTitleFontForLocalizedString(this.PhaseTitle), Color.White, true, false);
            if (!this.isExiting)
            {
                string[]  strArray   = this.PhaseSubtitle.Split(Utils.newlineDelim);
                Rectangle rectangle2 = new Rectangle(rectangle1.X, rectangle1.Y + rectangle1.Height + 2, rectangle1.Width, 22);
                for (int index = 0; index < strArray.Length; ++index)
                {
                    this.spriteBatch.Draw(Utils.white, rectangle2, Color.Black * 0.4f);
                    TextItem.doFontLabelToSize(rectangle2, strArray[index], GuiData.UISmallfont, Utils.AddativeWhite * 0.9f, true, false);
                    rectangle2.Y += rectangle2.Height + 2;
                }
            }
        }
コード例 #2
0
        public override void Draw(float t)
        {
            base.Draw(t);
            spriteBatch.Draw(Utils.white, infoBar, os.indentBackgroundColor);
            infoBarUsedRam.Width = (int)(infoBar.Width * (1.0 - os.ramAvaliable / (double)os.totalRam));
            spriteBatch.Draw(Utils.white, infoBarUsedRam, USED_RAM_COLOR);
            spriteBatch.DrawString(GuiData.detailfont, infoString, new Vector2(infoBar.X, infoBar.Y), Color.White);
            spriteBatch.DrawString(GuiData.detailfont, string.Concat(os.exes.Count),
                                   new Vector2(bounds.X + bounds.Width - (os.exes.Count >= 10 ? 24 : 12), infoBar.Y), Color.White);
            if (OutOfMemoryFlashTime <= 0.0)
            {
                return;
            }
            var num    = Math.Min(1f, OutOfMemoryFlashTime);
            var amount = Math.Max(0.0f, OutOfMemoryFlashTime - (FLASH_TIME - 1f));

            PatternDrawer.draw(bounds, 0.0f, Color.Transparent,
                               Color.Lerp(os.lockedColor, Utils.AddativeRed, amount) * num, spriteBatch, PatternDrawer.errorTile);
            var height    = 40;
            var rectangle = new Rectangle(bounds.X, bounds.Y + bounds.Height - height - 1, bounds.Width, height);

            spriteBatch.Draw(Utils.white, Utils.InsetRectangle(rectangle, 4), Color.Black * 0.75f);
            --rectangle.X;
            var text = " ^ INSUFFICIENT MEMORY ^ ";

            TextItem.doFontLabelToSize(rectangle, text, GuiData.font, Color.Black * num);
            rectangle.X += 2;
            TextItem.doFontLabelToSize(rectangle, text, GuiData.font, Color.Black * num);
            --rectangle.X;
            TextItem.doFontLabelToSize(rectangle, text, GuiData.font, Color.White * num);
        }
コード例 #3
0
ファイル: HexClockExe.cs プロジェクト: hochladen/Hacknet
        public override void Draw(float t)
        {
            base.Draw(t);
            this.drawOutline();
            this.drawTarget("app:");
            DateTime now  = DateTime.Now;
            string   str1 = "#";
            int      num  = now.Hour;
            string   str2 = num.ToString("00");

            num = now.Minute;
            string str3 = num.ToString("00");

            num = now.Second;
            string str4  = num.ToString("00");
            string str5  = str1 + str2 + str3 + str4;
            Color  color = Utils.ColorFromHexString(str5);

            if (!this.stopUIChange)
            {
                this.AutoUpdateTheme(color);
            }
            Rectangle contentAreaDest = this.GetContentAreaDest();

            this.spriteBatch.Draw(Utils.white, contentAreaDest, color);
            int width  = (int)((double)this.bounds.Width * 0.800000011920929);
            int height = 30;

            TextItem.doFontLabelToSize(new Rectangle(contentAreaDest.X + (contentAreaDest.Width / 2 - width / 2), contentAreaDest.Y + (contentAreaDest.Height / 2 - height / 2), width, height), str5, GuiData.font, Utils.AddativeWhite, false, false);
        }
コード例 #4
0
        public override void Draw(float t)
        {
            base.Draw(t);
            this.spriteBatch.Draw(Utils.white, this.infoBar, this.os.indentBackgroundColor);
            this.infoBarUsedRam.Width = (int)((double)this.infoBar.Width * (1.0 - (double)this.os.ramAvaliable / (double)this.os.totalRam));
            this.spriteBatch.Draw(Utils.white, this.infoBarUsedRam, RamModule.USED_RAM_COLOR);
            this.spriteBatch.DrawString(GuiData.detailfont, this.infoString, new Vector2((float)this.infoBar.X, (float)this.infoBar.Y), Color.White);
            this.spriteBatch.DrawString(GuiData.detailfont, string.Concat((object)this.os.exes.Count), new Vector2((float)(this.bounds.X + this.bounds.Width - (this.os.exes.Count >= 10 ? 24 : 12)), (float)this.infoBar.Y), Color.White);
            if ((double)this.OutOfMemoryFlashTime <= 0.0)
            {
                return;
            }
            float num    = Math.Min(1f, this.OutOfMemoryFlashTime);
            float amount = Math.Max(0.0f, this.OutOfMemoryFlashTime - (RamModule.FLASH_TIME - 1f));

            PatternDrawer.draw(this.bounds, 0.0f, Color.Transparent, Color.Lerp(this.os.lockedColor, Utils.AddativeRed, amount) * num, this.spriteBatch, PatternDrawer.errorTile);
            int       height    = 40;
            Rectangle rectangle = new Rectangle(this.bounds.X, this.bounds.Y + this.bounds.Height - height - 1, this.bounds.Width, height);

            this.spriteBatch.Draw(Utils.white, Utils.InsetRectangle(rectangle, 4), Color.Black * 0.75f);
            --rectangle.X;
            string text = " ^ " + LocaleTerms.Loc("INSUFFICIENT MEMORY") + " ^ ";

            TextItem.doFontLabelToSize(rectangle, text, GuiData.font, Color.Black * num, false, false);
            rectangle.X += 2;
            TextItem.doFontLabelToSize(rectangle, text, GuiData.font, Color.Black * num, false, false);
            --rectangle.X;
            TextItem.doFontLabelToSize(rectangle, text, GuiData.font, Color.White * num, false, false);
        }
コード例 #5
0
        private void DrawHeadings(Rectangle bounds, SpriteBatch sb)
        {
            Rectangle rectangle1 = new Rectangle(bounds.X, bounds.Y + 4, bounds.Width, 40);
            Rectangle dest1      = rectangle1;

            dest1.X     += 8;
            dest1.Width -= 8;
            TextItem.doFontLabelToSize(dest1, this.name, GuiData.font, Color.White, true, true);
            rectangle1.Y     += rectangle1.Height - 1;
            rectangle1.Height = 1;
            sb.Draw(Utils.white, rectangle1, Color.White);
            Color themeColor = this.ThemeColor;

            rectangle1.Y     += 2;
            rectangle1.Height = 20;
            Color patternColor = this.IsInCriticalFirmwareFailure ? Color.DarkRed : themeColor * 0.28f;

            if (!this.IsInCriticalFirmwareFailure && this.PilotAlerted)
            {
                patternColor = this.os.warningColor * 0.5f;
            }
            PatternDrawer.draw(rectangle1, 1f, themeColor * 0.1f, patternColor, sb, PatternDrawer.warningStripe);
            if (this.IsReloadingFirmware)
            {
                Rectangle destinationRectangle = rectangle1;
                destinationRectangle.Width = (int)((double)destinationRectangle.Width * (double)Utils.QuadraticOutCurve(this.firmwareReloadProgress / 6f));
                sb.Draw(Utils.white, destinationRectangle, Utils.AddativeWhite * 0.4f);
            }
            Rectangle dest2 = Utils.InsetRectangle(rectangle1, 1);
            string    text  = this.IsReloadingFirmware ? LocaleTerms.Loc("RELOADING FIRMWARE") : (this.IsInCriticalFirmwareFailure ? LocaleTerms.Loc("CRITICAL FIRMWARE FAILURE") : (this.PilotAlerted ? LocaleTerms.Loc("PILOT ALERTED") : LocaleTerms.Loc("FLIGHT IN PROGRESS")));

            TextItem.doCenteredFontLabel(dest2, text, GuiData.font, Color.White, false);
            Rectangle rectangle2 = new Rectangle(dest2.X, dest2.Y + dest2.Height + 8, dest2.Width, 24);
            int       num1       = 4;
            int       num2       = (rectangle2.Width - num1 * 3) / 3;

            if (Button.doButton(632877701, rectangle2.X, rectangle2.Y, num2 - 20, rectangle2.Height, LocaleTerms.Loc("Disconnect"), new Color?(this.os.lockedColor)))
            {
                this.os.runCommand("disconnect");
            }
            if (Button.doButton(632877703, rectangle2.X + num1 + num2 - 20, rectangle2.Y, num2 + 10 + num1, rectangle2.Height, LocaleTerms.Loc("Pilot Alert"), new Color?(this.ThemeColor)))
            {
                this.PilotAlerted = true;
            }
            if (Button.doButton(632877706, rectangle2.X + num1 * 3 + num2 * 2 - 10, rectangle2.Y, num2 + 10 + num1, rectangle2.Height, LocaleTerms.Loc("Reload Firmware"), new Color?(this.os.lockedColor)))
            {
                this.StartReloadFirmware();
            }
            Rectangle dest3   = new Rectangle(rectangle2.X + 6, rectangle2.Y + rectangle2.Height + 20, rectangle2.Width - 75, 70);
            byte      status1 = (double)this.currentAirspeed <= 500.0 ? (byte)0 : ((double)this.currentAirspeed < 600.0 ? (byte)1 : (byte)2);

            this.DrawFieldDisplay(dest3, sb, LocaleTerms.Loc("Air Speed (kn)"), this.currentAirspeed.ToString("0.0"), status1);
            dest3.Y += dest3.Height + 6;
            byte status2 = (double)this.rateOfClimb > -0.200000002980232 ? (byte)0 : ((double)this.rateOfClimb > -1.0 ? (byte)1 : (byte)2);

            this.DrawFieldDisplay(dest3, sb, LocaleTerms.Loc("Rate of Climb (f/s)"), this.rateOfClimb.ToString("0.000"), status2);
            dest3.Y += dest3.Height + 6;
            this.DrawFieldDisplay(dest3, sb, LocaleTerms.Loc("Heading (deg)"), string.Concat((object)67.228f), (byte)0);
            dest3.Y += dest3.Height + 6;
        }
コード例 #6
0
        private void DrawFieldDisplay(Rectangle dest, SpriteBatch sb, string title, string value, byte status)
        {
            Rectangle rectangle = new Rectangle(dest.X, dest.Y, dest.Height, dest.Height);
            Texture2D texture   = (int)status == 0 ? this.StatusOKIcon : this.CautionIcon;
            Color     color     = (int)status == 0 ? this.ThemeColor : ((int)status == 1 ? Color.Orange : Color.Red);

            sb.Draw(this.CircleOutline, rectangle, color);
            if ((int)status < 2 || (double)this.os.timer % 0.400000005960464 >= 0.200000002980232)
            {
                bool      flag = (int)status != 0;
                Rectangle destinationRectangle = Utils.InsetRectangle(rectangle, rectangle.Width / 5);
                if (flag)
                {
                    destinationRectangle.Y -= 2;
                }
                sb.Draw(texture, destinationRectangle, color);
            }
            Rectangle dest1 = new Rectangle(rectangle.X + rectangle.Width + 6, dest.Y, dest.Width - rectangle.Width, dest.Height / 3 - 1);

            TextItem.doFontLabelToSize(dest1, title, GuiData.font, color, true, true);
            Rectangle destinationRectangle1 = new Rectangle(dest1.X - 8, dest1.Y + dest1.Height, dest1.Width + 8, 1);

            dest1.Y += dest1.Height + 1;
            sb.Draw(Utils.white, destinationRectangle1, color);
            dest1.Height = (int)((double)dest.Height / 3.0 * 2.0) - 1;
            TextItem.doFontLabelToSize(dest1, value, GuiData.font, (int)status == 0 ? Color.White * 0.9f : color, true, true);
        }
コード例 #7
0
        private void DrawBasePanel(Rectangle dest)
        {
            int width1 = dest.Width - 8;
            int width2 = (int)((double)width1 * 0.4);
            int width3 = (int)((double)width1 * 0.6);

            if (!this.gettingNewNote && Button.doButton(631012 + this.os.exes.IndexOf((ExeModule)this), dest.X + dest.Width - width2, dest.Y + 4, width2, dest.Height - 6, LocaleTerms.Loc("Close"), new Color?(this.os.lockedColor * this.fade)))
            {
                if (this.gettingNewNote)
                {
                    this.os.terminal.executeLine();
                    this.gettingNewNote = false;
                }
                this.Completed();
                this.RemoveReopnener();
                this.isExiting = true;
            }
            if (!this.gettingNewNote && Button.doButton(611014 + this.os.exes.IndexOf((ExeModule)this), dest.X, dest.Y + 4, width3, dest.Height - 6, LocaleTerms.Loc("Add Note"), new Color?(this.os.highlightColor * this.fade)))
            {
                this.os.runCommand("getString Note");
                this.os.getStringCache = "";
                this.gettingNewNote    = true;
            }
            else
            {
                if (!this.gettingNewNote)
                {
                    return;
                }
                Rectangle dest1 = new Rectangle(dest.X, dest.Y + 4, width1, dest.Height - 6);
                PatternDrawer.draw(dest1, 1f, Color.Transparent, this.os.highlightColor * 0.5f, this.spriteBatch, PatternDrawer.thinStripe);
                TextItem.doFontLabelToSize(dest1, LocaleTerms.Loc("Type In Terminal..."), GuiData.smallfont, Color.White, false, false);
            }
        }
コード例 #8
0
        public void Draw(Rectangle dest, SpriteBatch sb)
        {
            var width1  = (int)(dest.Width * 0.5);
            var height1 = (int)(dest.Height * 0.400000005960464);
            var dest1   = new Rectangle(dest.Width / 2 - width1 / 2, (int)(dest.Y + dest.Height / 2.5 - height1 / 2), width1,
                                        height1);
            var destinationRectangle1 = new Rectangle(dest.X, dest1.Y + 115, dest.Width, dest1.Height - 245);

            sb.Draw(Utils.white, destinationRectangle1,
                    Color.Lerp(new Color(115, 0, 0), new Color(122, 0, 0),
                               0.0f + Utils.randm((float)(1.0 - Utils.randm(1f) * (double)Utils.randm(1f)))));
            dest1.Y += 12;
            TextItem.doFontLabelToSize(dest1, Utils.FlipRandomChars("HACKNET", 0.028), GuiData.titlefont,
                                       Color.White * 0.12f);
            FlickeringTextEffect.DrawLinedFlickeringText(dest1, Utils.FlipRandomChars("HACKNET", 0.003), 11f, 0.7f,
                                                         GuiData.titlefont, null, Color.White, 5);
            var y       = destinationRectangle1.Y + dest1.Height - 80;
            var width2  = dest.Width / 4;
            var num1    = 20;
            var num2    = (width2 - num1) / 2;
            var height2 = 42;
            var destinationRectangle2 = new Rectangle(dest.X + dest.Width / 2 - width2 / 2, y, width2, height2);

            sb.Draw(Utils.white, destinationRectangle2, Color.Black * 0.8f);
            if (
                !Button.doButton(18273302, destinationRectangle2.X, destinationRectangle2.Y, destinationRectangle2.Width,
                                 destinationRectangle2.Height, "New Session", new Color(124, 137, 149)) || Start == null)
            {
                return;
            }
            Start();
        }
コード例 #9
0
        internal virtual void DrawCautionLinedMessage(Rectangle dest, int stripHeight, Color color, string Message, SpriteBatch sb, Texture2D stripTexture = null, int textOffsetY = 0)
        {
            if (stripTexture == null)
            {
                stripTexture = PatternDrawer.warningStripe;
            }
            Rectangle dest1 = dest;

            dest1.Height = stripHeight;
            PatternDrawer.draw(dest1, 1f, Color.Transparent, color, sb, stripTexture);
            dest1 = new Rectangle(dest1.X, dest.Y + dest.Height - stripHeight, dest1.Width, stripHeight);
            PatternDrawer.draw(dest1, 1f, Color.Transparent, color, sb, stripTexture);
            int       height = dest.Height - dest1.Height * 2 + dest.Height / 10;
            Rectangle dest2  = new Rectangle(dest.X, dest.Y + stripHeight + 2 + textOffsetY, dest.Width, height);

            if (Settings.ActiveLocale == "en-us")
            {
                TextItem.doFontLabelToSize(dest2, Message, GuiData.titlefont, color, true, false);
            }
            else
            {
                TextItem.doCenteredFontLabel(dest2, Message, GuiData.font, color, false);
            }
            Rectangle rectangle = dest2;

            rectangle.Y      = dest.Y + dest.Height + 2;
            rectangle.Height = 30;
        }
コード例 #10
0
        public static void DrawFlickeringText(Rectangle dest, string text, float maxOffset, float rarity,
                                              SpriteFont font, object os_Obj, Color BaseCol)
        {
            OS os = null;

            if (os_Obj != null)
            {
                os = (OS)os_Obj;
            }
            else
            {
                internalTimer += 0.01666667f;
            }
            var color1 = new Color(BaseCol.R, 0, 0, 0);
            var color2 = new Color(0, BaseCol.G, 0, 0);
            var color3 = new Color(0, 0, BaseCol.B, 0);

            TextItem.doFontLabelToSize(
                RectAddX(dest, (int)(maxOffset * (double)GetOffsetForSinTime(1.3f, 12.3f, rarity, os))), text, font,
                color1);
            TextItem.doFontLabelToSize(
                RectAddX(dest, (int)(maxOffset * (double)GetOffsetForSinTime(0.8f, 29f, rarity, os))), text, font,
                color2);
            TextItem.doFontLabelToSize(
                RectAddX(dest, (int)(maxOffset * (double)GetOffsetForSinTime(0.5f, -939.7f, rarity, os))), text, font,
                color3);
        }
コード例 #11
0
        public static void DrawLoadingEffect(Rectangle bounds, SpriteBatch sb, object OS_obj, bool drawLoadingText = true)
        {
            OS        os        = (OS)OS_obj;
            Rectangle rectangle = new Rectangle(bounds.X + bounds.Width / 2, bounds.Y + bounds.Height / 2, 2, 70);
            float     num1      = (float)Math.Abs(Math.Sin((double)os.timer * 0.200000002980232) * 100.0);
            Vector2   origin    = new Vector2(2f, 10f);
            float     num2      = 6.283185f / num1;
            float     rotation  = 0.0f;
            int       num3      = 0;

            while ((double)rotation < 6.28318548202515)
            {
                Rectangle destinationRectangle = rectangle;
                destinationRectangle.Height = Math.Abs((int)((double)rectangle.Height * Math.Sin(2.0 * (double)os.timer + (double)num3 * 0.200000002980232))) + 10;
                origin.Y = 1.6f;
                sb.Draw(Utils.white, destinationRectangle, new Rectangle?(), os.highlightColor, rotation, origin, SpriteEffects.FlipVertically, 0.6f);
                ++num3;
                rotation += num2;
            }
            if (!drawLoadingText)
            {
                return;
            }
            TextItem.doFontLabelToSize(new Rectangle(bounds.X, bounds.Y + 20, bounds.Width, 30), LocaleTerms.Loc("Loading..."), GuiData.font, Utils.AddativeWhite, false, false);
        }
コード例 #12
0
        private void DrawNotes(Rectangle dest)
        {
            int y = dest.Y;

            for (int index1 = 0; index1 < this.notes.Count; ++index1)
            {
                string[] strArray = this.notes[index1].Split(Utils.newlineDelim);
                int      num1     = NotesExe.noteBaseCost + strArray.Length * NotesExe.noteCostPerLine;
                if (y - dest.Y + num1 > dest.Height + 1)
                {
                    break;
                }
                Rectangle destinationRectangle = new Rectangle(dest.X, y + NotesExe.noteBaseCost / 2 - 2, dest.Width, num1 - NotesExe.noteBaseCost / 2);
                this.spriteBatch.Draw(Utils.white, destinationRectangle, this.os.highlightColor * 0.2f);
                int num2 = y + NotesExe.noteBaseCost / 2;
                for (int index2 = 0; index2 < strArray.Length; ++index2)
                {
                    this.spriteBatch.DrawString(GuiData.UITinyfont, strArray[index2], new Vector2((float)(destinationRectangle.X + 2), (float)num2), Color.White);
                    num2 += NotesExe.noteCostPerLine;
                }
                int num3 = 13;
                if (Button.doButton(539261 + index1 * 100 + this.os.exes.IndexOf((ExeModule)this) * 2000, destinationRectangle.X + destinationRectangle.Width - num3 - 1, y + NotesExe.noteBaseCost / 2 + 1, num3, num3, "", new Color?(Color.White * 0.5f), NotesExe.crossTexture))
                {
                    this.notes.RemoveAt(index1);
                    this.recalcualteRamCost();
                    this.SaveNotesToDrive();
                    --index1;
                }
                if ((double)this.MemoryWarningFlashTime > 0.0)
                {
                    float num4  = Math.Min(1f, this.MemoryWarningFlashTime);
                    Color color = Color.Lerp(this.os.lockedColor, this.os.brightLockedColor, Utils.rand(0.4f)) * num4;
                    if (4.0 - (double)this.MemoryWarningFlashTime < 0.300000011920929)
                    {
                        float num5 = (float)(1.0 - (4.0 - (double)this.MemoryWarningFlashTime) / 0.300000011920929);
                        color = Color.Lerp(color, Utils.AddativeWhite, num5 * 0.7f);
                    }
                    this.spriteBatch.Draw(Utils.white, destinationRectangle, color);
                    int       height     = 60;
                    int       num6       = (destinationRectangle.Height - height) / 2;
                    Rectangle rectangle1 = new Rectangle(destinationRectangle.X, destinationRectangle.Y + num6, destinationRectangle.Width, height);
                    this.spriteBatch.Draw(Utils.white, rectangle1, Color.Black * num4 * 0.8f);
                    int num7 = height - 10;
                    rectangle1.Y     += 5;
                    rectangle1.X     += 10;
                    rectangle1.Width -= 20;
                    rectangle1.Height = num7 / 2;
                    TextItem.doFontLabelToSize(rectangle1, Utils.FlipRandomChars(LocaleTerms.Loc("Insufficient Memory"), 0.00700000021606684), GuiData.font, Color.White * num4, false, false);
                    rectangle1.Y += num7 / 2;
                    TextItem.doFontLabelToSize(rectangle1, Utils.FlipRandomChars(LocaleTerms.Loc("Close Notes to Free Space"), 0.00700000021606684), GuiData.font, Color.White * num4, false, false);
                    Rectangle rectangle2 = new Rectangle(destinationRectangle.X + destinationRectangle.Width - num3 - 1, y + NotesExe.noteBaseCost / 2 + 1, num3, num3);
                    this.spriteBatch.Draw(NotesExe.crossTexture, rectangle2, Color.Red * num4);
                    double num8 = (1.0 + Math.Sin((double)this.os.timer)) / 2.0;
                    rectangle2 = Utils.InsetRectangle(rectangle2, (int)(num8 * -20.0));
                    this.spriteBatch.Draw(NotesExe.crossTexture, rectangle2, Utils.AddativeWhite * num4 * (float)(1.0 - num8));
                }
                y += num1;
            }
        }
コード例 #13
0
        public override void draw(Rectangle bounds, SpriteBatch sb)
        {
            base.draw(bounds, sb);
            bool      flag = !this.RequiresLogin || this.comp.adminIP == this.os.thisComputer.ip || this.comp.userLoggedIn;
            Rectangle dest = Utils.InsetRectangle(bounds, 2);
            Rectangle destinationRectangle = new Rectangle(dest.X, dest.Y - 1, 18, dest.Height + 2);

            sb.Draw(Utils.white, destinationRectangle, this.ThemeColor);
            destinationRectangle.X     += destinationRectangle.Width / 2;
            destinationRectangle.Width /= 2;
            sb.Draw(Utils.white, destinationRectangle, Color.Black * 0.2f);
            dest.X     += 20;
            dest.Width -= 25;
            Rectangle rectangle1 = new Rectangle(dest.X + 4, dest.Y, dest.Width, 35);

            TextItem.doFontLabelToSize(rectangle1, this.name, GuiData.font, Color.White, true, true);
            int width   = dest.Width / 4;
            int height1 = 22;

            if (Button.doButton(37849102, rectangle1.X + rectangle1.Width - 6 - width, rectangle1.Y + rectangle1.Height - rectangle1.Height / 2 - height1 / 2, width, height1, LocaleTerms.Loc("Exit IRC View"), new Color?(this.ThemeColor)))
            {
                this.os.display.command = "connect";
            }
            rectangle1.Y     += rectangle1.Height;
            rectangle1.X     -= 6;
            dest.Y           += rectangle1.Height;
            dest.Height      -= rectangle1.Height;
            rectangle1.Height = 2;
            sb.Draw(Utils.white, rectangle1, this.ThemeColor);
            dest.Y      += rectangle1.Height + 2;
            dest.Height -= rectangle1.Height + 2;
            dest.Height -= 6;
            PatternDrawer.draw(dest, 0.22f, Color.Black * 0.5f, flag ? this.ThemeColor * 0.12f : Utils.AddativeRed * 0.2f, sb, flag ? PatternDrawer.thinStripe : PatternDrawer.warningStripe);
            dest.X      += 2;
            dest.Width  -= 4;
            dest.Height -= 4;
            if (flag)
            {
                this.System.Draw(dest, sb, false, LocaleTerms.Loc("UNKNOWN"), this.UserColors);
            }
            else
            {
                int       height2    = dest.Height / 4;
                Rectangle rectangle2 = new Rectangle(dest.X - 4, dest.Y + dest.Height / 2 - height2 / 2, dest.Width + 6, height2);
                sb.Draw(Utils.white, rectangle2, this.os.lockedColor);
                rectangle2.Height -= 35;
                TextItem.doCenteredFontLabel(rectangle2, LocaleTerms.Loc("Login To Server"), GuiData.font, Color.White, false);
                if (Button.doButton(84109551, rectangle2.X + rectangle2.Width / 2 - rectangle2.Width / 4, rectangle2.Y + rectangle2.Height - 32, rectangle2.Width / 2, 28, "Login", new Color?()))
                {
                    this.os.runCommand("login");
                }
            }
        }
コード例 #14
0
ファイル: MissionHubServer.cs プロジェクト: hochladen/Hacknet
        private void doContractPreviewScreen(Rectangle bounds, SpriteBatch sb)
        {
            string stringForContractFile = this.getIDStringForContractFile(this.listingsFolder.files[this.selectedElementIndex]);

            if (!this.listingMissions.ContainsKey(stringForContractFile))
            {
                return;
            }
            ActiveMission listingMission = this.listingMissions[stringForContractFile];
            Vector2       vector2        = new Vector2((float)(bounds.X + 20), (float)(bounds.Y + 20));

            TextItem.doFontLabel(vector2 + new Vector2((float)this.getTransitionOffset(0), 0.0f), "CONTRACT:" + stringForContractFile, GuiData.titlefont, new Color?(), (float)(bounds.Width / 2), 40f, false);
            vector2.Y += 40f;
            TextItem.doFontLabel(vector2 + new Vector2((float)this.getTransitionOffset(1), 0.0f), listingMission.postingTitle.Replace("#", ""), GuiData.font, new Color?(), (float)(bounds.Width - 30), float.MaxValue, false);
            vector2.Y += 30f;
            string        str           = DisplayModule.cleanSplitForWidth(listingMission.postingBody, bounds.Width - 110);
            StringBuilder stringBuilder = new StringBuilder();
            int           num1          = (int)((double)(((float)bounds.Width - 20f) / GuiData.smallfont.MeasureString("-").X) / 2.0);

            for (int index = 1; index < num1 - 5; ++index)
            {
                stringBuilder.Append("-");
            }
            string text = str.Replace("###", stringBuilder.ToString());

            if (LocaleActivator.ActiveLocaleIsCJK())
            {
                text       = Utils.SuperSmartTwimForWidth(listingMission.postingBody, bounds.Width - 110, GuiData.smallfont);
                vector2.Y += 20f;
            }
            TextItem.doFontLabel(vector2 + new Vector2((float)this.getTransitionOffset(2), 0.0f), text, GuiData.smallfont, new Color?(), (float)(bounds.Width - 20), float.MaxValue, false);
            int num2 = Math.Max(135, bounds.Height / 6);

            if (Button.doButton(2171618, bounds.X + 20 + this.getTransitionOffset(3), bounds.Y + bounds.Height - num2, bounds.Width / 5, 30, LocaleTerms.Loc("Back"), new Color?()))
            {
                this.state            = MissionHubServer.HubState.Listing;
                this.screenTransition = 1f;
            }
            if (this.os.currentMission == null)
            {
                if (Button.doButton(2171615, bounds.X + 20 + this.getTransitionOffset(4), bounds.Y + bounds.Height - num2 - 40, bounds.Width / 5, 30, LocaleTerms.Loc("Accept"), new Color?(this.os.highlightColor)))
                {
                    this.acceptMission(listingMission, this.selectedElementIndex, stringForContractFile);
                    this.state            = MissionHubServer.HubState.Listing;
                    this.screenTransition = 1f;
                }
            }
            else
            {
                TextItem.doFontLabelToSize(new Rectangle(bounds.X + 20 + this.getTransitionOffset(4), bounds.Y + bounds.Height - num2 - 40, bounds.Width / 2, 30), LocaleTerms.Loc("Abort current contract to accept new ones."), GuiData.smallfont, Color.White, false, false);
            }
        }
コード例 #15
0
        private void doContractPreviewScreen(Rectangle bounds, SpriteBatch sb)
        {
            var stringForContractFile = getIDStringForContractFile(listingsFolder.files[selectedElementIndex]);

            if (!listingMissions.ContainsKey(stringForContractFile))
            {
                return;
            }
            var mission = listingMissions[stringForContractFile];
            var vector2 = new Vector2(bounds.X + 20, bounds.Y + 20);

            TextItem.doFontLabel(vector2 + new Vector2(getTransitionOffset(0), 0.0f),
                                 "CONTRACT:" + stringForContractFile, GuiData.titlefont, new Color?(), bounds.Width / 2, 40f);
            vector2.Y += 40f;
            TextItem.doFontLabel(vector2 + new Vector2(getTransitionOffset(1), 0.0f), mission.postingTitle, GuiData.font,
                                 new Color?(), bounds.Width - 30, float.MaxValue);
            vector2.Y += 30f;
            var text = DisplayModule.cleanSplitForWidth(mission.postingBody, bounds.Width - 110);

            TextItem.doFontLabel(vector2 + new Vector2(getTransitionOffset(2), 0.0f), text, GuiData.smallfont,
                                 new Color?(), bounds.Width - 20, float.MaxValue);
            var num = Math.Max(135, bounds.Height / 6);

            if (Button.doButton(2171618, bounds.X + 20 + getTransitionOffset(3), bounds.Y + bounds.Height - num,
                                bounds.Width / 5, 30, "Back", new Color?()))
            {
                state            = HubState.Listing;
                screenTransition = 1f;
            }
            if (os.currentMission == null)
            {
                if (
                    !Button.doButton(2171615, bounds.X + 20 + getTransitionOffset(4),
                                     bounds.Y + bounds.Height - num - 40, bounds.Width / 5, 30, "Accept", os.highlightColor))
                {
                    return;
                }
                acceptMission(mission, selectedElementIndex, stringForContractFile);
                state            = HubState.Listing;
                screenTransition = 1f;
            }
            else
            {
                TextItem.doFontLabelToSize(
                    new Rectangle(bounds.X + 20 + getTransitionOffset(4), bounds.Y + bounds.Height - num - 40,
                                  bounds.Width / 2, 30), "Abort current contract to accept new ones.", GuiData.smallfont,
                    Color.White);
            }
        }
コード例 #16
0
        private void RenderMenuMainState(Rectangle dest, SpriteBatch sb)
        {
            int       num1   = 5;
            int       height = Math.Min(dest.Height / (num1 + 1), 32);
            int       num2   = (int)((double)(dest.Height - height * (num1 + 1)) / 2.0);
            bool      flag   = this.State == MemoryForensicsExe.MemForensicsState.Processing;
            Color     color  = flag ? Color.Gray : Color.White;
            Rectangle dest1  = new Rectangle(dest.X + 20, dest.Y + num2, (int)((double)dest.Width * 0.899999976158142), height);
            Rectangle destinationRectangle = new Rectangle(dest.X + 2, dest1.Y - 4, dest.Width - 4, dest1.Height * (num1 + 1));

            sb.Draw(Utils.white, destinationRectangle, Color.Black * 0.8f);
            if (height <= 6)
            {
                return;
            }
            TextItem.doFontLabelToSize(dest1, LocaleTerms.Loc("Memory Dump") + " : " + this.filenameLoaded, GuiData.smallfont, Color.LightGray, true, true);
            dest1.Y += dest1.Height + 2;
            if (Button.doButton(381023801, dest1.X, dest1.Y, dest1.Width, dest1.Height, LocaleTerms.Loc("Process Recent Commands Run..."), new Color?(color)) && !flag)
            {
                this.MoveToProcessing();
                this.OutputData.Clear();
                this.OutputData.AddRange((IEnumerable <string>) this.ActiveMem.CommandsRun);
                this.AnnouncementData = LocaleTerms.Loc("Results for recently run commands remaining in cached memory") + "::";
            }
            dest1.Y += dest1.Height + 2;
            if (Button.doButton(381023803, dest1.X, dest1.Y, dest1.Width, dest1.Height, LocaleTerms.Loc("Process Files in Memory..."), new Color?(color)) && !flag)
            {
                this.MoveToProcessing();
                this.OutputData.Clear();
                this.OutputData.AddRange((IEnumerable <string>) this.ActiveMem.DataBlocks);
                this.AnnouncementData = LocaleTerms.Loc("Results for accessed non-binary file fragments in cached memory") + "::";
            }
            dest1.Y += dest1.Height + 2;
            if (Button.doButton(381023807, dest1.X, dest1.Y, dest1.Width, dest1.Height, LocaleTerms.Loc("Process Images in Memory..."), new Color?(color)) && !flag)
            {
                this.MoveToProcessing();
                this.IsDisplayingImages = true;
                this.OutputData.Clear();
                this.OutputData.AddRange((IEnumerable <string>) this.ActiveMem.Images);
                Task.Factory.StartNew((Action)(() => this.StartLoadingInTexturesForMemory()));
                this.AnnouncementData = LocaleTerms.Loc("Results for accessed image-type tagged binary fragments in cached memory") + "::";
            }
            dest1.Y += dest1.Height + 2;
            if (Button.doButton(381023809, dest1.X, dest1.Y, dest1.Width, dest1.Height, LocaleTerms.Loc("Exit"), new Color?(this.os.lockedColor)))
            {
                this.isExiting = true;
            }
            dest1.Y += dest1.Height + 2;
        }
コード例 #17
0
        private void DrawBrowse(Rectangle dest, SpriteBatch spriteBatch)
        {
            Rectangle drawRectForRow1 = this.GetDrawRectForRow(0, 12);
            bool      flag            = this.Permissions == DatabaseDaemon.DatabasePermissions.Public || this.comp.adminIP == this.os.thisComputer.ip;

            TextItem.doFontLabelToSize(drawRectForRow1, string.Format(LocaleTerms.Loc("{0} : Records"), (object)this.name), GuiData.font, Color.White, true, true);
            Rectangle drawRectForRow2 = this.GetDrawRectForRow(0, 0);

            PatternDrawer.draw(drawRectForRow2, 0.5f, Color.Transparent, this.ThemeColor * 0.2f, spriteBatch, PatternDrawer.thinStripe);
            Rectangle rectangle = new Rectangle(drawRectForRow2.X + 4, drawRectForRow2.Y + drawRectForRow2.Height / 2 + 12, drawRectForRow2.Width / 3, drawRectForRow2.Height / 2 - 15);

            if (Button.doButton(71118000, rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height, LocaleTerms.Loc("Back"), new Color?(Color.Gray)))
            {
                this.State = DatabaseDaemon.DatabaseState.Welcome;
            }
            if (this.DataType == (Type)null || string.IsNullOrWhiteSpace(this.DataTypeIdentifier) || this.DataTypeIdentifier.ToLower() == "none")
            {
                Rectangle drawRectForRow3 = this.GetDrawRectForRow(1, 2);
                drawRectForRow3.Height += (int)((double)this.blockSize * (double)(this.blocksHigh - 3));
                PatternDrawer.draw(drawRectForRow3, 0.4f, Color.Black * 0.3f, Utils.makeColorAddative(this.ThemeColor) * 0.25f, spriteBatch, PatternDrawer.binaryTile);
                TextItem.doCenteredFontLabel(this.GetDrawRectForRow(3, 8), " - " + LocaleTerms.Loc("API Access Enabled") + " - ", GuiData.smallfont, Color.White, false);
            }
            else
            {
                Rectangle ListDest = this.GetDrawRectForRow(1, 4);
                ListDest.Height += (int)((double)this.blockSize * ((double)this.blocksHigh - 2.5));
                this.ScrollPanel.NumberOfPanels = this.DatasetFolder.files.Count;
                this.ScrollPanel.Draw((Action <int, Rectangle, SpriteBatch>)((i, bounds, sb) =>
                {
                    FileEntry file = this.DatasetFolder.files[i];
                    string text    = "REC#" + i.ToString("000") + " : " + this.GetAnnounceNameForFileName(file.name);
                    int width      = Math.Max(160, bounds.Width / 3);
                    if (Button.doButton(71118100 + i, bounds.X, bounds.Y + 2, width, bounds.Height - 4, string.Format(LocaleTerms.Loc("View Record #{0}"), (object)i.ToString("000")), new Color?(this.ThemeColor)))
                    {
                        this.ActiveFile       = this.DatasetFolder.files[i];
                        this.State            = DatabaseDaemon.DatabaseState.EntryDisplay;
                        this.DeserializedFile = (object)null;
                    }
                    Vector2 vector2 = GuiData.smallfont.MeasureString(text);
                    Rectangle destinationRectangle = new Rectangle(bounds.X + bounds.Width / 3 + 6, bounds.Y + bounds.Height / 2 - 1, ListDest.Width - (width + (int)vector2.X + 26), 1);
                    sb.Draw(Utils.white, destinationRectangle, Color.White * 0.1f);
                    TextItem.doFontLabel(new Vector2((float)(destinationRectangle.X + destinationRectangle.Width) + 6f, (float)bounds.Y + 2f), text, GuiData.smallfont, new Color?(Color.White), (float)bounds.Width, (float)bounds.Height, false);
                }), spriteBatch, ListDest);
            }
        }
コード例 #18
0
        public void RenderMainDisplay(Rectangle dest, SpriteBatch sb)
        {
            dest = this.RenderMainDisplayHeaders(dest, sb);
            switch (this.State)
            {
            case MemoryForensicsExe.MemForensicsState.Error:
                PatternDrawer.draw(dest, 1f, Color.Transparent, Utils.AddativeRed, this.spriteBatch, PatternDrawer.errorTile);
                Rectangle rectangle1 = new Rectangle(dest.X, dest.Y + dest.Height / 3, dest.Width, 60);
                sb.Draw(Utils.white, rectangle1, Color.Black * 0.4f);
                TextItem.doFontLabelToSize(rectangle1, LocaleTerms.Loc("ERROR"), GuiData.font, Color.White, true, true);
                Rectangle rectangle2 = new Rectangle(dest.X, rectangle1.Y + rectangle1.Height + 2, dest.Width, dest.Height / 2);
                sb.Draw(Utils.white, rectangle2, Color.Black * 0.8f);
                string text = Utils.SuperSmartTwimForWidth(this.ErrorMessage.Length > 500 ? this.ErrorMessage.Substring(0, 500) : this.ErrorMessage, rectangle2.Width, GuiData.smallfont);
                TextItem.doFontLabelToSize(rectangle2, text, GuiData.smallfont, Utils.AddativeRed, true, true);
                if (!Button.doButton(381023801, dest.X + 2, rectangle2.Y + rectangle2.Height + 2, this.bounds.Width / 3, 30, LocaleTerms.Loc("Close"), new Color?(this.os.lockedColor)))
                {
                    break;
                }
                this.isExiting = true;
                break;

            case MemoryForensicsExe.MemForensicsState.ReadingFile:
                Rectangle bounds = new Rectangle(dest.X, dest.Y, (int)((double)dest.Width * ((double)this.timeInCurrentState / 2.0)), dest.Height);
                bounds = new Rectangle(dest.X + (int)((double)dest.Width * (1.0 - (double)this.timeInCurrentState / 2.0)), dest.Y, (int)((double)dest.Width * ((double)this.timeInCurrentState / 2.0)), dest.Height);
                this.GridEffect.RenderGrid(bounds, sb, this.ThemeColorDark * 0.5f, this.ThemeColorMain, this.ThemeColorDark, false);
                break;

            case MemoryForensicsExe.MemForensicsState.Main:
                this.DrawMainStateBackground(dest, sb);
                this.RenderMenuMainState(dest, sb);
                break;

            case MemoryForensicsExe.MemForensicsState.Processing:
                this.DrawMainStateBackground(dest, sb);
                this.RenderResultsDisplayMainState(dest, sb, true);
                break;

            case MemoryForensicsExe.MemForensicsState.DisplayingSolution:
                this.DrawMainStateBackground(dest, sb);
                this.RenderResultsDisplayMainState(dest, sb, false);
                break;
            }
        }
コード例 #19
0
 public void Draw(Rectangle dest, string text, SpriteBatch sb, Color TextDrawColor)
 {
     try
     {
         if (GuiData.ActiveFontConfig.name != this.activeFontConfigName)
         {
             this.Panel.ScrollDown     = 0.0f;
             this.Panel.PanelHeight    = (int)((double)GuiData.ActiveFontConfig.tinyFontCharHeight + 2.0 + (double)GuiData.ActiveFontConfig.tinyFont.LineSpacing);
             this.activeFontConfigName = GuiData.ActiveFontConfig.name;
         }
         string[] data = text.Split(Utils.robustNewlineDelim, StringSplitOptions.None);
         this.Panel.NumberOfPanels = data.Length;
         this.Panel.Draw((Action <int, Rectangle, SpriteBatch>)((index, panelDest, spriteBatch) => spriteBatch.DrawString(GuiData.tinyfont, data[index], Utils.ClipVec2ForTextRendering(new Vector2((float)panelDest.X, (float)panelDest.Y)), TextDrawColor)), sb, dest);
     }
     catch (Exception ex)
     {
         TextItem.doFontLabelToSize(dest, text, GuiData.tinyfont, TextDrawColor, false, false);
     }
 }
コード例 #20
0
        public static void RenderObject(object o, Rectangle bounds, SpriteBatch spriteBatch, ScrollableSectionedPanel panel, Color TitleColor)
        {
            List <ReflectiveRenderer.RenderableField> fields = ReflectiveRenderer.GetRenderablesFromType(o.GetType(), o, 0);
            int entryLineHeight = ReflectiveRenderer.GetEntryLineHeight();

            panel.PanelHeight    = entryLineHeight;
            panel.NumberOfPanels = fields.Count;
            int pixelsPerIndentLevel = 20;

            panel.Draw((Action <int, Rectangle, SpriteBatch>)((i, dest, sb) =>
            {
                int num     = fields[i].IndentLevel * pixelsPerIndentLevel;
                dest.X     += num;
                dest.Width -= num;
                if (fields[i].IsTitle)
                {
                    TextItem.doFontLabelToSize(dest, fields[i].RenderedValue, GuiData.font, TitleColor, true, true);
                    Rectangle destinationRectangle = new Rectangle(dest.X, dest.Y + dest.Height - 1, dest.Width, 1);
                    sb.Draw(Utils.white, destinationRectangle, TitleColor);
                }
                else
                {
                    string text1      = fields[i].VariableName + " :";
                    Vector2 vector2_1 = GuiData.smallfont.MeasureString(text1);
                    sb.DrawString(GuiData.smallfont, text1, new Vector2((float)dest.X, (float)dest.Y), Color.Gray);
                    string text2      = fields[i].RenderedValue;
                    Vector2 vector2_2 = GuiData.smallfont.MeasureString(text2);
                    if ((double)vector2_2.X > (double)(dest.Width - 20) || (double)vector2_2.Y > (double)dest.Height)
                    {
                        text2.Replace("\n", " ");
                        text2 = text2.Substring(0, Math.Min(text2.Length, (int)((double)dest.Width / ((double)GuiData.ActiveFontConfig.tinyFontCharHeight + 2.0)))) + "...";
                    }
                    Vector2 position = new Vector2((float)((double)dest.X + (double)vector2_1.X + 6.0), (float)dest.Y);
                    if (ReflectiveRenderer.PreRenderForObject != null && sb.Name != "AltRTBatch")
                    {
                        ReflectiveRenderer.PreRenderForObject(position, fields[i].t, fields[i].RenderedValue);
                    }
                    sb.DrawString(GuiData.smallfont, text2, position, Color.White);
                }
            }), spriteBatch, bounds);
            ReflectiveRenderer.PreRenderForObject = (Action <Vector2, Type, string>)null;
        }
コード例 #21
0
        public static void DrawFlickeringText(Rectangle dest, string text, float maxOffset, float rarity, SpriteFont font, object os_Obj, Color BaseCol)
        {
            OS os = (OS)null;

            if (os_Obj != null)
            {
                os = (OS)os_Obj;
            }
            else
            {
                FlickeringTextEffect.internalTimer += 0.01666667f;
            }
            Color color1 = new Color((int)BaseCol.R, 0, 0, 0);
            Color color2 = new Color(0, (int)BaseCol.G, 0, 0);
            Color color3 = new Color(0, 0, (int)BaseCol.B, 0);

            TextItem.doFontLabelToSize(FlickeringTextEffect.RectAddX(dest, (int)((double)maxOffset * (double)FlickeringTextEffect.GetOffsetForSinTime(1.3f, 12.3f, rarity, (object)os))), text, font, color1, false, false);
            TextItem.doFontLabelToSize(FlickeringTextEffect.RectAddX(dest, (int)((double)maxOffset * (double)FlickeringTextEffect.GetOffsetForSinTime(0.8f, 29f, rarity, (object)os))), text, font, color2, false, false);
            TextItem.doFontLabelToSize(FlickeringTextEffect.RectAddX(dest, (int)((double)maxOffset * (double)FlickeringTextEffect.GetOffsetForSinTime(0.5f, -939.7f, rarity, (object)os))), text, font, color3, false, false);
        }
コード例 #22
0
        public override void Draw(float t)
        {
            base.Draw(t);
            drawOutline();
            drawTarget("app:");
            var now   = DateTime.Now;
            var str   = "#" + now.Hour.ToString("00") + now.Minute.ToString("00") + now.Second.ToString("00");
            var color = Utils.ColorFromHexString(str);

            AutoUpdateTheme(color);
            var contentAreaDest = GetContentAreaDest();

            spriteBatch.Draw(Utils.white, contentAreaDest, color);
            var width  = (int)(bounds.Width * 0.800000011920929);
            var height = 30;

            TextItem.doFontLabelToSize(
                new Rectangle(contentAreaDest.X + (contentAreaDest.Width / 2 - width / 2),
                              contentAreaDest.Y + (contentAreaDest.Height / 2 - height / 2), width, height), str, GuiData.font,
                Utils.AddativeWhite);
        }
コード例 #23
0
        private void DrawEntry(Rectangle dest, SpriteBatch spriteBatch)
        {
            if (this.DeserializedFile == null)
            {
                try
                {
                    this.DeserializedFile = ObjectSerializer.DeserializeObject(Utils.GenerateStreamFromString(this.DeCleanXMLForFile(this.ActiveFile.data)), this.DataType);
                }
                catch (Exception ex)
                {
                    this.State        = DatabaseDaemon.DatabaseState.Error;
                    this.errorMessage = LocaleTerms.Loc("Error De-serializing Entry") + " : " + this.ActiveFile.name + "\n" + Utils.GenerateReportFromException(ex).Replace("Hacknet", "Database");
                    return;
                }
            }
            Rectangle drawRectForRow = this.GetDrawRectForRow(0, 0);

            drawRectForRow.Height = drawRectForRow.Height / 2;
            TextItem.doFontLabelToSize(drawRectForRow, string.Format(LocaleTerms.Loc("Entry for {0}"), (object)this.GetAnnounceNameForFileName(this.ActiveFile.name)), GuiData.font, Color.White, true, true);
            drawRectForRow.Y += drawRectForRow.Height;
            if (Button.doButton(7301991, drawRectForRow.X, drawRectForRow.Y, drawRectForRow.Width / 2, drawRectForRow.Height, LocaleTerms.Loc("Back"), new Color?(Color.Gray)))
            {
                this.State            = DatabaseDaemon.DatabaseState.Browse;
                this.ActiveFile       = (FileEntry)null;
                this.DeserializedFile = (object)null;
            }
            else
            {
                Rectangle bounds = new Rectangle((int)this.BlockStartTopLeft.X, (int)this.BlockStartTopLeft.Y + (int)this.blockSize, (int)((double)this.blockSize * (double)(this.blocksWide - 1)), (int)((double)this.blockSize * (double)(this.blocksHigh - 2)));
                if (this.HasSpecialCaseDraw)
                {
                    ReflectiveRenderer.PreRenderForObject += (Action <Vector2, Type, string>)((pos, targetType, targetValue) => this.DrawSpecialCase(pos, bounds, targetType, targetValue, spriteBatch));
                }
                ReflectiveRenderer.RenderObject(this.DeserializedFile, bounds, spriteBatch, this.ScrollPanel, this.ThemeColor);
                if (this.HasSpecialCaseDraw)
                {
                    ReflectiveRenderer.PreRenderForObject = (Action <Vector2, Type, string>)null;
                }
            }
        }
コード例 #24
0
        private void DrawError(Rectangle dest, SpriteBatch sb)
        {
            Rectangle drawRectForRow1 = this.GetDrawRectForRow(0, 12);
            bool      flag            = this.Permissions == DatabaseDaemon.DatabasePermissions.Public || this.comp.adminIP == this.os.thisComputer.ip;

            TextItem.doFontLabelToSize(drawRectForRow1, this.name, GuiData.font, Color.White, false, true);
            PatternDrawer.draw(new Rectangle(dest.X + 1, (int)this.BlockStartTopLeft.Y, dest.Width - 2, (int)((double)this.blockSize * 2.0)), 0.5f, Color.Transparent, Utils.AddativeRed * 0.2f, sb, flag ? PatternDrawer.thinStripe : PatternDrawer.errorTile);
            TextItem.doFontLabelToSize(this.GetDrawRectForRow(1, 12), LocaleTerms.Loc("ERROR"), GuiData.font, Utils.AddativeRed * 0.8f, true, true);
            Rectangle drawRectForRow2 = this.GetDrawRectForRow(2, 14);

            if (Button.doButton(73616101, (int)this.BlockStartTopLeft.X, drawRectForRow2.Y, dest.Width / 2, drawRectForRow2.Height, LocaleTerms.Loc("Back"), new Color?(this.ThemeColor)))
            {
                this.State = DatabaseDaemon.DatabaseState.Welcome;
            }
            Rectangle rectangle = this.GetDrawRectForRow(3, 14);

            rectangle.Height = (int)(((double)this.blocksHigh - 4.0) * (double)this.blockSize);
            rectangle        = Utils.InsetRectangle(rectangle, 2);
            string text = Utils.SuperSmartTwimForWidth(this.errorMessage, rectangle.Width, GuiData.smallfont);

            this.TextRegion.Draw(rectangle, text, sb, Utils.AddativeRed);
        }
コード例 #25
0
 private static void DrawIndicatorForAltitude(Rectangle dest, int altitude, string ElementTitle, int totalAltitude, Rectangle totalBar, SpriteBatch sb, Color c, bool LineAtTop = false, bool useGradientBacking = false)
 {
     dest.Y = totalBar.Y + AircraftAltitudeIndicator.GetHeightForAltitude(altitude, totalAltitude, totalBar);
     if (LineAtTop)
     {
         ++dest.Y;
         --dest.Height;
     }
     sb.Draw(useGradientBacking ? Utils.gradientLeftRight : Utils.white, dest, new Rectangle?(), Color.Black * (useGradientBacking ? 1f : 0.5f), 0.0f, Vector2.Zero, SpriteEffects.FlipHorizontally, 0.4f);
     TextItem.doFontLabelToSize(dest, ElementTitle, GuiData.font, c, true, true);
     if (LineAtTop)
     {
         --dest.Y;
         dest.Height = 1;
     }
     else
     {
         dest.Y     += dest.Height - 2;
         dest.Height = 1;
     }
     sb.Draw(Utils.white, dest, c);
 }
コード例 #26
0
        internal virtual void DrawNonAdminDisplay(Rectangle dest, SpriteBatch sb)
        {
            Rectangle destinationRectangle = new Rectangle(dest.X + 1, dest.Y, dest.Width, 1);

            sb.Draw(Utils.white, destinationRectangle, Utils.AddativeRed);
            int       height1   = 120;
            Rectangle rectangle = new Rectangle(dest.X, dest.Y + (dest.Height / 2 - height1), dest.Width, height1);

            sb.Draw(Utils.white, rectangle, Color.Black * 0.8f);
            int stripHeight = 20;

            this.DrawCautionLinedMessage(Utils.InsetRectangle(rectangle, 4), stripHeight, Color.Red, "ACCESS DENIED", sb, (Texture2D)null, 0);
            int       height2 = 90;
            Rectangle dest1   = Utils.InsetRectangle(new Rectangle(rectangle.X, rectangle.Y + stripHeight + 2, rectangle.Width, height2), 20);

            dest1.Y      = rectangle.Y + rectangle.Height + 2;
            dest1.Height = 30;
            TextItem.doFontLabelToSize(dest1, LocaleTerms.Loc("Non-Admin Account Detected - Login to Proceed or Disconnect Now"), GuiData.font, Color.Black, true, false);
            TextItem.doFontLabelToSize(dest1, LocaleTerms.Loc("Non-Admin Account Detected - Login to Proceed or Disconnect Now"), GuiData.font, Color.Red * 0.7f, true, false);
            int width   = 340;
            int x       = dest.X + dest.Width / 2 - width / 2;
            int y1      = dest1.Y + dest1.Height + 10;
            int height3 = 40;

            if (Button.doButton(302001, x, y1, width, height3, LocaleTerms.Loc("Login"), new Color?(Color.Gray)))
            {
                this.os.runCommand("login");
                this.os.terminal.clearCurrentLine();
            }
            int y2 = y1 + (height3 + 6);

            if (!Button.doButton(302003, x, y2, width, 40, LocaleTerms.Loc("Disconnect"), new Color?(Color.Red)))
            {
                return;
            }
            this.os.runCommand("dc");
        }
コード例 #27
0
        public override void Draw(float t)
        {
            base.Draw(t);
            this.drawOutline();
            this.drawTarget("app:");
            Rectangle contentAreaDest = this.GetContentAreaDest();

            if (contentAreaDest.Height < 5)
            {
                return;
            }
            PatternDrawer.draw(contentAreaDest, 0.1f, Color.Transparent, this.os.highlightColor * 0.1f, this.spriteBatch, PatternDrawer.wipTile);
            int       height    = Math.Min(contentAreaDest.Height / 2, 30);
            Rectangle rectangle = new Rectangle(contentAreaDest.X, contentAreaDest.Y + contentAreaDest.Height / 2 - height, contentAreaDest.Width, height);

            this.spriteBatch.Draw(Utils.white, rectangle, Color.Black);
            if (this.DownloadComplete)
            {
                this.spriteBatch.Draw(Utils.white, rectangle, this.DidFail ? Color.Red * 0.5f : this.os.highlightColor * 0.5f);
                TextItem.doFontLabelToSize(Utils.InsetRectangle(rectangle, 4), this.DidFail ? LocaleTerms.Loc("Empty Scan Detected") : LocaleTerms.Loc("Download Complete"), GuiData.smallfont, Utils.AddativeWhite, true, false);
                rectangle.Y      += rectangle.Height;
                rectangle.Height -= 4;
                rectangle.X      += 4;
                rectangle.Width  -= 8;
                if (this.DidFail)
                {
                    return;
                }
                TextItem.doFontLabelToSize(rectangle, this.savedFileName, GuiData.font, Utils.AddativeWhite, true, false);
            }
            else
            {
                float num = this.elapsedTime / 6f;
                rectangle.Width = (int)((double)rectangle.Width * (double)num);
                this.spriteBatch.Draw(Utils.white, rectangle, this.os.highlightColor * 0.5f);
            }
        }
コード例 #28
0
ファイル: NotesExe.cs プロジェクト: strangea/OpenHacknet
        private void DrawBasePanel(Rectangle dest)
        {
            var width = Math.Min(120, (dest.Width - 8) / 2);

            if (Button.doButton(631012 + os.exes.IndexOf(this), dest.X + dest.Width - width, dest.Y + 4, width,
                                dest.Height - 6, "Close", os.lockedColor * fade))
            {
                if (gettingNewNote)
                {
                    os.terminal.executeLine();
                    gettingNewNote = false;
                }
                Completed();
                RemoveReopnener();
                isExiting = true;
            }
            if (!gettingNewNote &&
                Button.doButton(631014 + os.exes.IndexOf(this), dest.X, dest.Y + 4, width, dest.Height - 6, "Add Note",
                                os.highlightColor * fade))
            {
                os.runCommand("getString Note");
                os.getStringCache = "";
                gettingNewNote    = true;
            }
            else
            {
                if (!gettingNewNote)
                {
                    return;
                }
                var dest1 = new Rectangle(dest.X, dest.Y + 4, width, dest.Height - 6);
                PatternDrawer.draw(dest1, 1f, Color.Transparent, os.highlightColor * 0.5f, spriteBatch,
                                   PatternDrawer.thinStripe);
                TextItem.doFontLabelToSize(dest1, "Type In Terminal...", GuiData.smallfont, Color.White);
            }
        }
コード例 #29
0
ファイル: SSLPortExe.cs プロジェクト: hochladen/Hacknet
        public override void Draw(float t)
        {
            base.Draw(t);
            this.drawOutline();
            this.drawTarget("app:");
            Rectangle rectangle1 = Utils.InsetRectangle(new Rectangle(this.bounds.X, this.bounds.Y + Module.PANEL_HEIGHT, this.bounds.Width, this.bounds.Height - Module.PANEL_HEIGHT), 2);

            if (this.bounds.Height < Module.PANEL_HEIGHT + 4)
            {
                return;
            }
            float num1 = 1f;

            if ((double)this.elapsedTime < 12.0)
            {
                num1 = this.elapsedTime / 12f;
            }
            float   num2      = 0.6f;
            float   num3      = Utils.CubicInCurve(Utils.CubicInCurve(Math.Min(1f, num1 * (1f / num2))));
            float   num4      = Math.Max(0.0f, Math.Min(1f, (float)(((double)num1 - (double)num2) * (1.0 / (1.0 - (double)num2)))));
            int     num5      = 7;
            bool    flag      = true;
            Vector2 vector2_1 = new Vector2((float)(this.bounds.X + this.bounds.Width / 2), (float)(this.bounds.Y + Module.PANEL_HEIGHT + this.bounds.Height / 2 - 12));
            float   num6      = num2 * 12f;
            float   num7      = (float)(((double)this.elapsedTime - (double)num6) / (15.0 - (double)num6));

            if ((double)num3 < 0.990000009536743)
            {
                num7 = 0.0f;
            }
            Vector2 left      = vector2_1;
            float   diamater  = (float)this.bounds.Width - (float)(100.0 - (double)num7 * 1500.0);
            float   num8      = num4 * 1f;
            Vector2 vector2_2 = new Vector2((float)Math.Sin((double)this.os.timer * 2.0) * (diamater / 4f), (float)Math.Cos((double)this.os.timer * 2.0) * (diamater / 4f));
            Vector2 vector2_3 = vector2_1 - this.LastCentralRenderOffset * num4 * 1f;

            this.LastCentralRenderOffset = Vector2.Zero;
            for (int index = 0; index < num5; ++index)
            {
                int num9         = 13;
                int subdivisions = num9;
                if (index == 0)
                {
                    subdivisions = (int)((double)(num9 - 1) * (double)Math.Min(1f, num3 + 0.0831f)) + 1;
                }
                float nodeDiamater = Math.Max(1f, (float)((double)num5 - (double)index * 2.0 + 1.0)) + num8;
                float timer        = this.os.timer * 2f;
                if (flag)
                {
                    timer *= index % 2 == 0 ? 1f : -1f;
                }
                if ((double)index < 1.0 + (double)(int)(6.0 * (double)num4))
                {
                    TunnelingCircleEffect.Draw(this.spriteBatch, vector2_3, diamater, nodeDiamater, subdivisions, timer, Color.Lerp(Color.White, Color.Transparent, Utils.QuadraticOutCurve((float)index / (float)num5)), Color.Gray * (float)(0.119999997317791 * (1.0 - (double)num1) + 0.100000001490116), this.os.highlightColor, rectangle1);
                    Vector2 leftOut;
                    Vector2 rightOut;
                    Utils.ClipLineSegmentsForRect(rectangle1, left, vector2_3, out leftOut, out rightOut);
                    Utils.drawLineAlt(this.spriteBatch, leftOut, rightOut, Vector2.Zero, this.os.highlightColor * 0.3f, 0.6f, 1f, Utils.gradientLeftRight);
                }
                float num10 = diamater / 4f;
                left = vector2_3;
                Vector2 vector2_4 = new Vector2((float)Math.Sin((double)timer) * num10, (float)Math.Cos((double)timer) * num10);
                this.LastCentralRenderOffset += vector2_4;
                vector2_3 += vector2_4;
                diamater   = diamater / 2f - nodeDiamater;
                if (index == num5 - 1 && (double)num3 > 0.990000009536743)
                {
                    if ((double)vector2_3.X > (double)rectangle1.X && (double)vector2_3.X < (double)(rectangle1.X + rectangle1.Width) && (double)vector2_3.Y > (double)rectangle1.Y && (double)vector2_3.Y < (double)(rectangle1.Y + rectangle1.Height))
                    {
                        this.spriteBatch.Draw(Utils.white, vector2_3, new Rectangle?(), (double)num4 > 0.990000009536743 ? this.os.unlockedColor : this.os.highlightColor, 0.0f, Vector2.Zero, Vector2.One * 2f, SpriteEffects.None, 0.7f);
                    }
                    if (this.IsComplete)
                    {
                        int       num11 = 2;
                        Rectangle destinationRectangle = new Rectangle((int)vector2_3.X - num11 / 2, rectangle1.Y, num11, rectangle1.Height);
                        this.spriteBatch.Draw(Utils.white, destinationRectangle, Utils.makeColorAddative(this.os.highlightColor));
                        Rectangle rectangle2 = new Rectangle(rectangle1.X, (int)vector2_3.Y - num11 / 2, rectangle1.Width, num11);
                        if (rectangle2.Y > rectangle1.Y + rectangle1.Height - 30 || rectangle2.Y < rectangle1.Y)
                        {
                            rectangle2.Y = rectangle1.Y + rectangle1.Height / 2 - num11;
                        }
                        this.spriteBatch.Draw(Utils.white, rectangle2, Utils.makeColorAddative(this.os.highlightColor));
                        rectangle2.Height = Math.Min(24, rectangle1.Height / 2);
                        rectangle2.Y      = rectangle1.Y + rectangle1.Height / 2 - rectangle2.Height / 2;
                        if ((double)Utils.randm(0.25f) + 0.75 < (double)num7)
                        {
                            this.spriteBatch.Draw(Utils.white, rectangle2, Color.Black * 0.5f);
                            TextItem.doFontLabelToSize(rectangle2, "   -  " + LocaleTerms.Loc("SSL TUNNEL COMPLETE") + "  -", GuiData.smallfont, Color.White, true, false);
                        }
                    }
                }
            }
        }
コード例 #30
0
        private void DrawHoverTooltip(Rectangle bounds, SpriteBatch sb)
        {
            float     announcerWidth = 80f;
            int       num            = bounds.Height - 80;
            Rectangle rectangle1;

            if (this.hoverIndex > -1 && this.hoverIndex < this.upgradeNames.Count && this.activeState != null)
            {
                Rectangle bounds1 = bounds;
                bounds1.Height = num;
                bool  flag      = (double)this.upgradeCosts[this.hoverIndex] <= (double)this.activeState.points;
                float cornerCut = 20f;
                FancyOutlines.DrawCornerCutOutline(bounds1, sb, cornerCut, this.ThemeColor);
                Rectangle dest = new Rectangle((int)((double)bounds.X + (double)cornerCut + 4.0), bounds.Y + 3, (int)((double)bounds.Width - ((double)cornerCut + 4.0) * 2.0), 40);
                TextItem.doFontLabelToSize(dest, this.upgradeNames[this.hoverIndex], GuiData.font, this.ThemeColorHighlight, false, false);
                rectangle1 = new Rectangle(bounds.X + 2, bounds.Y + dest.Height + 4, bounds.Width - 4, 20);
                string text = flag ? (Settings.ActiveLocale != "en-us" ? LocaleTerms.Loc("UPGRADE AVALIABLE") : "UPGRADE AVAILABLE") : LocaleTerms.Loc("INSUFFICIENT POINTS");
                TextItem.doFontLabelToSize(rectangle1, text, GuiData.font, flag ? this.ThemeColorHighlight * 0.8f : Color.Gray, false, false);
                rectangle1.Y     += rectangle1.Height;
                rectangle1.Height = 50;
                rectangle1.X     += 4;
                rectangle1.Width -= 4;
                float f = this.activeState.points == 0L ? 1f : this.upgradeCosts[this.hoverIndex] / (float)this.activeState.points;
                this.DrawStatsTextBlock(LocaleTerms.Loc("COST"), string.Concat((object)this.upgradeCosts[this.hoverIndex]), (!float.IsNaN(f) ? f * 100f : 100f).ToString("00.0") + LocaleTerms.Loc("% of current Points"), rectangle1, sb, announcerWidth);
                rectangle1.Y += rectangle1.Height;
                this.DrawStatsTextBlock("+PPS", string.Concat((object)this.upgradeValues[this.hoverIndex]), ((double)this.currentRate <= 0.0 ? 100f : (float)((double)this.upgradeValues[this.hoverIndex] / (double)this.currentRate * 100.0)).ToString("00.0") + LocaleTerms.Loc("% of current Points Per Second"), rectangle1, sb, announcerWidth);
                Rectangle rectangle2 = new Rectangle((int)((double)bounds.X + (double)cornerCut + 4.0), rectangle1.Y + rectangle1.Height + 4, (int)((double)bounds.Width - ((double)cornerCut + 4.0) * 2.0), 50);
                if (flag)
                {
                    sb.Draw(this.scanlinesTextBackground, rectangle2, Utils.makeColorAddative(this.ThemeColorHighlight) * 0.6f);
                    FlickeringTextEffect.DrawFlickeringText(rectangle2, "CLICK TO UPGRADE", 3f, 0.1f, GuiData.titlefont, (object)this.os, Utils.AddativeWhite);
                }
                else
                {
                    sb.Draw(this.scanlinesTextBackground, rectangle2, Color.Lerp(this.os.brightLockedColor, Utils.makeColorAddative(Color.Red), 0.2f + Utils.randm(0.8f)) * 0.4f);
                    FlickeringTextEffect.DrawFlickeringText(rectangle2, "INSUFFICIENT POINTS", 3f, 0.1f, GuiData.titlefont, (object)this.os, Utils.AddativeWhite);
                }
            }
            rectangle1 = new Rectangle(bounds.X + 2, bounds.Y + num + 4, bounds.Width - 4, 50);
            float f1 = (double)this.currentRate <= 0.0 ? 0.0f : (float)this.activeState.points / this.currentRate;

            if (float.IsNaN(f1))
            {
                f1 = float.PositiveInfinity;
            }
            this.DrawStatsTextBlock("PPS", this.currentRate.ToString("000.0") ?? "", f1.ToString("00.0") + " " + LocaleTerms.Loc("seconds to double current points"), rectangle1, sb, announcerWidth);
            float totalSeconds = (float)this.os.lastGameTime.ElapsedGameTime.TotalSeconds;

            for (int index = 0; index < this.UpgradeNotifiers.Count; ++index)
            {
                PointClickerDaemon.UpgradeNotifier upgradeNotifier = this.UpgradeNotifiers[index];
                upgradeNotifier.timer -= totalSeconds * 4f;
                if ((double)upgradeNotifier.timer <= 0.0)
                {
                    this.UpgradeNotifiers.RemoveAt(index);
                    --index;
                }
                else
                {
                    Vector2 vector2 = GuiData.font.MeasureString(upgradeNotifier.text);
                    sb.DrawString(GuiData.font, upgradeNotifier.text, new Vector2((float)rectangle1.X + (float)(((double)rectangle1.Width - (double)announcerWidth) / 2.0) + announcerWidth, (float)(rectangle1.Y + 10)), this.ThemeColorHighlight * upgradeNotifier.timer, 0.0f, vector2 / 2f, (float)(0.5 + (1.0 - (double)upgradeNotifier.timer) * 2.20000004768372), SpriteEffects.None, 0.9f);
                    this.UpgradeNotifiers[index] = upgradeNotifier;
                }
            }
        }