コード例 #1
0
ファイル: ClockExe.cs プロジェクト: strangea/OpenHacknet
        public override void Draw(float t)
        {
            base.Draw(t);
            drawOutline();
            drawTarget("app:");
            var now = DateTime.Now;

            TextItem.doFontLabel(new Vector2(bounds.X + 2, bounds.Y + 12),
                                 (now.Hour % 12).ToString("00") + " : " + now.Minute.ToString("00") + " : " + now.Second.ToString("00"),
                                 GuiData.titlefont, RamModule.USED_RAM_COLOR, bounds.Width - 15, bounds.Height - 10);
            TextItem.doFontLabel(new Vector2(bounds.X + bounds.Width - 28, bounds.Y + bounds.Height - 38),
                                 now.Hour > 12 ? "PM" : "AM", GuiData.titlefont, RamModule.USED_RAM_COLOR, 30f, 26f);
            var width = bounds.Width - 2;
            var destinationRectangle = new Rectangle(bounds.X + 1, bounds.Y + bounds.Height - 1 - 6, width, 1);
            var num1 = now.Millisecond / 1000f;
            var num2 = 0.0f;

            if (num1 < 0.5)
            {
                num2 = (float)(1.0 - num1 * 2.0);
            }
            spriteBatch.Draw(Utils.white, destinationRectangle, os.moduleColorSolidDefault * 0.2f * num2);
            destinationRectangle.Width = (int)(width * (double)num1);
            spriteBatch.Draw(Utils.white, destinationRectangle, os.moduleColorSolidDefault * 0.2f);
            var num3 = (now.Second + num1) / 60f;

            destinationRectangle.Width = (int)(width * (double)num3);
            destinationRectangle.Y    += 2;
            spriteBatch.Draw(Utils.white, destinationRectangle, os.moduleColorStrong);
            var num4 = now.Minute / 60f;
            var num5 = now.Hour / 60.0;

            destinationRectangle.Width = (int)(width * (double)num4);
            destinationRectangle.Y    += 2;
            spriteBatch.Draw(Utils.white, destinationRectangle, os.moduleColorSolid);
        }
コード例 #2
0
        public override void draw(Rectangle bounds, SpriteBatch sb)
        {
            base.draw(bounds, sb);
            this.drawBackground(bounds, sb);
            int num1 = bounds.X + 10;
            int num2 = bounds.Y + 10;

            TextItem.doFontLabel(new Vector2((float)num1, (float)num2), this.name, GuiData.font, new Color?(), (float)(bounds.Width - 20), (float)bounds.Height, false);
            int       num3      = num2 + ((int)GuiData.font.MeasureString(this.name).Y + 2);
            string    text      = "Error: System.IO.FileNotFoundException went unhandled\n" + "File Server_Message.txt not found\n" + "at UploadDaemonCore.RenderModule.HelptextDisplay.cs\nline 107 position 95";
            FileEntry fileEntry = this.root.searchForFile("Server_Message.txt");

            if (fileEntry != null)
            {
                text = fileEntry.data;
            }
            Vector2 vector2 = TextItem.doMeasuredFontLabel(new Vector2((float)num1, (float)num3), text, GuiData.tinyfont, new Color?(), float.MaxValue, float.MaxValue);

            if (!this.hasReturnViewButton || !Button.doButton(50821549, num1 - 2, (int)((double)num3 + (double)vector2.Y + 8.0), bounds.Width / 3, 26, "Exit Upload View", new Color?(this.themeColor)))
            {
                return;
            }
            this.os.display.command = "connect";
        }
コード例 #3
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;
        }
コード例 #4
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;
            }
        }
コード例 #5
0
        private Rectangle doListingScreenBackground(Rectangle bounds, SpriteBatch sb)
        {
            var destinationRectangle1 = new Rectangle(bounds.X + 1, bounds.Y + 1, bounds.Width - 2, bounds.Height - 2);

            sb.Draw(Utils.white, destinationRectangle1, themeColorBackground);
            doLoggedInScreenDetailing(bounds, sb);
            destinationRectangle1.Height = 5;
            destinationRectangle1.Width  = 0;
            destinationRectangle1.Y     += 12;
            if (thinBarcodeTop == null)
            {
                thinBarcodeTop = new ThinBarcode(bounds.Width - 4, 5);
            }
            if (thinBarcodeBot == null)
            {
                thinBarcodeBot = new ThinBarcode(bounds.Width - 4, 5);
            }
            thinBarcodeTop.Draw(sb, destinationRectangle1.X, destinationRectangle1.Y, themeColor);
            TextItem.doFontLabel(new Vector2(bounds.X + 20, destinationRectangle1.Y + 10), "MISSION LISTING",
                                 GuiData.titlefont, themeColor, bounds.Width - 40, 35f);
            destinationRectangle1.Y += 45;
            destinationRectangle1.X  = bounds.X + 1;
            thinBarcodeBot.Draw(sb, destinationRectangle1.X, destinationRectangle1.Y, themeColor);
            destinationRectangle1.Y     += 10;
            destinationRectangle1.X      = bounds.X + 1;
            destinationRectangle1.Width  = decorationPanel.Width;
            destinationRectangle1.Height = decorationPanel.Height;
            sb.Draw(decorationPanel, destinationRectangle1, themeColor);
            destinationRectangle1.X    += destinationRectangle1.Width;
            destinationRectangle1.Width = bounds.Width - 2 - destinationRectangle1.Width;
            sb.Draw(decorationPanelSide, destinationRectangle1, themeColor);
            var pos    = new Vector2(bounds.X + 6, destinationRectangle1.Y + decorationPanel.Height / 2 - 8);
            var height = (int)(decorationPanel.Height * 0.300000011920929);
            var num1   = (float)((decorationPanel.Height - (double)height) / 2.0);
            var destinationRectangle2 = new Rectangle(bounds.X + 1, (int)(destinationRectangle1.Y + (double)num1),
                                                      decorationPanel.Width, height);
            var rectangle = new Rectangle(0, (int)((decorationPanel.Height - (double)height) / 2.0),
                                          decorationPanel.Width, height);
            var flag1 = Button.outlineOnly;
            var flag2 = Button.drawingOutline;

            Button.outlineOnly    = true;
            Button.drawingOutline = false;
            var myID  = 974748322;
            var color = GuiData.active == myID
                ? Color.Black
                : (GuiData.hot == myID ? themeColorLine : themeColorBackground);

            sb.Draw(decorationPanel, destinationRectangle2, rectangle, color, 0.0f, Vector2.Zero, SpriteEffects.None,
                    0.6f);
            if (Button.doButton(myID, bounds.X + 1, destinationRectangle1.Y + decorationPanel.Height / 6 + 4,
                                decorationPanel.Width - 30, (int)(decorationPanel.Height - decorationPanel.Height / 6 * 3.20000004768372),
                                "Back", Color.Transparent))
            {
                screenTransition = 1f;
                state            = HubState.Menu;
            }
            Button.outlineOnly    = flag1;
            Button.drawingOutline = flag2;
            pos.X += decorationPanel.Width - 10;
            pos.Y += 4f;
            var text1 = "CSEC secure contract listing panel : Verified Connection : Token last verfied " + DateTime.Now;

            TextItem.doFontLabel(pos, text1, GuiData.detailfont, themeColor, destinationRectangle1.Width - 10f, 14f);
            pos.Y += 12f;
            if (missionListPageNumber > 0 &&
                Button.doButton(188278101, (int)pos.X, (int)pos.Y, 45, 20, "<", new Color?()))
            {
                --missionListPageNumber;
                screenTransition = 1f;
            }
            destinationRectangle1.X += 50;
            var num2  = listingsFolder.files.Count / missionListDisplayed + 1;
            var text2 = (missionListPageNumber + 1).ToString() + "/" + num2;
            var num3  = (float)(50.0 - GuiData.smallfont.MeasureString(text2).X / 2.0);

            sb.DrawString(GuiData.smallfont, text2, new Vector2(destinationRectangle1.X + num3, (int)pos.Y + 1),
                          Color.White);
            destinationRectangle1.X += 100;
            if (missionListPageNumber < num2 - 1 &&
                Button.doButton(188278102, destinationRectangle1.X, (int)pos.Y, 45, 20, ">", new Color?()))
            {
                ++missionListPageNumber;
                screenTransition = 1f;
            }
            destinationRectangle1.Y     += decorationPanel.Height + 4;
            destinationRectangle1.Width  = bounds.Width - 2;
            destinationRectangle1.X      = bounds.X + 1;
            destinationRectangle1.Height = 7;
            sb.Draw(Utils.white, destinationRectangle1, themeColor);
            destinationRectangle1.Y += destinationRectangle1.Height;
            return(new Rectangle(bounds.X, destinationRectangle1.Y, bounds.Width,
                                 bounds.Height - bounds.Height / 12 - (destinationRectangle1.Y - bounds.Y)));
        }
コード例 #6
0
        internal static void onDrawMainMenuTitlesIL(ILContext il)
        {
            ILCursor c = new ILCursor(il);

            c.GotoNext(MoveType.After,
                       x => x.MatchCall(AccessTools.Constructor(typeof(Rectangle), new Type[] { typeof(int), typeof(int), typeof(int), typeof(int) }))
                       );

            c.Emit(OpCodes.Ldarg_0);
            c.Emit(OpCodes.Ldloca, 0);
            c.EmitDelegate <EmitDelegate>((MainMenu self, ref Rectangle dest) =>
            {
                if (defaultTitleFont == null)
                {
                    defaultTitleFont = self.ScreenManager.Game.Content.Load <SpriteFont>("Kremlin");
                }

                var version   = PathfinderAPIPlugin.ModVer;
                var mainTitle = "HACKNET";
                var subtitle  = "OS"
                                + (DLC1SessionUpgrader.HasDLC1Installed ? "+Labyrinths " : " ")
                                + MainMenu.OSVersion + " Pathfinder " + version;

                var main = new TitleData(mainTitle,
                                         defaultTitleColor,
                                         defaultTitleFont,
                                         dest
                                         );
                var sub = new TitleData(subtitle,
                                        main.Color * 0.5f,
                                        GuiData.smallfont,
                                        new Rectangle(520, 178, 0, 0)
                                        );

                var drawMainMenuTitles = new DrawMainMenuTitlesEvent(self, main, sub);
                EventManager <DrawMainMenuTitlesEvent> .InvokeAll(drawMainMenuTitles);

                main = drawMainMenuTitles.Main;
                sub  = drawMainMenuTitles.Sub;
                FlickeringTextEffect.DrawLinedFlickeringText(
                    dest = main.Destination,
                    main.Title,
                    7f,
                    0.55f,
                    main.Font,
                    null,
                    main.Color
                    );
                TextItem.doFontLabel(new Vector2(sub.Destination.Location.X, sub.Destination.Location.Y), sub.Title, sub.Font, sub.Color, 600f, 26f);
            });

            var firstLabel = c.MarkLabel();

            c.GotoNext(MoveType.Before,
                       x => x.MatchCall(AccessTools.Method(
                                            typeof(TextItem),
                                            nameof(TextItem.doFontLabel),
                                            new Type[] { typeof(Vector2), typeof(string), typeof(SpriteFont), typeof(Color?), typeof(float), typeof(float), typeof(bool) }
                                            )
                                        )
                       );
            var endInst = c.Index;

            c.GotoLabel(firstLabel, MoveType.Before);
            c.RemoveRange((endInst - c.Index) + 1);
        }
コード例 #7
0
        public void doInboxDisplay(Rectangle bounds, SpriteBatch sb)
        {
            int height1 = 24;

            this.doInboxHeader(bounds, sb);
            Vector2   vector2 = new Vector2((float)(bounds.X + 2), (float)(bounds.Y + 91));
            Folder    folder  = this.userFolder.folders[0];
            Rectangle destinationRectangle1 = new Rectangle(bounds.X + 2, (int)vector2.Y, bounds.Width - 4, height1);

            Button.outlineOnly = true;
            int num1 = 0;

            while (destinationRectangle1.Y + destinationRectangle1.Height < bounds.Y + bounds.Height - 2)
            {
                sb.Draw(Utils.white, destinationRectangle1, num1 % 2 == 0 ? this.evenLine : this.oddLine);
                ++num1;
                int height2 = destinationRectangle1.Height;
                destinationRectangle1.Height = 1;
                if (num1 > 1)
                {
                    sb.Draw(Utils.white, destinationRectangle1, this.seperatorLineColor);
                }
                destinationRectangle1.Height = height2;
                destinationRectangle1.Y     += height1;
            }
            Rectangle tmpRect = GuiData.tmpRect;

            this.drawBackingGradient(bounds, sb);
            tmpRect.X      = bounds.X + 1;
            tmpRect.Y      = (int)vector2.Y - 3;
            tmpRect.Width  = bounds.Width - 4;
            tmpRect.Height = 3;
            sb.Draw(Utils.white, tmpRect, this.themeColor);
            tmpRect.X    += tmpRect.Width;
            tmpRect.Width = 3;
            sb.Draw(Utils.white, tmpRect, this.themeColor);
            tmpRect.X      = destinationRectangle1.X;
            tmpRect.Y      = (int)vector2.Y;
            tmpRect.Width  = 160;
            tmpRect.Height = bounds.Height - (tmpRect.Y - bounds.Y) - 1;
            sb.Draw(Utils.white, tmpRect, this.senderDarkeningColor);
            tmpRect.X    += tmpRect.Width;
            tmpRect.Width = 3;
            sb.Draw(Utils.white, tmpRect, this.themeColor);
            tmpRect.X               = destinationRectangle1.X;
            tmpRect.Y               = (int)vector2.Y;
            tmpRect.Width           = 160;
            tmpRect.Height          = bounds.Height - (tmpRect.Y - bounds.Y) - 1;
            destinationRectangle1.Y = (int)vector2.Y;
            TextItem.DrawShadow     = false;
            float num2 = (float)(bounds.Height - 2);
            int   val1 = num1;
            int   num3 = Math.Max(0, val1 * this.inboxPage - 1);

            this.totalPagesDetected = (int)((double)folder.files.Count / (double)val1);
            int num4 = Math.Min(val1, folder.files.Count - num3);

            for (int index = num3; index < num3 + num4; ++index)
            {
                try
                {
                    string[] strArray = folder.files[index].data.Split(MailServer.emailSplitDelims, StringSplitOptions.None);
                    byte     num5     = Convert.ToByte(strArray[0]);
                    int      myID     = 8100 + index;
                    if (GuiData.hot == myID)
                    {
                        Rectangle destinationRectangle2 = new Rectangle(bounds.X + 2, destinationRectangle1.Y + 1, bounds.Width - 4, height1 - 2);
                        sb.Draw(Utils.white, destinationRectangle2, index % 2 == 0 ? Color.White * 0.07f : Color.Black * 0.2f);
                    }
                    if (Button.doButton(myID, bounds.X + 2, destinationRectangle1.Y + 1, bounds.Width - 4, height1 - 2, "", new Color?(Color.Transparent)))
                    {
                        this.state              = 4;
                        this.selectedEmail      = folder.files[index];
                        this.emailData          = this.selectedEmail.data.Split(MailServer.emailSplitDelims, StringSplitOptions.None);
                        this.selectedEmail.data = "1" + this.selectedEmail.data.Substring(1);
                        if (this.sectionedPanel != null)
                        {
                            this.sectionedPanel.ScrollDown = 0.0f;
                        }
                    }
                    if ((int)num5 == 0)
                    {
                        sb.Draw(this.unopenedIcon, vector2 + Vector2.One, this.themeColor);
                    }
                    TextItem.doFontLabel(vector2 + new Vector2((float)(this.unopenedIcon.Width + 1), 2f), strArray[1], GuiData.tinyfont, new Color?(this.textColor), (float)(tmpRect.Width - this.unopenedIcon.Width - 3), (float)height1, false);
                    TextItem.doFontLabel(vector2 + new Vector2((float)(tmpRect.Width + 10), 2f), strArray[2], GuiData.tinyfont, new Color?(this.textColor), (float)(bounds.Width - tmpRect.Width - 20), (float)height1, false);
                    vector2.Y += (float)height1;
                    destinationRectangle1.Y = (int)vector2.Y;
                }
                catch (FormatException ex)
                {
                }
            }
            Button.outlineOnly = false;
        }
コード例 #8
0
 private void drawTitle(Rectangle bounds, SpriteBatch sb)
 {
     TextItem.doFontLabel(new Vector2((float)bounds.X, (float)bounds.Y), LocaleTerms.Loc("International Academic Database"), GuiData.font, new Color?(), (float)(bounds.Width - 6), float.MaxValue, false);
 }
コード例 #9
0
        public override void Draw(float t)
        {
            base.Draw(t);
            this.drawOutline();
            this.drawTarget("app:");
            bool drawShadow = TextItem.DrawShadow;

            TextItem.DrawShadow = false;
            Vector2 location  = this.locations[0];
            Vector2 vector2_1 = new Vector2((float)this.bounds.X + 2f, (float)this.bounds.Y + 26f);
            Vector2 vector2_2 = new Vector2((float)this.bounds.Width - 4f, (float)this.bounds.Height - 30f);

            if ((double)vector2_2.X > 0.0 && (double)vector2_2.Y > 0.0)
            {
                for (int index = 1; index < this.locations.Count; ++index)
                {
                    Vector2 vector2_3 = this.locations[index];
                    if (index == this.locations.Count - 1)
                    {
                        vector2_3 = Vector2.Lerp(location, vector2_3, (float)(1.0 - (double)this.timeToNextBounce / 0.0700000002980232));
                    }
                    Utils.drawLine(this.spriteBatch, vector2_1 + location * vector2_2, vector2_1 + vector2_3 * vector2_2, Vector2.Zero, (this.isError ? Utils.AddativeRed : Utils.AddativeWhite) * 0.5f * ((float)index / (float)this.locations.Count), 0.4f);
                    location = this.locations[index];
                }
                for (int index = 1; index < this.locations.Count; ++index)
                {
                    this.spriteBatch.Draw(Utils.white, this.locations[index] * vector2_2 + vector2_1, Utils.AddativeWhite);
                }
            }
            SpriteFont font = Settings.ActiveLocale == "en-us" ? GuiData.titlefont : GuiData.font;

            if (this.IsComplete)
            {
                bool      flag = this.errorMessage != null;
                Rectangle destinationRectangle1 = new Rectangle(this.bounds.X + 1, this.bounds.Y + 26, this.bounds.Width - 2, this.bounds.Height - 28);
                this.spriteBatch.Draw(Utils.white, destinationRectangle1, Color.Black * 0.7f);
                Rectangle rectangle = destinationRectangle1;
                rectangle.Height = Math.Min(35, this.bounds.Height / 5);
                string str = LocaleTerms.Loc(flag ? "ERROR" : "SCAN COMPLETE");
                TextItem.doFontLabel(new Vector2((float)rectangle.X, (float)rectangle.Y), str, font, new Color?(this.os.highlightColor), (float)rectangle.Width, (float)rectangle.Height, false);
                TextItem.doFontLabel(new Vector2((float)rectangle.X, (float)rectangle.Y), Utils.FlipRandomChars(str, 0.1), font, new Color?(Utils.AddativeWhite * (0.1f * Utils.rand())), (float)rectangle.Width, (float)rectangle.Height, false);
                Rectangle destinationRectangle2 = new Rectangle(rectangle.X, rectangle.Y + rectangle.Height, rectangle.Width, 1);
                this.spriteBatch.Draw(Utils.white, destinationRectangle2, Utils.AddativeWhite * 0.5f);
                if (!this.isExiting)
                {
                    string text = string.Format(LocaleTerms.Loc("DEVICES FOUND : {0}"), (object)this.devicesFound);
                    if (flag)
                    {
                        text = this.errorMessage;
                    }
                    Vector2 pos = new Vector2((float)(rectangle.X + 2), (float)(rectangle.Y + rectangle.Height + 2));
                    TextItem.doFontLabel(pos, text, font, new Color?((this.devicesFound > 0 ? Utils.AddativeWhite : Color.Red) * 0.8f), (float)(this.bounds.Width - 10), flag ? (float)this.bounds.Height * 0.8f : 23f, false);
                    pos.Y += 25f;
                    for (int index = 0; index < this.ResultTitles.Count && (double)pos.Y - (double)this.bounds.Y + 60.0 <= (double)this.bounds.Height; ++index)
                    {
                        TextItem.doFontLabel(pos, Utils.FlipRandomChars(this.ResultTitles[index], 0.01), GuiData.font, new Color?(Color.Lerp(this.os.highlightColor, Utils.AddativeWhite, (float)(0.200000002980232 + 0.100000001490116 * (double)Utils.rand()))), (float)(this.bounds.Width - 10), 24f, false);
                        pos.Y += 22f;
                        TextItem.doFontLabel(pos, this.ResultBodies[index], GuiData.detailfont, new Color?(Utils.AddativeWhite * 0.85f), (float)(this.bounds.Width - 10), 30f, false);
                        pos.Y += 30f;
                        pos.Y += 4f;
                    }
                }
                if (!this.isExiting && Button.doButton(646464029 + this.PID, this.bounds.X + 2, this.bounds.Y + this.bounds.Height - 2 - 20, this.bounds.Width - 50, 20, LocaleTerms.Loc("Exit"), new Color?(this.os.lockedColor)))
                {
                    this.isExiting = true;
                }
            }
            else
            {
                int       height    = Math.Min(38, this.bounds.Height / 3);
                Rectangle rectangle = new Rectangle(this.bounds.X + 1, this.bounds.Y + this.bounds.Height / 2 - height / 2, this.bounds.Width - 2, height);
                this.spriteBatch.Draw(Utils.white, rectangle, Color.Black * 0.7f);
                TextItem.doFontLabelToSize(rectangle, Utils.FlipRandomChars(LocaleTerms.Loc("SCANNING"), 0.009), font, this.IsComplete ? this.os.highlightColor : Utils.AddativeWhite * 0.8f, false, false);
                TextItem.doFontLabelToSize(rectangle, Utils.FlipRandomChars(LocaleTerms.Loc("SCANNING"), 0.15), font, this.IsComplete ? this.os.highlightColor : Utils.AddativeWhite * (0.18f * Utils.rand()), false, false);
            }
            TextItem.DrawShadow = drawShadow;
        }
コード例 #10
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            try
            {
                PostProcessor.begin();
                ScreenManager.FadeBackBufferToBlack(byte.MaxValue);
                GuiData.startDraw();
                var dest1 = new Rectangle(0, 0, ScreenManager.GraphicsDevice.Viewport.Width,
                                          ScreenManager.GraphicsDevice.Viewport.Height);
                var destinationRectangle = new Rectangle(-20, -20, ScreenManager.GraphicsDevice.Viewport.Width + 40,
                                                         ScreenManager.GraphicsDevice.Viewport.Height + 40);
                var dest2 = new Rectangle(dest1.X + dest1.Width / 4, dest1.Height / 4, dest1.Width / 2, dest1.Height / 4);
                GuiData.spriteBatch.Draw(Utils.white, destinationRectangle, Color.Black);
                hexBackground.Draw(dest1, GuiData.spriteBatch, Color.Transparent,
                                   Settings.lighterColorHexBackground ? new Color(20, 20, 20) : new Color(10, 10, 10, 0),
                                   HexGridBackground.ColoringAlgorithm.NegaitiveSinWash, 0.0f);
                TextItem.DrawShadow = false;
                switch (State)
                {
                case MainMenuState.NewUser:
                    DrawLoginScreen(dest2, true);
                    break;

                case MainMenuState.Login:
                    DrawLoginScreen(dest2, false);
                    break;

                default:
                    if (Settings.isLockedDemoMode)
                    {
                        attractModeScreen.Draw(dest1, GuiData.spriteBatch);
                        break;
                    }
                    FlickeringTextEffect.DrawLinedFlickeringText(new Rectangle(180, 120, 340, 100), "HACKNET", 7f,
                                                                 0.55f, titleFont, null, titleColor, 2);
                    TextItem.doFontLabel(new Vector2(520f, 178f), "OS " + OSVersion, GuiData.smallfont,
                                         titleColor * 0.5f, 600f, 26f);
                    var canRun = true;
                    if (Settings.IsExpireLocked)
                    {
                        var    timeSpan = Settings.ExpireTime - DateTime.Now;
                        string text;
                        if (timeSpan.TotalSeconds < 1.0)
                        {
                            text   = "TEST BUILD EXPIRED - EXECUTION DISABLED";
                            canRun = false;
                        }
                        else
                        {
                            text = "Test Build : Expires in " + timeSpan;
                        }
                        TextItem.doFontLabel(new Vector2(180f, 105f), text, GuiData.smallfont, Color.Red * 0.8f, 600f,
                                             26f);
                    }
                    if (Settings.isLockedDemoMode)
                    {
                        drawDemoModeButtons(canRun);
                        break;
                    }
                    drawMainMenuButtons(canRun);
                    if (Settings.testingMenuItemsEnabled)
                    {
                        drawTestingMainMenuButtons(canRun);
                    }
                    break;
                }
                GuiData.endDraw();
                PostProcessor.end();
                ScreenManager.FadeBackBufferToBlack(byte.MaxValue - TransitionAlpha);
            }
            catch (ObjectDisposedException ex)
            {
                if (hasSentErrorEmail)
                {
                    throw ex;
                }
                var body =
                    string.Concat(
                        Utils.GenerateReportFromException(ex) + "\r\n Font:" + titleFont +
                        "\r\n White:" + Utils.white + "\r\n WhiteDisposed:" + Utils.white.IsDisposed +
                        "\r\n SmallFont:" + GuiData.smallfont + "\r\n TinyFont:" + GuiData.tinyfont +
                        "\r\n LineEffectTarget:" + FlickeringTextEffect.GetReportString() + "\r\n PostProcessort stuff:" +
                        PostProcessor.GetStatusReportString(), "\r\nRESOLUTION:\r\n ",
                        Game1.GetSingleton().GraphicsDevice.PresentationParameters.BackBufferWidth, "x") +
                    Game1.GetSingleton().GraphicsDevice.PresentationParameters.BackBufferHeight + "\r\nFullscreen: " +
                    (Game1.GetSingleton().graphics.IsFullScreen ? "true" : "false") + "\r\n Adapter: " +
                    Game1.GetSingleton().GraphicsDevice.Adapter.Description + "\r\n Device Name: " +
                    Game1.GetSingleton().GraphicsDevice.GraphicsDeviceStatus;
                Utils.SendRealWorldEmail(
                    "Hackent " + OSVersion + " Crash " + DateTime.Now.ToShortDateString() + " " +
                    DateTime.Now.ToShortTimeString(), "*****@*****.**", body);
                hasSentErrorEmail = true;
                SettingsLoader.writeStatusFile();
            }
        }
コード例 #11
0
 private void drawTestingMainMenuButtons(bool canRun)
 {
     if (Button.doButton(8801, 634, 200, 225, 23, "New Test Session", buttonColor) && canRun)
     {
         ExitScreen();
         resetOS();
         if (!Settings.soundDisabled)
         {
             ScreenManager.playAlertSound();
         }
         var os = new OS();
         ScreenManager.AddScreen(os, ScreenManager.controllingPlayer);
         os.delayer.RunAllDelayedActions();
         os.threadedSaveExecute();
         ScreenManager.RemoveScreen(os);
         OS.WillLoadSave = true;
         resetOS();
         ScreenManager.AddScreen(new OS(), ScreenManager.controllingPlayer);
     }
     if (Button.doButton(8803, 634, 225, 225, 23, "New Entropy Accelerated Session", buttonColor) && canRun)
     {
         ExitScreen();
         resetOS();
         if (!Settings.soundDisabled)
         {
             ScreenManager.playAlertSound();
         }
         var os1 = new OS();
         os1.SaveGameUserName    = "******";
         os1.SaveUserAccountName = "entropyTest";
         ScreenManager.AddScreen(os1, ScreenManager.controllingPlayer);
         os1.Flags.AddFlag("TutorialComplete");
         os1.delayer.RunAllDelayedActions();
         os1.threadedSaveExecute();
         ScreenManager.RemoveScreen(os1);
         OS.WillLoadSave = true;
         resetOS();
         Settings.initShowsTutorial = false;
         var os2 = new OS();
         ScreenManager.AddScreen(os2, ScreenManager.controllingPlayer);
         MissionFunctions.runCommand(0, "EntropyFastFowardSetup");
         os2.delayer.Post(ActionDelayer.Wait(1.0), () => Game1.GetSingleton().IsMouseVisible = true);
     }
     if (Button.doButton(8806, 634, 250, 225, 23, "Run Test Suite", buttonColor))
     {
         testSuiteResult = TestSuite.TestSaveLoadOnFile(ScreenManager);
     }
     if (Button.doButton(8809, 634, 275, 225, 23, "Export Animation", buttonColor))
     {
         var TitleFill = new Rectangle(0, 0, 300, 100);
         AnimatedSpriteExporter.ExportAnimation("OutNowAnim", "OutNow", TitleFill.Width, TitleFill.Height, 24f,
                                                40f, GuiData.spriteBatch.GraphicsDevice, t => new OS
         {
             highlightColor = new Color(166, byte.MaxValue, 215)
         }.timer += t, (sb, dest) =>
         {
             sb.Draw(Utils.white, dest, new Color(13, 13, 13));
             FlickeringTextEffect.DrawFlickeringText(TitleFill, "OUT NOW", 8f, 0.7f, titleFont, null,
                                                     new Color(216, 216, 216));
         }, 1);
     }
     if (Button.doButton(8812, 634, 300, 225, 23, "New CSEC Accel Session", buttonColor) && canRun)
     {
         ExitScreen();
         resetOS();
         if (!Settings.soundDisabled)
         {
             ScreenManager.playAlertSound();
         }
         var os1 = new OS();
         ScreenManager.AddScreen(os1, ScreenManager.controllingPlayer);
         os1.Flags.AddFlag("TutorialComplete");
         os1.delayer.RunAllDelayedActions();
         os1.threadedSaveExecute();
         ScreenManager.RemoveScreen(os1);
         OS.WillLoadSave = true;
         resetOS();
         Settings.initShowsTutorial = false;
         var os2 = new OS();
         ScreenManager.AddScreen(os2, ScreenManager.controllingPlayer);
         MissionFunctions.runCommand(0, "CSECFastFowardSetup");
         os2.delayer.Post(ActionDelayer.Wait(1.0), () => Game1.GetSingleton().IsMouseVisible = true);
     }
     if (testSuiteResult == null)
     {
         return;
     }
     TextItem.doFontLabel(new Vector2(635f, 325f),
                          Utils.SuperSmartTwimForWidth(testSuiteResult, 600, GuiData.tinyfont), GuiData.tinyfont,
                          testSuiteResult.Length > 250 ? Utils.AddativeRed : Utils.AddativeWhite, float.MaxValue, float.MaxValue);
 }
コード例 #12
0
ファイル: MailServer.cs プロジェクト: strangea/OpenHacknet
        public void doInboxDisplay(Rectangle bounds, SpriteBatch sb)
        {
            var height = 24;

            doInboxHeader(bounds, sb);
            var vector2 = new Vector2(bounds.X + 2, bounds.Y + 91);
            var folder  = userFolder.folders[0];
            var destinationRectangle1 = new Rectangle(bounds.X + 2, (int)vector2.Y, bounds.Width - 4, height);

            Button.outlineOnly = true;
            var num1 = 0;

            while (destinationRectangle1.Y + destinationRectangle1.Height < bounds.Y + bounds.Height - 2)
            {
                sb.Draw(Utils.white, destinationRectangle1, num1 % 2 == 0 ? evenLine : oddLine);
                ++num1;
                var num2 = destinationRectangle1.Height;
                destinationRectangle1.Height = 1;
                if (num1 > 1)
                {
                    sb.Draw(Utils.white, destinationRectangle1, seperatorLineColor);
                }
                destinationRectangle1.Height = num2;
                destinationRectangle1.Y     += height;
            }
            var destinationRectangle2 = GuiData.tmpRect;

            drawBackingGradient(bounds, sb);
            destinationRectangle2.X      = bounds.X + 1;
            destinationRectangle2.Y      = (int)vector2.Y - 3;
            destinationRectangle2.Width  = bounds.Width - 2;
            destinationRectangle2.Height = 3;
            sb.Draw(Utils.white, destinationRectangle2, themeColor);
            destinationRectangle2.X    += destinationRectangle2.Width;
            destinationRectangle2.Width = 3;
            sb.Draw(Utils.white, destinationRectangle2, themeColor);
            destinationRectangle2.X      = destinationRectangle1.X;
            destinationRectangle2.Y      = (int)vector2.Y;
            destinationRectangle2.Width  = 160;
            destinationRectangle2.Height = bounds.Height - (destinationRectangle2.Y - bounds.Y) - 1;
            sb.Draw(Utils.white, destinationRectangle2, senderDarkeningColor);
            destinationRectangle2.X    += destinationRectangle2.Width;
            destinationRectangle2.Width = 3;
            sb.Draw(Utils.white, destinationRectangle2, themeColor);
            destinationRectangle2.X      = destinationRectangle1.X;
            destinationRectangle2.Y      = (int)vector2.Y;
            destinationRectangle2.Width  = 160;
            destinationRectangle2.Height = bounds.Height - (destinationRectangle2.Y - bounds.Y) - 1;
            destinationRectangle1.Y      = (int)vector2.Y;
            TextItem.DrawShadow          = false;
            var val1 = num1;
            var num3 = Math.Max(0, val1 * inboxPage - 1);

            totalPagesDetected = (int)(folder.files.Count / (double)val1);
            var num4 = Math.Min(val1, folder.files.Count - num3);

            for (var index = num3; index < num3 + num4; ++index)
            {
                try
                {
                    var strArray = folder.files[index].data.Split(emailSplitDelims, StringSplitOptions.None);
                    var num2     = Convert.ToByte(strArray[0]);
                    var myID     = 8100 + index;
                    if (GuiData.hot == myID)
                    {
                        var destinationRectangle3 = new Rectangle(bounds.X + 2, destinationRectangle1.Y + 1,
                                                                  bounds.Width - 4, height - 2);
                        sb.Draw(Utils.white, destinationRectangle3, index % 2 == 0 ? Color.White * 0.07f : Color.Black * 0.2f);
                    }
                    if (Button.doButton(myID, bounds.X + 2, destinationRectangle1.Y + 1, bounds.Width - 4, height - 2,
                                        "", Color.Transparent))
                    {
                        state              = 4;
                        selectedEmail      = folder.files[index];
                        emailData          = selectedEmail.data.Split(emailSplitDelims, StringSplitOptions.None);
                        selectedEmail.data = "1" + selectedEmail.data.Substring(1);
                        if (sectionedPanel != null)
                        {
                            sectionedPanel.ScrollDown = 0.0f;
                        }
                    }
                    if (num2 == 0)
                    {
                        sb.Draw(unopenedIcon, vector2 + Vector2.One, themeColor);
                    }
                    TextItem.doFontLabel(vector2 + new Vector2(unopenedIcon.Width + 1, 2f), strArray[1],
                                         GuiData.tinyfont, textColor, destinationRectangle2.Width - unopenedIcon.Width - 3, height);
                    TextItem.doFontLabel(vector2 + new Vector2(destinationRectangle2.Width + 10, 2f), strArray[2],
                                         GuiData.tinyfont, textColor, bounds.Width - destinationRectangle2.Width - 20, height);
                    vector2.Y += height;
                    destinationRectangle1.Y = (int)vector2.Y;
                }
                catch (FormatException ex)
                {
                }
            }
            Button.outlineOnly = false;
        }
コード例 #13
0
ファイル: MailServer.cs プロジェクト: strangea/OpenHacknet
        public void doRespondDisplay(Rectangle bounds, SpriteBatch sb)
        {
            var    pos   = new Vector2(bounds.X + 2, bounds.Y + 20);
            string str   = null;
            var    width = bounds.Width - 20 - corner.Width;

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

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

            TextItem.doLabel(new Vector2(bounds.X + bounds.Width / 2 - vector2_1.X / 2f, pos.Y + 40f), text, new Color?());
        }
コード例 #14
0
ファイル: ThemeChangerExe.cs プロジェクト: hochladen/Hacknet
        private void DrawListing(Rectangle dest, SpriteBatch sb)
        {
            this.DrawHeaders(dest, sb);
            if (this.isExiting)
            {
                return;
            }
            Vector2 pos = new Vector2((float)(dest.X + 2), (float)dest.Y + 60f);

            TextItem.doFontLabel(pos, LocaleTerms.Loc("Remote"), GuiData.smallfont, new Color?(this.themeColor), (float)(this.bounds.Width - 20), 20f, false);
            pos.Y += 18f;
            sb.Draw(Utils.white, new Rectangle(this.bounds.X + 2, (int)pos.Y, this.bounds.Width - 6, 1), Utils.AddativeWhite);
            List <string> stringList1   = new List <string>();
            Folder        currentFolder = Programs.getCurrentFolder(this.os);

            for (int index = 0; index < currentFolder.files.Count; ++index)
            {
                if (ThemeManager.getThemeForDataString(currentFolder.files[index].data) != OSTheme.TerminalOnlyBlack)
                {
                    stringList1.Add(currentFolder.files[index].name);
                }
            }
            string    str = (string)null;
            string    selectedFileData = (string)null;
            Color     color            = Color.Lerp(this.os.topBarColor, Utils.AddativeWhite, 0.2f);
            int       scrollOffset     = SelectableTextList.scrollOffset;
            Rectangle rectangle1       = new Rectangle((int)pos.X, (int)pos.Y, this.bounds.Width - 6, 54);

            if (stringList1.Count > 0)
            {
                SelectableTextList.scrollOffset = this.remoteScroll;
                this.remotesSelected            = SelectableTextList.doFancyList(8139191 + this.PID, rectangle1.X, rectangle1.Y, rectangle1.Width, rectangle1.Height, stringList1.ToArray(), this.remotesSelected, new Color?(color), true);
                if (SelectableTextList.selectionWasChanged)
                {
                    this.localsSelected = -1;
                }
                this.remoteScroll = SelectableTextList.scrollOffset;
                if (this.remotesSelected >= 0)
                {
                    if (this.remotesSelected >= stringList1.Count)
                    {
                        this.remotesSelected = -1;
                    }
                    else
                    {
                        str = stringList1[this.remotesSelected];
                        selectedFileData = currentFolder.searchForFile(str).data;
                    }
                }
            }
            else
            {
                sb.Draw(Utils.white, rectangle1, Utils.VeryDarkGray);
                TextItem.doFontLabelToSize(rectangle1, "    -- " + LocaleTerms.Loc("No Valid Files") + " --    ", GuiData.smallfont, Utils.AddativeWhite, false, false);
            }
            pos.Y += (float)(rectangle1.Height + 6);
            TextItem.doFontLabel(pos, LocaleTerms.Loc("Local Theme Files"), GuiData.smallfont, new Color?(this.themeColor), (float)(this.bounds.Width - 20), 20f, false);
            pos.Y += 18f;
            sb.Draw(Utils.white, new Rectangle(this.bounds.X + 2, (int)pos.Y, this.bounds.Width - 6, 1), Utils.AddativeWhite);
            stringList1.Clear();
            List <string> stringList2 = new List <string>();
            Folder        folder1     = this.os.thisComputer.files.root.searchForFolder("sys");

            for (int index = 0; index < folder1.files.Count; ++index)
            {
                if (ThemeManager.getThemeForDataString(folder1.files[index].data) != OSTheme.TerminalOnlyBlack)
                {
                    stringList1.Add(folder1.files[index].name);
                    stringList2.Add(folder1.files[index].data);
                }
            }
            Folder folder2 = this.os.thisComputer.files.root.searchForFolder("home");

            for (int index = 0; index < folder2.files.Count; ++index)
            {
                if (ThemeManager.getThemeForDataString(folder2.files[index].data) != OSTheme.TerminalOnlyBlack)
                {
                    stringList1.Add(folder2.files[index].name);
                    stringList2.Add(folder2.files[index].data);
                }
            }
            Rectangle rectangle2 = new Rectangle((int)pos.X, (int)pos.Y, this.bounds.Width - 6, 72);

            if (stringList1.Count > 0)
            {
                SelectableTextList.scrollOffset = this.localScroll;
                this.localsSelected             = SelectableTextList.doFancyList(839192 + this.PID, rectangle2.X, rectangle2.Y, rectangle2.Width, rectangle2.Height, stringList1.ToArray(), this.localsSelected, new Color?(color), true);
                if (SelectableTextList.selectionWasChanged)
                {
                    this.remotesSelected = -1;
                }
                this.localScroll = SelectableTextList.scrollOffset;
                if (this.localsSelected >= 0)
                {
                    str = stringList1[this.localsSelected];
                    selectedFileData = stringList2[this.localsSelected];
                }
            }
            else
            {
                sb.Draw(Utils.white, rectangle2, Utils.VeryDarkGray);
                TextItem.doFontLabelToSize(rectangle2, "    -- " + LocaleTerms.Loc("No Valid Files") + " --    ", GuiData.smallfont, Utils.AddativeWhite, false, false);
            }
            SelectableTextList.scrollOffset = scrollOffset;
            pos.Y += (float)(rectangle2.Height + 2);
            Rectangle bounds = new Rectangle(this.bounds.X + 4, (int)pos.Y + 2, this.bounds.Width - 8, (int)((double)dest.Height - ((double)pos.Y - (double)dest.Y)) - 4);

            this.DrawApplyField(str, selectedFileData, bounds, sb);
        }
コード例 #15
0
        private void DrawWarningScreen()
        {
            if (warningScreenIsActivating)
            {
                spriteBatch.Draw(Utils.white, fullscreen, Color.White);
            }
            else
            {
                DrawFlashingRedBackground();
            }
            var text      = "WARNING";
            var vector2_1 = titleFont.MeasureString(text);
            var widthTo   = fullscreen.Width * 0.65f;
            var scale     = widthTo / vector2_1.X;
            var vector2_2 = new Vector2(20f, -10f);

            spriteBatch.DrawString(titleFont, text, vector2_2, Color.Black, 0.0f, Vector2.Zero, scale,
                                   SpriteEffects.None, 0.5f);
            vector2_2.Y += (float)(vector2_1.Y * (double)scale - 55.0);
            TextItem.doFontLabel(vector2_2, "COMPLETED TRACE DETECTED : EMERGENCY RECOVERY MODE ACTIVE", titleFont,
                                 Color.Black, widthTo, float.MaxValue);
            vector2_2.Y += 40f;
            vector2_2    = DrawFlashInString("Unsyndicated foreign connection detected during active trace", vector2_2,
                                             0.0f, 0.2f, false, 0.2f);
            vector2_2 = DrawFlashInString(" :: Emergency recovery mode activated", vector2_2, 0.1f, 0.2f, false, 0.2f);
            vector2_2 = DrawFlashInString("-----------------------------------------------------------------------",
                                          vector2_2, 0.2f, 0.2f, false, 0.2f);
            vector2_2 = DrawFlashInString(" ", vector2_2, 0.5f, 0.2f, false, 0.2f);
            vector2_2 = DrawFlashInString(
                "Automated screening procedures will divert incoming connections temporarily", vector2_2, 0.5f, 0.2f,
                false, 0.2f);
            vector2_2 = DrawFlashInString("This window is a final oppourtunity to regain anonymity.", vector2_2, 0.6f,
                                          0.2f, false, 0.2f);
            vector2_2 = DrawFlashInString("As your current IP Address is known, it must be changed -", vector2_2, 0.7f,
                                          0.2f, false, 0.2f);
            vector2_2 = DrawFlashInString("This can ony be done on your currently active ISP's routing server",
                                          vector2_2, 0.8f, 0.2f, false, 0.2f);
            vector2_2 =
                DrawFlashInString("Reverse tracerouting has located this ISP server's ip address as 68.144.93.18",
                                  vector2_2, 0.9f, 0.2f, false, 0.2f);
            vector2_2 = DrawFlashInString(
                "Your local ip : " + os.thisComputer.ip + " must be tracked here and changed.", vector2_2, 1f, 0.2f,
                false, 0.2f);
            vector2_2 = DrawFlashInString(" ", vector2_2, 1.1f, 0.2f, false, 0.2f);
            vector2_2 =
                DrawFlashInString("Failure to complete this while active diversion holds will result in complete",
                                  vector2_2, 1.1f, 0.2f, false, 0.2f);
            vector2_2 =
                DrawFlashInString(
                    "and permenant loss of all account data - THIS IS NOT REPEATABLE AND CANNOT BE DELAYED", vector2_2,
                    1.2f, 0.2f, false, 0.2f);
            if (warningScreenIsActivating || timeThisState < 1.20000004768372 ||
                !Button.doButton(789798001, 20, (int)(vector2_2.Y + 10.0), 400, 40, "BEGIN", Color.Black))
            {
                return;
            }
            timeThisState             = 0.0f;
            state                     = TraceDangerState.WarningScreenExiting;
            PreventOSRendering        = true;
            onBeatFlashTimer          = os.timer;
            warningScreenIsActivating = true;
            spinUpSound.Play(1f, 0.0f, 0.0f);
            os.terminal.inputLocked = false;
            os.delayer.Post(ActionDelayer.Wait(0.1), () => spinUpSound.Play(1f, 0.0f, 0.0f));
            os.delayer.Post(ActionDelayer.Wait(0.4), () => spinUpSound.Play(0.4f, 0.0f, 0.0f));
            os.delayer.Post(ActionDelayer.Wait(0.8), () => spinUpSound.Play(0.2f, 0.1f, 0.0f));
            os.delayer.Post(ActionDelayer.Wait(1.3), () => spinUpSound.Play(0.1f, 0.2f, 0.0f));
            os.delayer.Post(ActionDelayer.Wait(0.01), () => MusicManager.playSongImmediatley("Music/Traced"));
        }
コード例 #16
0
        public void Draw()
        {
            var flag = TextItem.DrawShadow;

            TextItem.DrawShadow = false;
            switch (state)
            {
            case TraceDangerState.WarningScrenIntro:
                DrawFlashingRedBackground();
                var destinationRectangle1 = new Rectangle(10, fullscreen.Height / 2 - 2, fullscreen.Width - 20, 4);
                spriteBatch.Draw(Utils.white, destinationRectangle1, Color.Black);
                destinationRectangle1.Width = (int)(destinationRectangle1.Width * (1.0 - percentComplete));
                spriteBatch.Draw(Utils.white, destinationRectangle1, Color.Red);
                break;

            case TraceDangerState.WarningScreen:
                DrawWarningScreen();
                break;

            case TraceDangerState.WarningScreenExiting:
                DrawFlashingRedBackground();
                var destinationRectangle2 = new Rectangle(10, fullscreen.Height / 2 - 2, fullscreen.Width - 20, 4);
                if (percentComplete > 0.5)
                {
                    var num =
                        (int)
                        (os.fullscreen.Height * 0.7f *
                         (double)Utils.QuadraticOutCurve((float)((percentComplete - 0.5) * 2.0)));
                    destinationRectangle2.Y      = fullscreen.Height / 2 - 2 - num / 2;
                    destinationRectangle2.Height = num;
                }
                spriteBatch.Draw(Utils.white, destinationRectangle2, Color.Black);
                destinationRectangle2.Width =
                    (int)
                    (destinationRectangle2.Width *
                     (double)Math.Min(1f, Utils.QuadraticOutCurve(percentComplete * 2f)));
                spriteBatch.Draw(Utils.white, destinationRectangle2, Color.DarkRed);
                var num1 = Utils.QuadraticOutCurve((float)((percentComplete - 0.5) * 2.0));
                if (percentComplete > 0.5)
                {
                    new ThinBarcode(destinationRectangle2.Width, destinationRectangle2.Height).Draw(spriteBatch,
                                                                                                    destinationRectangle2.X, destinationRectangle2.Y,
                                                                                                    Utils.randm(1f) > (double)num1
                                ? Color.Black
                                : Utils.randm(1f) <= (double)num1 || Utils.randm(1f) <= 0.800000011920929
                                    ? Utils.VeryDarkGray
                                    : Utils.AddativeWhite);
                }
                TextItem.doFontLabel(new Vector2(fullscreen.Width / 2 - 250, destinationRectangle2.Y - 70),
                                     "INITIALIZING FAILSAFE", GuiData.titlefont, Color.White, 500f, 70f);
                break;

            case TraceDangerState.Countdown:
                PreventOSRendering = false;
                var num2 = timeThisState * 0.5f;
                if (num2 < 1.0)
                {
                    os.display.visible  = num2 > (double)Utils.randm(1f);
                    os.netMap.visible   = num2 > (double)Utils.randm(1f);
                    os.terminal.visible = num2 > (double)Utils.randm(1f);
                    os.ram.visible      = num2 > (double)Utils.randm(1f);
                }
                else
                {
                    os.display.visible  = true;
                    os.netMap.visible   = true;
                    os.terminal.visible = true;
                    os.ram.visible      = true;
                }
                DrawCountdownOverlay();
                break;

            case TraceDangerState.DisconnectedReboot:
                DrawDisconnectedScreen();
                break;
            }
            TextItem.DrawShadow = flag;
        }
コード例 #17
0
        public override void draw(Rectangle bounds, SpriteBatch sb)
        {
            this.drawSideBar(bounds, sb);
            int num1 = (int)((double)bounds.Width / 5.0);

            bounds.Width -= num1;
            bounds.X     += num1;
            this.drawTitle(bounds, sb);
            bounds.Y      += 30;
            bounds.Height -= 30;
            switch (this.state)
            {
            case AcademicDatabaseDaemon.ADDState.Welcome:
                bool      flag = this.comp.adminIP == this.os.thisComputer.ip;
                Rectangle destinationRectangle = bounds;
                destinationRectangle.Y      = bounds.Y + 60 - 20;
                destinationRectangle.Height = 22;
                sb.Draw(Utils.white, destinationRectangle, flag ? this.themeColor : this.darkThemeColor);
                string text1 = LocaleTerms.Loc("Valid Administrator Account Detected");
                if (!flag)
                {
                    text1 = LocaleTerms.Loc("Non-Admin Account Active");
                }
                Vector2 vector2   = GuiData.smallfont.MeasureString(text1);
                Vector2 position1 = new Vector2((float)(destinationRectangle.X + destinationRectangle.Width / 2) - vector2.X / 2f, (float)destinationRectangle.Y);
                sb.DrawString(GuiData.smallfont, text1, position1, Color.Black);
                if (Button.doButton(456011, bounds.X + 30, bounds.Y + bounds.Height / 2 - 15, bounds.Width / 2, 40, LocaleTerms.Loc("About This Server"), new Color?(this.themeColor)))
                {
                    this.state = AcademicDatabaseDaemon.ADDState.InfoPanel;
                }
                if (Button.doButton(456001, bounds.X + 30, bounds.Y + bounds.Height / 2 - 15 + 50, bounds.Width / 2, 40, LocaleTerms.Loc("Search Entries"), new Color?(this.themeColor)))
                {
                    this.state = AcademicDatabaseDaemon.ADDState.Seach;
                    this.os.execute("getString Name");
                }
                if (!Button.doButton(456005, bounds.X + 30, bounds.Y + bounds.Height / 2 - 15 + 100, bounds.Width / 2, 40, LocaleTerms.Loc("Exit"), new Color?(this.themeColor)))
                {
                    break;
                }
                this.os.display.command = "connect";
                break;

            case AcademicDatabaseDaemon.ADDState.Seach:
                this.drawSearchState(bounds, sb);
                break;

            case AcademicDatabaseDaemon.ADDState.MultiMatchSearch:
            case AcademicDatabaseDaemon.ADDState.PendingResult:
                if (Button.doButton(456010, bounds.X + 2, bounds.Y + 2, 160, 30, LocaleTerms.Loc("Back"), new Color?(this.darkThemeColor)))
                {
                    this.state = AcademicDatabaseDaemon.ADDState.Welcome;
                }
                Vector2 position2 = new Vector2((float)(bounds.X + bounds.Width / 2), (float)(bounds.Y + bounds.Height / 2));
                Vector2 origin    = new Vector2((float)(this.loadingCircle.Width / 2), (float)(this.loadingCircle.Height / 2));
                sb.Draw(this.loadingCircle, position2, new Rectangle?(), Color.White, (float)((double)this.os.timer % Math.PI * 3.0), origin, Vector2.One, SpriteEffects.None, 0.5f);
                float num2 = this.os.timer - this.searchStartTime;
                if ((this.state != AcademicDatabaseDaemon.ADDState.PendingResult || (double)num2 <= 3.59999990463257) && (this.state != AcademicDatabaseDaemon.ADDState.MultiMatchSearch || (double)num2 <= 0.699999988079071))
                {
                    break;
                }
                this.state = AcademicDatabaseDaemon.ADDState.Entry;
                this.needsDeletionConfirmation = true;
                this.doPreEntryViewSearch();
                break;

            case AcademicDatabaseDaemon.ADDState.Entry:
            case AcademicDatabaseDaemon.ADDState.EditPerson:
                this.drawEntryState(bounds, sb);
                break;

            case AcademicDatabaseDaemon.ADDState.EntryNotFound:
                if (Button.doButton(456010, bounds.X + 2, bounds.Y + 20, 160, 30, LocaleTerms.Loc("Back"), new Color?(this.darkThemeColor)))
                {
                    this.state = AcademicDatabaseDaemon.ADDState.Welcome;
                }
                if (Button.doButton(456015, bounds.X + 2, bounds.Y + 55, 160, 30, LocaleTerms.Loc("Search Again"), new Color?(this.darkThemeColor)))
                {
                    this.state = AcademicDatabaseDaemon.ADDState.Seach;
                    this.os.execute("getString Name");
                }
                TextItem.doFontLabel(new Vector2((float)(bounds.X + 2), (float)(bounds.Y + 90)), LocaleTerms.Loc("No Entries Found"), GuiData.font, new Color?(), float.MaxValue, float.MaxValue, false);
                break;

            case AcademicDatabaseDaemon.ADDState.MultipleEntriesFound:
                this.drawMultipleEntriesState(bounds, sb);
                break;

            case AcademicDatabaseDaemon.ADDState.InfoPanel:
                if (Button.doButton(456010, bounds.X + 2, bounds.Y + 30, 160, 30, LocaleTerms.Loc("Back"), new Color?(this.darkThemeColor)))
                {
                    this.state = AcademicDatabaseDaemon.ADDState.Welcome;
                }
                Vector2 pos = new Vector2((float)(bounds.X + 20), (float)(bounds.Y + 70));
                TextItem.doFontLabel(pos, LocaleTerms.Loc("Information"), GuiData.font, new Color?(), float.MaxValue, float.MaxValue, false);
                pos.Y += 40f;
                FileEntry fileEntry = this.root.searchForFile("info.txt");
                string    text2     = "ERROR: Unhandled System.IO.FileNotFoundException\nFile \"info.txt\" was not found";
                if (fileEntry != null)
                {
                    text2 = DisplayModule.cleanSplitForWidth(fileEntry.data, bounds.Width - 80);
                }
                TextItem.DrawShadow = false;
                TextItem.doFontLabel(pos, text2, GuiData.smallfont, new Color?(), (float)(bounds.Width - 40), float.MaxValue, false);
                break;

            case AcademicDatabaseDaemon.ADDState.EditEntry:
                this.drawEditDegreeState(bounds, sb);
                break;
            }
        }
コード例 #18
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;
                }
            }
        }
コード例 #19
0
        private void drawEntryState(Rectangle bounds, SpriteBatch sb)
        {
            if (this.state == AcademicDatabaseDaemon.ADDState.Entry && this.os.hasConnectionPermission(true))
            {
                this.state = AcademicDatabaseDaemon.ADDState.EditPerson;
            }
            if (Button.doButton(456010, bounds.X + 2, bounds.Y + 2, 160, 30, LocaleTerms.Loc("Back"), new Color?(this.darkThemeColor)))
            {
                this.state = AcademicDatabaseDaemon.ADDState.Welcome;
            }
            float x  = (float)bounds.X + 20f;
            float y1 = (float)bounds.Y + 50f;

            TextItem.doFontLabel(new Vector2(x, y1), this.searchedName, GuiData.font, new Color?(), (float)bounds.Width - (x - (float)bounds.X), 60f, false);
            float y2 = y1 + 30f;

            if (this.searchedDegrees.Count == 0)
            {
                TextItem.doFontLabel(new Vector2(x, y2), " -" + LocaleTerms.Loc("No Degrees Found"), GuiData.smallfont, new Color?(), float.MaxValue, float.MaxValue, false);
            }
            for (int index = 0; index < this.searchedDegrees.Count; ++index)
            {
                string text = LocaleTerms.Loc("Degree") + " :" + this.searchedDegrees[index].name + "\n" + LocaleTerms.Loc("Uni") + "      :" + this.searchedDegrees[index].uni + "\nGPA      :" + (object)this.searchedDegrees[index].GPA;
                TextItem.doFontLabel(new Vector2(x, y2), text, GuiData.smallfont, new Color?(), (float)bounds.Width - ((float)bounds.X - x), 50f, false);
                y2 += 60f;
                if (this.state == AcademicDatabaseDaemon.ADDState.EditPerson)
                {
                    float num = y2 - 10f;
                    if (Button.doButton(457900 + index, (int)x, (int)num, 100, 20, LocaleTerms.Loc("Edit"), new Color?()))
                    {
                        this.state       = AcademicDatabaseDaemon.ADDState.EditEntry;
                        this.editedField = AcademicDatabaseDaemon.ADDEditField.None;
                        this.editedIndex = index;
                    }
                    if (Button.doButton(456900 + index, (int)x + 105, (int)num, 100, 20, this.needsDeletionConfirmation ? LocaleTerms.Loc("Delete") : LocaleTerms.Loc("Confirm?"), new Color?(this.needsDeletionConfirmation ? Color.Gray : Color.Red)))
                    {
                        if (this.needsDeletionConfirmation)
                        {
                            this.needsDeletionConfirmation = false;
                        }
                        else
                        {
                            this.comp.log("ACADEMIC_DATABASE::RecordDeletion_:_#" + (object)index + "_: " + this.searchedName.Replace(" ", "_"));
                            this.searchedDegrees.RemoveAt(index);
                            this.saveChangesToEntry();
                            --index;
                            this.needsDeletionConfirmation = true;
                        }
                    }
                    y2 = num + 35f;
                }
            }
            float num1 = y2 + 10f;

            if (this.state != AcademicDatabaseDaemon.ADDState.EditPerson || !Button.doButton(458009, (int)x, (int)num1, 200, 30, LocaleTerms.Loc("Add Degree"), new Color?(this.themeColor)))
            {
                return;
            }
            Degree degree = new Degree("UNKNOWN", "UNKNOWN", 0.0f);

            this.searchedDegrees.Add(degree);
            this.editedIndex = this.searchedDegrees.IndexOf(degree);
            this.state       = AcademicDatabaseDaemon.ADDState.EditEntry;
            this.comp.log("ACADEMIC_DATABASE::RecordAdd_:_#" + (object)this.editedIndex + "_: " + this.searchedName.Replace(" ", "_"));
        }
コード例 #20
0
ファイル: MainMenu.cs プロジェクト: hochladen/Hacknet
        private void drawMainMenuButtons(bool canRun)
        {
            int num1 = 135;
            int num2;

            if (Button.doButton(1, 180, num2 = num1 + 65, 450, 50, LocaleTerms.Loc("New Session"), new Color?(MainMenu.buttonColor)) && canRun)
            {
                this.NextStartedGameShouldBeDLCAccelerated = false;
                this.State = MainMenu.MainMenuState.NewUser;
                this.loginScreen.ClearTextBox();
                this.loginScreen.ResetForNewAccount();
            }
            bool   hasSaves = SaveFileManager.HasSaves;
            string text     = LocaleTerms.Loc("No Accounts");

            if (hasSaves)
            {
                text = !this.canLoad ? LocaleTerms.Loc("Invalid Last Account : Login Manually") : string.Format(LocaleTerms.Loc("Continue with account [{0}]"), (object)SaveFileManager.LastLoggedInUser.Username);
            }
            int num3;

            if (Button.doButton(1102, 180, num3 = num2 + 65, 450, 28, text, new Color?(this.canLoad ? MainMenu.buttonColor : Color.Black)) && this.canLoad)
            {
                this.loginScreen.ClearTextBox();
                this.loginScreen.LoadGameForUserFileAndUsername(SaveFileManager.LastLoggedInUser.FileUsername, SaveFileManager.LastLoggedInUser.Username);
            }
            int num4;

            if (Button.doButton(11, 180, num4 = num3 + 39, 450, 50, LocaleTerms.Loc("Login"), new Color?(hasSaves ? MainMenu.buttonColor : Color.Black)))
            {
                if (hasSaves)
                {
                    try
                    {
                        this.State = MainMenu.MainMenuState.Login;
                        this.loginScreen.ClearTextBox();
                        this.loginScreen.ResetForLogin();
                    }
                    catch (Exception ex)
                    {
                        Utils.writeToFile(LocaleTerms.Loc("OS Load Error") + ": " + ex.ToString() + "\n\n" + ex.StackTrace, "crashLog.txt");
                    }
                }
            }
            int num5;

            if (Button.doButton(3, 180, num5 = num4 + 65, 450, 50, LocaleTerms.Loc("Settings"), new Color?(MainMenu.buttonColor)))
            {
                this.ScreenManager.AddScreen((GameScreen) new OptionsMenu(), new PlayerIndex?(this.ScreenManager.controllingPlayer));
            }
            int num6;
            int y = num6 = num5 + 65;

            if (Settings.isServerMode)
            {
                if (Button.doButton(4, 180, y, 450, 50, "Start Relay Server", new Color?(MainMenu.buttonColor)))
                {
                    this.ScreenManager.AddScreen((GameScreen) new ServerScreen(), new PlayerIndex?(this.ScreenManager.controllingPlayer));
                }
                y += 65;
            }
            if (Settings.AllowExtensionMode)
            {
                if (Button.doButton(5, 180, y, 450, 50, "Extensions", new Color?(MainMenu.buttonColor)))
                {
                    this.State = MainMenu.MainMenuState.Extensions;
                    this.extensionsScreen.Reset();
                }
                y += 65;
            }
            if (Settings.HasLabyrinthsDemoStartMainMenuButton && DLC1SessionUpgrader.HasDLC1Installed)
            {
                if (Button.doButton(7, 180, y, 450, 28, "New Labyrinths Accelerated Session", new Color?(Color.Lerp(Utils.AddativeWhite, new Color(68, 162, 194), 1f - Utils.rand(0.3f)))) && canRun)
                {
                    this.NextStartedGameShouldBeDLCAccelerated = true;
                    this.State = MainMenu.MainMenuState.NewUser;
                    this.loginScreen.ClearTextBox();
                    this.loginScreen.ResetForNewAccount();
                }
                y += 65;
            }
            if (Button.doButton(15, 180, y, 450, 28, LocaleTerms.Loc("Exit"), new Color?(MainMenu.exitButtonColor)))
            {
                MusicManager.stop();
                Game1.threadsExiting = true;
                Game1.getSingleton().Exit();
            }
            int num7 = y + 30;

            if (!PlatformAPISettings.RemoteStorageRunning)
            {
                TextItem.doFontLabel(new Vector2(180f, (float)num7), LocaleTerms.Loc("WARNING: Error connecting to Steam Cloud"), GuiData.smallfont, new Color?(Color.DarkRed), float.MaxValue, float.MaxValue, false);
                num7 += 20;
            }
            if (string.IsNullOrWhiteSpace(MainMenu.AccumErrors))
            {
                return;
            }
            TextItem.doFontLabel(new Vector2(180f, (float)num7), MainMenu.AccumErrors, GuiData.smallfont, new Color?(Color.DarkRed), float.MaxValue, float.MaxValue, false);
            int num8 = num7 + 20;
        }
コード例 #21
0
        private void drawMainMenuButtons(bool canRun)
        {
            var num1 = 135;
            int num2;

            if (Button.doButton(1, 180, num2 = num1 + 65, 450, 50, "New Session", buttonColor) && canRun)
            {
                State = MainMenuState.NewUser;
                loginScreen.ResetForNewAccount();
            }
            int num3;

            if (
                Button.doButton(1102, 180, num3 = num2 + 65, 450, 28,
                                canLoad
                        ? "Continue with account [" + SaveFileManager.LastLoggedInUser.Username + "]"
                        : "No Accounts", canLoad ? buttonColor : Color.Black) && canLoad)
            {
                loginScreen.LoadGameForUserFileAndUsername(SaveFileManager.LastLoggedInUser.FileUsername,
                                                           SaveFileManager.LastLoggedInUser.Username);
            }
            int num4;

            if (Button.doButton(11, 180, num4 = num3 + 39, 450, 50, "Login", canLoad ? buttonColor : Color.Black))
            {
                if (canLoad)
                {
                    try
                    {
                        State = MainMenuState.Login;
                        loginScreen.ResetForLogin();
                    }
                    catch (Exception ex)
                    {
                        Utils.writeToFile("OS Load Error: " + ex + "\n\n" + ex.StackTrace, "crashLog.txt");
                    }
                }
            }
            int num5;

            if (Button.doButton(3, 180, num5 = num4 + 65, 450, 50, "Settings", buttonColor))
            {
                ScreenManager.AddScreen(new OptionsMenu(), ScreenManager.controllingPlayer);
            }
            int num6;
            var y = num6 = num5 + 65;

            if (Settings.isServerMode)
            {
                if (Button.doButton(4, 180, y, 450, 50, "Start Relay Server", buttonColor))
                {
                    ScreenManager.AddScreen(new ServerScreen(), ScreenManager.controllingPlayer);
                }
                y += 65;
            }
            if (Settings.AllowAdventureMode)
            {
                if (Button.doButton(5, 180, y, 450, 50, "Adventure Session", buttonColor))
                {
                    ExitScreen();
                    resetOS();
                    Settings.IsInAdventureMode = true;
                    if (!Settings.soundDisabled)
                    {
                        ScreenManager.playAlertSound();
                    }
                    ScreenManager.AddScreen(new OS(), ScreenManager.controllingPlayer);
                }
                y += 65;
            }
            if (Button.doButton(15, 180, y, 450, 28, "Exit", exitButtonColor))
            {
                MusicManager.stop();
                Game1.threadsExiting = true;
                Game1.GetSingleton().Exit();
            }
            var num7 = y + 30;

            if (!PlatformAPISettings.RemoteStorageRunning)
            {
                TextItem.doFontLabel(new Vector2(180f, num7), "WARNING: Error connecting to Steam Cloud",
                                     GuiData.smallfont, Color.DarkRed, float.MaxValue, float.MaxValue);
                num7 += 20;
            }
            if (string.IsNullOrWhiteSpace(AccumErrors))
            {
                return;
            }
            TextItem.doFontLabel(new Vector2(180f, num7), AccumErrors, GuiData.smallfont, Color.DarkRed, float.MaxValue,
                                 float.MaxValue);
            var num8 = num7 + 20;
        }
コード例 #22
0
        public Vector2 Draw(SpriteBatch sb, Rectangle dest, ExtensionInfo info)
        {
            this.ActiveInfo = info;
            if (!this.HasInitializedSteamCallbacks)
            {
                this.InitSteamCallbacks();
            }
            this.Update();
            Vector2 vector2 = new Vector2((float)dest.X, (float)dest.Y);
            bool    flag1   = info.WorkshopPublishID != "NONE";

            this.currentStatusMessage = flag1 ? "Ready to push Updates" : "Ready to create in steam";
            if (!flag1 && string.IsNullOrWhiteSpace(this.currentBodyMessage))
            {
                this.currentBodyMessage = "By submitting this item, you agree to the workshop terms of service\nhttp://steamcommunity.com/sharedfiles/workshoplegalagreement";
            }
            Vector2 pos1 = new Vector2(vector2.X + (float)(dest.Width / 2), vector2.Y);

            TextItem.doFontLabel(pos1, this.currentStatusMessage, GuiData.font, new Color?(Color.Gray), (float)dest.Width / 2f, 30f, false);
            pos1.Y += 30f;
            TextItem.doFontLabel(pos1, this.currentTitleMessage, GuiData.font, new Color?(Color.White), (float)dest.Width / 2f, 30f, false);
            pos1.Y += 30f;
            Vector2 pos2 = pos1;

            if (this.showLoadingSpinner)
            {
                pos1.X          += 16f;
                this.spinnerRot += 0.1f;
                Rectangle destinationRectangle = new Rectangle((int)pos1.X, (int)pos1.Y + 20, 40, 40);
                sb.Draw(this.spinnerTex, destinationRectangle, new Rectangle?(), Color.White, this.spinnerRot, this.spinnerTex.GetCentreOrigin(), SpriteEffects.None, 0.5f);
                pos2.X += 45f;
            }
            if (this.isInUpload)
            {
                Rectangle rectangle          = new Rectangle((int)pos2.X, (int)pos2.Y + 6, dest.Width / 2, 20);
                ulong     punBytesProcessed  = 0;
                ulong     punBytesTotal      = 1;
                int       itemUpdateProgress = (int)SteamUGC.GetItemUpdateProgress(this.updateHandle, out punBytesProcessed, out punBytesTotal);
                double    val1 = (double)punBytesProcessed / (double)punBytesTotal;
                if ((long)punBytesTotal == 0L)
                {
                    val1 = 0.0;
                }
                sb.Draw(Utils.white, Utils.InsetRectangle(rectangle, -1), Utils.AddativeWhite * 0.7f);
                sb.Draw(Utils.white, rectangle, Utils.VeryDarkGray);
                rectangle.Width = (int)((double)rectangle.Width * val1);
                sb.Draw(Utils.white, rectangle, Color.LightBlue);
                pos2.Y += 31f;
                if (punBytesTotal > 0UL)
                {
                    string format = "{0}% - {1}mb of {2}mb Transfered";
                    string str1   = (val1 * 100.0).ToString("00.00");
                    ulong  num    = punBytesProcessed / 1000000UL;
                    string str2   = num.ToString("0.00");
                    num = punBytesTotal / 1000000UL;
                    string str3  = num.ToString("0.00");
                    string text1 = string.Format(format, (object)str1, (object)str2, (object)str3);
                    Utils.DrawStringMonospace(sb, text1, GuiData.smallfont, pos2, Color.White, 9f);
                    pos2.Y += 20f;
                    TimeSpan time  = DateTime.Now - this.transferStarted;
                    string   text2 = string.Format("ETA: {0} // Elapsed : {1}", (object)this.getTimespanDisplayString(TimeSpan.FromSeconds(time.TotalSeconds / Math.Max(val1, 0.01))), (object)this.getTimespanDisplayString(time));
                    Utils.DrawStringMonospace(sb, text2, GuiData.smallfont, pos2, Color.White, 9f);
                    pos2.Y += 25f;
                }
            }
            TextItem.doFontLabel(pos2, this.currentBodyMessage, GuiData.smallfont, new Color?(Color.White * 0.8f), (float)dest.Width / 2f, 30f, false);
            int  height = 40;
            int  width  = 450;
            bool flag2  = !this.showLoadingSpinner;

            if (!this.isInUpload)
            {
                if (Button.doButton(371711001, (int)vector2.X, (int)vector2.Y, width, height, flag1 ? " - Item Created -" : "Create Entry in Steam Workshop", new Color?(flag1 ? Color.LightBlue : Color.Gray)) && !flag1 && flag2)
                {
                    this.CreateExtensionInSteam(info);
                }
                vector2.Y += (float)(height + 4);
                if (Button.doButton(371711003, (int)vector2.X, (int)vector2.Y, width, height, "Upload to Steam Workshop", new Color?(flag1 ? Color.LightBlue : Color.Gray)) && flag2)
                {
                    this.PerformUpdate(info);
                }
                vector2.Y += (float)(height + 4);
                if (Button.doButton(371711005, (int)vector2.X, (int)vector2.Y + 10, width, height - 10, "Back to Extension Menu", new Color?(Color.Black)) && flag2 && this.GoBack != null)
                {
                    this.GoBack();
                }
                vector2.Y += (float)(height + 4);
            }
            return(vector2);
        }
コード例 #23
0
ファイル: MainMenu.cs プロジェクト: hochladen/Hacknet
        private void drawTestingMainMenuButtons(bool canRun)
        {
            SpriteFont tinyfont = GuiData.tinyfont;
            string     text     = "FONT:";

            for (int index = 0; index < tinyfont.Characters.Count; ++index)
            {
                text += (string)(object)tinyfont.Characters[index];
                if (index % 20 == 0)
                {
                    text += "\n";
                }
            }
            if (true)
            {
                text = "Labyrinths Testers:\nPress \"Start Full DLC Test\" to begin\n\n" + text;
            }
            GuiData.spriteBatch.DrawString(tinyfont, text, new Vector2(867f, 200f), Color.White);
            if (Button.doButton(8801, 634, 200, 225, 23, "New Test Session", new Color?(MainMenu.buttonColor)) && canRun && canRun)
            {
                this.ExitScreen();
                MainMenu.resetOS();
                if (!Settings.soundDisabled)
                {
                    this.ScreenManager.playAlertSound();
                }
                OS os = new OS();
                os.SaveGameUserName    = "******";
                os.SaveUserAccountName = "__test";
                this.ScreenManager.AddScreen((GameScreen)os, new PlayerIndex?(this.ScreenManager.controllingPlayer));
                os.Flags.AddFlag("TutorialComplete");
                os.delayer.RunAllDelayedActions();
                os.threadedSaveExecute(false);
                this.ScreenManager.RemoveScreen((GameScreen)os);
                OS.WillLoadSave = true;
                MainMenu.resetOS();
                os = new OS();
                os.SaveGameUserName    = "******";
                os.SaveUserAccountName = "__test";
                this.ScreenManager.AddScreen((GameScreen)os, new PlayerIndex?(this.ScreenManager.controllingPlayer));
                os.delayer.Post(ActionDelayer.Wait(0.1), (Action)(() => Game1.getSingleton().IsMouseVisible = true));
                os.delayer.Post(ActionDelayer.Wait(0.4), (Action)(() =>
                {
                    os.runCommand("debug");
                    ComputerLoader.loadMission("Content/Missions/MainHub/Intro/Intro01.xml", false);
                }));
                if (!Settings.EnableDLC)
                {
                    ComputerLoader.loadMission("Content/Missions/BitMission0.xml", false);
                }
            }
            if (Button.doButton(8803, 634, 225, 225, 23, "New DLC Test Session", new Color?(Settings.EnableDLC ? Color.Gray : MainMenu.buttonColor)) && canRun && canRun)
            {
                this.ExitScreen();
                MainMenu.resetOS();
                if (!Settings.soundDisabled)
                {
                    this.ScreenManager.playAlertSound();
                }
                OS os1 = new OS();
                os1.SaveGameUserName    = "******";
                os1.SaveUserAccountName = "__test";
                this.ScreenManager.AddScreen((GameScreen)os1, new PlayerIndex?(this.ScreenManager.controllingPlayer));
                SessionAccelerator.AccelerateSessionToDLCHA((object)os1);
                os1.threadedSaveExecute(false);
                this.ScreenManager.RemoveScreen((GameScreen)os1);
                OS.WillLoadSave = true;
                MainMenu.resetOS();
                Settings.initShowsTutorial = false;
                OS os2 = new OS();
                os2.SaveGameUserName    = "******";
                os2.SaveUserAccountName = "__test";
                this.ScreenManager.AddScreen((GameScreen)os2, new PlayerIndex?(this.ScreenManager.controllingPlayer));
                os2.delayer.Post(ActionDelayer.Wait(0.15), (Action)(() => Game1.getSingleton().IsMouseVisible = true));
            }
            if (Button.doButton(8806, 634, 250, 225, 23, "Run Test Suite", new Color?(MainMenu.buttonColor)))
            {
                this.testSuiteResult = TestSuite.RunTestSuite(this.ScreenManager, false);
            }
            if (Button.doButton(8809, 634, 275, 225, 23, "Run Quick Tests", new Color?(MainMenu.buttonColor)))
            {
                this.testSuiteResult = TestSuite.RunTestSuite(this.ScreenManager, true);
            }
            else
            {
                if (Button.doButton(8812, 634, 300, 225, 23, "Start Full DLC Test", new Color?(MainMenu.buttonColor)) && canRun)
                {
                    this.StartFullDLCTest();
                }
                if (this.testSuiteResult == null)
                {
                    return;
                }
                TextItem.doFontLabel(new Vector2(635f, 325f), Utils.SuperSmartTwimForWidth(this.testSuiteResult, 600, GuiData.tinyfont), GuiData.tinyfont, new Color?(this.testSuiteResult.Length > 950 ? Utils.AddativeRed : Utils.AddativeWhite), float.MaxValue, float.MaxValue, false);
            }
        }
コード例 #24
0
        public override void draw(Rectangle bounds, SpriteBatch sb)
        {
            base.draw(bounds, sb);
            var width  = bounds.Width;
            var height = bounds.Height;

            if (rendertarget == null || rendertarget.Width != width || rendertarget.Height != height)
            {
                if (rtSpritebatch == null)
                {
                    rtSpritebatch = new SpriteBatch(sb.GraphicsDevice);
                }
                if (rendertarget != null)
                {
                    rendertarget.Dispose();
                }
                rendertarget = new RenderTarget2D(sb.GraphicsDevice, width, height);
            }
            if (!PlayingHeartbreak)
            {
                TextItem.DrawShadow = false;
                TextItem.doFontLabel(new Vector2(bounds.X + 6, bounds.Y + 2),
                                     Utils.FlipRandomChars("PortHack.Heart", 0.003), GuiData.font, Utils.AddativeWhite * 0.6f,
                                     bounds.Width - 10, 100f);
                TextItem.doFontLabel(new Vector2(bounds.X + 6, bounds.Y + 2),
                                     Utils.FlipRandomChars("PortHack.Heart", 0.1), GuiData.font, Utils.AddativeWhite * 0.2f,
                                     bounds.Width - 10, 100f);
            }
            if (PlayingHeartbreak)
            {
                playTimeExpended += (float)os.lastGameTime.ElapsedGameTime.TotalSeconds;
            }
            UpdateForTime(bounds, sb);
            var currentRenderTarget = Utils.GetCurrentRenderTarget();

            sb.GraphicsDevice.SetRenderTarget(rendertarget);
            sb.GraphicsDevice.Clear(Color.Transparent);
            rtSpritebatch.Begin();
            var dest      = new Rectangle(0, 0, bounds.Width, bounds.Height);
            var vector3_1 = new Vector3(MathHelper.ToRadians(35.4f), MathHelper.ToRadians(45f),
                                        MathHelper.ToRadians(0.0f));
            var vector3_2 = new Vector3(1f, 1f, 0.0f) * os.timer * 0.2f + new Vector3(os.timer * 0.1f, os.timer * -0.4f, 0.0f);
            var num       = 2.5f;

            if (PlayingHeartbreak)
            {
                if (playTimeExpended < (double)num)
                {
                    Cube3D.RenderWireframe(Vector3.Zero, 2.6f,
                                           Vector3.Lerp(Utils.NormalizeRotationVector(vector3_2), vector3_1,
                                                        Utils.QuadraticOutCurve(playTimeExpended / num)), Color.White);
                }
                else
                {
                    pcs.DrawHeartSequence(dest, (float)os.lastGameTime.ElapsedGameTime.TotalSeconds, 30f);
                }
            }
            else
            {
                Cube3D.RenderWireframe(new Vector3(0.0f, 0.0f, 0.0f), 2.6f, vector3_2, Color.White);
            }
            rtSpritebatch.End();
            sb.GraphicsDevice.SetRenderTarget(currentRenderTarget);
            var rectangle = new Rectangle(bounds.X + (bounds.Width - width) / 2, bounds.Y + (bounds.Height - height) / 2,
                                          width, height);
            var rarity = Math.Min(1f, (float)(playTimeExpended / (double)num * 0.800000011920929 + 0.200000002980232));

            FlickeringTextEffect.DrawFlickeringSprite(sb, rectangle, rendertarget, 4f, rarity, os, Color.White);
            sb.Draw(rendertarget, rectangle, Utils.AddativeWhite * 0.7f);
        }
コード例 #25
0
        public static bool onDrawMainMenuTitles(MainMenu self, out bool result, ref Rectangle dest)
        {
            if (defaultTitleFont == null)
            {
                defaultTitleFont = self.ScreenManager.Game.Content.Load <SpriteFont>("Kremlin");
            }
            Logger.Verbose("Redrawing Main Menu Titles");
            var version   = Assembly.GetExecutingAssembly().GetName().Version.ToString();
            var mainTitle = "HACKNET";
            var subtitle  = "OS"
                            + (DLC1SessionUpgrader.HasDLC1Installed ? "+Labyrinths " : " ")
                            + MainMenu.OSVersion + " Pathfinder " + version;

            result = true;
            if (Settings.IsExpireLocked)
            {
                TimeSpan timeSpan = Settings.ExpireTime - DateTime.Now;
                string   text3;
                if (timeSpan.TotalSeconds < 1.0)
                {
                    text3  = LocaleTerms.Loc("TEST BUILD EXPIRED - EXECUTION DISABLED");
                    result = false;
                }
                else
                {
                    text3 = "Test Build : Expires in " + timeSpan.ToString();
                }
                TextItem.doFontLabel(new Vector2(180f, 105f), text3, GuiData.smallfont, Color.Red * 0.8f, 600f, 26f, false);
            }
            var main = new MainTitleData(mainTitle,
                                         defaultTitleColor,
                                         defaultTitleFont,
                                         dest
                                         );
            var sub = new SubTitleData(subtitle,
                                       main.Color * 0.5f,
                                       GuiData.smallfont,
                                       new Vector4(520, 178, 0, 0)
                                       );
            var drawMainMenuTitles = new Event.DrawMainMenuTitlesEvent(self, main, sub);

            drawMainMenuTitles.CallEvent();
            if (drawMainMenuTitles.IsCancelled)
            {
                return(true);
            }
            main = drawMainMenuTitles.Main;
            sub  = drawMainMenuTitles.Sub;
            FlickeringTextEffect.DrawLinedFlickeringText(
                dest = main.Destination,
                main.Title,
                7f,
                0.55f,
                main.Font,
                null,
                main.Color
                );
            TextItem.doFontLabel(sub.Destination, sub.Title, sub.Font, sub.Color, 600f, 26f);
            Logger.Verbose("Finished Redrawing Main Menu Titles");
            return(true);
        }
コード例 #26
0
        public override void Draw(float t)
        {
            base.Draw(t);
            var arg_0C_0 = Rectangle.Empty;

            drawOutline();
            drawTarget("app:");
            TextItem.doFontLabel(new Vector2(bounds.X + 2, bounds.Y + 14),
                                 complete ? "Operation Complete" : "SSH Crack in operation...", GuiData.UITinyfont,
                                 Utils.AddativeWhite * 0.8f * fade, bounds.Width - 6, 3.40282347E+38f);
            var num       = bounds.Y + 30;
            var num2      = bounds.X + 2;
            var num3      = 0.4f;
            var rectangle = new Rectangle(bounds.X + 2, bounds.Y + 16, GridEntryWidth - 2, GridEntryHeight - 2);

            for (var i = 0; i < width; i++)
            {
                for (var j = 0; j < height; j++)
                {
                    var sSHCrackGridEntry = Grid[i, j];
                    rectangle.X = num2 + i * GridEntryWidth;
                    rectangle.Y = num + j * GridEntryHeight;
                    if (rectangle.Y + 1 <= bounds.Y + bounds.Height && sSHCrackGridEntry.TimeTillActive <= 0f)
                    {
                        var value = os.lockedColor;
                        if (sSHCrackGridEntry.TimeSinceActivated < num3)
                        {
                            var amount = sSHCrackGridEntry.TimeSinceActivated / num3;
                            value = Color.Lerp(os.brightLockedColor, os.lockedColor, amount);
                        }
                        if (sSHCrackGridEntry.TimeTillSolved <= 0f)
                        {
                            value = os.unlockedColor;
                            if (sSHCrackGridEntry.TimeTillSolved > -1f * num3)
                            {
                                var amount2 = -1f * sSHCrackGridEntry.TimeTillSolved / num3;
                                value = Color.Lerp(os.unlockedColor, unlockedFlashColor, amount2);
                            }
                        }
                        if (GridShowingSheen)
                        {
                            var num4 = 0f;
                            if (sSHCrackGridEntry.TimeSinceActivated >= 0f)
                            {
                                num4 = sSHCrackGridEntry.TimeSinceActivated / (num3 / 2f);
                                if (sSHCrackGridEntry.TimeSinceActivated > num3 / 2f)
                                {
                                    num4 = 1f - Math.Min(1f, (sSHCrackGridEntry.TimeSinceActivated - num3 / 2f) / (num3 / 2f));
                                }
                            }
                            if (num4 < 0.25f)
                            {
                                num4 = 0f;
                            }
                            else if (num4 < 0.75f)
                            {
                                num4 = 0.5f;
                            }
                            value = Color.Lerp(os.unlockedColor, unlockedFlashColor, num4);
                        }
                        var destinationRectangle = rectangle;
                        var flag = true;
                        if (rectangle.Y + rectangle.Height > bounds.Y + bounds.Height)
                        {
                            destinationRectangle.Height = rectangle.Height -
                                                          (rectangle.Y + rectangle.Height - (bounds.Y + bounds.Height));
                            flag = false;
                        }
                        spriteBatch.Draw(Utils.white, destinationRectangle, value * fade);
                        var num5 = (sSHCrackGridEntry.CurrentValue >= 10)
                            ? ((sSHCrackGridEntry.CurrentValue >= 100) ? 1f : 5f)
                            : 8f;
                        if (flag)
                        {
                            spriteBatch.DrawString(GuiData.UITinyfont, string.Concat(sSHCrackGridEntry.CurrentValue),
                                                   new Vector2(rectangle.X + num5, rectangle.Y - 1.5f), Color.White * fade);
                        }
                    }
                }
            }
        }
コード例 #27
0
        private void DrawUpgrades(Rectangle bounds, SpriteBatch sb)
        {
            int panelHeight = 28;

            if (this.scrollerPanel == null)
            {
                this.scrollerPanel = new ScrollableSectionedPanel(panelHeight, sb.GraphicsDevice);
            }
            this.scrollerPanel.NumberOfPanels = this.upgradeNames.Count;
            Button.outlineOnly    = true;
            Button.drawingOutline = false;
            int  drawnThisCycle    = 0;
            bool needsButtonChecks = bounds.Contains(GuiData.getMousePoint());

            this.scrollerPanel.Draw((Action <int, Rectangle, SpriteBatch>)((index, drawAreaFull, sprBatch) =>
            {
                Rectangle destinationRectangle = new Rectangle(drawAreaFull.X, drawAreaFull.Y, drawAreaFull.Width - 12, drawAreaFull.Height);
                int myID = 115700 + index * 111;
                if (needsButtonChecks && Button.doButton(myID, destinationRectangle.X, destinationRectangle.Y, destinationRectangle.Width, destinationRectangle.Height, "", new Color?(Color.Transparent)))
                {
                    this.PurchaseUpgrade(index);
                }
                else if (!needsButtonChecks && GuiData.hot == myID)
                {
                    GuiData.hot = -1;
                }
                bool flag1 = (double)this.upgradeCosts[index] <= (double)this.activeState.points;
                bool flag2 = flag1 && GuiData.hot == myID;
                if (GuiData.hot == myID)
                {
                    this.hoverIndex = index;
                }
                if (flag2)
                {
                    int height = destinationRectangle.Height;
                    int num1   = 0;
                    int num2   = 0;
                    if (drawAreaFull.X == 0 && drawAreaFull.Y == 0)
                    {
                        if (drawnThisCycle == 0)
                        {
                            num1 = bounds.X;
                            num2 = bounds.Y;
                        }
                        else
                        {
                            num1 = bounds.X;
                            num2 = bounds.Y + bounds.Height - panelHeight / 2;
                        }
                    }
                    Rectangle rectangle = new Rectangle(num1 + destinationRectangle.X - height, num2 + destinationRectangle.Y - height, destinationRectangle.Width + 2 * height, destinationRectangle.Height + 2 * height);
                    for (int index1 = 0; index1 < this.Stars.Count; ++index1)
                    {
                        this.DrawStar(rectangle, sb, this.Stars[index1]);
                    }
                    sb.Draw(this.scanlinesTextBackground, rectangle, this.ThemeColor * (GuiData.active == myID ? 0.6f : 0.3f));
                }
                sprBatch.Draw(this.scanlinesTextBackground, destinationRectangle, new Rectangle?(new Rectangle(this.scanlinesTextBackground.Width / 2, this.scanlinesTextBackground.Height / 9 * 4, this.scanlinesTextBackground.Width / 2, this.scanlinesTextBackground.Height / 4)), flag1 ? this.ThemeColor * 0.2f : Utils.AddativeWhite * 0.08f);
                if (GuiData.hot == myID)
                {
                    RenderedRectangle.doRectangle(destinationRectangle.X + 1, destinationRectangle.Y + 1, destinationRectangle.Width - 2, destinationRectangle.Height - 2, new Color?(flag2 ? (GuiData.active == myID ? Color.Black : this.ThemeColorBacking) : Color.Black));
                }
                if (index == 0)
                {
                    Utils.drawLine(sprBatch, new Vector2((float)(destinationRectangle.X + 1), (float)(destinationRectangle.Y + 1)), new Vector2((float)(destinationRectangle.X + destinationRectangle.Width - 2), (float)(destinationRectangle.Y + 1)), Vector2.Zero, this.ThemeColor, 0.8f);
                }
                Utils.drawLine(sprBatch, new Vector2((float)(destinationRectangle.X + 1), (float)(destinationRectangle.Y + destinationRectangle.Height - 2)), new Vector2((float)(destinationRectangle.X + destinationRectangle.Width - 2), (float)(destinationRectangle.Y + destinationRectangle.Height - 2)), Vector2.Zero, this.ThemeColor, 0.8f);
                if (flag1)
                {
                    sprBatch.Draw(Utils.white, new Rectangle(destinationRectangle.X, destinationRectangle.Y + 1, 8, destinationRectangle.Height - 2), this.ThemeColor);
                }
                string text = "[" + this.activeState.upgradeCounts[index].ToString("000") + "] " + this.upgradeNames[index];
                TextItem.doFontLabel(new Vector2((float)(destinationRectangle.X + 4 + (flag1 ? 10 : 0)), (float)(destinationRectangle.Y + 4)), text, GuiData.UISmallfont, new Color?(flag2 ? (GuiData.active == myID ? this.ThemeColor : (flag1 ? Color.White : Color.Gray)) : (flag1 ? Utils.AddativeWhite : Color.Gray)), (float)(destinationRectangle.Width - 6), float.MaxValue, false);
                ++drawnThisCycle;
            }), sb, bounds);
            Button.outlineOnly    = false;
            Button.drawingOutline = true;
        }
コード例 #28
0
 public override void draw(Rectangle bounds, SpriteBatch sb)
 {
     base.draw(bounds, sb);
     try
     {
         int width  = bounds.Width;
         int height = bounds.Height;
         if (this.rendertarget == null || this.rendertarget.Width != width || this.rendertarget.Height != height)
         {
             if (this.rtSpritebatch == null)
             {
                 this.rtSpritebatch = new SpriteBatch(sb.GraphicsDevice);
             }
             if (this.rendertarget != null)
             {
                 this.rendertarget.Dispose();
             }
             this.rendertarget = new RenderTarget2D(sb.GraphicsDevice, width, height);
         }
         if (!this.PlayingHeartbreak)
         {
             TextItem.DrawShadow = false;
             TextItem.doFontLabel(new Vector2((float)(bounds.X + 6), (float)(bounds.Y + 2)), Utils.FlipRandomChars("PortHack.Heart", 0.003), GuiData.font, new Color?(Utils.AddativeWhite * 0.6f), (float)(bounds.Width - 10), 100f, false);
             TextItem.doFontLabel(new Vector2((float)(bounds.X + 6), (float)(bounds.Y + 2)), Utils.FlipRandomChars("PortHack.Heart", 0.1), GuiData.font, new Color?(Utils.AddativeWhite * 0.2f), (float)(bounds.Width - 10), 100f, false);
         }
         if (this.PlayingHeartbreak)
         {
             this.playTimeExpended += (float)this.os.lastGameTime.ElapsedGameTime.TotalSeconds;
         }
         this.UpdateForTime(bounds, sb);
         RenderTarget2D currentRenderTarget = Utils.GetCurrentRenderTarget();
         sb.GraphicsDevice.SetRenderTarget(this.rendertarget);
         sb.GraphicsDevice.Clear(Color.Transparent);
         this.rtSpritebatch.Begin();
         Rectangle dest      = new Rectangle(0, 0, bounds.Width, bounds.Height);
         Vector3   vector3_1 = new Vector3(MathHelper.ToRadians(35.4f), MathHelper.ToRadians(45f), MathHelper.ToRadians(0.0f));
         Vector3   vector3_2 = new Vector3(1f, 1f, 0.0f) * this.os.timer * 0.2f + new Vector3(this.os.timer * 0.1f, this.os.timer * -0.4f, 0.0f);
         float     num       = 2.5f;
         if (this.PlayingHeartbreak)
         {
             if ((double)this.playTimeExpended < (double)num)
             {
                 Cube3D.RenderWireframe(Vector3.Zero, 2.6f, Vector3.Lerp(Utils.NormalizeRotationVector(vector3_2), vector3_1, Utils.QuadraticOutCurve(this.playTimeExpended / num)), Color.White);
             }
             else
             {
                 this.pcs.DrawHeartSequence(dest, (float)this.os.lastGameTime.ElapsedGameTime.TotalSeconds, 30f);
             }
         }
         else
         {
             Cube3D.RenderWireframe(new Vector3(0.0f, 0.0f, 0.0f), 2.6f, vector3_2, Color.White);
         }
         this.rtSpritebatch.End();
         sb.GraphicsDevice.SetRenderTarget(currentRenderTarget);
         Rectangle rectangle = new Rectangle(bounds.X + (bounds.Width - width) / 2, bounds.Y + (bounds.Height - height) / 2, width, height);
         float     rarity    = Math.Min(1f, (float)((double)this.playTimeExpended / (double)num * 0.800000011920929 + 0.200000002980232));
         FlickeringTextEffect.DrawFlickeringSprite(sb, rectangle, (Texture2D)this.rendertarget, 4f, rarity, (object)this.os, Color.White);
         sb.Draw((Texture2D)this.rendertarget, rectangle, Utils.AddativeWhite * 0.7f);
     }
     catch (Exception ex)
     {
         Console.WriteLine(Utils.GenerateReportFromException(ex));
     }
 }
コード例 #29
0
        public void doRespondDisplay(Rectangle bounds, SpriteBatch sb)
        {
            Vector2 pos   = new Vector2((float)(bounds.X + 2), (float)(bounds.Y + 20));
            string  str   = (string)null;
            int     width = bounds.Width - 20 - this.corner.Width;

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

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

            TextItem.doLabel(new Vector2((float)(bounds.X + bounds.Width / 2) - vector2_1.X / 2f, pos.Y + 40f), text, new Color?());
        }
コード例 #30
0
        private void drawMissionEntry(Rectangle bounds, SpriteBatch sb, ActiveMission mission, int index)
        {
            var flag1 = false;

            if (mission.postingAcceptFlagRequirements != null)
            {
                for (var index1 = 0; index1 < mission.postingAcceptFlagRequirements.Length; ++index1)
                {
                    if (!os.Flags.HasFlag(mission.postingAcceptFlagRequirements[index1]))
                    {
                        flag1 = true;
                    }
                }
            }
            var myID  = index * 139284 + 984275 + index;
            var flag2 = Button.outlineOnly;
            var flag3 = Button.drawingOutline;

            Button.outlineOnly    = true;
            Button.drawingOutline = false;
            if (GuiData.active == myID)
            {
                sb.Draw(Utils.white, bounds, Color.Black);
            }
            else if (GuiData.hot == myID)
            {
                sb.Draw(Utils.white, bounds, themeColor * 0.12f);
            }
            else
            {
                var color = index % 2 == 0 ? themeColorLine : themeColorBackground;
                if (flag1)
                {
                    color = Color.Lerp(color, Color.Gray, 0.25f);
                }
                sb.Draw(Utils.white, bounds, color);
            }
            if (flag1)
            {
                var destinationRectangle = bounds;
                destinationRectangle.Height -= 6;
                destinationRectangle.Y      += 3;
                destinationRectangle.X      += bounds.Width - bounds.Height - 6;
                destinationRectangle.Width   = destinationRectangle.Height;
                sb.Draw(lockIcon, destinationRectangle, Color.White * 0.2f);
            }
            if (!flag1 && Button.doButton(myID, bounds.X, bounds.Y, bounds.Width, bounds.Height, "", Color.Transparent))
            {
                selectedElementIndex = index;
                state            = HubState.ContractPreview;
                screenTransition = 1f;
            }
            var text1 = mission.postingTitle ?? "";

            TextItem.doFontLabel(new Vector2(bounds.X + 1 + getTransitionOffset(index), bounds.Y + 3), text1,
                                 GuiData.smallfont, Color.White, bounds.Width, float.MaxValue);
            var text2 = "Target: " + mission.target + " -- Client: " + mission.client + " -- Key: " +
                        mission.generationKeys;

            TextItem.doFontLabel(new Vector2(bounds.X + 1, bounds.Y + bounds.Height - 16), text2, GuiData.detailfont,
                                 Color.White * 0.3f, bounds.Width, 13f);
            bounds.Y     += bounds.Height - 1;
            bounds.Height = 1;
            sb.Draw(Utils.white, bounds, themeColor * 0.2f);
            Button.outlineOnly    = flag2;
            Button.drawingOutline = flag3;
        }