コード例 #1
0
ファイル: WebServerDaemon.cs プロジェクト: hochladen/Hacknet
        public override void draw(Rectangle bounds, SpriteBatch sb)
        {
            bounds.Height -= 16;
            ++bounds.X;
            bounds.Width -= 2;
            if (this.shouldShow404)
            {
                Vector2 vector2 = new Vector2((float)(bounds.X + 10), (float)(bounds.Y + bounds.Height / 4));
                sb.Draw(Utils.white, new Rectangle(bounds.X, (int)vector2.Y, (int)((double)bounds.Width * 0.7), 80), this.os.highlightColor * 0.3f);
                TextItem.doFontLabel(vector2 + new Vector2(0.0f, 10f), LocaleTerms.Loc("Error 404"), GuiData.font, new Color?(Color.White), float.MaxValue, float.MaxValue, false);
                TextItem.doFontLabel(vector2 + new Vector2(0.0f, 42f), LocaleTerms.Loc("Page not found"), GuiData.smallfont, new Color?(Color.White), float.MaxValue, float.MaxValue, false);
            }
            else
            {
                this.os.postFXDrawActions += (Action)(() => WebRenderer.drawTo(bounds, sb));
            }
            Rectangle rectangle = bounds;

            rectangle.Y     += bounds.Height;
            rectangle.Height = 16;
            bool smallButtonDraw = Button.smallButtonDraw;

            Button.smallButtonDraw = true;
            int width = 200;

            if (Button.doButton(83801, rectangle.X + 1, rectangle.Y + 1, width, rectangle.Height - 2, "HN: " + LocaleTerms.Loc("Exit Web View"), new Color?()))
            {
                this.os.display.command = "connect";
            }
            if (this.os.hasConnectionPermission(false) && Button.doButton(83805, rectangle.X + rectangle.Width - (width + 1), rectangle.Y + 1, width, rectangle.Height - 2, LocaleTerms.Loc("View Source"), new Color?()))
            {
                this.showSourcePressed();
            }
            Button.smallButtonDraw = smallButtonDraw;
        }
コード例 #2
0
        public override void draw(Rectangle bounds, SpriteBatch sb)
        {
            bounds.Height -= 16;
            ++bounds.X;
            bounds.Width -= 2;
            if (shouldShow404)
            {
                var vector2 = new Vector2(bounds.X + 10, bounds.Y + bounds.Height / 4);
                sb.Draw(Utils.white, new Rectangle(bounds.X, (int)vector2.Y, (int)(bounds.Width * 0.7), 80),
                        os.highlightColor * 0.3f);
                TextItem.doFontLabel(vector2 + new Vector2(0.0f, 10f), "Error 404", GuiData.font, Color.White,
                                     float.MaxValue, float.MaxValue);
                TextItem.doFontLabel(vector2 + new Vector2(0.0f, 42f), "Page not found", GuiData.smallfont, Color.White,
                                     float.MaxValue, float.MaxValue);
            }
            else
            {
                os.postFXDrawActions += () => WebRenderer.drawTo(bounds, sb);
            }
            var rectangle = bounds;

            rectangle.Y     += bounds.Height;
            rectangle.Height = 16;
            var flag = Button.smallButtonDraw;

            Button.smallButtonDraw = true;
            var width = 200;

            if (Button.doButton(83801, rectangle.X + 1, rectangle.Y + 1, width, rectangle.Height - 2,
                                "HN: Exit Web View", new Color?()))
            {
                os.display.command = "connect";
            }
            if (os.hasConnectionPermission(false) &&
                Button.doButton(83805, rectangle.X + rectangle.Width - (width + 1), rectangle.Y + 1, width,
                                rectangle.Height - 2, "View Source", new Color?()))
            {
                showSourcePressed();
            }
            Button.smallButtonDraw = flag;
        }