protected virtual void Dispose(bool disposing) { if (!disposed) { if (disposing) { if (this.starfield != null) this.starfield.Dispose(); if (this.DeepSpaceDone != null) this.DeepSpaceDone.Dispose(); if (this.EmpireDone != null) this.EmpireDone.Dispose(); if (this.DeepSpaceGateKeeper != null) this.DeepSpaceGateKeeper.Dispose(); if (this.ItemsToBuild != null) this.ItemsToBuild.Dispose(); if (this.WorkerBeginEvent != null) this.WorkerBeginEvent.Dispose(); if (this.WorkerCompletedEvent != null) this.WorkerCompletedEvent.Dispose(); if (this.anomalyManager != null) this.anomalyManager.Dispose(); if (this.bloomComponent != null) this.bloomComponent.Dispose(); if (this.ShipGateKeeper != null) this.ShipGateKeeper.Dispose(); if (this.SystemThreadGateKeeper != null) this.SystemThreadGateKeeper.Dispose(); if (this.FogMap != null) this.FogMap.Dispose(); if (this.MasterShipList != null) this.MasterShipList.Dispose(); if (this.EmpireGateKeeper != null) this.EmpireGateKeeper.Dispose(); if (this.BombList != null) this.BombList.Dispose(); if (this.flash != null) this.flash.Dispose(); if (this.lightning != null) this.lightning.Dispose(); if (this.neb_particles != null) this.neb_particles.Dispose(); if (this.photonExplosionParticles != null) this.photonExplosionParticles.Dispose(); if (this.projectileTrailParticles != null) this.projectileTrailParticles.Dispose(); if (this.sceneMap != null) this.sceneMap.Dispose(); if (this.shipListInfoUI != null) this.shipListInfoUI.Dispose(); if (this.smokePlumeParticles != null) this.smokePlumeParticles.Dispose(); if (this.sparks != null) this.sparks.Dispose(); if (this.star_particles != null) this.star_particles.Dispose(); if (this.engineTrailParticles != null) this.engineTrailParticles.Dispose(); if (this.explosionParticles != null) this.explosionParticles.Dispose(); if (this.explosionSmokeParticles != null) this.explosionSmokeParticles.Dispose(); if (this.fireTrailParticles != null) this.fireTrailParticles.Dispose(); if (this.fireParticles != null) this.fireParticles.Dispose(); if (this.flameParticles != null) this.flameParticles.Dispose(); if (this.beamflashes != null) this.beamflashes.Dispose(); if (this.dsbw != null) this.dsbw.Dispose(); if (this.SelectedShipList != null) this.SelectedShipList.Dispose(); if (this.NotificationManager != null) this.NotificationManager.Dispose(); if (this.FogMapTarget != null) this.FogMapTarget.Dispose(); } this.starfield = null; this.DeepSpaceDone = null; this.EmpireDone = null; this.DeepSpaceGateKeeper = null; this.ItemsToBuild = null; this.WorkerBeginEvent = null; this.WorkerCompletedEvent = null; this.anomalyManager = null; this.bloomComponent = null; this.ShipGateKeeper = null; this.SystemThreadGateKeeper = null; this.FogMap = null; this.MasterShipList = null; this.EmpireGateKeeper = null; this.BombList = null; this.flash = null; this.lightning = null; this.neb_particles = null; this.photonExplosionParticles = null; this.projectileTrailParticles = null; this.sceneMap = null; this.shipListInfoUI = null; this.smokePlumeParticles = null; this.sparks = null; this.star_particles = null; this.engineTrailParticles = null; this.explosionParticles = null; this.explosionSmokeParticles = null; this.fireTrailParticles = null; this.fireParticles = null; this.flameParticles = null; this.beamflashes = null; this.dsbw = null; this.SelectedShipList = null; this.NotificationManager = null; this.FogMapTarget = null; } }
public void LoadGraphics() { this.projection = Matrix.CreatePerspectiveFieldOfView(0.7853982f, (float)this.ScreenManager.GraphicsDevice.Viewport.Width / (float)this.ScreenManager.GraphicsDevice.Viewport.Height, 1000f, 3E+07f); this.Frustum = new BoundingFrustum(this.view * this.projection); this.mmHousing = new Rectangle(this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 276, this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 256, 276, 256); this.MinimapDisplayRect = new Rectangle(this.mmHousing.X + 61, this.mmHousing.Y + 43, 200, 200); this.minimap = new MiniMap(this.mmHousing); this.mmButtons = new MinimapButtons(this.mmHousing, this.EmpireUI); this.mmShowBorders = new Rectangle(this.MinimapDisplayRect.X, this.MinimapDisplayRect.Y - 25, 32, 32); this.mmDSBW = new Rectangle(this.mmShowBorders.X + 32, this.mmShowBorders.Y, 64, 32); this.mmAutomation = new Rectangle(this.mmDSBW.X + this.mmDSBW.Width, this.mmShowBorders.Y, 96, 32); this.mmShipView = new Rectangle(this.MinimapDisplayRect.X - 32, this.MinimapDisplayRect.Y, 32, 105); this.mmGalaxyView = new Rectangle(this.mmShipView.X, this.mmShipView.Y + 105, 32, 105); this.SectorMap = new Rectangle(this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 300, this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 150, 150, 150); this.GalaxyMap = new Rectangle(this.SectorMap.X + this.SectorMap.Width, this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 150, 150, 150); this.SelectedStuffRect = new Rectangle(0, this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 247, 407, 242); this.ShipInfoUIElement = new ShipInfoUIElement(this.SelectedStuffRect, this.ScreenManager, this); this.sInfoUI = new SystemInfoUIElement(this.SelectedStuffRect, this.ScreenManager, this); this.pInfoUI = new PlanetInfoUIElement(this.SelectedStuffRect, this.ScreenManager, this); this.shipListInfoUI = new ShipListInfoUIElement(this.SelectedStuffRect, this.ScreenManager, this); this.vuiElement = new VariableUIElement(this.SelectedStuffRect, this.ScreenManager, this); this.SectorSourceRect = new Rectangle((this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 720) / 2, (this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 720) / 2, 720, 720); this.EmpireUI = new EmpireUIOverlay(this.player, this.ScreenManager.GraphicsDevice, this); this.bloomComponent = new BloomComponent(this.ScreenManager); this.bloomComponent.LoadContent(); this.aw = new AutomationWindow(this.ScreenManager, this); PresentationParameters presentationParameters = this.ScreenManager.GraphicsDevice.PresentationParameters; int backBufferWidth = presentationParameters.BackBufferWidth; int backBufferHeight = presentationParameters.BackBufferHeight; SurfaceFormat backBufferFormat = presentationParameters.BackBufferFormat; this.sceneMap = new ResolveTexture2D(this.ScreenManager.GraphicsDevice, backBufferWidth, backBufferHeight, 1, backBufferFormat); this.MainTarget = BloomComponent.CreateRenderTarget(this.ScreenManager.GraphicsDevice, 1, backBufferFormat); this.LightsTarget = BloomComponent.CreateRenderTarget(this.ScreenManager.GraphicsDevice, 1, backBufferFormat); this.MiniMapSector = BloomComponent.CreateRenderTarget(this.ScreenManager.GraphicsDevice, 1, backBufferFormat); this.BorderRT = BloomComponent.CreateRenderTarget(this.ScreenManager.GraphicsDevice, 1, backBufferFormat); this.StencilRT = BloomComponent.CreateRenderTarget(this.ScreenManager.GraphicsDevice, 1, backBufferFormat); string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); if (this.loadFogPath == null) { this.FogMap = ResourceManager.TextureDict["Textures/UniverseFeather"]; } else { using (FileStream fileStream = File.OpenRead(folderPath + "/StarDrive/Saved Games/Fog Maps/" + this.loadFogPath + ".png")) this.FogMap = Texture2D.FromFile(this.ScreenManager.GraphicsDevice, (Stream)fileStream); } this.FogMapTarget = new RenderTarget2D(this.ScreenManager.GraphicsDevice, 512, 512, 1, backBufferFormat, this.ScreenManager.GraphicsDevice.PresentationParameters.MultiSampleType, presentationParameters.MultiSampleQuality); this.basicFogOfWarEffect = this.ScreenManager.Content.Load<Effect>("Effects/BasicFogOfWar"); this.LoadMenu(); MuzzleFlashManager.universeScreen = this; DroneAI.universeScreen = this; MuzzleFlashManager.flashModel = this.ScreenManager.Content.Load<Model>("Model/Projectiles/muzzleEnergy"); MuzzleFlashManager.FlashTexture = this.ScreenManager.Content.Load<Texture2D>("Model/Projectiles/Textures/MuzzleFlash_01"); ExplosionManager.universeScreen = this; FTLManager.universeScreen = this; FTLManager.FTLTexture = this.ScreenManager.Content.Load<Texture2D>("Textures/Ships/FTL"); this.anomalyManager = new AnomalyManager(); ShipDesignScreen.screen = this; Fleet.screen = this; Bomb.screen = this; Anomaly.screen = this; PlanetScreen.screen = this; MinimapButtons.screen = this; Projectile.contentManager = this.ScreenManager.Content; Projectile.universeScreen = this; ShipModule.universeScreen = this; Asteroid.universeScreen = this; Empire.universeScreen = this; SpaceJunk.universeScreen = this; ResourceManager.universeScreen = this; Planet.universeScreen = this; Weapon.universeScreen = this; Ship.universeScreen = this; ArtificialIntelligence.universeScreen = this; MissileAI.universeScreen = this; Moon.universeScreen = this; CombatScreen.universeScreen = this; FleetDesignScreen.screen = this; this.xnaPlanetModel = this.ScreenManager.Content.Load<Model>("Model/SpaceObjects/planet"); this.atmoModel = this.ScreenManager.Content.Load<Model>("Model/sphere"); this.AtmoEffect = this.ScreenManager.Content.Load<Effect>("Effects/PlanetHalo"); this.cloudTex = this.ScreenManager.Content.Load<Texture2D>("Model/SpaceObjects/earthcloudmap"); this.RingTexture = this.ScreenManager.Content.Load<Texture2D>("Model/SpaceObjects/planet_rings"); this.ThrusterEffect = this.ScreenManager.Content.Load<Effect>("Effects/Thrust"); this.listener = new AudioListener(); this.SunModel = this.ScreenManager.Content.Load<Model>("Model/SpaceObjects/star_plane"); this.NebModel = this.ScreenManager.Content.Load<Model>("Model/SpaceObjects/star_plane"); this.ScreenRectangle = new Rectangle(0, 0, this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth, this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight); this.starfield = new Starfield(Vector2.Zero, this.ScreenManager.GraphicsDevice, this.ScreenManager.Content); this.starfield.LoadContent(); //fbedard: new button for ShipsInCombat this.ShipsInCombat = new UIButton(); ShipsInCombat.Rect = new Rectangle(this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 275, this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 280, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"].Height); ShipsInCombat.NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_menu"]; ShipsInCombat.HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_menu_hover"]; ShipsInCombat.PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_menu_pressed"]; ShipsInCombat.Text = "Ships: 0"; ShipsInCombat.Launches = "ShipsInCombat"; //fbedard: new button for PlanetsInCombat this.PlanetsInCombat = new UIButton(); PlanetsInCombat.Rect = new Rectangle(this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 135, this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 280, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"].Height); PlanetsInCombat.NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_menu"]; PlanetsInCombat.HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_menu_hover"]; PlanetsInCombat.PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_menu_pressed"]; PlanetsInCombat.Text = "Planets: 0"; PlanetsInCombat.Launches = "PlanetsInCombat"; }