/// <summary>LoadContent will be called once per game and is the place to load all of your content.</summary> protected override void LoadContent() { base.LoadContent(); // Create a new SpriteBatch, which can be used to draw textures. _spriteBatch = new SpriteBatch(GraphicsDevice); Services.AddService(typeof(SpriteBatch), _spriteBatch); // Tell the console how to render itself. LoadConsole(); // Load generator constraints. FactoryLibrary.LoadContent(Content); // Create the profile implementation. Settings.Instance.CurrentProfile = new Profile(); // Load / create profile. if (Settings.Instance.CurrentProfile.Profiles.Contains(Settings.Instance.CurrentProfileName)) { Settings.Instance.CurrentProfile.Load(Settings.Instance.CurrentProfileName); } else { // TODO: create profile selection screen, show it if no or an invalid profile is active. Settings.Instance.CurrentProfile.Create("Default", Data.PlayerClassType.Default); Settings.Instance.CurrentProfileName = "Default"; Settings.Instance.CurrentProfile.Save(); } // Set up audio data (load wave/sound bank). LoadAudio(); // Set up graphical user interface. LoadGui(); // Set up graphs. LoadGraphs(); }
protected override void Initialize() { if (_content == null) { _content = new PlainContentManager(Services); } if (_batch == null) { _batch = new SpriteBatch(GraphicsDeviceManager.GraphicsDevice); } if (_grid == null) { _grid = new Grid(_content, GraphicsDeviceManager); _grid.LoadContent(); } FactoryLibrary.LoadContent(_content); _manager.AddSystems(new AbstractSystem[] { new AvatarSystem(), new ShipInfoSystem(), new CharacterSystem <AttributeType>(), new VelocitySystem(), new TranslationSystem(), new IndexSystem(16, 1), new ExpirationSystem(), new InventorySystem(), new ItemSlotSystem(), new ItemEffectSystem(), new RegeneratingValueSystem(), new PhysicsSystem(1f / Settings.TicksPerSecond), new GraphicsDeviceSystem(GraphicsDeviceManager), new ContentSystem(_content), new ShipShapeSystem(), new CameraCenteredInterpolationSystem { Enabled = true }, new LocalPlayerSystem(null), new CameraSystem(GraphicsDeviceManager.GraphicsDevice, null), new PlanetMaxBoundsRenderer(_content, GraphicsDeviceManager) { Enabled = true }, new PlanetRenderSystem { Enabled = true }, new SunRenderSystem { Enabled = true }, new CameraCenteredTextureRenderSystem { Enabled = true }, new CameraCenteredParticleEffectSystem(() => 1f) { Enabled = true }, new ShieldRenderSystem { Enabled = true }, new DebugSlotRenderSystem { Enabled = true } }); // Fix position to avoid querying unavailable services. ((CameraSystem)_manager.GetSystem(CameraSystem.TypeId)).CameraPosition = FarPosition.Zero; // Enable debug render systems. _slots = (DebugSlotRenderSystem)_manager.GetSystem(DebugSlotRenderSystem.TypeId); _maxBounds = (PlanetMaxBoundsRenderer)Manager.GetSystem(PlanetMaxBoundsRenderer.TypeId); _shields = (ShieldRenderSystem)Manager.GetSystem(ShieldRenderSystem.TypeId); Clear(); _updateTimer.Enabled = true; _drawTimer.Enabled = true; GraphicsDeviceOnDeviceReset(null, null); GraphicsDeviceManager.GraphicsDevice.DeviceReset += GraphicsDeviceOnDeviceReset; }