Example #1
0
        public override void draw(Rectangle bounds, SpriteBatch sb)
        {
            base.draw(bounds, sb);
            bounds = Utils.InsetRectangle(bounds, 1);
            int num1    = 90;
            int height1 = 30;

            TextItem.doCenteredFontLabel(new Rectangle(bounds.X, bounds.Y + height1, bounds.Width, num1 - height1), this.OverrideTitle == null ? LocaleTerms.Loc("Labyrinths Project") : this.OverrideTitle, GuiData.font, Color.White, false);
            Rectangle rectangle = new Rectangle(bounds.X, bounds.Y + num1 + height1, bounds.Width, bounds.Height - (num1 + 2 * height1));

            if (this.showingCredits)
            {
                this.timeInCredits += (float)this.os.lastGameTime.ElapsedGameTime.TotalSeconds;
                float timeInCredits = this.timeInCredits;
                float num2          = ((double)timeInCredits > 5.0 ? timeInCredits - 4f : Utils.CubicInCurve(timeInCredits / 5f)) % 165f;
                Utils.FillEverywhereExcept(rectangle, Utils.GetFullscreen(), sb, Color.Black * 0.5f);
                float num3 = 20f;
                float num4 = (float)(rectangle.Y - height1 + rectangle.Height) - num2 * num3;
                for (int index = 0; index < this.CreditsData.Length; ++index)
                {
                    int        height2 = 22;
                    SpriteFont font    = GuiData.smallfont;
                    Color      color   = Color.LightGray * 0.9f;
                    string     text    = this.CreditsData[index];
                    if (text.StartsWith("%"))
                    {
                        text    = text.Substring(1);
                        height2 = 45;
                        font    = GuiData.font;
                        color   = Utils.AddativeWhite * 0.9f;
                    }
                    else if (text.StartsWith("^"))
                    {
                        text    = text.Substring(1);
                        height2 = 30;
                        font    = GuiData.font;
                        color   = Color.White;
                    }
                    if ((double)num4 >= (double)(rectangle.Y - height1))
                    {
                        TextItem.doCenteredFontLabel(new Rectangle(rectangle.X, (int)num4, rectangle.Width, height2), text, font, color, false);
                    }
                    num4 += (float)(height2 + 2);
                    if ((double)num4 > (double)(rectangle.Y + rectangle.Height))
                    {
                        break;
                    }
                }
                if ((double)this.timeInCredits > 40.0 && Button.doButton(18394902, rectangle.X + rectangle.Width / 4, rectangle.Y + rectangle.Height - 23, rectangle.Width / 2, 20, LocaleTerms.Loc("Proceed"), new Color?((double)this.timeInCredits > 65.0 ? this.os.highlightColor : Color.Black)))
                {
                    this.os.display.command = "connect";
                }
            }
            else if (this.isInResetSequence)
            {
                this.timeInReset += (float)this.os.lastGameTime.ElapsedGameTime.TotalSeconds;
                if ((double)this.timeInReset >= 5.0)
                {
                    this.showingCredits = true;
                    PostProcessor.EndingSequenceFlashOutActive             = false;
                    PostProcessor.EndingSequenceFlashOutPercentageComplete = 0.0f;
                    if (!Settings.IsInExtensionMode)
                    {
                        this.EndDLC();
                        if (!this.hasCuedFinaleSong)
                        {
                            this.os.delayer.Post(ActionDelayer.Wait(2.0), (Action)(() => MusicManager.playSongImmediatley("DLC\\Music\\DreamHead")));
                            this.hasCuedFinaleSong = true;
                        }
                        MediaPlayer.IsRepeating = true;
                        for (int index = 0; index < 9; ++index)
                        {
                            this.os.delayer.Post(ActionDelayer.Wait((double)index / 7.0), (Action)(() => SFX.addCircle(this.os.mailicon.pos + new Vector2(20f, 6f), Utils.AddativeWhite * 0.8f, 400f)));
                        }
                    }
                }
                else
                {
                    float num2 = Math.Min(this.timeInReset, 1f);
                    Utils.FillEverywhereExcept(rectangle, Utils.GetFullscreen(), sb, Color.Black * 0.5f * num2);
                    PatternDrawer.draw(rectangle, 0.3f, Color.Transparent, Color.Black * 0.7f, sb, PatternDrawer.binaryTile);
                    this.AddRadialMailLine();
                    PostProcessor.EndingSequenceFlashOutActive             = true;
                    PostProcessor.EndingSequenceFlashOutPercentageComplete = num2;
                    if (!this.hasCuedBuildup && (double)this.timeInReset > 2.8)
                    {
                        this.buildup.Play();
                        this.hasCuedBuildup = true;
                    }
                    TextItem.doCenteredFontLabel(rectangle, LocaleTerms.Loc("Disabling..."), GuiData.font, Color.White, false);
                }
            }
            else
            {
                PatternDrawer.draw(rectangle, 0.3f, Color.Transparent, Color.Black * 0.7f, sb, PatternDrawer.binaryTile);
                string text = this.OverrideButtonText == null?LocaleTerms.Loc("Disable Agent Monitoring") : this.OverrideButtonText;

                bool flag = this.OverrideButtonText != null;
                if (Button.doButton(38101920, rectangle.X + 50, rectangle.Y + rectangle.Height / 2 - 13, rectangle.Width - 100, 26, text, new Color?(this.os.highlightColor)))
                {
                    if (!flag)
                    {
                        this.isInResetSequence = true;
                        this.timeInReset       = 0.0f;
                        if (MusicManager.currentSongName == "DLC/Music/RemiDrone")
                        {
                            MusicManager.stop();
                        }
                        this.spindownImpact.Play();
                        if (this.spindown != null)
                        {
                            this.os.delayer.Post(ActionDelayer.Wait(1.1), (Action)(() => this.spindown.Play()));
                        }
                        DLC1SessionUpgrader.ReDsicoverAllVisibleNodesInOSCache((object)this.os);
                    }
                    else
                    {
                        this.isInResetSequence = false;
                        this.showingCredits    = true;
                        if (this.ConditionalActionsToLoadOnButtonPress != null)
                        {
                            RunnableConditionalActions.LoadIntoOS(this.ConditionalActionsToLoadOnButtonPress, (object)this.os);
                        }
                    }
                }
            }
            Rectangle destinationRectangle = new Rectangle(bounds.X, bounds.Y + num1, bounds.Width, height1);

            sb.Draw(Utils.white, destinationRectangle, Utils.VeryDarkGray);
            destinationRectangle.Y = bounds.Y + num1 + height1 + rectangle.Height;
            sb.Draw(Utils.white, destinationRectangle, Utils.VeryDarkGray);
        }
Example #2
0
        public void doEmailViewerDisplay(Rectangle bounds, SpriteBatch sb)
        {
            var vector2 = new Vector2(bounds.X + 2, bounds.Y + 20);

            if (Button.doButton(800007, (int)vector2.X, (int)vector2.Y, bounds.Width - 20 - corner.Width, 30,
                                "Return to Inbox", os.darkBackgroundColor))
            {
                state = 3;
            }
            vector2.Y += 35f;
            var destinationRectangle = GuiData.tmpRect;

            destinationRectangle.X      = bounds.X + 1;
            destinationRectangle.Y      = (int)vector2.Y;
            destinationRectangle.Width  = bounds.Width - 2;
            destinationRectangle.Height = 38;
            sb.Draw(Utils.white, destinationRectangle, textColor);
            vector2.Y += 3f;
            sb.DrawString(GuiData.UITinyfont, "<" + emailData[1] + ">", vector2, Color.Black);
            vector2.Y += 18f;
            sb.DrawString(GuiData.UITinyfont, "Subject: " + emailData[2], vector2, Color.Black);
            vector2.Y += 25f;
            vector2.X += 20f;
            var num1       = 25;
            var num2       = (emailData.Length - 4 + 1) * num1;
            var textBounds = new Rectangle((int)vector2.X, (int)vector2.Y, bounds.Width - 22,
                                           (int)(bounds.Height - (vector2.Y - (double)bounds.Y) - num2));
            var str = Utils.SmartTwimForWidth(emailData[3], bounds.Width - 50, GuiData.tinyfont);

            vector2.Y += DrawMailMessageText(textBounds, sb, str.Split(Utils.newlineDelim));
            vector2.Y += num1 - 5;
            var num3 = 0;

            for (var index1 = 4; index1 < emailData.Length; ++index1)
            {
                var strArray = emailData[index1].Split(spaceDelim, StringSplitOptions.RemoveEmptyEntries);
                var flag     = true;
                if (strArray.Length >= 1)
                {
                    if (strArray[0].Equals("link"))
                    {
                        var labelSize = TextItem.doMeasuredTinyLabel(vector2,
                                                                     "LINK : " + strArray[1] + "@" + strArray[2], new Color?());
                        var computer = Programs.getComputer(os, strArray[2]);
                        if (!os.netMap.visibleNodes.Contains(os.netMap.nodes.IndexOf(computer)))
                        {
                            DrawButtonGlow(vector2, labelSize);
                        }
                        if (Button.doButton(800009 + num3, (int)(vector2.X + (double)labelSize.X + 5.0),
                                            (int)vector2.Y, 20, 17, "+", new Color?()))
                        {
                            computer.highlightFlashTime = 1f;
                            os.netMap.discoverNode(computer);
                            SFX.addCircle(Programs.getComputer(os, strArray[2]).getScreenSpacePosition(), Color.White,
                                          32f);
                            buttonSound.Play();
                        }
                    }
                    else if (strArray[0].Equals("account"))
                    {
                        var labelSize = TextItem.doMeasuredTinyLabel(vector2,
                                                                     "ACCOUNT : " + strArray[1] + " : User="******" Pass="******"+", new Color?()))
                        {
                            var computer = Programs.getComputer(os, strArray[1]);
                            computer.highlightFlashTime = 1f;
                            os.netMap.discoverNode(computer);
                            computer.highlightFlashTime = 1f;
                            SFX.addCircle(computer.getScreenSpacePosition(), Color.White, 32f);
                            for (var index2 = 0; index2 < computer.users.Count; ++index2)
                            {
                                var userDetail = computer.users[index2];
                                if (userDetail.name.Equals(strArray[3]))
                                {
                                    userDetail.known       = true;
                                    computer.users[index2] = userDetail;
                                    break;
                                }
                            }
                            buttonSound.Play();
                        }
                    }
                    else if (strArray[0].Equals("note"))
                    {
                        var labelSize = TextItem.doMeasuredTinyLabel(vector2, "NOTE : " + strArray[1], new Color?());
                        if (!NotesExe.NoteExists(strArray[2], os))
                        {
                            DrawButtonGlow(vector2, labelSize);
                        }
                        if (Button.doButton(800009 + num3, (int)(vector2.X + (double)labelSize.X + 5.0),
                                            (int)vector2.Y, 20, 17, "+", new Color?()))
                        {
                            NotesExe.AddNoteToOS(strArray[2], os, false);
                        }
                    }
                    else
                    {
                        flag = false;
                    }
                    if (flag)
                    {
                        ++num3;
                        vector2.Y += num1;
                    }
                }
            }
            vector2.Y = bounds.Y + bounds.Height - 35;
            if (!Button.doButton(90200, (int)vector2.X, (int)vector2.Y, 300, 30, "Reply", new Color?()))
            {
                return;
            }
            emailReplyStrings.Clear();
            addingNewReplyString   = false;
            missionIncompleteReply = false;
            state = 5;
        }
Example #3
0
 private void AddRadialMailLine()
 {
     SFX.AddRadialLine(this.os.mailicon.pos + new Vector2(20f, 10f), 3.141593f + Utils.rand(3.141593f), 600f + Utils.randm(300f), 800f, 500f, 200f + Utils.randm(400f), 0.35f, Utils.AddativeWhite * Utils.randm(1f), 3f, false);
 }
Example #4
0
 public override void Completed()
 {
     base.Completed();
     this.IsComplete = true;
     if (this.targetComp.attatchedDeviceIDs != null)
     {
         string[] strArray = this.targetComp.attatchedDeviceIDs.Split(Utils.commaDelim, StringSplitOptions.RemoveEmptyEntries);
         float    num      = 0.0f;
         for (int index = 0; index < strArray.Length; ++index)
         {
             Computer device = Programs.getComputer(this.os, strArray[index]);
             if (device != null)
             {
                 Action action = (Action)(() =>
                 {
                     this.os.netMap.discoverNode(device);
                     Vector2 loc = this.os.netMap.GetNodeDrawPos(device) + new Vector2((float)this.os.netMap.bounds.X, (float)this.os.netMap.bounds.Y) + new Vector2((float)(NetworkMap.NODE_SIZE / 2));
                     SFX.addCircle(loc, this.os.highlightColor, 120f);
                     this.os.delayer.Post(ActionDelayer.Wait(0.2), (Action)(() => SFX.addCircle(loc, this.os.highlightColor, 80f)));
                     this.os.delayer.Post(ActionDelayer.Wait(0.4), (Action)(() => SFX.addCircle(loc, this.os.highlightColor, 65f)));
                     this.os.write(string.Format(LocaleTerms.Loc("eOS Device \"{0}\" opened for connection at {1}"), (object)device.name, (object)device.ip));
                     this.ResultTitles.Add(device.name);
                     this.ResultBodies.Add(device.ip + " " + device.location.ToString() + "\n" + Guid.NewGuid().ToString());
                 });
                 this.os.delayer.Post(ActionDelayer.Wait((double)num), action);
                 ++num;
                 ++this.devicesFound;
             }
         }
     }
     if (this.devicesFound != 0)
     {
         return;
     }
     this.isError = true;
 }
Example #5
0
 private void AddRadialMailLine()
 {
     SFX.AddRadialLine(this.os.mailicon.pos + new Vector2(20f, 10f), 3.141593f + Utils.rand(3.141593f), 600f + Utils.randm(300f), 800f, 500f, 200f + Utils.randm(400f), 0.35f, Color.Lerp(Utils.makeColor((byte)100, (byte)0, (byte)0, byte.MaxValue), Utils.AddativeRed, Utils.randm(1f)), 3f, false);
 }
Example #6
0
        private void CompleteMailPhaseOut()
        {
            this.os.DisableEmailIcon = true;
            SFX.addCircle(this.os.mailicon.pos + new Vector2(20f, 6f), Utils.AddativeRed * 0.8f, 100f);
            for (int index = 0; index < 12; ++index)
            {
                this.os.delayer.Post(ActionDelayer.Wait((double)index / 7.0), (Action)(() => SFX.addCircle(this.os.mailicon.pos + new Vector2(20f, 6f), Utils.AddativeRed * 0.8f, 400f)));
            }
            Vector2 mailIconPos = this.os.mailicon.pos;

            this.explosion.Explode(1500, new Vector2(-0.1f, 3.241593f), mailIconPos, 1f, 8f, 100f, 1600f, 1000f, 1200f, 3f, 7f);
            this.os.delayer.Post(ActionDelayer.Wait(0.1), (Action)(() => this.explosion.Explode(100, new Vector2(-0.1f, 3.241593f), mailIconPos, 1f, 6f, 100f, 1300f, 1000f, 1300f, 3f, 7f)));
            this.BreakSound.Play();
            this.os.topBarIconsColor = this.originalTopBarIconsColor;
            PostProcessor.EndingSequenceFlashOutActive             = false;
            PostProcessor.EndingSequenceFlashOutPercentageComplete = 0.0f;
            this.os.terminal.reset();
        }
Example #7
0
        protected override void LoadContent()
        {
            if (!this.CanLoadContent)
            {
                return;
            }
            PortExploits.populate();
            this.sman.controllingPlayer = PlayerIndex.One;
            if (Settings.isConventionDemo)
            {
                this.setWindowPosition(new Vector2(200f, 200f));
            }
            this.LoadGraphicsContent();
            this.LoadRegenSafeContent();
            ContentManager content = this.Content;

            GuiData.font        = content.Load <SpriteFont>("Font23");
            GuiData.titlefont   = content.Load <SpriteFont>("Kremlin");
            GuiData.smallfont   = this.Content.Load <SpriteFont>("Font12");
            GuiData.UISmallfont = GuiData.smallfont;
            GuiData.tinyfont    = this.Content.Load <SpriteFont>("Font10");
            GuiData.UITinyfont  = this.Content.Load <SpriteFont>("Font10");
            GuiData.detailfont  = this.Content.Load <SpriteFont>("Font7");
            GuiData.spriteBatch = this.sman.SpriteBatch;
            GuiData.InitFontOptions(this.Content);
            GuiData.init(this.Window);
            DLC1SessionUpgrader.CheckForDLCFiles();
            VehicleInfo.init();
            WorldLocationLoader.init();
            ThemeManager.init(content);
            MissionGenerationParser.init();
            MissionGenerator.init(content);
            UsernameGenerator.init();
            MusicManager.init(content);
            SFX.init(content);
            OldSystemSaveFileManifest.Load();
            try
            {
                SaveFileManager.Init(true);
            }
            catch (UnauthorizedAccessException ex)
            {
                MainMenu.AccumErrors += " ---- WARNING ---\nHacknet cannot access the Save File Folder (Path Below) to read/write save files.\nNO PROGRESS WILL BE SAVED.\n";
                MainMenu.AccumErrors += "Check folder permissions, run Hacknet.exe as Administrator, and try again.\n";
                MainMenu.AccumErrors += "If Errors Persist, search for \"Hacknet Workaround\" for a steam forums thread with more options.\n";
                MainMenu.AccumErrors  = MainMenu.AccumErrors + ":: Error Details ::\n" + Utils.GenerateReportFromException((Exception)ex);
            }
            if (this.NeedsSettingsLocaleActivation)
            {
                if (!Settings.ForceEnglish)
                {
                    string forActiveLanguage = PlatformAPISettings.GetCodeForActiveLanguage(LocaleActivator.SupportedLanguages);
                    LocaleActivator.ActivateLocale(forActiveLanguage, this.Content);
                    Settings.ActiveLocale = forActiveLanguage;
                }
            }
            else if (SettingsLoader.didLoad && Settings.ActiveLocale != "en-us")
            {
                LocaleActivator.ActivateLocale(Settings.ActiveLocale, this.Content);
            }
            Helpfile.init();
            FileEntry.init(this.Content);
            this.HasLoadedContent = true;
            this.LoadInitialScreens();
            if (!WebRenderer.Enabled)
            {
                return;
            }
            XNAWebRenderer.XNAWR_Initialize("file:///nope.html", WebRenderer.textureUpdated, 512, 512);
            WebRenderer.setSize(512, 512);
        }