public ResearchScreenNew(EmpireUIOverlay empireUI)
 {
     this.empireUI = empireUI;
     base.IsPopup = true;
     base.TransitionOnTime = TimeSpan.FromSeconds(0.25);
     base.TransitionOffTime = TimeSpan.FromSeconds(0.25);
     this.camera = new Camera2d();
 }
 public MinimapButtons(Rectangle r, EmpireUIOverlay eui)
 {
     this.Rect = r;
     Vector2 Cursor = new Vector2((float)(r.X + 11), (float)(r.Y + 13));
     Color baseColor = new Color(34, 42, 56);
     this.home = new SkinnableButton(new Rectangle((int)Cursor.X + 3, (int)Cursor.Y, 15, 16), "UI/icon_home")
     {
         BaseColor = baseColor,
         HoverColor = new Color(140, 88, 50),
         IsToggle = false
     };
     Cursor.Y = Cursor.Y + 25f;
     this.zoom = new SkinnableButton(new Rectangle((int)Cursor.X, (int)Cursor.Y, 22, 22), "UI/icon_minus")
     {
         BaseColor = baseColor,
         HoverColor = new Color(140, 88, 50),
         IsToggle = false
     };
     Cursor.Y = Cursor.Y + 28f;
     this.bDSBW = new SkinnableButton(new Rectangle((int)Cursor.X, (int)Cursor.Y, 22, 17), "UI/icon_dsbw")
     {
         BaseColor = baseColor,
         HoverColor = new Color(140, 88, 50),
         IsToggle = false
     };
     Cursor.Y = Cursor.Y + 28f;
     this.bPlanetsList = new SkinnableButton(new Rectangle((int)Cursor.X, (int)Cursor.Y, 21, 21), "UI/icon_planetslist")
     {
         BaseColor = baseColor,
         HoverColor = new Color(140, 88, 50),
         IsToggle = false
     };
     Cursor.Y = Cursor.Y + 28f;
     this.bShipsList = new SkinnableButton(new Rectangle((int)Cursor.X + 2, (int)Cursor.Y, 18, 19), "UI/icon_shipslist")
     {
         BaseColor = baseColor,
         IsToggle = false,
         HoverColor = new Color(140, 88, 50)
     };
     Cursor.Y = Cursor.Y + 28f;
     this.bFleets = new SkinnableButton(new Rectangle((int)Cursor.X + 2, (int)Cursor.Y, 18, 16), "UI/icon_fleets")
     {
         BaseColor = baseColor,
         HoverColor = new Color(140, 88, 50),
         IsToggle = false
     };
     Cursor.Y = Cursor.Y + 28f;
     this.bAutomation = new SkinnableButton(new Rectangle((int)Cursor.X + 2, (int)Cursor.Y, 15, 12), "UI/icon_automation")
     {
         BaseColor = baseColor,
         IsToggle = false,
         HoverColor = new Color(140, 88, 50)
     };
 }
 public ShipDesignScreen(EmpireUIOverlay EmpireUI)
 {
     this.EmpireUI = EmpireUI;
     base.TransitionOnTime = TimeSpan.FromSeconds(0.25);
 }
        //private bool AutoButtonHover;
        public ShipListScreen(Ship_Game.ScreenManager ScreenManager, EmpireUIOverlay empUI)
        {
            this.empUI = empUI;
            base.TransitionOnTime = TimeSpan.FromSeconds(0.25);
            base.TransitionOffTime = TimeSpan.FromSeconds(0.25);
            base.IsPopup = true;
            this.eui = empUI;
            base.ScreenManager = ScreenManager;
            if (base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth <= 1280)
            {
                //this.LowRes = true;
            }
            Rectangle titleRect = new Rectangle(2, 44, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth * 2 / 3, 80);
            this.TitleBar = new Menu2(ScreenManager, titleRect);
            this.TitlePos = new Vector2((float)(titleRect.X + titleRect.Width / 2) - Fonts.Laserian14.MeasureString(Localizer.Token(190)).X / 2f, (float)(titleRect.Y + titleRect.Height / 2 - Fonts.Laserian14.LineSpacing / 2));
            this.leftRect = new Rectangle(2, titleRect.Y + titleRect.Height + 5, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 10, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - (titleRect.Y + titleRect.Height) - 7);
            this.EMenu = new Menu2(ScreenManager, this.leftRect);
            this.close = new CloseButton(new Rectangle(this.leftRect.X + this.leftRect.Width - 40, this.leftRect.Y + 20, 20, 20));
            this.eRect = new Rectangle(2, titleRect.Y + titleRect.Height + 25, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 40, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - (titleRect.Y + titleRect.Height) - 7);
            while (this.eRect.Height % 80 != 0)
            {
                this.eRect.Height = this.eRect.Height - 1;
            }
            this.ShipSubMenu = new Submenu(ScreenManager, this.eRect);
            this.ShipSL = new ScrollList(this.ShipSubMenu, 30);
            if (EmpireManager.GetEmpireByName(empUI.screen.PlayerLoyalty).GetShips().Count > 0)
            {
                foreach (Ship ship in EmpireManager.GetEmpireByName(empUI.screen.PlayerLoyalty).GetShips())
                {
                    if (!ship.IsPlayerDesign && this.HidePlatforms)
                    {
                        continue;
                    }
                    ShipListScreenEntry entry = new ShipListScreenEntry(ship, this.eRect.X + 22, this.leftRect.Y + 20, this.EMenu.Menu.Width - 30, 30, this);
                    this.ShipSL.AddItem(entry);
                }
                if (this.ShipSL.Entries.Count<ScrollList.Entry>() > 0)
                {
                    this.SelectedShip = (this.ShipSL.Entries[this.ShipSL.indexAtTop].item as ShipListScreenEntry).ship;
                }
                else
                    this.SelectedShip = null;
            }
            Ref<bool> aeRef = new Ref<bool>(() => this.HidePlatforms, (bool x) => {
                this.HidePlatforms = x;
               this.ResetList(this.ShowRoles.Options[this.ShowRoles.ActiveIndex].@value);
            });
            this.cb_hide_proj = new Checkbox(new Vector2((float)(this.TitleBar.Menu.X + this.TitleBar.Menu.Width + 10), (float)(this.TitleBar.Menu.Y + 15)), Localizer.Token(191), aeRef, Fonts.Arial12Bold);
            this.ShowRoles = new DropOptions(new Rectangle(this.TitleBar.Menu.X + this.TitleBar.Menu.Width + 175, this.TitleBar.Menu.Y + 15, 175, 18));
            this.ShowRoles.AddOption("All Ships", 1);
            this.ShowRoles.AddOption("Fighters", 2);
            this.ShowRoles.AddOption("Corvettes", 10);
            this.ShowRoles.AddOption("Frigates", 3);
            this.ShowRoles.AddOption("Cruisers", 4);
            this.ShowRoles.AddOption("Capitals", 5);
            this.ShowRoles.AddOption("Civilian", 8);
            this.ShowRoles.AddOption("All Structures", 9);
            this.ShowRoles.AddOption("Fleets Only", 6);

            // Replaced using the tick-box for player design filtering. Platforms now can be browsed with 'structures'
            // this.ShowRoles.AddOption("Player Designs Only", 7);

            this.AutoButton = new Rectangle(0, 0, 243, 33);
            this.SortSystem = new SortButton(this.empUI.empire.data.SLSort,Localizer.Token(192));
            this.SortName = new SortButton(this.empUI.empire.data.SLSort, Localizer.Token(193));
            this.SortRole = new SortButton(this.empUI.empire.data.SLSort,Localizer.Token(194));
            //Localizer.Token(193)
            this.Maint = new SortButton(this.empUI.empire.data.SLSort, "maint");
            this.SB_FTL = new SortButton(this.empUI.empire.data.SLSort, "FTL");
            this.SB_STL = new SortButton(this.empUI.empire.data.SLSort, "STL");
            this.SB_Troop = new SortButton(this.empUI.empire.data.SLSort, "Troop");
            this.SB_STR = new SortButton(this.empUI.empire.data.SLSort, "STR");
            //this.Maint.rect = this.MaintRect;
            ResetList(1);  //fbedard: initial filter
        }
 public override void ExitScreen()
 {
     if (this.MultiThread)
     {
     //    this.ShipUpdateThread.Abort();
         this.WorkerThread.Abort();
         foreach (Thread thread in this.SystemUpdateThreadList)
             thread.Abort();
     }
     this.EmpireUI.empire = (Empire)null;
     this.EmpireUI = (EmpireUIOverlay)null;
     UniverseScreen.DeepSpaceManager.CollidableObjects.Clear();
     UniverseScreen.DeepSpaceManager.CollidableProjectiles.Clear();
     UniverseScreen.ShipSpatialManager.CollidableObjects.Clear();
     this.ScreenManager.Music.Stop(AudioStopOptions.Immediate);
     this.NebulousShit.Clear();
     this.bloomComponent = (BloomComponent)null;
     this.bg3d.BGItems.Clear();
     this.bg3d = (Background3D)null;
     this.playerShip = (Ship)null;
     this.ShipToView = (Ship)null;
     foreach (Ship ship in (List<Ship>)this.MasterShipList)
         ship.TotallyRemove();
     this.MasterShipList.ApplyPendingRemovals();
     this.MasterShipList.Clear();
     foreach (SolarSystem solarSystem in UniverseScreen.SolarSystemList)
     {
         solarSystem.spatialManager.CollidableProjectiles.Clear();
         solarSystem.spatialManager.CollidableObjects.Clear();
         solarSystem.spatialManager.ClearBuckets();
         solarSystem.spatialManager.Destroy();
         solarSystem.spatialManager = (SpatialManager)null;
         solarSystem.FiveClosestSystems.Clear();
         foreach (Planet planet in solarSystem.PlanetList)
         {
             planet.TilesList = new List<PlanetGridSquare>();
             if (planet.SO != null)
             {
                 planet.SO.Clear();
                 this.ScreenManager.inter.ObjectManager.Remove((ISceneObject)planet.SO);
                 planet.SO = (SceneObject)null;
             }
         }
         foreach (Asteroid asteroid in (List<Asteroid>)solarSystem.AsteroidsList)
         {
             if (asteroid.GetSO() != null)
             {
                 asteroid.GetSO().Clear();
                 this.ScreenManager.inter.ObjectManager.Remove((ISceneObject)asteroid.GetSO());
             }
         }
         solarSystem.AsteroidsList.Clear();
         foreach (Moon moon in solarSystem.MoonList)
         {
             if (moon.GetSO() != null)
             {
                 moon.GetSO().Clear();
                 this.ScreenManager.inter.ObjectManager.Remove((ISceneObject)moon.GetSO());
             }
         }
         solarSystem.MoonList.Clear();
     }
     foreach (Empire empire in EmpireManager.EmpireList)
         empire.CleanOut();
     foreach (SpaceJunk spaceJunk in (List<SpaceJunk>)UniverseScreen.JunkList)
     {
         spaceJunk.trailEmitter = (ParticleEmitter)null;
         spaceJunk.JunkSO.Clear();
         this.ScreenManager.inter.ObjectManager.Remove((ISceneObject)spaceJunk.JunkSO);
         spaceJunk.JunkSO = (SceneObject)null;
     }
     UniverseScreen.JunkList.Clear();
     this.SelectedShip = (Ship)null;
     this.SelectedFleet = (Fleet)null;
     this.SelectedPlanet = (Planet)null;
     this.SelectedSystem = (SolarSystem)null;
     ShieldManager.shieldList.Clear();
     ShieldManager.PlanetaryShieldList.Clear();
     this.PlanetsDict.Clear();
     this.ClickableFleetsList.Clear();
     this.ClickableShipsList.Clear();
     this.ClickPlanetList.Clear();
     this.ClickableSystems.Clear();
     UniverseScreen.DeepSpaceManager.ClearBuckets();
     UniverseScreen.DeepSpaceManager.CollidableObjects.Clear();
     UniverseScreen.DeepSpaceManager.CollidableObjects.Clear();
     UniverseScreen.DeepSpaceManager.CollidableProjectiles.Clear();
     UniverseScreen.DeepSpaceManager.ClearBuckets();
     UniverseScreen.DeepSpaceManager.Destroy();
     UniverseScreen.DeepSpaceManager = (SpatialManager)null;
     UniverseScreen.SolarSystemList.Clear();
     this.starfield.UnloadContent();
     this.starfield.Dispose();
     UniverseScreen.SolarSystemList.Clear();
     this.beamflashes.UnloadContent();
     this.explosionParticles.UnloadContent();
     this.photonExplosionParticles.UnloadContent();
     this.explosionSmokeParticles.UnloadContent();
     this.projectileTrailParticles.UnloadContent();
     this.fireTrailParticles.UnloadContent();
     this.smokePlumeParticles.UnloadContent();
     this.fireParticles.UnloadContent();
     this.engineTrailParticles.UnloadContent();
     this.flameParticles.UnloadContent();
     this.sparks.UnloadContent();
     this.lightning.UnloadContent();
     this.flash.UnloadContent();
     this.star_particles.UnloadContent();
     this.neb_particles.UnloadContent();
     this.SolarSystemDict.Clear();
     ShipDesignScreen.screen = (UniverseScreen)null;
     Fleet.screen = (UniverseScreen)null;
     Bomb.screen = (UniverseScreen)null;
     Anomaly.screen = (UniverseScreen)null;
     PlanetScreen.screen = (UniverseScreen)null;
     MinimapButtons.screen = (UniverseScreen)null;
     Projectile.contentManager = this.ScreenManager.Content;
     Projectile.universeScreen = (UniverseScreen)null;
     ShipModule.universeScreen = (UniverseScreen)null;
     Asteroid.universeScreen = (UniverseScreen)null;
     Empire.universeScreen = (UniverseScreen)null;
     SpaceJunk.universeScreen = (UniverseScreen)null;
     ResourceManager.universeScreen = (UniverseScreen)null;
     Planet.universeScreen = (UniverseScreen)null;
     Weapon.universeScreen = (UniverseScreen)null;
     Ship.universeScreen = (UniverseScreen)null;
     ArtificialIntelligence.universeScreen = (UniverseScreen)null;
     MissileAI.universeScreen = (UniverseScreen)null;
     Moon.universeScreen = (UniverseScreen)null;
     CombatScreen.universeScreen = (UniverseScreen)null;
     MuzzleFlashManager.universeScreen = (UniverseScreen)null;
     FleetDesignScreen.screen = (UniverseScreen)null;
     ExplosionManager.universeScreen = (UniverseScreen)null;
     FTLManager.universeScreen = (UniverseScreen)null;
     DroneAI.universeScreen = (UniverseScreen)null;
     StatTracker.SnapshotsDict.Clear();
     EmpireManager.EmpireList.Clear();
     this.ScreenManager.inter.Unload();
     //GC.Collect(2, GCCollectionMode.Optimized);
     this.Dispose();
     base.ExitScreen();
 }
        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";
        }
        public EmpireScreen(Ship_Game.ScreenManager ScreenManager, EmpireUIOverlay empUI)
        {
            base.TransitionOnTime = TimeSpan.FromSeconds(0.25);
            base.TransitionOffTime = TimeSpan.FromSeconds(0.25);
            base.IsPopup = true;
            this.eui = empUI;
            base.ScreenManager = ScreenManager;
            if (base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth <= 1280)
            {
                //this.LowRes = true;
            }

            Rectangle titleRect = new Rectangle(2, 44, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth * 2 / 3, 80);
            this.TitleBar = new Menu2(ScreenManager, titleRect);
            this.TitlePos = new Vector2((float)(titleRect.X + titleRect.Width / 2) - Fonts.Laserian14.MeasureString(Localizer.Token(383)).X / 2f, (float)(titleRect.Y + titleRect.Height / 2 - Fonts.Laserian14.LineSpacing / 2));
            this.leftRect = new Rectangle(2, titleRect.Y + titleRect.Height + 5, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 10, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - (titleRect.Y + titleRect.Height) - 7);
            this.close = new CloseButton(new Rectangle(this.leftRect.X + this.leftRect.Width - 40, this.leftRect.Y + 20, 20, 20));
            this.EMenu = new Menu2(ScreenManager, this.leftRect);
            this.eRect = new Rectangle(2, titleRect.Y + titleRect.Height + 25, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 40, (int)(0.66f * (float)(ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - (titleRect.Y + titleRect.Height) - 7)));
            while (this.eRect.Height % 80 != 0)
            {
                this.eRect.Height = this.eRect.Height - 1;
            }
            this.ColonySubMenu = new Submenu(ScreenManager, this.eRect);
            this.ColoniesList = new ScrollList(this.ColonySubMenu, 80);
            //if (!this.firstSort || this.pop.Ascending !=true)
            {
                foreach (Planet p in EmpireManager.GetEmpireByName(empUI.screen.PlayerLoyalty).GetPlanets())
                {
                    EmpireScreenEntry entry = new EmpireScreenEntry(p, this.eRect.X + 22, this.leftRect.Y + 20, this.EMenu.Menu.Width - 30, 80, this);
                    this.ColoniesList.AddItem(entry);
                }
            }
            this.pop = new SortButton(this.eui.empire.data.ESSort, "pop");
            this.food = new SortButton(this.eui.empire.data.ESSort, "food");
            this.prod = new SortButton(this.eui.empire.data.ESSort, "prod");
            this.res = new SortButton(this.eui.empire.data.ESSort, "res");
            this.money = new SortButton(this.eui.empire.data.ESSort, "money");
            this.SelectedPlanet = (this.ColoniesList.Entries[this.ColoniesList.indexAtTop].item as EmpireScreenEntry).p;
            this.GovernorDropdown = new DropOptions(new Rectangle(0, 0, 100, 18));
            this.GovernorDropdown.AddOption("--", 1);
            this.GovernorDropdown.AddOption(Localizer.Token(4064), 0);
            this.GovernorDropdown.AddOption(Localizer.Token(4065), 2);
            this.GovernorDropdown.AddOption(Localizer.Token(4066), 4);
            this.GovernorDropdown.AddOption(Localizer.Token(4067), 3);
            this.GovernorDropdown.AddOption(Localizer.Token(4068), 5);
            this.GovernorDropdown.AddOption(Localizer.Token(393), 6);
            this.GovernorDropdown.ActiveIndex = ColonyScreen.GetIndex(this.SelectedPlanet);
            if (this.GovernorDropdown.Options[this.GovernorDropdown.ActiveIndex].@value != (int)this.SelectedPlanet.colonyType)
            {
                this.SelectedPlanet.colonyType = (Planet.ColonyType)this.GovernorDropdown.Options[this.GovernorDropdown.ActiveIndex].@value;
                if (this.SelectedPlanet.colonyType != Planet.ColonyType.Colony)
                {
                    this.SelectedPlanet.FoodLocked = true;
                    this.SelectedPlanet.ProdLocked = true;
                    this.SelectedPlanet.ResLocked = true;
                    this.SelectedPlanet.GovernorOn = true;
                }
                else
                {
                    this.SelectedPlanet.GovernorOn = false;
                    this.SelectedPlanet.FoodLocked = false;
                    this.SelectedPlanet.ProdLocked = false;
                    this.SelectedPlanet.ResLocked = false;
                }
            }
            this.AutoButton = new Rectangle(0, 0, 140, 33);
            this.firstSort = true;
        }
        public ColonyScreen(Planet p, Ship_Game.ScreenManager ScreenManager, EmpireUIOverlay empUI)
        {
            this.eui = empUI;
            this.ScreenManager = ScreenManager;
            this.p = p;
            if (this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth <= 1366)
                this.LowRes = true;
            Rectangle theMenu1 = new Rectangle(2, 44, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth * 2 / 3, 80);
            this.TitleBar = new Menu2(ScreenManager, theMenu1);
            this.LeftColony = new ToggleButton(new Rectangle(theMenu1.X + 25, theMenu1.Y + 24, 14, 35), "SelectionBox/button_arrow_left", "SelectionBox/button_arrow_left", "SelectionBox/button_arrow_left_hover", "SelectionBox/button_arrow_left_hover", "");
            this.RightColony = new ToggleButton(new Rectangle(theMenu1.X + theMenu1.Width - 39, theMenu1.Y + 24, 14, 35), "SelectionBox/button_arrow_right", "SelectionBox/button_arrow_right", "SelectionBox/button_arrow_right_hover", "SelectionBox/button_arrow_right_hover", "");
            this.TitlePos = new Vector2((float)(theMenu1.X + theMenu1.Width / 2) - Fonts.Laserian14.MeasureString("Colony Overview").X / 2f, (float)(theMenu1.Y + theMenu1.Height / 2 - Fonts.Laserian14.LineSpacing / 2));
            Rectangle theMenu2 = new Rectangle(2, theMenu1.Y + theMenu1.Height + 5, theMenu1.Width, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - (theMenu1.Y + theMenu1.Height) - 7);
            this.LeftMenu = new Menu1(ScreenManager, theMenu2);
            Rectangle theMenu3 = new Rectangle(theMenu1.X + theMenu1.Width + 10, theMenu1.Y, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 3 - 15, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - theMenu1.Y - 2);
            this.RightMenu = new Menu1(ScreenManager, theMenu3);
            this.MoneyRect = new Rectangle(theMenu2.X + theMenu2.Width - 75, theMenu2.Y + 20, ResourceManager.TextureDict["NewUI/icon_money"].Width, ResourceManager.TextureDict["NewUI/icon_money"].Height);
            this.close = new CloseButton(new Rectangle(theMenu3.X + theMenu3.Width - 52, theMenu3.Y + 22, 20, 20));
            Rectangle theMenu4 = new Rectangle(theMenu2.X + 20, theMenu2.Y + 20, (int)(0.400000005960464 * (double)theMenu2.Width), (int)(0.25 * (double)(theMenu2.Height - 80)));
            this.PlanetInfo = new Submenu(ScreenManager, theMenu4);
            this.PlanetInfo.AddTab(Localizer.Token(326));
            Rectangle theMenu5 = new Rectangle(theMenu2.X + 20, theMenu2.Y + 20 + theMenu4.Height, (int)(0.400000005960464 * (double)theMenu2.Width), (int)(0.25 * (double)(theMenu2.Height - 80)));
            this.pDescription = new Submenu(ScreenManager, theMenu5);
            Rectangle theMenu6 = new Rectangle(theMenu2.X + 20, theMenu2.Y + 20 + theMenu4.Height + theMenu5.Height + 20, (int)(0.400000005960464 * (double)theMenu2.Width), (int)(0.25 * (double)(theMenu2.Height - 80)));
            this.pLabor = new Submenu(ScreenManager, theMenu6);
            this.pLabor.AddTab(Localizer.Token(327));
            float num1 = (float)(int)((double)theMenu6.Width * 0.600000023841858);
            while ((double)num1 % 10.0 != 0.0)
                ++num1;
            Rectangle rectangle1 = new Rectangle(theMenu6.X + 60, theMenu6.Y + 25 + (int)(0.25 * (double)(theMenu6.Height - 25)), (int)num1, 6);
            this.SliderFood = new ColonyScreen.Slider();
            this.SliderFood.sRect = rectangle1;
            this.SliderFood.amount = p.FarmerPercentage;
            this.FoodLock = new ColonyScreen.Lock();
            this.FoodLock.LockRect = new Rectangle(this.SliderFood.sRect.X + this.SliderFood.sRect.Width + 50, this.SliderFood.sRect.Y + 2 + this.SliderFood.sRect.Height / 2 - ResourceManager.TextureDict[this.FoodLock.Path].Height / 2, ResourceManager.TextureDict[this.FoodLock.Path].Width, ResourceManager.TextureDict[this.FoodLock.Path].Height);
            if (p.Owner != null && p.Owner.data.Traits.Cybernetic > 0)
                p.FoodLocked = true;
            this.FoodLock.Locked = p.FoodLocked;
            Rectangle rectangle2 = new Rectangle(theMenu6.X + 60, theMenu6.Y + 25 + (int)(0.5 * (double)(theMenu6.Height - 25)), (int)num1, 6);
            this.SliderProd = new ColonyScreen.Slider();
            this.SliderProd.sRect = rectangle2;
            this.SliderProd.amount = p.WorkerPercentage;
            this.ProdLock = new ColonyScreen.Lock();
            this.ProdLock.LockRect = new Rectangle(this.SliderFood.sRect.X + this.SliderFood.sRect.Width + 50, this.SliderProd.sRect.Y + 2 + this.SliderFood.sRect.Height / 2 - ResourceManager.TextureDict[this.FoodLock.Path].Height / 2, ResourceManager.TextureDict[this.FoodLock.Path].Width, ResourceManager.TextureDict[this.FoodLock.Path].Height);
            this.ProdLock.Locked = p.ProdLocked;
            Rectangle rectangle3 = new Rectangle(theMenu6.X + 60, theMenu6.Y + 25 + (int)(0.75 * (double)(theMenu6.Height - 25)), (int)num1, 6);
            this.SliderRes = new ColonyScreen.Slider();
            this.SliderRes.sRect = rectangle3;
            this.SliderRes.amount = p.ResearcherPercentage;
            this.ResLock = new ColonyScreen.Lock();
            this.ResLock.LockRect = new Rectangle(this.SliderFood.sRect.X + this.SliderFood.sRect.Width + 50, this.SliderRes.sRect.Y + 2 + this.SliderFood.sRect.Height / 2 - ResourceManager.TextureDict[this.FoodLock.Path].Height / 2, ResourceManager.TextureDict[this.FoodLock.Path].Width, ResourceManager.TextureDict[this.FoodLock.Path].Height);
            this.ResLock.Locked = p.ResLocked;
            Rectangle theMenu7 = new Rectangle(theMenu2.X + 20, theMenu2.Y + 20 + theMenu4.Height + theMenu5.Height + theMenu6.Height + 40, (int)(0.400000005960464 * (double)theMenu2.Width), (int)(0.25 * (double)(theMenu2.Height - 80)));
            this.pStorage = new Submenu(ScreenManager, theMenu7);
            this.pStorage.AddTab(Localizer.Token(328));
            this.eui.screen.ShipsInCombat.Active = false;
            this.eui.screen.PlanetsInCombat.Active = false;

            if (GlobalStats.HardcoreRuleset)
            {
                int num2 = (theMenu7.Width - 40) / 4;
                this.ResourceButtons.Add(new ThreeStateButton(p.fs, "Food", new Vector2((float)(theMenu7.X + 20), (float)(theMenu7.Y + 30))));
                this.ResourceButtons.Add(new ThreeStateButton(p.ps, "Production", new Vector2((float)(theMenu7.X + 20 + num2), (float)(theMenu7.Y + 30))));
                this.ResourceButtons.Add(new ThreeStateButton(Planet.GoodState.EXPORT, "Fissionables", new Vector2((float)(theMenu7.X + 20 + num2 * 2), (float)(theMenu7.Y + 30))));
                this.ResourceButtons.Add(new ThreeStateButton(Planet.GoodState.EXPORT, "ReactorFuel", new Vector2((float)(theMenu7.X + 20 + num2 * 3), (float)(theMenu7.Y + 30))));
            }
            else
            {
                this.FoodStorage = new ProgressBar(new Rectangle(theMenu7.X + 100, theMenu7.Y + 25 + (int)(0.330000013113022 * (double)(theMenu7.Height - 25)), (int)(0.400000005960464 * (double)theMenu7.Width), 18));
                this.FoodStorage.Max = p.MAX_STORAGE;
                this.FoodStorage.Progress = p.FoodHere;
                this.FoodStorage.color = "green";
                this.foodDropDown = this.LowRes ? new DropDownMenu(new Rectangle(theMenu7.X + 90 + (int)(0.400000005960464 * (double)theMenu7.Width) + 20, this.FoodStorage.pBar.Y + this.FoodStorage.pBar.Height / 2 - 9, (int)(0.200000002980232 * (double)theMenu7.Width), 18)) : new DropDownMenu(new Rectangle(theMenu7.X + 100 + (int)(0.400000005960464 * (double)theMenu7.Width) + 20, this.FoodStorage.pBar.Y + this.FoodStorage.pBar.Height / 2 - 9, (int)(0.200000002980232 * (double)theMenu7.Width), 18));
                this.foodDropDown.AddOption(Localizer.Token(329));
                this.foodDropDown.AddOption(Localizer.Token(330));
                this.foodDropDown.AddOption(Localizer.Token(331));
                this.foodDropDown.ActiveIndex = (int)p.fs;
                this.foodStorageIcon = new Rectangle(theMenu7.X + 20, this.FoodStorage.pBar.Y + this.FoodStorage.pBar.Height / 2 - ResourceManager.TextureDict["NewUI/icon_storage_food"].Height / 2, ResourceManager.TextureDict["NewUI/icon_storage_food"].Width, ResourceManager.TextureDict["NewUI/icon_storage_food"].Height);
                this.ProdStorage = new ProgressBar(new Rectangle(theMenu7.X + 100, theMenu7.Y + 25 + (int)(0.660000026226044 * (double)(theMenu7.Height - 25)), (int)(0.400000005960464 * (double)theMenu7.Width), 18));
                this.ProdStorage.Max = p.MAX_STORAGE;
                this.ProdStorage.Progress = p.ProductionHere;
                this.profStorageIcon = new Rectangle(theMenu7.X + 20, this.ProdStorage.pBar.Y + this.ProdStorage.pBar.Height / 2 - ResourceManager.TextureDict["NewUI/icon_storage_food"].Height / 2, ResourceManager.TextureDict["NewUI/icon_storage_production"].Width, ResourceManager.TextureDict["NewUI/icon_storage_food"].Height);
                this.prodDropDown = this.LowRes ? new DropDownMenu(new Rectangle(theMenu7.X + 90 + (int)(0.400000005960464 * (double)theMenu7.Width) + 20, this.ProdStorage.pBar.Y + this.FoodStorage.pBar.Height / 2 - 9, (int)(0.200000002980232 * (double)theMenu7.Width), 18)) : new DropDownMenu(new Rectangle(theMenu7.X + 100 + (int)(0.400000005960464 * (double)theMenu7.Width) + 20, this.ProdStorage.pBar.Y + this.FoodStorage.pBar.Height / 2 - 9, (int)(0.200000002980232 * (double)theMenu7.Width), 18));
                this.prodDropDown.AddOption(Localizer.Token(329));
                this.prodDropDown.AddOption(Localizer.Token(330));
                this.prodDropDown.AddOption(Localizer.Token(331));
                this.prodDropDown.ActiveIndex = (int)p.ps;
            }
            Rectangle theMenu8 = new Rectangle(theMenu2.X + 20 + theMenu4.Width + 20, theMenu4.Y, theMenu2.Width - 60 - theMenu4.Width, (int)((double)theMenu2.Height * 0.5));
            this.subColonyGrid = new Submenu(ScreenManager, theMenu8);
            this.subColonyGrid.AddTab(Localizer.Token(332));
            Rectangle theMenu9 = new Rectangle(theMenu2.X + 20 + theMenu4.Width + 20, theMenu8.Y + theMenu8.Height + 20, theMenu2.Width - 60 - theMenu4.Width, theMenu2.Height - 20 - theMenu8.Height - 40);
            this.pFacilities = new Submenu(ScreenManager, theMenu9);
            this.pFacilities.AddTab(Localizer.Token(333));
            this.launchTroops = new UIButton();
            this.launchTroops.Rect = new Rectangle(theMenu9.X + theMenu9.Width - 175, theMenu9.Y - 5, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height);
            this.launchTroops.NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"];
            this.launchTroops.HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_hover"];
            this.launchTroops.PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_pressed"];
            this.launchTroops.Text = "Launch Troops";
            this.launchTroops.Launches = "Launch Troops";

            //fbedard: Add Send Troops button
            this.SendTroops = new UIButton();
            this.SendTroops.Rect = new Rectangle(theMenu9.X + theMenu9.Width - this.launchTroops.Rect.Width - 185, theMenu9.Y - 5, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height);
            this.SendTroops.NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"];
            this.SendTroops.HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_hover"];
            this.SendTroops.PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_pressed"];
            this.SendTroops.Text = "Send Troops";
            this.SendTroops.Launches = "Send Troops";

            this.CommoditiesSL = new ScrollList(this.pFacilities, 40);
            Rectangle theMenu10 = new Rectangle(theMenu3.X + 20, theMenu3.Y + 20, theMenu3.Width - 40, (int)(0.5 * (double)(theMenu3.Height - 60)));
            this.build = new Submenu(ScreenManager, theMenu10);
            this.build.AddTab(Localizer.Token(334));
            this.buildSL = new ScrollList(this.build);
            this.playerDesignsToggle = new ToggleButton(new Rectangle(this.build.Menu.X + this.build.Menu.Width - 270, this.build.Menu.Y, 29, 20), "SelectionBox/button_grid_active", "SelectionBox/button_grid_inactive", "SelectionBox/button_grid_hover", "SelectionBox/button_grid_pressed", "SelectionBox/icon_grid");
            this.playerDesignsToggle.Active = GlobalStats.ShowAllDesigns;
            if (p.HasShipyard)
                this.build.AddTab(Localizer.Token(335));
            if (p.AllowInfantry)
                this.build.AddTab(Localizer.Token(336));
            Rectangle theMenu11 = new Rectangle(theMenu3.X + 20, theMenu3.Y + 20 + 20 + theMenu10.Height, theMenu3.Width - 40, theMenu3.Height - 40 - theMenu10.Height - 20 - 3);
            this.queue = new Submenu(ScreenManager, theMenu11);
            this.queue.AddTab(Localizer.Token(337));
            this.QSL = new ScrollList(this.queue);
            this.QSL.IsDraggable = true;
            this.PlanetIcon = new Rectangle(theMenu4.X + theMenu4.Width - 148, theMenu4.Y + (theMenu4.Height - 25) / 2 - 64 + 25, 128, 128);
            this.gridPos = new Rectangle(this.subColonyGrid.Menu.X + 10, this.subColonyGrid.Menu.Y + 30, this.subColonyGrid.Menu.Width - 20, this.subColonyGrid.Menu.Height - 35);
            int width = this.gridPos.Width / 7;
            int height = this.gridPos.Height / 5;
            foreach (PlanetGridSquare planetGridSquare in p.TilesList)
                planetGridSquare.ClickRect = new Rectangle(this.gridPos.X + planetGridSquare.x * width, this.gridPos.Y + planetGridSquare.y * height, width, height);
            this.PlanetName.Text = p.Name;
            this.PlanetName.MaxCharacters = 12;
            if (p.Owner != null)
            {
                this.shipsCanBuildLast = p.Owner.ShipsWeCanBuild.Count;
                this.buildingsHereLast = p.BuildingList.Count;
                this.buildingsCanBuildLast = this.BuildingsCanBuild.Count;
                this.detailInfo = (object)p.Description;
                Rectangle rectangle4 = new Rectangle(this.pDescription.Menu.X + 10, this.pDescription.Menu.Y + 30, 124, 148);
                Rectangle rectangle5 = new Rectangle(rectangle4.X + rectangle4.Width + 20, rectangle4.Y + rectangle4.Height - 15, (int)Fonts.Pirulen16.MeasureString(Localizer.Token(370)).X, Fonts.Pirulen16.LineSpacing);
                this.GovernorDropdown = new DropOptions(new Rectangle(rectangle5.X + 30, rectangle5.Y + 30, 100, 18));
                this.GovernorDropdown.AddOption("--", 1);
                this.GovernorDropdown.AddOption(Localizer.Token(4064), 0);
                this.GovernorDropdown.AddOption(Localizer.Token(4065), 2);
                this.GovernorDropdown.AddOption(Localizer.Token(4066), 4);
                this.GovernorDropdown.AddOption(Localizer.Token(4067), 3);
                this.GovernorDropdown.AddOption(Localizer.Token(4068), 5);
                this.GovernorDropdown.AddOption(Localizer.Token(5087), 6);
                this.GovernorDropdown.ActiveIndex = ColonyScreen.GetIndex(p);
                if ((Planet.ColonyType)this.GovernorDropdown.Options[this.GovernorDropdown.ActiveIndex].value != this.p.colonyType)
                {
                    this.p.colonyType = (Planet.ColonyType)this.GovernorDropdown.Options[this.GovernorDropdown.ActiveIndex].value;
                    if (this.p.colonyType == Planet.ColonyType.Colony)
                    {
                        this.p.GovernorOn = false;
                        this.p.FoodLocked = false;
                        this.p.ProdLocked = false;
                        this.p.ResLocked = false;
                    }
                    else
                    {
                        this.p.FoodLocked = true;
                        this.p.ProdLocked = true;
                        this.p.ResLocked = true;
                        this.p.GovernorOn = true;
                    }
                }
                Ref<bool> connectedTo = new Ref<bool>((Func<bool>)(() => p.GovBuildings), (Action<bool>)(x => p.GovBuildings = x));
                Ref<bool> @ref = new Ref<bool>((Func<bool>)(() => p.GovSliders), (Action<bool>)(x => p.GovSliders = x));
                this.GovBuildings = new Checkbox(new Vector2((float)(rectangle5.X - 10), (float)(rectangle5.Y - (Fonts.Arial12Bold.LineSpacing * 2 + 15))), "Governor manages buildings", connectedTo, Fonts.Arial12Bold);
                this.GovSliders = new Checkbox(new Vector2((float)(rectangle5.X - 10), (float)(rectangle5.Y - (Fonts.Arial12Bold.LineSpacing + 10))), "Governor manages labor sliders", connectedTo, Fonts.Arial12Bold);
            }
            else
                PlanetScreen.screen.LookingAtPlanet = false;
        }
        //private bool AutoButtonHover;
        public PlanetListScreen(Ship_Game.ScreenManager ScreenManager, EmpireUIOverlay empUI)
        {
            this.empUI = empUI;
            base.TransitionOnTime = TimeSpan.FromSeconds(0.25);
            base.TransitionOffTime = TimeSpan.FromSeconds(0.25);
            base.IsPopup = true;
            base.ScreenManager = ScreenManager;
            if (base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth <= 1280)
            {
                //this.LowRes = true;
            }
            Rectangle titleRect = new Rectangle(2, 44, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth * 2 / 3, 80);
            this.TitleBar = new Menu2(ScreenManager, titleRect);
            this.TitlePos = new Vector2((float)(titleRect.X + titleRect.Width / 2) - Fonts.Laserian14.MeasureString(Localizer.Token(1402)).X / 2f, (float)(titleRect.Y + titleRect.Height / 2 - Fonts.Laserian14.LineSpacing / 2));
            this.leftRect = new Rectangle(2, titleRect.Y + titleRect.Height + 5, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 10, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - (titleRect.Y + titleRect.Height) - 7);
            this.EMenu = new Menu2(ScreenManager, this.leftRect);
            this.close = new CloseButton(new Rectangle(this.leftRect.X + this.leftRect.Width - 40, this.leftRect.Y + 20, 20, 20));
            this.eRect = new Rectangle(2, titleRect.Y + titleRect.Height + 25, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 40, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - (titleRect.Y + titleRect.Height) - 15);
            this.sb_Sys = new SortButton(this.empUI.empire.data.PLSort, Localizer.Token(192));
            this.sb_Name = new SortButton(this.empUI.empire.data.PLSort, Localizer.Token(389));
            this.sb_Fert = new SortButton(this.empUI.empire.data.PLSort,Localizer.Token(386) );
            this.sb_Rich = new SortButton(this.empUI.empire.data.PLSort,Localizer.Token(387));
            this.sb_Pop = new SortButton(this.empUI.empire.data.PLSort,Localizer.Token(1403));
            this.sb_Owned = new SortButton(this.empUI.empire.data.PLSort, "Owner");

            while (this.eRect.Height % 40 != 0)
            {
                this.eRect.Height = this.eRect.Height - 1;
            }
            this.eRect.Height = this.eRect.Height - 20;
            this.ShipSubMenu = new Submenu(ScreenManager, this.eRect);
            this.PlanetSL = new ScrollList(this.ShipSubMenu, 40);
               // this.LastSorted = this.empUI.empire.data.PLSort;

            foreach (SolarSystem system in UniverseScreen.SolarSystemList.OrderBy(distance => Vector2.Distance(distance.Position, EmpireManager.GetEmpireByName(empUI.screen.PlayerLoyalty).GetWeightedCenter())))
            {
                foreach (Planet p in system.PlanetList)
                {
                    if (!p.ExploredDict[EmpireManager.GetEmpireByName(empUI.screen.PlayerLoyalty)])
                    {
                        continue;
                    }
                    this.planets.Add(p);
                }
            }
            //foreach (Planet p in this.planets)
            //{
            //    if (this.HideOwned && p.Owner != null || this.HideUninhab && !p.habitable)
            //    {
            //        continue;
            //    }
            //    PlanetListScreenEntry entry = new PlanetListScreenEntry(p, this.eRect.X + 22, this.leftRect.Y + 20, this.EMenu.Menu.Width - 30, 40, this);
            //    this.PlanetSL.AddItem(entry);
            //}

            //this.ResetList();
            //this.SelectedPlanet = (this.PlanetSL.Entries[this.PlanetSL.indexAtTop].item as PlanetListScreenEntry).planet;
            Ref<bool> aeRef = new Ref<bool>(() => this.HideOwned, (bool x) => {
                this.HideOwned = x;
                this.ResetList();
            });
            this.cb_hideOwned = new Checkbox(new Vector2((float)(this.TitleBar.Menu.X + this.TitleBar.Menu.Width + 15), (float)(this.TitleBar.Menu.Y + 15)), "Hide Owned", aeRef, Fonts.Arial12Bold);
            aeRef = new Ref<bool>(() => this.HideUninhab, (bool x) => {
                this.HideUninhab = x;
                this.ResetList();
            });
            this.cb_hideUninhabitable = new Checkbox(new Vector2((float)(this.TitleBar.Menu.X + this.TitleBar.Menu.Width + 15), (float)(this.TitleBar.Menu.Y + 35)), "Hide Uninhabitable", aeRef, Fonts.Arial12Bold);
            this.AutoButton = new Rectangle(0, 0, 243, 33);
        }
 public FleetDesignScreen(EmpireUIOverlay EmpireUI)
 {
     this.fleet = new Fleet();
     this.EmpireUI = EmpireUI;
     base.TransitionOnTime = TimeSpan.FromSeconds(0.75);
 }