예제 #1
0
파일: Game1.cs 프로젝트: hochladen/Hacknet
 public Game1()
 {
     Game1.OriginalCultureInfo             = CultureInfo.CurrentCulture;
     Game1.culture                         = new CultureInfo("en-US");
     Thread.CurrentThread.CurrentCulture   = Game1.culture;
     Thread.CurrentThread.CurrentUICulture = Game1.culture;
     Game1.threadsExiting                  = false;
     this.graphics                         = new GraphicsDeviceManager((Game)this);
     this.Content.RootDirectory            = "Content";
     this.graphics.DeviceDisposing        += new EventHandler <EventArgs>(this.graphics_DeviceDisposing);
     this.graphics.DeviceResetting        += new EventHandler <EventArgs>(this.graphics_DeviceResetting);
     this.graphics.DeviceReset            += new EventHandler <EventArgs>(this.graphics_DeviceReset);
     PlatformAPISettings.InitPlatformAPI();
     SettingsLoader.checkStatus();
     if (SettingsLoader.didLoad)
     {
         this.CanLoadContent = true;
         this.graphics.PreferredBackBufferWidth  = Math.Min(SettingsLoader.resWidth, 4096);
         this.graphics.PreferredBackBufferHeight = Math.Min(SettingsLoader.resHeight, 4096);
         this.graphics.IsFullScreen        = SettingsLoader.isFullscreen;
         this.graphics.PreferMultiSampling = SettingsLoader.ShouldMultisample;
         if (Settings.StartOnAltMonitor & !SettingsLoader.isFullscreen)
         {
             this.graphics.PreparingDeviceSettings += new EventHandler <PreparingDeviceSettingsEventArgs>(this.graphics_PreparingDeviceSettingsForAltMonitor);
         }
         Console.WriteLine("Loaded Settings - Language Code: " + Settings.ActiveLocale);
     }
     else
     {
         this.graphics.PreferMultiSampling = true;
         if (Settings.windowed)
         {
             this.graphics.PreferredBackBufferWidth  = 1280;
             this.graphics.PreferredBackBufferHeight = 800;
             this.CanLoadContent = true;
         }
         else
         {
             this.graphicsPreparedHandler            = new EventHandler <PreparingDeviceSettingsEventArgs>(this.graphics_PreparingDeviceSettings);
             this.graphics.PreparingDeviceSettings  += this.graphicsPreparedHandler;
             this.graphics.PreferredBackBufferWidth  = 1280;
             this.graphics.PreferredBackBufferHeight = 800;
             this.graphics.IsFullScreen = true;
         }
         this.NeedsSettingsLocaleActivation = true;
         Console.WriteLine("Settings file not found, setting defaults.");
     }
     this.CheckAndFixWindowPosition();
     this.IsMouseVisible  = true;
     this.IsFixedTimeStep = false;
     Game1.singleton      = this;
     this.Exiting        += new EventHandler <EventArgs>(this.handleExit);
     StatsManager.InitStats();
 }
예제 #2
0
 public Game1()
 {
     culture = new CultureInfo("en-US");
     Thread.CurrentThread.CurrentCulture   = culture;
     Thread.CurrentThread.CurrentUICulture = culture;
     threadsExiting = false;
     graphics       = new GraphicsDeviceManager(this)
     {
         GraphicsProfile     = GraphicsProfile.HiDef,
         PreferMultiSampling = true
     };
     graphics.DeviceDisposing += Graphics_DeviceDisposing;
     graphics.DeviceResetting += Graphics_DeviceResetting;
     graphics.DeviceReset     += Graphics_DeviceReset;
     SettingsLoader.checkStatus();
     if (SettingsLoader.didLoad)
     {
         CanLoadContent = true;
         graphics.PreferredBackBufferWidth  = Math.Min(SettingsLoader.resWidth, 4096);
         graphics.PreferredBackBufferHeight = Math.Min(SettingsLoader.resHeight, 4096);
         graphics.IsFullScreen = SettingsLoader.isFullscreen;
     }
     else if (Settings.windowed)
     {
         graphics.PreferredBackBufferWidth  = 1280;
         graphics.PreferredBackBufferHeight = 800;
         CanLoadContent = true;
     }
     else
     {
         graphicsPreparedHandler            = Graphics_PreparingDeviceSettings;
         graphics.PreparingDeviceSettings  += graphicsPreparedHandler;
         graphics.PreferredBackBufferWidth  = 1280;
         graphics.PreferredBackBufferHeight = 800;
         graphics.IsFullScreen = true;
     }
     IsMouseVisible        = true;
     IsFixedTimeStep       = false;
     Content.RootDirectory = "Content";
     singleton             = this;
     Exiting += HandleExit;
     PlatformAPISettings.InitPlatformAPI();
     StatsManager.InitStats();
 }
예제 #3
0
파일: Game1.cs 프로젝트: hochladen/Hacknet
        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);
        }