Пример #1
0
        private void DrawInvioabilityEffect(Rectangle dest)
        {
            var color = Color.Lerp(os.lockedColor, os.brightLockedColor, Utils.randm(0.5f) + 0.5f);

            color.A = 0;
            var destinationRectangle1 = new Rectangle(dest.X + fancyCornerSprite.Width, dest.Y,
                                                      dest.Width - fancyCornerSprite.Width * 2, fancyPanelSprite.Height);

            spriteBatch.Draw(fancyPanelSprite, destinationRectangle1, color);
            spriteBatch.Draw(fancyCornerSprite, new Vector2(dest.X, dest.Y), new Rectangle?(), color, 0.0f, Vector2.Zero,
                             1f, SpriteEffects.FlipHorizontally, 0.4f);
            spriteBatch.Draw(fancyCornerSprite,
                             new Vector2(destinationRectangle1.X + destinationRectangle1.Width, dest.Y), color);
            var num1  = fancyCornerSprite.Width - 38;
            var dest1 = new Rectangle(dest.X + num1, dest.Y + fancyCornerSprite.Height / 2, dest.Width - num1 * 2,
                                      dest.Height - fancyCornerSprite.Height);

            Color.Lerp(Utils.AddativeWhite, os.brightLockedColor, Utils.randm(0.5f) + 0.5f);
            FlickeringTextEffect.DrawLinedFlickeringText(dest1, "INVIOABILITY ERROR", 4f, 0.26f, GuiData.titlefont, os,
                                                         Utils.AddativeWhite, 2);
            var destinationRectangle2 = destinationRectangle1;

            destinationRectangle2.Y = dest.Y + dest.Height - fancyPanelSprite.Height;
            spriteBatch.Draw(fancyPanelSprite, destinationRectangle2, new Rectangle?(), color, 0.0f, Vector2.Zero,
                             SpriteEffects.FlipVertically, 0.5f);
            float num2 = fancyCornerSprite.Height - fancyPanelSprite.Height;

            spriteBatch.Draw(fancyCornerSprite, new Vector2(dest.X, destinationRectangle2.Y - num2), new Rectangle?(),
                             color, 0.0f, Vector2.Zero, 1f, SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically, 0.4f);
            spriteBatch.Draw(fancyCornerSprite,
                             new Vector2(destinationRectangle1.X + destinationRectangle1.Width, destinationRectangle2.Y - num2),
                             new Rectangle?(), color, 0.0f, Vector2.Zero, 1f, SpriteEffects.FlipVertically, 0.5f);
        }
Пример #2
0
        public void Draw(Rectangle dest, SpriteBatch sb)
        {
            var width1  = (int)(dest.Width * 0.5);
            var height1 = (int)(dest.Height * 0.400000005960464);
            var dest1   = new Rectangle(dest.Width / 2 - width1 / 2, (int)(dest.Y + dest.Height / 2.5 - height1 / 2), width1,
                                        height1);
            var destinationRectangle1 = new Rectangle(dest.X, dest1.Y + 115, dest.Width, dest1.Height - 245);

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

            sb.Draw(Utils.white, destinationRectangle2, Color.Black * 0.8f);
            if (
                !Button.doButton(18273302, destinationRectangle2.X, destinationRectangle2.Y, destinationRectangle2.Width,
                                 destinationRectangle2.Height, "New Session", new Color(124, 137, 149)) || Start == null)
            {
                return;
            }
            Start();
        }
Пример #3
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            PostProcessor.begin();
            GuiData.startDraw();
            GuiData.spriteBatch.Draw(Utils.white, Fullscreen, Color.Black);
            var dest = Utils.InsetRectangle(Fullscreen, 200);

            dest.Y      = dest.Y + dest.Height / 2 - 200;
            dest.Height = 400;
            var destinationRectangle = new Rectangle(Fullscreen.X, dest.Y + 50, Fullscreen.Width, dest.Height - 148);

            GuiData.spriteBatch.Draw(Utils.white, destinationRectangle, Utils.AddativeRed * (0.5f + Utils.randm(0.1f)));
            var text = "HACKNET";

            FlickeringTextEffect.DrawLinedFlickeringText(dest, text, 18f, 0.7f, GuiData.titlefont, null, Color.White, 6);
            dest.Y     += 400;
            dest.Height = 120;
            FlickeringTextEffect.DrawFlickeringText(dest, Utils.FlipRandomChars("MORE SOON", 0.008), -8f, 0.7f,
                                                    GuiData.titlefont, null, Color.Gray);
            FlickeringTextEffect.DrawFlickeringText(dest, Utils.FlipRandomChars("MORE SOON", 0.03), -8f, 0.7f,
                                                    GuiData.titlefont, null, Utils.AddativeWhite * 0.15f);
            GuiData.endDraw();
            PostProcessor.end();
        }
Пример #4
0
        private bool DrawBackgroundAndTitle()
        {
            FlickeringTextEffect.DrawLinedFlickeringText(new Rectangle(180, 120, 340, 100), "HACKNET", 7f, 0.55f, this.titleFont, (object)null, this.titleColor, 2);
            string str = "";

            TextItem.doFontLabel(new Vector2(520f, 178f), "OS" + (DLC1SessionUpgrader.HasDLC1Installed ? "+Labyrinths " : " ") + MainMenu.OSVersion + " " + str, GuiData.smallfont, new Color?(this.titleColor * 0.5f), 600f, 26f, false);
            bool flag = true;

            if (Settings.IsExpireLocked)
            {
                TimeSpan timeSpan = Settings.ExpireTime - DateTime.Now;
                string   text;
                if (timeSpan.TotalSeconds < 1.0)
                {
                    text = LocaleTerms.Loc("TEST BUILD EXPIRED - EXECUTION DISABLED");
                    flag = false;
                }
                else
                {
                    text = "Test Build : Expires in " + timeSpan.ToString();
                }
                TextItem.doFontLabel(new Vector2(180f, 105f), text, GuiData.smallfont, new Color?(Color.Red * 0.8f), 600f, 26f, false);
            }
            return(flag);
        }
Пример #5
0
        private void DrawCredits()
        {
            var vector2_1 = new Vector2(0.0f, creditsScroll);
            var width     = (int)(os.fullscreen.Width * 0.5);
            var height    = (int)(os.fullscreen.Height * 0.400000005960464);
            var dest      = new Rectangle(os.fullscreen.Width / 2 - width / 2, (int)(vector2_1.Y - (double)(height / 2)), width,
                                          height);
            var destinationRectangle = new Rectangle(os.fullscreen.X, dest.Y + 65, os.fullscreen.Width,
                                                     dest.Height - 135);

            if (elapsedTime >= 1.71000003814697)
            {
                spriteBatch.Draw(Utils.white, destinationRectangle,
                                 Color.Lerp(Utils.AddativeRed, Color.Red, 0.2f + Utils.randm(0.05f)) * 0.5f);
                FlickeringTextEffect.DrawLinedFlickeringText(dest, "HACKNET", 16f, 0.4f, GuiData.titlefont, os,
                                                             Color.White, 5);
            }
            vector2_1.Y += os.fullscreen.Height / 2f;
            for (var index = 0; index < CreditsData.Length; ++index)
            {
                var num = 20f;
                var str = CreditsData[index];
                if (!string.IsNullOrEmpty(str))
                {
                    var text       = str;
                    var spriteFont = GuiData.font;
                    var color      = Color.White * 0.7f;
                    if (str.StartsWith("^"))
                    {
                        text  = str.Substring(1);
                        color = Color.Gray * 0.6f;
                    }
                    else if (str.StartsWith("%"))
                    {
                        text       = str.Substring(1);
                        spriteFont = GuiData.titlefont;
                        num        = 90f;
                    }
                    if (str.StartsWith("$"))
                    {
                        text       = str.Substring(1);
                        color      = Color.Gray * 0.6f;
                        spriteFont = GuiData.smallfont;
                    }
                    var vector2_2 = spriteFont.MeasureString(text);
                    var position  = vector2_1 + new Vector2(os.fullscreen.Width / 2 - vector2_2.X / 2f, 0.0f);
                    spriteBatch.DrawString(spriteFont, text, position, color);
                    vector2_1.Y += num;
                }
                vector2_1.Y += num;
            }
            if (vector2_1.Y >= -500.0)
            {
                return;
            }
            CompleteAndReturnToMenu();
        }
Пример #6
0
        private void DrawCredits()
        {
            Vector2   vector2_1            = new Vector2(0.0f, this.creditsScroll);
            int       width                = (int)((double)this.os.fullscreen.Width * 0.5);
            int       height               = (int)((double)this.os.fullscreen.Height * 0.400000005960464);
            Rectangle dest                 = new Rectangle(this.os.fullscreen.Width / 2 - width / 2, (int)((double)vector2_1.Y - (double)(height / 2)), width, height);
            Rectangle destinationRectangle = new Rectangle(this.os.fullscreen.X, dest.Y + 65, this.os.fullscreen.Width, dest.Height - 135);

            if ((double)this.elapsedTime >= 1.71000003814697)
            {
                this.spriteBatch.Draw(Utils.white, destinationRectangle, Color.Lerp(Utils.AddativeRed, Color.Red, 0.2f + Utils.randm(0.05f)) * 0.5f);
                FlickeringTextEffect.DrawLinedFlickeringText(dest, "HACKNET", 16f, 0.4f, GuiData.titlefont, (object)this.os, Color.White, 5);
            }
            vector2_1.Y += (float)this.os.fullscreen.Height / 2f;
            for (int index = 0; index < this.CreditsData.Length; ++index)
            {
                float  num  = 20f;
                string str1 = this.CreditsData[index];
                if (!string.IsNullOrEmpty(str1))
                {
                    string     str2       = str1;
                    SpriteFont spriteFont = GuiData.font;
                    Color      color      = Color.White * 0.7f;
                    if (str1.StartsWith("^"))
                    {
                        str2  = str1.Substring(1);
                        color = Color.Gray * 0.6f;
                    }
                    else if (str1.StartsWith("%"))
                    {
                        str2       = str1.Substring(1);
                        spriteFont = GuiData.titlefont;
                        num        = 90f;
                    }
                    if (str1.StartsWith("$"))
                    {
                        str2       = str1.Substring(1);
                        color      = Color.Gray * 0.6f;
                        spriteFont = GuiData.smallfont;
                    }
                    Vector2 vector2_2  = spriteFont.MeasureString(str2);
                    Vector2 position   = vector2_1 + new Vector2((float)(this.os.fullscreen.Width / 2) - vector2_2.X / 2f, 0.0f);
                    string  renderable = Utils.CleanStringToRenderable(str2);
                    this.spriteBatch.DrawString(spriteFont, renderable, position, color);
                    vector2_1.Y += num;
                }
                vector2_1.Y += num;
            }
            if ((double)vector2_1.Y >= -500.0)
            {
                return;
            }
            this.CompleteAndReturnToMenu();
        }
Пример #7
0
        private void DrawLogo(Rectangle dest, SpriteBatch sb)
        {
            var num1 = (float)os.lastGameTime.ElapsedGameTime.TotalSeconds;

            for (var index = 0; index < Stars.Count; ++index)
            {
                var pointClickerStar = Stars[index];
                pointClickerStar.life -= num1 * 2f * pointClickerStar.timescale;
                if (Stars[index].life <= 0.0)
                {
                    Stars.RemoveAt(index);
                    --index;
                    AddRandomLogoStar(false);
                }
                else
                {
                    Stars[index] = pointClickerStar;
                }
            }
            var currentRenderTarget = Utils.GetCurrentRenderTarget();

            sb.GraphicsDevice.SetRenderTarget(logoRenderBase);
            sb.GraphicsDevice.Clear(Color.Transparent);
            logoBatch.Begin();
            var num2 = (float)(Math.Sin(os.timer / 2.20000004768372) + 1.0) / 2f;

            logoBatch.Draw(background1, Vector2.Zero, Utils.AddativeWhite * num2);
            logoBatch.Draw(background2, Vector2.Zero, Utils.AddativeWhite * (1f - num2));
            var dest1 = new Rectangle(0, 0, logoBase.Width, logoBase.Height);

            logoBatch.Draw(logoBase, Vector2.Zero, Color.White);
            FlickeringTextEffect.DrawFlickeringSprite(logoBatch, dest1, logoBase, 4f, 0.25f, os, Color.White);
            var num3 = (float)(0.439999997615814 + (Math.Sin(os.timer * 0.823000013828278) + 1.0) / 2.0);

            logoBatch.Draw(logoOverlay1, Vector2.Zero, Utils.AddativeWhite * num3);
            logoBatch.Draw(logoOverlay2, Vector2.Zero, Utils.AddativeWhite * (1f - num3));
            logoBatch.End();
            sb.GraphicsDevice.SetRenderTarget(currentRenderTarget);
            for (var index = 0; index < Stars.Count; ++index)
            {
                DrawStar(dest, sb, Stars[index]);
            }
            FlickeringTextEffect.DrawFlickeringSpriteAltWeightings(sb, dest, logoRenderBase, 4f, 0.01f, os,
                                                                   Utils.AddativeWhite);
        }
Пример #8
0
        public static void SendErrorEmail(Exception ex, string postfix = "", string extraData = "")
        {
            var body =
                string.Concat(
                    GenerateReportFromException(ex) + "\r\n White:" + white + "\r\n WhiteDisposed:" +
                    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 + "\r\n Extra:\r\n" + extraData + "\r\n";

            SendRealWorldEmail(
                "Hackent " + postfix + MainMenu.OSVersion + " Crash " + DateTime.Now.ToShortDateString() + " " +
                DateTime.Now.ToShortTimeString(), "*****@*****.**", body);
        }
Пример #9
0
        private void DrawLogo(Rectangle dest, SpriteBatch sb)
        {
            float totalSeconds = (float)this.os.lastGameTime.ElapsedGameTime.TotalSeconds;

            for (int index = 0; index < this.Stars.Count; ++index)
            {
                PointClickerDaemon.PointClickerStar star = this.Stars[index];
                star.life -= totalSeconds * 2f * star.timescale;
                if ((double)this.Stars[index].life <= 0.0)
                {
                    this.Stars.RemoveAt(index);
                    --index;
                    this.AddRandomLogoStar(false);
                }
                else
                {
                    this.Stars[index] = star;
                }
            }
            RenderTarget2D currentRenderTarget = Utils.GetCurrentRenderTarget();

            sb.GraphicsDevice.SetRenderTarget(this.logoRenderBase);
            sb.GraphicsDevice.Clear(Color.Transparent);
            this.logoBatch.Begin();
            float num1 = (float)(Math.Sin((double)this.os.timer / 2.20000004768372) + 1.0) / 2f;

            this.logoBatch.Draw(this.background1, Vector2.Zero, Utils.AddativeWhite * num1);
            this.logoBatch.Draw(this.background2, Vector2.Zero, Utils.AddativeWhite * (1f - num1));
            Rectangle dest1 = new Rectangle(0, 0, this.logoBase.Width, this.logoBase.Height);

            this.logoBatch.Draw(this.logoBase, Vector2.Zero, Color.White);
            FlickeringTextEffect.DrawFlickeringSprite(this.logoBatch, dest1, this.logoBase, 4f, 0.25f, (object)this.os, Color.White);
            float num2 = (float)(0.439999997615814 + (Math.Sin((double)this.os.timer * 0.823000013828278) + 1.0) / 2.0);

            this.logoBatch.Draw(this.logoOverlay1, Vector2.Zero, Utils.AddativeWhite * num2);
            this.logoBatch.Draw(this.logoOverlay2, Vector2.Zero, Utils.AddativeWhite * (1f - num2));
            this.logoBatch.End();
            sb.GraphicsDevice.SetRenderTarget(currentRenderTarget);
            for (int index = 0; index < this.Stars.Count; ++index)
            {
                this.DrawStar(dest, sb, this.Stars[index]);
            }
            FlickeringTextEffect.DrawFlickeringSpriteAltWeightings(sb, dest, (Texture2D)this.logoRenderBase, 4f, 0.01f, (object)this.os, Utils.AddativeWhite);
        }
Пример #10
0
        public static void end()
        {
            device.SetRenderTarget(backTarget);
            sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.AnisotropicClamp,
                     DepthStencilState.Default, RasterizerState.CullNone, blur);
            sb.Draw(target, Vector2.Zero, Color.White);
            sb.End();
            var renderTarget = dangerModeEnabled ? dangerBufferTarget : null;

            device.SetRenderTarget(renderTarget);
            if (EndingSequenceFlashOutActive)
            {
                device.Clear(Color.Black);
            }
            sb.Begin();
            var fullscreenRect = GetFullscreenRect();

            if (EndingSequenceFlashOutActive)
            {
                FlickeringTextEffect.DrawFlickeringSprite(sb, fullscreenRect, target, 12f, 0f, null, Color.White);
            }
            else
            {
                sb.Draw(target, fullscreenRect, Color.White);
            }
            if (bloomEnabled)
            {
                sb.Draw(backTarget, fullscreenRect, bloomColor);
            }
            else
            {
                sb.Draw(target, fullscreenRect, bloomAbsenceHighlighterColor);
            }
            sb.End();
            if (dangerModeEnabled)
            {
                DrawDangerModeFliters();
            }
        }
Пример #11
0
        public static void end()
        {
            PostProcessor.device.SetRenderTarget(PostProcessor.backTarget);
            PostProcessor.sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.AnisotropicClamp, DepthStencilState.Default, RasterizerState.CullNone, PostProcessor.blur);
            PostProcessor.sb.Draw((Texture2D)PostProcessor.target, Vector2.Zero, Color.White);
            PostProcessor.sb.End();
            RenderTarget2D renderTarget = PostProcessor.dangerModeEnabled ? PostProcessor.dangerBufferTarget : (RenderTarget2D)null;

            PostProcessor.device.SetRenderTarget(renderTarget);
            if (PostProcessor.EndingSequenceFlashOutActive)
            {
                PostProcessor.device.Clear(Color.Black);
            }
            PostProcessor.sb.Begin();
            Rectangle fullscreenRect = PostProcessor.GetFullscreenRect();

            if (PostProcessor.EndingSequenceFlashOutActive)
            {
                FlickeringTextEffect.DrawFlickeringSprite(PostProcessor.sb, fullscreenRect, (Texture2D)PostProcessor.target, 12f, 0.0f, (object)null, Color.White);
            }
            else
            {
                PostProcessor.sb.Draw((Texture2D)PostProcessor.target, fullscreenRect, Color.White);
            }
            if (PostProcessor.bloomEnabled)
            {
                PostProcessor.sb.Draw((Texture2D)PostProcessor.backTarget, fullscreenRect, PostProcessor.bloomColor);
            }
            else
            {
                PostProcessor.sb.Draw((Texture2D)PostProcessor.target, fullscreenRect, PostProcessor.bloomAbsenceHighlighterColor);
            }
            PostProcessor.sb.End();
            if (!PostProcessor.dangerModeEnabled)
            {
                return;
            }
            PostProcessor.DrawDangerModeFliters();
        }
Пример #12
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            PostProcessor.begin();
            GuiData.startDraw();
            GuiData.spriteBatch.Draw(Utils.white, this.Fullscreen, Color.Black);
            if (this.IsDLCDemoScreen)
            {
                this.HexBackground.Draw(Utils.GetFullscreen(), GuiData.spriteBatch, Utils.AddativeRed * 0.2f, Color.Black, HexGridBackground.ColoringAlgorithm.OutlinedSinWash, 0.0f);
                this.pointEffect.Render(Utils.GetFullscreen(), GuiData.spriteBatch);
                GuiData.spriteBatch.Draw(Utils.white, this.Fullscreen, Color.Black * 0.5f);
            }
            Rectangle dest = Utils.InsetRectangle(this.Fullscreen, 200);

            dest.Y      = dest.Y + dest.Height / 2 - 200;
            dest.Height = 400;
            Rectangle destinationRectangle = new Rectangle(this.Fullscreen.X, dest.Y + 50, this.Fullscreen.Width, dest.Height - 148);

            GuiData.spriteBatch.Draw(Utils.white, destinationRectangle, Utils.AddativeRed * (0.5f + Utils.randm(0.1f)));
            string text = "HACKNET";

            FlickeringTextEffect.DrawLinedFlickeringText(dest, text, this.IsDLCDemoScreen ? 5f : 18f, this.IsDLCDemoScreen ? 0.8f : 0.7f, GuiData.titlefont, (object)null, Color.White, 6);
            dest.Y     += 400;
            dest.Height = 120;
            SpriteFont font = GuiData.titlefont;

            if (Settings.ActiveLocale != "en-us")
            {
                font = GuiData.font;
            }
            string input = this.IsDLCDemoScreen ? "EXPANSION COMING DECEMBER" : "MORE SOON";

            FlickeringTextEffect.DrawFlickeringText(dest, Utils.FlipRandomChars(LocaleTerms.Loc(input), this.IsDLCDemoScreen ? 0.0045 : 0.008), -8f, 0.7f, font, (object)null, Color.Gray);
            FlickeringTextEffect.DrawFlickeringText(dest, Utils.FlipRandomChars(LocaleTerms.Loc(input), 0.03), -8f, 0.7f, font, (object)null, Utils.AddativeWhite * 0.15f);
            GuiData.endDraw();
            PostProcessor.end();
        }
Пример #13
0
        private void DrawInvioabilityEffect(Rectangle dest)
        {
            Color color = Color.Lerp(this.os.lockedColor, this.os.brightLockedColor, Utils.randm(0.5f) + 0.5f);

            color.A = (byte)0;
            Rectangle destinationRectangle1 = new Rectangle(dest.X + this.fancyCornerSprite.Width, dest.Y, dest.Width - this.fancyCornerSprite.Width * 2, this.fancyPanelSprite.Height);

            this.spriteBatch.Draw(this.fancyPanelSprite, destinationRectangle1, color);
            this.spriteBatch.Draw(this.fancyCornerSprite, new Vector2((float)dest.X, (float)dest.Y), new Rectangle?(), color, 0.0f, Vector2.Zero, 1f, SpriteEffects.FlipHorizontally, 0.4f);
            this.spriteBatch.Draw(this.fancyCornerSprite, new Vector2((float)(destinationRectangle1.X + destinationRectangle1.Width), (float)dest.Y), color);
            int       num1  = this.fancyCornerSprite.Width - 38;
            Rectangle dest1 = new Rectangle(dest.X + num1, dest.Y + this.fancyCornerSprite.Height / 2, dest.Width - num1 * 2, dest.Height - this.fancyCornerSprite.Height);

            Color.Lerp(Utils.AddativeWhite, this.os.brightLockedColor, Utils.randm(0.5f) + 0.5f);
            FlickeringTextEffect.DrawLinedFlickeringText(dest1, "INVIOLABILITY ERROR", 4f, 0.26f, GuiData.titlefont, (object)this.os, Utils.AddativeWhite, 2);
            Rectangle destinationRectangle2 = destinationRectangle1;

            destinationRectangle2.Y = dest.Y + dest.Height - this.fancyPanelSprite.Height;
            this.spriteBatch.Draw(this.fancyPanelSprite, destinationRectangle2, new Rectangle?(), color, 0.0f, Vector2.Zero, SpriteEffects.FlipVertically, 0.5f);
            float num2 = (float)(this.fancyCornerSprite.Height - this.fancyPanelSprite.Height);

            this.spriteBatch.Draw(this.fancyCornerSprite, new Vector2((float)dest.X, (float)destinationRectangle2.Y - num2), new Rectangle?(), color, 0.0f, Vector2.Zero, 1f, SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically, 0.4f);
            this.spriteBatch.Draw(this.fancyCornerSprite, new Vector2((float)(destinationRectangle1.X + destinationRectangle1.Width), (float)destinationRectangle2.Y - num2), new Rectangle?(), color, 0.0f, Vector2.Zero, 1f, SpriteEffects.FlipVertically, 0.5f);
        }
Пример #14
0
        private Vector2 DrawExtensionInfoDetail(Vector2 drawpos, Rectangle dest, SpriteBatch sb, ScreenManager screenMan, ExtensionInfo info)
        {
            sb.DrawString(GuiData.titlefont, info.Name.ToUpper(), drawpos, Utils.AddativeWhite * 0.66f);
            drawpos.Y += 80f;
            int height1 = sb.GraphicsDevice.Viewport.Height;
            int num1    = 256;

            if (height1 < 900)
            {
                num1 = 120;
            }
            Rectangle dest1   = new Rectangle((int)drawpos.X, (int)drawpos.Y, num1, num1);
            Texture2D texture = this.DefaultModImage;

            if (info.LogoImage != null)
            {
                texture = info.LogoImage;
            }
            FlickeringTextEffect.DrawFlickeringSprite(sb, dest1, texture, 2f, 0.5f, (object)null, Color.White);
            Vector2 position = drawpos + new Vector2((float)num1 + 40f, 20f);
            float   num2     = (float)dest.Width - (drawpos.X - (float)dest.X);
            string  text1    = Utils.SuperSmartTwimForWidth(info.Description, (int)num2, GuiData.smallfont);

            sb.DrawString(GuiData.smallfont, text1, position, Utils.AddativeWhite * 0.7f);
            drawpos.Y += (float)num1 + 10f;
            if (this.IsInPublishScreen)
            {
                Rectangle fullscreen = Utils.GetFullscreen();
                Rectangle dest2      = new Rectangle((int)drawpos.X, (int)drawpos.Y, fullscreen.Width - (int)drawpos.X * 2, fullscreen.Height - ((int)drawpos.Y + 50));
                return(this.workshopPublishScreen.Draw(sb, dest2, info));
            }
            if (this.ReportOverride != null)
            {
                string text2 = Utils.SuperSmartTwimForWidth(this.ReportOverride, 800, GuiData.smallfont);
                sb.DrawString(GuiData.smallfont, text2, drawpos + new Vector2(460f, 0.0f), this.ReportOverride.Length > 250 ? Utils.AddativeRed : Utils.AddativeWhite);
            }
            int val1    = 40;
            int num3    = 5;
            int num4    = info.AllowSave ? 4 : 2;
            int num5    = height1 - (int)drawpos.Y - 55;
            int height2 = Math.Min(val1, (num5 - num4 * num3) / num4);

            if (Button.doButton(7900010, (int)drawpos.X, (int)drawpos.Y, 450, height2, string.Format(LocaleTerms.Loc("New {0} Account"), (object)info.Name), new Color?(MainMenu.buttonColor)))
            {
                this.State = ExtensionsMenuScreen.EMSState.GetUsername;
                this.SaveScreen.ResetForNewAccount();
            }
            drawpos.Y += (float)(height2 + num3);
            if (info.AllowSave)
            {
                bool flag = !string.IsNullOrWhiteSpace(SaveFileManager.LastLoggedInUser.FileUsername);
                if (Button.doButton(7900019, (int)drawpos.X, (int)drawpos.Y, 450, height2, flag ? "Continue Account : " + SaveFileManager.LastLoggedInUser.Username : "******", new Color?(flag ? MainMenu.buttonColor : Color.Black)))
                {
                    OS.WillLoadSave = true;
                    if (this.LoadAccountForExtension_FileAndUsername != null)
                    {
                        this.LoadAccountForExtension_FileAndUsername(SaveFileManager.LastLoggedInUser.FileUsername, SaveFileManager.LastLoggedInUser.Username);
                    }
                }
                drawpos.Y += (float)(height2 + num3);
                if (Button.doButton(7900020, (int)drawpos.X, (int)drawpos.Y, 450, height2, LocaleTerms.Loc("Login") + "...", new Color?(flag ? MainMenu.buttonColor : Color.Black)))
                {
                    this.State = ExtensionsMenuScreen.EMSState.ShowAccounts;
                    this.SaveScreen.ResetForLogin();
                }
                drawpos.Y += (float)(height2 + num3);
            }
            if (Button.doButton(7900030, (int)drawpos.X, (int)drawpos.Y, 450, height2, LocaleTerms.Loc("Run Verification Tests"), new Color?(MainMenu.buttonColor)))
            {
                int    errorsAdded = 0;
                string str1        = ExtensionTests.TestExtensionForRuntime(screenMan, info.FolderPath, out errorsAdded);
                try
                {
                    ExtensionInfo.VerifyExtensionInfo(info);
                }
                catch (Exception ex)
                {
                    str1 = str1 + "\nExtension Metadata Error:\n" + Utils.GenerateReportFromException(ex);
                    ++errorsAdded;
                }
                if (errorsAdded == 0)
                {
                    this.ReportOverride = LocaleTerms.Loc("Testing...") + "\n" + LocaleTerms.Loc("All tests complete") + "\n0 " + LocaleTerms.Loc("Errors Found");
                }
                else
                {
                    this.ReportOverride = LocaleTerms.Loc("Errors Found") + ". " + string.Format(LocaleTerms.Loc("Writing report to {0}"), (object)(info.FolderPath + "/report.txt\n").Replace("\\", "/")) + str1;
                    string str2 = info.FolderPath + "/report.txt";
                    if (File.Exists(str2))
                    {
                        File.Delete(str2);
                    }
                    Utils.writeToFile(this.ReportOverride, str2);
                }
                MusicManager.transitionToSong("Music/Ambient/AmbientDrone_Clipped");
                ExtensionLoader.ActiveExtensionInfo = this.ExtensionInfoToShow;
            }
            drawpos.Y += (float)(height2 + num3);
            if (Settings.AllowExtensionPublish && PlatformAPISettings.Running)
            {
                if (Button.doButton(7900031, (int)drawpos.X, (int)drawpos.Y, 450, height2, LocaleTerms.Loc("Steam Workshop Publishing"), new Color?(MainMenu.buttonColor)))
                {
                    this.IsInPublishScreen = true;
                }
                drawpos.Y += (float)(height2 + num3);
            }
            if (Button.doButton(7900040, (int)drawpos.X, (int)drawpos.Y, 450, 25, LocaleTerms.Loc("Back to Extension List"), new Color?(MainMenu.exitButtonColor)))
            {
                this.ExtensionInfoToShow = (ExtensionInfo)null;
            }
            drawpos.Y += 30f;
            return(drawpos);
        }
        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);
        }
Пример #16
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);
        }
Пример #17
0
        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);
            try
            {
                PostProcessor.begin();
                this.ScreenManager.FadeBackBufferToBlack((int)byte.MaxValue);
                GuiData.startDraw();
                Rectangle dest1 = new Rectangle(0, 0, this.ScreenManager.GraphicsDevice.Viewport.Width, this.ScreenManager.GraphicsDevice.Viewport.Height);
                Rectangle destinationRectangle = new Rectangle(-20, -20, this.ScreenManager.GraphicsDevice.Viewport.Width + 40, this.ScreenManager.GraphicsDevice.Viewport.Height + 40);
                Rectangle 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);
                if (Settings.DrawHexBackground)
                {
                    this.hexBackground.Draw(dest1, GuiData.spriteBatch, Color.Transparent, Settings.lighterColorHexBackground ? new Color(20, 20, 20) : new Color(15, 15, 15, 0), HexGridBackground.ColoringAlgorithm.NegaitiveSinWash, 0.0f);
                }
                TextItem.DrawShadow = false;
                switch (this.State)
                {
                case MainMenu.MainMenuState.NewUser:
                    this.DrawLoginScreen(dest2, true);
                    break;

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

                case MainMenu.MainMenuState.Extensions:
                    this.DrawBackgroundAndTitle();
                    this.extensionsScreen.Draw(new Rectangle(180, 150, Math.Min(700, dest1.Width / 2), (int)((double)dest1.Height * 0.699999988079071)), GuiData.spriteBatch, this.ScreenManager);
                    break;

                default:
                    if (Settings.isLockedDemoMode)
                    {
                        this.attractModeScreen.Draw(dest1, GuiData.spriteBatch);
                        break;
                    }
                    bool canRun = this.DrawBackgroundAndTitle();
                    if (Settings.isLockedDemoMode)
                    {
                        this.drawDemoModeButtons(canRun);
                    }
                    else
                    {
                        this.drawMainMenuButtons(canRun);
                        if (Settings.testingMenuItemsEnabled)
                        {
                            this.drawTestingMainMenuButtons(canRun);
                        }
                    }
                    break;
                }
                GuiData.endDraw();
                PostProcessor.end();
                this.ScreenManager.FadeBackBufferToBlack((int)byte.MaxValue - (int)this.TransitionAlpha);
            }
            catch (ObjectDisposedException ex)
            {
                if (this.hasSentErrorEmail)
                {
                    throw ex;
                }
                string body = Utils.GenerateReportFromException((Exception)ex) + "\r\n Font:" + (object)this.titleFont + "\r\n White:" + (object)Utils.white + "\r\n WhiteDisposed:" + (object)Utils.white.IsDisposed + "\r\n SmallFont:" + (object)GuiData.smallfont + "\r\n TinyFont:" + (object)GuiData.tinyfont + "\r\n LineEffectTarget:" + FlickeringTextEffect.GetReportString() + "\r\n PostProcessort stuff:" + PostProcessor.GetStatusReportString() + "\r\nRESOLUTION:\r\n " + (object)Game1.getSingleton().GraphicsDevice.PresentationParameters.BackBufferWidth + "x" + (object)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.Adapter.DeviceName + "\r\n Status: " + (object)Game1.getSingleton().GraphicsDevice.GraphicsDeviceStatus;
                Utils.SendRealWorldEmail("Hacknet " + MainMenu.OSVersion + " Crash " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(), "*****@*****.**", body);
                this.hasSentErrorEmail = true;
                SettingsLoader.writeStatusFile();
            }
        }
Пример #18
0
        public void Draw(Rectangle dest, SpriteBatch sb)
        {
            int       width1  = (int)((double)dest.Width * 0.5);
            int       val2    = (int)((double)dest.Height * 0.400000005960464);
            int       val1    = 400;
            bool      flag    = val1 > val2;
            int       height1 = Math.Max(val1, val2);
            Rectangle dest1   = new Rectangle(dest.Width / 2 - width1 / 2, (int)((double)dest.Y + (double)dest.Height / 2.5 - (double)(height1 / 2)), width1, height1);
            Rectangle destinationRectangle1 = new Rectangle(dest.X, dest1.Y + 115 + (flag ? 7 : 0), dest.Width, dest1.Height - 245);

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

            if (Settings.MultiLingualDemo)
            {
                sb.Draw(Utils.white, destinationRectangle2, Color.Black * 0.8f);
                if (Button.doButton(18273302, destinationRectangle2.X, destinationRectangle2.Y, destinationRectangle2.Width, destinationRectangle2.Height, LocaleTerms.Loc("New Session"), new Color?(new Color(124, 137, 149))))
                {
                    LocaleActivator.ActivateLocale("ko-kr", Game1.getSingleton().Content);
                    if (this.Start != null)
                    {
                        this.Start();
                    }
                }
                destinationRectangle2.Y += destinationRectangle2.Height + 12;
                sb.Draw(Utils.white, destinationRectangle2, Color.Black * 0.8f);
                if (Button.doButton(18273304, destinationRectangle2.X, destinationRectangle2.Y, destinationRectangle2.Width, destinationRectangle2.Height, "Hacknet Veterans", new Color?(new Color(124, 137, 149))))
                {
                    LocaleActivator.ActivateLocale("en-us", Game1.getSingleton().Content);
                    if (this.StartDLC != null)
                    {
                        this.StartDLC();
                    }
                }
                destinationRectangle2.Y += destinationRectangle2.Height + 12;
                sb.Draw(Utils.white, destinationRectangle2, Color.Black * 0.8f);
                if (!Button.doButton(18273306, destinationRectangle2.X, destinationRectangle2.Y, destinationRectangle2.Width, destinationRectangle2.Height, "New Session", new Color?(new Color(124, 137, 149))))
                {
                    return;
                }
                LocaleActivator.ActivateLocale("en-us", Game1.getSingleton().Content);
                if (this.Start != null)
                {
                    this.Start();
                }
            }
            else
            {
                sb.Draw(Utils.white, destinationRectangle2, Color.Black * 0.8f);
                if (Button.doButton(18273302, destinationRectangle2.X, destinationRectangle2.Y, destinationRectangle2.Width, destinationRectangle2.Height, LocaleTerms.Loc("New Session"), new Color?(new Color(124, 137, 149))) && this.Start != null)
                {
                    this.Start();
                }
                destinationRectangle2.Y += destinationRectangle2.Height + 12;
                if (Settings.DLCEnabledDemo)
                {
                    sb.Draw(Utils.white, destinationRectangle2, Color.Black * 0.8f);
                    if (Button.doButton(18273303, destinationRectangle2.X, destinationRectangle2.Y, destinationRectangle2.Width, destinationRectangle2.Height, LocaleTerms.Loc("Labyrinths (Hacknet Veterans)"), new Color?(new Color(184, 137, 149))) && this.StartDLC != null)
                    {
                        this.StartDLC();
                    }
                }
            }
        }
Пример #19
0
        private void doConnectHeader()
        {
            var comp = os.connectedComp != null ? os.connectedComp : os.thisComputer;

            x += 20;
            y += 5;
            spriteBatch.Draw(GetComputerImage(comp), new Vector2(x, y), Color.White);
            spriteBatch.DrawString(GuiData.font, "Connected to ", new Vector2(x + 160, y), Color.White);
            y += 40;
            TextItem.doFontLabel(new Vector2(x + 160, y),
                                 os.connectedComp == null ? os.thisComputer.name : os.connectedComp.name, GuiData.font, Color.White,
                                 bounds.Width - 190f, 60f);
            y += 33;
            var str = os.connectedComp == null ? os.thisComputer.ip : os.connectedComp.ip;

            spriteBatch.DrawString(GuiData.smallfont, "@  " + str, new Vector2(x + 160, y), Color.White);
            y += 60;
            if (os.hasConnectionPermission(true))
            {
                y -= 20;
                var empty = Rectangle.Empty;
                empty.X      = bounds.X + 1;
                empty.Y      = y;
                empty.Width  = bounds.Width - 2;
                empty.Height = 20;
                spriteBatch.Draw(Utils.white, empty, os.highlightColor);
                var text    = "You are the Administrator of this System";
                var vector2 = GuiData.UISmallfont.MeasureString(text);
                var pos     = new Vector2(empty.X + empty.Width / 2 - vector2.X / 2f, empty.Y);
                os.postFXDrawActions += () => spriteBatch.DrawString(GuiData.UISmallfont, text, pos, Color.Black);
                if (bounds.Height > 500)
                {
                    y += 40;
                }
                else
                {
                    y += 12;
                }
            }
            if (comp.portsNeededForCrack > 100)
            {
                y += 10;
                var rectangle = new Rectangle(bounds.X + 2, y, bounds.Width - 4, 20);
                var text      = "INVIOABILITY DETECTED";
                var vector2   = GuiData.titlefont.MeasureString(text);
                var num1      = vector2.X / vector2.Y;
                var num2      = 10;
                var width     = (int)(rectangle.Height * (double)num1);
                vector2.Y /= vector2.Y / 20f;
                var num3 = (int)((rectangle.Width - width) / 2.0);
                var destinationRectangle = new Rectangle(rectangle.X, rectangle.Y, num3 - num2, rectangle.Height);
                var dest = new Rectangle(destinationRectangle.X + destinationRectangle.Width + num2,
                                         destinationRectangle.Y, width, rectangle.Height);
                destinationRectangle.Y      += 4;
                destinationRectangle.Height -= 8;
                spriteBatch.Draw(Utils.white, destinationRectangle, Color.Red);
                FlickeringTextEffect.DrawLinedFlickeringText(dest, text, 3f, 0.1f, GuiData.titlefont, os,
                                                             Utils.AddativeWhite, 2);
                destinationRectangle.X = rectangle.X + rectangle.Width - (destinationRectangle.Width + num2) + num2;
                spriteBatch.Draw(Utils.white, destinationRectangle, Color.Red);
                y += 40;
            }
            else
            {
                if (!os.hasConnectionPermission(true))
                {
                    return;
                }
                y += 40;
            }
        }
Пример #20
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));
     }
 }
Пример #21
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);
        }
Пример #22
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);
 }
Пример #23
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();
            }
        }
Пример #24
0
        private void doConnectHeader()
        {
            Computer comp = this.os.connectedComp != null ? this.os.connectedComp : this.os.thisComputer;

            this.x += 20;
            this.y += 5;
            this.spriteBatch.Draw(this.GetComputerImage(comp), new Vector2((float)this.x, (float)this.y), Color.White);
            this.spriteBatch.DrawString(GuiData.font, LocaleTerms.Loc("Connected to") + " ", new Vector2((float)(this.x + 160), (float)this.y), Color.White);
            this.y += 40;
            TextItem.doFontLabel(new Vector2((float)(this.x + 160), (float)this.y), this.os.connectedComp == null ? this.os.thisComputer.name : this.os.connectedComp.name, GuiData.font, new Color?(Color.White), (float)this.bounds.Width - 190f, 60f, false);
            this.y += 33;
            string str  = this.os.connectedComp == null ? this.os.thisComputer.ip : this.os.connectedComp.ip;
            float  num1 = LocaleActivator.ActiveLocaleIsCJK() ? 4f : 0.0f;

            this.spriteBatch.DrawString(GuiData.smallfont, "@  " + str, new Vector2((float)(this.x + 160), (float)this.y + num1), Color.White);
            this.y += 60;
            if (this.os.hasConnectionPermission(true))
            {
                this.y -= 20;
                Rectangle empty = Rectangle.Empty;
                empty.X      = this.bounds.X + 1;
                empty.Y      = this.y;
                empty.Width  = this.bounds.Width - 2;
                empty.Height = 20;
                this.spriteBatch.Draw(Utils.white, empty, this.os.highlightColor);
                string  text    = LocaleTerms.Loc("You are the Administrator of this System");
                Vector2 vector2 = GuiData.UISmallfont.MeasureString(text);
                Vector2 pos     = new Vector2((float)(empty.X + empty.Width / 2) - vector2.X / 2f, (float)empty.Y);
                if (LocaleActivator.ActiveLocaleIsCJK())
                {
                    pos.Y -= 2f;
                }
                this.os.postFXDrawActions += (Action)(() => this.spriteBatch.DrawString(GuiData.UISmallfont, text, pos, Color.Black));
                if (this.bounds.Height > 500)
                {
                    this.y += 40;
                }
                else
                {
                    this.y += 12;
                }
            }
            if (comp.portsNeededForCrack > 100)
            {
                this.y += 10;
                Rectangle rectangle = new Rectangle(this.bounds.X + 2, this.y, this.bounds.Width - 4, 20);
                string    text      = "INVIOLABILITY DETECTED";
                Vector2   vector2   = GuiData.titlefont.MeasureString(text);
                float     num2      = vector2.X / vector2.Y;
                int       num3      = 10;
                int       width     = (int)((double)rectangle.Height * (double)num2);
                vector2.Y /= vector2.Y / 20f;
                int       num4 = (int)((double)(rectangle.Width - width) / 2.0);
                Rectangle destinationRectangle = new Rectangle(rectangle.X, rectangle.Y, num4 - num3, rectangle.Height);
                Rectangle dest = new Rectangle(destinationRectangle.X + destinationRectangle.Width + num3, destinationRectangle.Y, width, rectangle.Height);
                destinationRectangle.Y      += 4;
                destinationRectangle.Height -= 8;
                this.spriteBatch.Draw(Utils.white, destinationRectangle, Color.Red);
                FlickeringTextEffect.DrawLinedFlickeringText(dest, text, 3f, 0.1f, GuiData.titlefont, (object)this.os, Utils.AddativeWhite, 2);
                destinationRectangle.X = rectangle.X + rectangle.Width - (destinationRectangle.Width + num3) + num3;
                this.spriteBatch.Draw(Utils.white, destinationRectangle, Color.Red);
                this.y += 40;
            }
            else
            {
                if (!this.os.hasConnectionPermission(true))
                {
                    return;
                }
                this.y += 40;
            }
        }
Пример #25
0
        private void DrawHoverTooltip(Rectangle bounds, SpriteBatch sb)
        {
            var       announcerWidth = 80f;
            var       num1           = bounds.Height - 80;
            Rectangle rectangle1;

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

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

            for (var index = 0; index < UpgradeNotifiers.Count; ++index)
            {
                var upgradeNotifier = UpgradeNotifiers[index];
                upgradeNotifier.timer -= num2 * 4f;
                if (upgradeNotifier.timer <= 0.0)
                {
                    UpgradeNotifiers.RemoveAt(index);
                    --index;
                }
                else
                {
                    var vector2 = GuiData.font.MeasureString(upgradeNotifier.text);
                    sb.DrawString(GuiData.font, upgradeNotifier.text,
                                  new Vector2(
                                      rectangle1.X + (float)((rectangle1.Width - (double)announcerWidth) / 2.0) + announcerWidth,
                                      rectangle1.Y + 10), ThemeColorHighlight * upgradeNotifier.timer, 0.0f, vector2 / 2f,
                                  (float)(0.5 + (1.0 - upgradeNotifier.timer) * 2.20000004768372), SpriteEffects.None, 0.9f);
                    UpgradeNotifiers[index] = upgradeNotifier;
                }
            }
        }
Пример #26
0
        private void DrawHoverTooltip(Rectangle bounds, SpriteBatch sb)
        {
            float     announcerWidth = 80f;
            int       num            = bounds.Height - 80;
            Rectangle rectangle1;

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

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

            for (int index = 0; index < this.UpgradeNotifiers.Count; ++index)
            {
                PointClickerDaemon.UpgradeNotifier upgradeNotifier = this.UpgradeNotifiers[index];
                upgradeNotifier.timer -= totalSeconds * 4f;
                if ((double)upgradeNotifier.timer <= 0.0)
                {
                    this.UpgradeNotifiers.RemoveAt(index);
                    --index;
                }
                else
                {
                    Vector2 vector2 = GuiData.font.MeasureString(upgradeNotifier.text);
                    sb.DrawString(GuiData.font, upgradeNotifier.text, new Vector2((float)rectangle1.X + (float)(((double)rectangle1.Width - (double)announcerWidth) / 2.0) + announcerWidth, (float)(rectangle1.Y + 10)), this.ThemeColorHighlight * upgradeNotifier.timer, 0.0f, vector2 / 2f, (float)(0.5 + (1.0 - (double)upgradeNotifier.timer) * 2.20000004768372), SpriteEffects.None, 0.9f);
                    this.UpgradeNotifiers[index] = upgradeNotifier;
                }
            }
        }
Пример #27
0
        private static void DrawModExtensionInfo(SpriteBatch sb, ref Vector2 pos, Rectangle rect, ExtensionsMenuScreen ms)
        {
            if (Extension.Handler.ActiveInfo == null)
            {
                return;
            }
            sb.DrawString(GuiData.titlefont, Extension.Handler.ActiveInfo.Name.ToUpper(), pos, Utils.AddativeWhite * 0.66f);
            pos.Y += 80;
            var height = sb.GraphicsDevice.Viewport.Height;
            var num    = 256;

            if (height < 900)
            {
                num = 120;
            }
            var dest2   = new Rectangle((int)pos.X, (int)pos.Y, num, num);
            var texture = ms.DefaultModImage;

            if (Extension.Handler.ModExtensions[Extension.Handler.ActiveInfo.Id].Item2 != null)
            {
                texture = Extension.Handler.ModExtensions[Extension.Handler.ActiveInfo.Id].Item2;
            }
            FlickeringTextEffect.DrawFlickeringSprite(sb, dest2, texture, 2f, 0.5f, null, Color.White);
            var position    = pos + new Vector2(num + 40f, 20f);
            var num2        = rect.Width - (pos.X - rect.X);
            var description = Extension.Handler.ActiveInfo.Description;
            var text        = Utils.SuperSmartTwimForWidth(description, (int)num2, GuiData.smallfont);

            sb.DrawString(GuiData.smallfont, text, position, Utils.AddativeWhite * 0.7f);
            pos = new Vector2(pos.X, pos.Y + num + 10);
            if (ms.IsInPublishScreen)
            {
                sb.DrawString(GuiData.font, "Mod Extensions don't support publishment on the workshop", new Vector2(300), Utils.AddativeWhite);
                if (tickWaits < -1)
                {
                    tickWaits = 10000;
                }
                else if (tickWaits > -1)
                {
                    --tickWaits;
                }
                else
                {
                    ms.IsInPublishScreen = false;
                    tickWaits            = -2;
                }
            }
            else
            {
                if (ms.ReportOverride != null)
                {
                    var text2 = Utils.SuperSmartTwimForWidth(ms.ReportOverride, 800, GuiData.smallfont);
                    sb.DrawString(GuiData.smallfont, text2, pos + new Vector2(460f, 0f),
                                  (ms.ReportOverride.Length > 250) ? Utils.AddativeRed : Utils.AddativeWhite);
                }
                int num3 = 40;
                int num4 = 5;
                int num5 = Extension.Handler.ActiveInfo.AllowSaves ? 4 : 2;
                int num6 = height - (int)pos.Y - 55;
                num3 = Math.Min(num3, (num6 - num5 * num4) / num5);
                if (Gui.Button.doButton(7900010, (int)pos.X, (int)pos.Y, 450, num3, "New " + Extension.Handler.ActiveInfo.Name + " Account",
                                        MainMenu.buttonColor))
                {
                    state = EMSState.GetUsername;
                    ms.SaveScreen.ResetForNewAccount();
                }
                pos.Y += num3 + num4;
                if (Extension.Handler.ActiveInfo.AllowSaves)
                {
                    bool flag = !string.IsNullOrWhiteSpace(SaveFileManager.LastLoggedInUser.FileUsername);
                    if (Gui.Button.doButton(7900019, (int)pos.X, (int)pos.Y, 450, num3,
                                            flag ? ("Continue Account : " + SaveFileManager.LastLoggedInUser.Username) : " - No Accounts - ",
                                            flag ? MainMenu.buttonColor : Color.Black))
                    {
                        OS.WillLoadSave = true;
                        if (ms.LoadAccountForExtension_FileAndUsername != null)
                        {
                            ms.LoadAccountForExtension_FileAndUsername.Invoke(SaveFileManager.LastLoggedInUser.FileUsername,
                                                                              SaveFileManager.LastLoggedInUser.Username);
                        }
                    }
                    pos.Y += num3 + num4;
                    if (Gui.Button.doButton(7900020, (int)pos.X, (int)pos.Y, 450, num3, "Login...", flag ? MainMenu.buttonColor : Color.Black))
                    {
                        state = EMSState.ShowAccounts;
                        ms.SaveScreen.ResetForLogin();
                    }
                    pos.Y += num3 + num4;
                }
                if (Gui.Button.doButton(7900030,
                                        (int)pos.X,
                                        (int)pos.Y,
                                        450,
                                        num3,
                                        "Run Verification Tests",
                                        MainMenu.buttonColor))
                {
                    Logger.Info("Extension verification tests can not be performed on mod extensions");
                }
                pos.Y += num3 + num4;
                if (Settings.AllowExtensionPublish && PlatformAPISettings.Running)
                {
                    ms.IsInPublishScreen |= Gui.Button.doButton(7900031, (int)pos.X, (int)pos.Y, 450, num3, "Steam Workshop Publishing",
                                                                MainMenu.buttonColor);
                    pos.Y += num3 + num4;
                }
                if (Gui.Button.doButton(7900040, (int)pos.X, (int)pos.Y, 450, 25, "Back to Extension List", MainMenu.exitButtonColor))
                {
                    ms.ExtensionInfoToShow       = null;
                    Extension.Handler.ActiveInfo = null;
                }
                pos.Y += 30;
            }
        }