Exemple #1
0
        public virtual void ShowPage(string pageData)
        {
            var str = Directory.GetCurrentDirectory() + "/Content/Web/Cache/HN_OS_WebCache.html";

            Utils.writeToFile(pageData, str);
            WebRenderer.navigateTo(str);
        }
Exemple #2
0
        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;
        }
 public override void LoadContent()
 {
     computers = new List <Texture2D>();
     computers.Add(TextureBank.load("Sprites/CompLogos/Sec0Computer", os.content));
     computers.Add(TextureBank.load("Sprites/CompLogos/Sec1Computer", os.content));
     computers.Add(TextureBank.load("Sprites/CompLogos/Computer", os.content));
     computers.Add(TextureBank.load("Sprites/CompLogos/OldServer", os.content));
     computers.Add(TextureBank.load("Sprites/CompLogos/Sec2Computer", os.content));
     computers.Add(TextureBank.load("Sprites/CompLogos/Sec2Computer", os.content));
     compAltIcons = new Dictionary <string, Texture2D>();
     compAltIcons.Add("laptop", TextureBank.load("Sprites/CompLogos/Laptop", os.content));
     compAltIcons.Add("chip", TextureBank.load("Sprites/CompLogos/chip", os.content));
     compAltIcons.Add("kellis", TextureBank.load("Sprites/CompLogos/KellisCompIcon", os.content));
     compAltIcons.Add("tablet", TextureBank.load("Sprites/CompLogos/Tablet", os.content));
     compAltIcons.Add("ePhone", TextureBank.load("Sprites/CompLogos/Phone1", os.content));
     compAltIcons.Add("ePhone2", TextureBank.load("Sprites/CompLogos/Phone2", os.content));
     defaultComputer   = TextureBank.load("Sprites/CompLogos/Computer", os.content);
     lockSprite        = TextureBank.load("Lock", os.content);
     openLockSprite    = TextureBank.load("OpenLock", os.content);
     fancyCornerSprite = TextureBank.load("Corner", os.content);
     fancyPanelSprite  = TextureBank.load("Panel", os.content);
     tmpRect           = new Rectangle();
     scroll            = Vector2.Zero;
     catScroll         = Vector2.Zero;
     WebRenderer.setSize(bounds.Width, bounds.Height);
 }
Exemple #4
0
 protected void LoadGraphicsContent()
 {
     this.spriteBatch = new SpriteBatch(this.GraphicsDevice);
     if (this.NeedsSettingsLocaleActivation)
     {
         SettingsLoader.ShouldMultisample = this.GraphicsDevice.Adapter.IsProfileSupported(GraphicsProfile.HiDef);
     }
     PostProcessor.init(this.graphics.GraphicsDevice, this.spriteBatch, this.Content);
     WebRenderer.init(this.graphics.GraphicsDevice);
 }
Exemple #5
0
 public static void init(GraphicsDevice gd)
 {
     if (!WebRenderer.Enabled)
     {
         WebRenderer.loadingPage = true;
     }
     else
     {
         WebRenderer.instance    = new WebRenderer();
         WebRenderer.graphics    = gd;
         WebRenderer.loadingPage = true;
     }
 }
Exemple #6
0
 private static void TextureUpdated(IntPtr buffer)
 {
     try
     {
         Marshal.Copy(buffer, WebRenderer.texBuffer, 0, WebRenderer.texBuffer.Length);
         WebRenderer.texture.SetData <byte>(WebRenderer.texBuffer);
         WebRenderer.loadingPage = false;
     }
     catch (AccessViolationException ex)
     {
         Console.WriteLine((object)ex);
         WebRenderer.navigateTo(WebRenderer.url);
     }
 }
Exemple #7
0
        public virtual void ShowPage(string pageData)
        {
            string str = Directory.GetCurrentDirectory() + "/Content/Web/Cache/HN_OS_WebCache.html";

            if (Settings.IsInExtensionMode)
            {
                string path = Path.Combine(Directory.GetCurrentDirectory(), ExtensionLoader.ActiveExtensionInfo.FolderPath, "Web", "Cache");
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                str = path + "/HN_OS_WebCache.html";
            }
            Utils.writeToFile(pageData, str);
            WebRenderer.navigateTo(str);
        }
Exemple #8
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;
        }
Exemple #9
0
 public static void Update(float dt)
 {
     if (ThemeManager.hexGrid != null)
     {
         ThemeManager.hexGrid.Update(dt * 0.4f);
         ThemeManager.hexGrid.HexScale = 0.2f;
     }
     if (ThemeManager.framesTillWebUpdate < 0)
     {
         return;
     }
     --ThemeManager.framesTillWebUpdate;
     if (ThemeManager.framesTillWebUpdate == -1)
     {
         if (OS.currentInstance.connectedComp != null && OS.currentInstance.connectedComp.getDaemon(typeof(WebServerDaemon)) != null)
         {
             WebRenderer.setSize(ThemeManager.webWidth, ThemeManager.webHeight);
         }
         else
         {
             ThemeManager.framesTillWebUpdate = 0;
         }
     }
 }
Exemple #10
0
 protected void LoadGraphicsContent()
 {
     spriteBatch = new SpriteBatch(GraphicsDevice);
     PostProcessor.init(graphics.GraphicsDevice, spriteBatch, Content);
     WebRenderer.init(graphics.GraphicsDevice);
 }
Exemple #11
0
 public static void init(GraphicsDevice gd)
 {
     instance = new WebRenderer();
     graphics = gd;
     loadingPage = true;
 }
Exemple #12
0
 public static void init(GraphicsDevice gd)
 {
     instance    = new WebRenderer();
     graphics    = gd;
     loadingPage = true;
 }
Exemple #13
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);
        }