public UnexploredPlanetScreen(Planet p, Ship_Game.ScreenManager ScreenManager)
 {
     this.ScreenManager = ScreenManager;
     this.p = p;
     if (ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth <= 1280)
     {
         this.LowRes = true;
     }
     Rectangle titleRect = new Rectangle(5, 44, 405, 80);
     if (this.LowRes)
     {
         titleRect.Width = 365;
     }
     this.TitleBar = new Menu2(ScreenManager, titleRect);
     this.TitlePos = new Vector2((float)(titleRect.X + titleRect.Width / 2) - Fonts.Laserian14.MeasureString(p.Name).X / 2f, (float)(titleRect.Y + titleRect.Height / 2 - Fonts.Laserian14.LineSpacing / 2));
     Rectangle leftRect = new Rectangle(5, titleRect.Y + titleRect.Height + 5, titleRect.Width, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - (titleRect.Y + titleRect.Height) - (int)(0.4f * (float)ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight));
     if (leftRect.Height < 350)
     {
         leftRect.Height = 350;
     }
     this.PlanetMenu = new Menu1(ScreenManager, leftRect);
     Rectangle psubRect = new Rectangle(leftRect.X + 20, leftRect.Y + 20, leftRect.Width - 40, leftRect.Height - 40);
     this.PlanetInfo = new Submenu(ScreenManager, psubRect);
     this.PlanetInfo.AddTab("Planet Info");
     this.PlanetIcon = new Rectangle(psubRect.X + psubRect.Width - 148, leftRect.Y + 55, 128, 128);
 }
        public override void LoadContent()
        {
            if (base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth <= 1366 || base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight <= 720)
            {
                this.LowRes = true;
            }
            Rectangle titleRect = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 203, (this.LowRes ? 10 : 44), 406, 80);
            Rectangle nameRect = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - (int)((float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth * 0.5f) / 2, titleRect.Y + titleRect.Height + 5, (int)((float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth * 0.5f), 150);
            Rectangle leftRect = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - (int)((float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth * 0.5f) / 2, nameRect.Y + nameRect.Height + 5, (int)((float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth * 0.5f), base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - (titleRect.Y + titleRect.Height) - (int)(0.28f * (float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight));
            if (leftRect.Height > 580)
            {
                leftRect.Height = 580;
            }
            this.close = new CloseButton(new Rectangle(leftRect.X + leftRect.Width - 40, leftRect.Y + 20, 20, 20));

            Rectangle ftlRect = new Rectangle(leftRect.X + 60, leftRect.Y + 100, 270, 50);
            this.FTLPenaltySlider = new FloatSlider(ftlRect, Localizer.Token(4007));
            this.FTLPenaltySlider.SetAmount(GlobalStats.FTLInSystemModifier);
            this.FTLPenaltySlider.amount = GlobalStats.FTLInSystemModifier;

            Rectangle EftlRect = new Rectangle(leftRect.X + 60, leftRect.Y + 150, 270, 50);
            this.EnemyFTLPenaltySlider = new FloatSlider(EftlRect, Localizer.Token(6139));
            this.EnemyFTLPenaltySlider.SetAmount(GlobalStats.EnemyFTLInSystemModifier);
            this.EnemyFTLPenaltySlider.amount = GlobalStats.EnemyFTLInSystemModifier;

            Ref<bool> acomRef = new Ref<bool>(() => GlobalStats.PlanetaryGravityWells, (bool x) => GlobalStats.PlanetaryGravityWells = x);
            Checkbox cb = new Checkbox(new Vector2((float)ftlRect.X, (float)(ftlRect.Y + 100)), Localizer.Token(4008), acomRef, Fonts.Arial12Bold);
            this.Checkboxes.Add(cb);

            cb.Tip_Token = 2288;

            //Added by McShooterz: new checkbox to prevent AI federations
            Ref<bool> pfRef = new Ref<bool>(() => GlobalStats.preventFederations, (bool x) => GlobalStats.preventFederations = x);
            Checkbox cb2 = new Checkbox(new Vector2((float)(ftlRect.X + 500), (float)(ftlRect.Y)), Localizer.Token(6022), pfRef, Fonts.Arial12Bold);
            this.Checkboxes.Add(cb2);

            cb2.Tip_Token = 7011;

            Ref<bool> FTLsRef = new Ref<bool>(() => GlobalStats.WarpInSystem, (bool x) => GlobalStats.WarpInSystem = x);
            Checkbox cb3 = new Checkbox(new Vector2((float)(ftlRect.X + 500), (float)(EftlRect.Y)), Localizer.Token(6178), FTLsRef, Fonts.Arial12Bold);
            this.Checkboxes.Add(cb3);

            Rectangle gwRect = new Rectangle(leftRect.X + 60, leftRect.Y + 220, 270, 50);
            this.GravityWellSize = new FloatSlider(gwRect, Localizer.Token(6002),0,20000,GlobalStats.GravityWellRange);

            //added by gremlin init extra planets slider
            Rectangle epRect = new Rectangle(leftRect.X + 60, leftRect.Y + 280, 270, 50);
            this.extraPlanets = new FloatSlider(epRect, "Extra Planets",0,6f,(float)GlobalStats.ExtraPlanets);

            Rectangle StartingPlanetRichness = new Rectangle(leftRect.X  + 60, leftRect.Y + 340, 270, 50);
            this.StartingPlanetRichness = new FloatSlider(StartingPlanetRichness, "Starting Planet Richness Bonus", 0, 5f, GlobalStats.StartingPlanetRichness);
            Rectangle MinimumWarpRange = new Rectangle(leftRect.X *2 + 60, leftRect.Y + 340, 270, 50);
            this.MinimumWarpRange = new FloatSlider(MinimumWarpRange, "Minimum Warp Range", 0, 1200000f, GlobalStats.MinimumWarpRange);
            Rectangle MemoryLimiter = new Rectangle(leftRect.X + 60, leftRect.Y + 400, 270, 50);
            this.MemoryLimiter = new FloatSlider(MemoryLimiter, "Memory Limit", 150000, 300000f, GlobalStats.MemoryLimiter);
            Rectangle OptionIncreaseShipMaintenance = new Rectangle(leftRect.X *2 + 60, leftRect.Y + 400, 270, 50);
            this.OptionIncreaseShipMaintenance = new FloatSlider(OptionIncreaseShipMaintenance, "Increase Maintenance", 1, 10f, GlobalStats.OptionIncreaseShipMaintenance);
            //Added by McShooterz: slider to change time for turns
            Rectangle OptionTurnTimer = new Rectangle(leftRect.X * 2 + 60, leftRect.Y + 275, 270, 50);
            this.TurnTimer = new FloatSlider(OptionTurnTimer, "Change Turn Timer", 2f, 18f, GlobalStats.TurnTimer);

            this.MainMenu = new Menu2(base.ScreenManager, leftRect);
        }
        public override void LoadContent()
        {
            if (base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth <= 1366 || base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight <= 720)
            {
                this.LowRes = true;
            }
            Rectangle titleRect = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 203, (this.LowRes ? 10 : 44), 406, 80);
            this.TitleBar = new Menu2(base.ScreenManager, titleRect);
            this.TitlePos = new Vector2((float)(titleRect.X + titleRect.Width / 2) - Fonts.Laserian14.MeasureString(Localizer.Token(18)).X / 2f, (float)(titleRect.Y + titleRect.Height / 2 - Fonts.Laserian14.LineSpacing / 2));
            Rectangle nameRect = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - (int)((float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth * 0.5f) / 2, titleRect.Y + titleRect.Height + 5, (int)((float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth * 0.5f), 150);
            this.Name = new Menu1(base.ScreenManager, nameRect);
            Rectangle nsubRect = new Rectangle(nameRect.X + 20, nameRect.Y - 5, nameRect.Width - 40, nameRect.Height - 15);
            this.NameSub = new Submenu(base.ScreenManager, nsubRect);
            this.ColorSelector = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 310, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight / 2 - 280, 620, 560);
            this.ColorSelectMenu = new Menu1(base.ScreenManager, this.ColorSelector);
            this.RaceNamePos = new Vector2((float)(nameRect.X + 40), (float)(nameRect.Y + 30));
            this.FlagPos = new Vector2((float)(nameRect.X + nameRect.Width - 80 - 100), (float)(nameRect.Y + 30));
            Rectangle leftRect = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - (int)((float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth * 0.5f) / 2, nameRect.Y + nameRect.Height + 5, (int)((float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth * 0.5f), base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - (titleRect.Y + titleRect.Height) - (int)(0.28f * (float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight));
            if (leftRect.Height > 580)
            {
                leftRect.Height = 580;
            }
            this.Left = new Menu1(base.ScreenManager, leftRect);
            Vector2 Position = new Vector2((float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 84), (float)(leftRect.Y + leftRect.Height + 10));
            this.RulesOptions = new UIButton()
            {
                Rect = new Rectangle((int)Position.X, (int)Position.Y, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height),
                NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"],
                HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_hover"],
                PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_pressed"],
                Text = Localizer.Token(4006),
                Launches = "Rule Options"
            };
            this.Buttons.Add(this.RulesOptions);
            Rectangle ChooseRaceRect = new Rectangle(5, (this.LowRes ? nameRect.Y : leftRect.Y), leftRect.X - 10, (this.LowRes ? leftRect.Y + leftRect.Height - nameRect.Y : leftRect.Height));
            this.ChooseRaceMenu = new Menu1(base.ScreenManager, ChooseRaceRect);
            Rectangle smaller = ChooseRaceRect;
            smaller.Y = smaller.Y - 20;
            smaller.Height = smaller.Height + 20;
            this.arch = new Submenu(base.ScreenManager, smaller);
            this.RaceArchetypeSL = new ScrollList(this.arch, 135);
            ResourceManager.Empires.Clear();
            ResourceManager.WhichModPath = "Content";
            if (GlobalStats.ActiveModInfo != null && !GlobalStats.ActiveModInfo.DisableDefaultRaces)
            {
                //ResourceManager.WhichModPath = string.Concat("Mods/", GlobalStats.ActiveMod.ModPath);

                ResourceManager.LoadEmpires();
                //ResourceManager.LoadSubsetEmpires();
            }
            else if (GlobalStats.ActiveModInfo == null || !GlobalStats.ActiveModInfo.DisableDefaultRaces)
            {
                ResourceManager.LoadEmpires();
                //ResourceManager.LoadSubsetEmpires();
            }
            else
            {
                ResourceManager.LoadSubsetEmpires();
            }
            if (GlobalStats.ActiveMod != null)
            {
                ResourceManager.WhichModPath = string.Concat("Mods/", GlobalStats.ActiveMod.ModPath);
                ResourceManager.LoadModdedEmpires();
            }
            foreach (EmpireData e in ResourceManager.Empires)
            {
                if (e.Faction == 1 || e.MinorRace)
                {
                    continue;
                }
                this.RaceArchetypeSL.AddItem(e);
                if (string.IsNullOrEmpty(e.Traits.VideoPath))
                {
                    continue;
                }
                this.TextureDict.Add(e, ResourceManager.TextureDict[string.Concat("Races/", e.Traits.VideoPath)]);
            }
            foreach (EmpireData e in ResourceManager.Empires)
            {
                if (e.Traits.Singular != "Human")
                {
                    continue;
                }
                this.SelectedData = e;
            }
            this.RaceName.Text = this.SelectedData.Traits.Name;
            this.SingEntry.Text = this.SelectedData.Traits.Singular;
            this.PlurEntry.Text = this.SelectedData.Traits.Plural;
            this.HomeSystemEntry.Text = this.SelectedData.Traits.HomeSystemName;
            this.HomeWorldName = this.SelectedData.Traits.HomeworldName;
            this.GalaxySizeRect = new Rectangle(nameRect.X + nameRect.Width + 40 - 22, nameRect.Y + 5, (int)Fonts.Arial12.MeasureString("Galaxy Size                                   ").X, Fonts.Arial12.LineSpacing);
            this.NumberStarsRect = new Rectangle(this.GalaxySizeRect.X, this.GalaxySizeRect.Y + Fonts.Arial12.LineSpacing + 10, this.GalaxySizeRect.Width, this.GalaxySizeRect.Height);
            this.NumOpponentsRect = new Rectangle(this.NumberStarsRect.X, this.NumberStarsRect.Y + Fonts.Arial12.LineSpacing + 10, this.NumberStarsRect.Width, this.NumberStarsRect.Height);
            this.GameModeRect = new Rectangle(this.NumOpponentsRect.X, this.NumOpponentsRect.Y + Fonts.Arial12.LineSpacing + 10, this.NumberStarsRect.Width, this.NumOpponentsRect.Height);
            this.PacingRect = new Rectangle(this.GameModeRect.X, this.GameModeRect.Y + Fonts.Arial12.LineSpacing + 10, this.GameModeRect.Width, this.GameModeRect.Height);
            this.DifficultyRect = new Rectangle(this.PacingRect.X, this.PacingRect.Y + Fonts.Arial12.LineSpacing + 10, this.PacingRect.Width, this.PacingRect.Height);
            Rectangle dRect = new Rectangle(leftRect.X + leftRect.Width + 5, leftRect.Y, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - leftRect.X - leftRect.Width - 10, leftRect.Height);
            this.Description = new Menu1(base.ScreenManager, dRect, true);
            this.dslrect = new Rectangle(leftRect.X + leftRect.Width + 5, leftRect.Y, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - leftRect.X - leftRect.Width - 10, leftRect.Height - 160);
            Submenu dsub = new Submenu(base.ScreenManager, this.dslrect);
            this.DescriptionSL = new ScrollList(dsub, Fonts.Arial12.LineSpacing);
            Rectangle psubRect = new Rectangle(leftRect.X + 20, leftRect.Y + 20, leftRect.Width - 40, leftRect.Height - 40);
            this.Traits = new Submenu(base.ScreenManager, psubRect);
            this.Traits.AddTab(Localizer.Token(19));
            this.Traits.AddTab(Localizer.Token(20));
            this.Traits.AddTab(Localizer.Token(21));
            int size = 55;
            if (GlobalStats.Config.Language != "German" && base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth <= 1280)
            {
                size = 65;
            }
            if (GlobalStats.Config.Language == "Russian" || GlobalStats.Config.Language == "Polish")
            {
                size = 70;
            }
            this.traitsSL = new ScrollList(this.Traits, size);
            foreach (TraitEntry t in this.AllTraits)
            {
                if (t.trait.Category == "Physical")
                    this.traitsSL.AddItem(t);
            }
            this.Engage = new UIButton()
            {
                Rect = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 140, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 40, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"].Height),
                NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"],
                HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_hover"],
                PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_pressed"],
                Text = Localizer.Token(22),
                Launches = "Engage"
            };
            this.Buttons.Add(this.Engage);
            this.Abort = new UIButton()
            {
                Rect = new Rectangle(10, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 40, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"].Height),
                NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"],
                HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_hover"],
                PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_pressed"],
                Text = Localizer.Token(23),
                Launches = "Abort"
            };
            this.Buttons.Add(this.Abort);
            this.ClearTraits = new UIButton()
            {
                Rect = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 150, this.Description.Menu.Y + this.Description.Menu.Height - 40, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"].Height),
                NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"],
                HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_hover"],
                PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_pressed"],
                Text = "Clear Traits",
                Launches = "Clear"
            };
            this.Buttons.Add(this.ClearTraits);
            this.DoRaceDescription();
            this.SetEmpireData(this.SelectedData);
            base.LoadContent();
        }
        //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 LoadContent()
 {
     float screenWidth = (float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth;
     float screenHeight = (float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight;
     Rectangle titleRect = new Rectangle((int)screenWidth / 2 - 200, 44, 400, 80);
     this.TitleBar = new Menu2(base.ScreenManager, titleRect);
     this.TitlePos = new Vector2((float)(titleRect.X + titleRect.Width / 2) - Fonts.Laserian14.MeasureString(Localizer.Token(6089)).X / 2f, (float)(titleRect.Y + titleRect.Height / 2 - Fonts.Laserian14.LineSpacing / 2));
     Rectangle leftRect = new Rectangle((int)screenWidth / 2 - 640, (screenHeight > 768f ? titleRect.Y + titleRect.Height + 5 : 44), 1280, 660);
     this.DMenu = new Menu2(base.ScreenManager, leftRect);
     this.close = new CloseButton(new Rectangle(leftRect.X + leftRect.Width - 40, leftRect.Y + 20, 20, 20));
     this.SelectedInfoRect = new Rectangle(leftRect.X + 60, leftRect.Y + 250, 368, 376);
     this.IntelligenceRect = new Rectangle(this.SelectedInfoRect.X + this.SelectedInfoRect.Width + 30, this.SelectedInfoRect.Y, 368, 376);
     this.OperationsRect = new Rectangle(this.IntelligenceRect.X + this.IntelligenceRect.Width + 30, this.SelectedInfoRect.Y, 368, 376);
     this.OpSLRect = new Rectangle(this.OperationsRect.X + 20, this.OperationsRect.Y + 20, this.OperationsRect.Width - 40, this.OperationsRect.Height - 45);
     Submenu OpSub = new Submenu(base.ScreenManager, this.OpSLRect);
     this.OperationsSL = new ScrollList(OpSub, Fonts.Arial12Bold.LineSpacing + 5);
     Vector2 ExecutePos = new Vector2((float)(this.OperationsRect.X + this.OperationsRect.Width / 2 - 91), (float)(this.OperationsRect.Y + this.OperationsRect.Height - 60));
     this.ExecuteOperation = new DanButton(ExecutePos, "Execute Op")
     {
         Toggled = true
     };
     Rectangle ComponentRect = new Rectangle(this.SelectedInfoRect.X + 20, this.SelectedInfoRect.Y + 35, this.SelectedInfoRect.Width - 40, this.SelectedInfoRect.Height - 95);
     this.AgentComponent = new Ship_Game.AgentComponent(ComponentRect, this);
     foreach (Empire e in EmpireManager.EmpireList)
     {
         if (e != EmpireManager.GetEmpireByName(this.screen.PlayerLoyalty))
         {
             if (e.isFaction || e.MinorRace)
             {
                 continue;
             }
             RaceEntry re = new RaceEntry()
             {
                 e = e
             };
             this.Races.Add(re);
         }
         else
         {
             RaceEntry re = new RaceEntry()
             {
                 e = e
             };
             this.SelectedEmpire = e;
             this.Races.Add(re);
         }
     }
     Vector2 Cursor = new Vector2(screenWidth / 2f - (float)(148 * this.Races.Count / 2), (float)(leftRect.Y + 10));
     int j = 0;
     foreach (RaceEntry re in this.Races)
     {
         re.container = new Rectangle((int)Cursor.X + 10 + j * 148, leftRect.Y + 40, 124, 148);
         j++;
     }
     Rectangle rectangle = new Rectangle();
     this.SpyBudgetSlider = new GenericSlider(rectangle, Localizer.Token(1637), 0f, 100f)
     {
         amount = 0f
     };
     Rectangle rectangle1 = new Rectangle();
     this.CounterSpySlider = new GenericSlider(rectangle1, Localizer.Token(1637), 0f, 100f)
     {
         amount = 0f
     };
     base.ScreenManager.racialMusic.SetVolume(0f);
 }
 public override void LoadContent()
 {
     Rectangle prect = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 659, 0, 1318, 757);
     this.BridgeRect = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 960, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight / 2 - 540, 1920, 1080);
     this.Player = new Menu2(base.ScreenManager, prect);
     this.Portrait = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 640, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight / 2 - 360, 1280, 720);
     Vector2 Cursor = new Vector2((float)(this.Portrait.X + this.Portrait.Width - 85), (float)(this.Portrait.Y + 140));
     this.EmpireNamePos = new Vector2(Cursor.X - Fonts.Pirulen20.MeasureString(this.them.data.Traits.Name).X, (float)(this.Portrait.Y + 40));
     if (!this.playerEmpire.GetRelations()[this.them].AtWar)
     {
         this.DeclareWar = new GenericButton(Cursor, Localizer.Token(1200), Fonts.Pirulen20, Fonts.Pirulen16);
         this.Buttons.Add(this.DeclareWar);
         Cursor.Y = Cursor.Y + 25f;
         this.Discuss = new GenericButton(Cursor, Localizer.Token(1201), Fonts.Pirulen20, Fonts.Pirulen16);
         this.Buttons.Add(this.Discuss);
         Cursor.Y = Cursor.Y + 25f;
     }
     this.Negotiate = new GenericButton(Cursor, Localizer.Token(1202), Fonts.Pirulen20, Fonts.Pirulen16);
     this.Buttons.Add(this.Negotiate);
     Cursor.Y = Cursor.Y + 25f;
     this.Exit = new GenericButton(Cursor, Localizer.Token(1203), Fonts.Pirulen20, Fonts.Pirulen16);
     this.Buttons.Add(this.Exit);
     Cursor = new Vector2((float)(this.Portrait.X + 115), (float)(this.Portrait.Y + 160));
     this.Trust = new GenericButton(Cursor, Localizer.Token(1204), Fonts.Pirulen16, Fonts.Pirulen12)
     {
         ToggleOn = true
     };
     this.TAFButtons.Add(this.Trust);
     this.TrustRect = new Rectangle(this.Portrait.X + 125, this.Trust.R.Y + 2, 100, this.Trust.R.Height);
     Cursor.Y = Cursor.Y + 25f;
     this.Anger = new GenericButton(Cursor, Localizer.Token(1205), Fonts.Pirulen16, Fonts.Pirulen12)
     {
         ToggleOn = true
     };
     this.AngerRect = new Rectangle(this.Portrait.X + 125, this.Anger.R.Y + 2, 100, this.Anger.R.Height);
     this.TAFButtons.Add(this.Anger);
     Cursor.Y = Cursor.Y + 25f;
     this.Fear = new GenericButton(Cursor, Localizer.Token(1206), Fonts.Pirulen16, Fonts.Pirulen12)
     {
         ToggleOn = true
     };
     this.TAFButtons.Add(this.Fear);
     this.FearRect = new Rectangle(this.Portrait.X + 125, this.Fear.R.Y + 2, 100, this.Fear.R.Height);
     Cursor.Y = Cursor.Y + 25f;
     this.DialogRect = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 350, this.Portrait.Y + this.Portrait.Height - 110, 700, 55);
     if (base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight < 820)
     {
         this.DialogRect.Y = this.Portrait.Y + this.Portrait.Height - 100;
     }
     this.R = this.DialogRect;
     this.R.Height = this.R.Height + 75;
     if (this.R.Y + this.R.Height > base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight)
     {
         this.R.Y = this.R.Y - (this.R.Y + this.R.Height - base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight + 2);
     }
     Rectangle blerdybloo = this.R;
     blerdybloo.Height = blerdybloo.Height - 40;
     Submenu ot = new Submenu(base.ScreenManager, blerdybloo);
     this.OfferTextSL = new ScrollList(ot, Fonts.Consolas18.LineSpacing + 2, true);
     this.Attitude_Pleading_Rect = new Rectangle(this.R.X + 45, this.R.Y + this.R.Height - 48, 180, 48);
     this.Attitude_Respectful_Rect = new Rectangle(this.R.X + 250 + 5, this.R.Y + this.R.Height - 48, 180, 48);
     this.Attitude_Threaten_Rect = new Rectangle(this.R.X + 450 + 15, this.R.Y + this.R.Height - 48, 180, 48);
     this.ToneContainerRect = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 324, this.Attitude_Pleading_Rect.Y, 648, 48);
     this.ap = new GenericButton(this.Attitude_Pleading_Rect, Localizer.Token(1207), Fonts.Pirulen12);
     this.ar = new GenericButton(this.Attitude_Respectful_Rect, Localizer.Token(1209), Fonts.Pirulen12)
     {
         ToggleOn = true
     };
     this.at = new GenericButton(this.Attitude_Threaten_Rect, Localizer.Token(1208), Fonts.Pirulen12);
     this.AccRejRect = new Rectangle(this.R.X + this.R.Width / 2 - 220, this.R.Y + this.R.Height - 48, 440, 48);
     this.Accept = new GenericButton(new Rectangle(this.AccRejRect.X, this.AccRejRect.Y, 220, 48), Localizer.Token(1210), Fonts.Pirulen12);
     this.Reject = new GenericButton(new Rectangle(this.AccRejRect.X + 220, this.AccRejRect.Y, 220, 48), Localizer.Token(1211), Fonts.Pirulen12);
     this.Negotiate_Right = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 192, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 280, 192, 280);
     this.Negotiate_Left = new Rectangle(0, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 280, 192, 280);
     this.BigTradeRect = new Rectangle(this.DialogRect.X + 75, this.DialogRect.Y - 202, this.DialogRect.Width - 150, 200);
     this.UsRect = new Rectangle(this.Negotiate_Right.X + 20, this.Negotiate_Right.Y + 35, this.BigTradeRect.Width / 2 - 9, 300);
     this.ThemRect = new Rectangle(this.Negotiate_Left.X + 15, this.Negotiate_Left.Y + 35, this.BigTradeRect.Width / 2 - 10, 300);
     this.SendOffer = new GenericButton(new Rectangle(this.R.X + this.R.Width / 2 - 90, this.R.Y - 40, 180, 33), Localizer.Token(1212), Fonts.Pirulen20);
     Submenu themsub = new Submenu(base.ScreenManager, this.ThemRect);
     this.TheirItemsSL = new ScrollList(themsub, Fonts.Consolas18.LineSpacing + 5, true);
     Submenu ussub = new Submenu(base.ScreenManager, this.UsRect);
     this.OurItemsSL = new ScrollList(ussub, Fonts.Consolas18.LineSpacing + 5, true);
     Submenu sub = new Submenu(base.ScreenManager, blerdybloo);
     this.StatementsSL = new ScrollList(sub, Fonts.Consolas18.LineSpacing + 2, true);
     if (!string.IsNullOrEmpty(this.them.data.Traits.VideoPath))
     {
         try
         {
             this.video = base.ScreenManager.Content.Load<Video>(string.Concat("Video/", this.them.data.Traits.VideoPath));
             this.player = new VideoPlayer()
             {
                 Volume = GlobalStats.Config.MusicVolume,
                 IsLooped = true
             };
             this.player.Play(this.video);
         }
         catch
         {
             this.video = base.ScreenManager.Content.Load<Video>(string.Concat("ModVideo/", this.them.data.Traits.VideoPath));
             this.player = new VideoPlayer()
             {
                 Volume = GlobalStats.Config.MusicVolume,
                 IsLooped = true
             };
             this.player.Play(this.video);
         }
     }
     base.ScreenManager.musicCategory.Pause();
     if (!this.them.data.ModRace)
     {
         //base.ScreenManager.racialMusic.SetVolume(GlobalStats.Config.MusicVolume);
         if (this.them.data.MusicCue != null)
         {
             if (this.WarDeclared)
             {
                 this.music = AudioManager.GetCue("Stardrive_Combat 1c_114BPM");
                 this.music.Play();
             }
             else
             {
                 this.music = AudioManager.GetCue(this.them.data.MusicCue);
                 this.music.Play();
             }
         }
     }
     this.TextCursor = new Vector2((float)(this.DialogRect.X + 5), (float)(this.DialogRect.Y + 5));
 }
        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 override void LoadContent()
 {
     Vector2 Cursor = new Vector2((float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 84), (float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight / 2 - 100));
     this.window = new Menu2(base.ScreenManager, new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 100, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight / 2 - 150, 200, 330));
     this.Save = new UIButton()
     {
         Rect = new Rectangle((int)Cursor.X, (int)Cursor.Y, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height),
         NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"],
         HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_hover"],
         PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_pressed"],
         Launches = "Save",
         Text = Localizer.Token(300)
     };
     this.Buttons.Add(this.Save);
     Cursor.Y = Cursor.Y + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height + 15);
     this.Load = new UIButton()
     {
         Rect = new Rectangle((int)Cursor.X, (int)Cursor.Y, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height),
         NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"],
         HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_hover"],
         PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_pressed"],
         Text = Localizer.Token(2),
         Launches = "Load Game"
     };
     this.Buttons.Add(this.Load);
     Cursor.Y = Cursor.Y + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height + 15);
     this.Options = new UIButton()
     {
         Rect = new Rectangle((int)Cursor.X, (int)Cursor.Y, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height),
         NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"],
         HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_hover"],
         PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_pressed"],
         Text = Localizer.Token(4),
         Launches = "Options"
     };
     this.Buttons.Add(this.Options);
     Cursor.Y = Cursor.Y + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height + 15);
     this.Return = new UIButton()
     {
         Rect = new Rectangle((int)Cursor.X, (int)Cursor.Y, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height),
         NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"],
         HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_hover"],
         PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_pressed"],
         Launches = "Return to Game",
         Text = Localizer.Token(301)
     };
     this.Buttons.Add(this.Return);
     Cursor.Y = Cursor.Y + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height + 15);
     this.ExitToMain = new UIButton()
     {
         Rect = new Rectangle((int)Cursor.X, (int)Cursor.Y, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height),
         NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"],
         HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_hover"],
         PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_pressed"],
         Launches = "Exit to Main Menu",
         Text = Localizer.Token(302)
     };
     this.Buttons.Add(this.ExitToMain);
     Cursor.Y = Cursor.Y + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height + 15);
     this.Exit = new UIButton()
     {
         Rect = new Rectangle((int)Cursor.X, (int)Cursor.Y, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height),
         NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"],
         HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_hover"],
         PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_pressed"],
         Launches = "Exit to Windows",
         Text = Localizer.Token(303)
     };
     this.Buttons.Add(this.Exit);
     Cursor.Y = Cursor.Y + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height + 15);
     base.LoadContent();
 }
 public void LoadGraphics()
 {
     Vector2 Cursor = new Vector2((float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 84), (float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight / 2 - 100));
     this.window = new Menu2(base.ScreenManager, new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 100, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight / 2 - 150, 200, 330));
     this.Save.Rect = new Rectangle((int)Cursor.X, (int)Cursor.Y, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height);
     Cursor.Y = Cursor.Y + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height + 15);
     this.Load.Rect = new Rectangle((int)Cursor.X, (int)Cursor.Y, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height);
     Cursor.Y = Cursor.Y + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height + 15);
     this.Options.Rect = new Rectangle((int)Cursor.X, (int)Cursor.Y, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height);
     Cursor.Y = Cursor.Y + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height + 15);
     this.Return.Rect = new Rectangle((int)Cursor.X, (int)Cursor.Y, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height);
     Cursor.Y = Cursor.Y + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height + 15);
     this.ExitToMain.Rect = new Rectangle((int)Cursor.X, (int)Cursor.Y, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height);
     Cursor.Y = Cursor.Y + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height + 15);
     this.Exit.Rect = new Rectangle((int)Cursor.X, (int)Cursor.Y, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height);
     Cursor.Y = Cursor.Y + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height + 15);
 }
        public CombatScreen(Ship_Game.ScreenManager sm, Planet p)
        {
            this.p = p;
            this.ScreenManager = sm;
            int screenWidth = this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth;
            this.GridRect = new Rectangle(screenWidth / 2 - 639, this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 490, 1278, 437);
            Rectangle titleRect = new Rectangle(screenWidth / 2 - 250, 44, 500, 80);
            this.TitleBar = new Menu2(this.ScreenManager, titleRect);
            this.TitlePos = new Vector2((float)(titleRect.X + titleRect.Width / 2) - Fonts.Laserian14.MeasureString("Ground Combat").X / 2f, (float)(titleRect.Y + titleRect.Height / 2 - Fonts.Laserian14.LineSpacing / 2));
            this.SelectedItemRect = new Rectangle(screenWidth - 240, 100, 225, 205);
            this.AssetsRect = new Rectangle(10, 48, 225, 200);
            this.HoveredItemRect = new Rectangle(10, 248, 225, 200);
            this.assetsUI = new OrbitalAssetsUIElement(this.AssetsRect, this.ScreenManager, PlanetScreen.screen, p);
            this.tInfo = new TroopInfoUIElement(this.SelectedItemRect, this.ScreenManager, PlanetScreen.screen);
            this.hInfo = new TroopInfoUIElement(this.HoveredItemRect, this.ScreenManager, PlanetScreen.screen);
            Rectangle ColonyGrid = new Rectangle(screenWidth / 2 - screenWidth * 2 / 3 / 2, 130, screenWidth * 2 / 3, screenWidth * 2 / 3 * 5 / 7);
            this.CombatField = new Menu2(sm, ColonyGrid);
            Rectangle OrbitalRect = new Rectangle(5, ColonyGrid.Y, (screenWidth - ColonyGrid.Width) / 2 - 20, ColonyGrid.Height+20);
            this.OrbitalResources = new Menu1(this.ScreenManager, OrbitalRect);
            Rectangle psubRect = new Rectangle(this.AssetsRect.X + 225, this.AssetsRect.Y+23, 185, this.AssetsRect.Height);
            this.orbitalResourcesSub = new Submenu(this.ScreenManager, psubRect);
            this.orbitalResourcesSub.AddTab("In Orbit");
            this.OrbitSL = new ScrollList(this.orbitalResourcesSub);
            universeScreen.ShipsInCombat.Active = false;
            universeScreen.PlanetsInCombat.Active = false;
            this.LandAll = new UIButton()
            {
                Rect = new Rectangle(this.orbitalResourcesSub.Menu.X + 20, this.orbitalResourcesSub.Menu.Y - 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height),
                NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"],
                HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_hover"],
                PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_pressed"],
                Launches = "Land",
                Text = "Land All"
            };
            this.LaunchAll = new UIButton()
            {
                Rect = new Rectangle(this.orbitalResourcesSub.Menu.X + 20, this.LandAll.Rect.Y -2- this.LandAll.Rect.Height, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height),
                NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"],
                HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_hover"],
                PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_pressed"],
                Launches = "LaunchAll",
                Text = "Launch All"
            };
            CombatScreen.universeScreen.MasterShipList.thisLock.EnterReadLock();
            foreach (Ship ship in CombatScreen.universeScreen.MasterShipList)
            {

                if (ship == null)
                    continue;
                if (Vector2.Distance(p.Position, ship.Center) >= 4000f || ship.loyalty != EmpireManager.GetEmpireByName(CombatScreen.universeScreen.PlayerLoyalty))
                {
                    continue;
                }
                if (ship.Role != "troop")
                {
                    if (ship.TroopList.Count <= 0 || (!ship.HasTroopBay && !ship.hasTransporter && !(p.HasShipyard && p.Owner == ship.loyalty)))  //fbedard
                        continue;
                    int LandingLimit = ship.GetHangars().Where(ready => ready.IsTroopBay && ready.hangarTimer <= 0).Count();
                    foreach (ShipModule module in ship.Transporters.Where(module => module.TransporterTimer <= 1))
                        LandingLimit += module.TransporterTroopLanding;
                    if (p.HasShipyard && p.Owner == ship.loyalty) LandingLimit = ship.TroopList.Count;  //fbedard: Allows to unload if shipyard
                    for (int i = 0; i < ship.TroopList.Count() && LandingLimit > 0; i++)
                    {
                        if (ship.TroopList[i] != null && ship.TroopList[i].GetOwner() == ship.loyalty)
                        {
                            this.OrbitSL.AddItem(ship.TroopList[i]);
                            LandingLimit--;
                        }
                    }
                }
                else
                {
                    this.OrbitSL.AddItem(ship);
                }
            }
            CombatScreen.universeScreen.MasterShipList.thisLock.ExitReadLock();
            this.gridPos = new Rectangle(ColonyGrid.X + 20, ColonyGrid.Y + 20, ColonyGrid.Width - 40, ColonyGrid.Height - 40);
            int xsize = this.gridPos.Width / 7;
            int ysize = this.gridPos.Height / 5;
            foreach (PlanetGridSquare pgs in p.TilesList)
            {
                pgs.ClickRect = new Rectangle(this.gridPos.X + pgs.x * xsize, this.gridPos.Y + pgs.y * ysize, xsize, ysize);
            }
            for (int row = 0; row < 6; row++)
            {
                for (int i = 0; i < 7; i++)
                {
                    CombatScreen.PointSet ps = new CombatScreen.PointSet()
                    {
                        point = new Vector2((float)this.GridRect.X + (float)i * this.widthByRow[row] + this.widthByRow[row] / 2f + this.startXByRow[row], (float)(this.GridRect.Y + this.GridRect.Height) - this.distancesByRow[row]),
                        row = row,
                        column = i
                    };
                    this.pointsList.Add(ps);
                }
            }
            foreach (CombatScreen.PointSet ps in this.pointsList)
            {
                foreach (CombatScreen.PointSet toCheck in this.pointsList)
                {
                    if (ps.column != toCheck.column || ps.row != toCheck.row - 1)
                    {
                        continue;
                    }
                    float Distance = Vector2.Distance(ps.point, toCheck.point);
                    Vector2 vtt = toCheck.point - ps.point;
                    vtt = Vector2.Normalize(vtt);
                    Vector2 cPoint = ps.point + ((vtt * Distance) / 2f);
                    CombatScreen.PointSet cp = new CombatScreen.PointSet()
                    {
                        point = cPoint,
                        row = ps.row,
                        column = ps.column
                    };
                    this.CenterPoints.Add(cp);
                }
            }
            foreach (PlanetGridSquare pgs in p.TilesList)
            {
                foreach (CombatScreen.PointSet ps in this.CenterPoints)
                {
                    if (pgs.x != ps.column || pgs.y != ps.row)
                    {
                        continue;
                    }
                    pgs.ClickRect = new Rectangle((int)ps.point.X - 32, (int)ps.point.Y - 32, 64, 64);
                }
            }
            foreach (PlanetGridSquare pgs in p.TilesList)
            {
                this.ReversedList.Add(pgs);
            }
        }
 public override void LoadContent()
 {
     this.camera = new Camera2d();
     Camera2d vector2 = this.camera;
     Viewport viewport = base.ScreenManager.GraphicsDevice.Viewport;
     float width = (float)viewport.Width / 2f;
     Viewport viewport1 = base.ScreenManager.GraphicsDevice.Viewport;
     vector2.Pos = new Vector2(width, (float)viewport1.Height / 2f);
     Rectangle main = new Rectangle(0, 0, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight);
     this.MainMenu = new Menu2(base.ScreenManager, main);
     this.MainMenuOffset = new Vector2((float)(main.X + 20), (float)(main.Y + 30));
     this.close = new CloseButton(new Rectangle(main.X + main.Width - 40, main.Y + 20, 20, 20));
     this.QueueContainer = new Rectangle(main.X + main.Width - 355, main.Y + 40, 330, main.Height - 100);
     this.qcomponent = new QueueComponent(base.ScreenManager, this.QueueContainer, this);
     if (base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth < 1600)
     {
         this.qcomponent.SetInvisible();
     }
     int numRoots = 0;
     foreach (KeyValuePair<string, TechEntry> tech in EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict())
     {
         if (ResourceManager.TechTree[tech.Value.UID].RootNode != 1)
         {
             continue;
         }
         if (!ResourceManager.TechTree[tech.Value.UID].Secret)
         {
             numRoots++;
         }
         else if (EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict()[tech.Value.UID].Discovered)
         {
             numRoots++;
         }
     }
     this.RowOffset = (main.Height - 40) / numRoots;
     this.MainMenuOffset.Y = (float)(main.Y + this.RowOffset / 3);
     if (base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight <= 720)
     {
         this.MainMenuOffset.Y = this.MainMenuOffset.Y + 8f;
     }
     foreach (KeyValuePair<string, TechEntry> tech in EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict())
     {
         if (ResourceManager.TechTree[tech.Value.UID].RootNode != 1)
         {
             continue;
         }
         if (ResourceManager.TechTree[tech.Value.UID].Secret)
         {
             if (!EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict()[tech.Value.UID].Discovered)
             {
                 continue;
             }
             this.Cursor.X = 0f;
             this.Cursor.Y = (float)(this.FindDeepestY() + 1);
             this.SetNode(tech.Value);
         }
         else
         {
             this.Cursor.X = 0f;
             this.Cursor.Y = (float)(this.FindDeepestY() + 1);
             this.SetNode(tech.Value);
         }
     }
     this.RowOffset = (main.Height - 40) / 6;
     foreach (KeyValuePair<string, Node> entry in this.TechTree)
     {
         this.PopulateAllTechsFromRoot(entry.Value as RootNode);
     }
     this.PopulateNodesFromRoot(this.TechTree[GlobalStats.ResearchRootUIDToDisplay] as RootNode);
     string resTop = EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).ResearchTopic;
     if (!string.IsNullOrEmpty(resTop))
     {
         this.qcomponent.LoadQueue(this.CompleteSubNodeTree[resTop] as TreeNode);
     }
     foreach (string uid in EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).data.ResearchQueue)
     {
         this.qcomponent.LoadQueue(this.CompleteSubNodeTree[uid] as TreeNode);
     }
     base.LoadContent();
 }
 public override void LoadContent()
 {
     this.close = new CloseButton(new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 38, 97, 20, 20));
     LightRig rig = base.ScreenManager.Content.Load<LightRig>("example/ShipyardLightrig");
     lock (GlobalStats.ObjectManagerLocker)
     {
         base.ScreenManager.inter.LightManager.Clear();
         base.ScreenManager.inter.LightManager.Submit(rig);
     }
     this.starfield = new Starfield(Vector2.Zero, base.ScreenManager.GraphicsDevice, base.ScreenManager.Content);
     this.starfield.LoadContent();
     Rectangle titleRect = new Rectangle(2, 44, 250, 80);
     this.TitleBar = new Menu2(base.ScreenManager, titleRect);
     this.TitlePos = new Vector2((float)(titleRect.X + titleRect.Width / 2) - Fonts.Laserian14.MeasureString("Fleet Hotkeys").X / 2f, (float)(titleRect.Y + titleRect.Height / 2 - Fonts.Laserian14.LineSpacing / 2));
     Rectangle leftRect = new Rectangle(2, titleRect.Y + titleRect.Height + 5, titleRect.Width, 500);
     this.LeftMenu = new Menu1(base.ScreenManager, leftRect, true);
     this.FleetSL = new ScrollList(this.LeftMenu.subMenu, 40);
     int i = 0;
     foreach (KeyValuePair<int, Ship_Game.Gameplay.Fleet> Fleet in EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).GetFleetsDict())
     {
         this.FleetsRects.Add(Fleet.Key, new Rectangle(leftRect.X + 2, leftRect.Y + i * 53, 52, 48));
         i++;
     }
     Rectangle shipRect = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 282, 140, 280, 80);
     this.ShipDesigns = new Menu2(base.ScreenManager, shipRect);
     this.ShipDesignsTitlePos = new Vector2((float)(shipRect.X + shipRect.Width / 2) - Fonts.Laserian14.MeasureString("Ship Designs").X / 2f, (float)(shipRect.Y + shipRect.Height / 2 - Fonts.Laserian14.LineSpacing / 2));
     Rectangle shipDesignsRect = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - shipRect.Width - 2, shipRect.Y + shipRect.Height + 5, shipRect.Width, 500);
     this.RightMenu = new Menu1(base.ScreenManager, shipDesignsRect);
     this.sub_ships = new Submenu(base.ScreenManager, shipDesignsRect);
     this.ShipSL = new ScrollList(this.sub_ships, 40);
     this.sub_ships.AddTab("Designs");
     this.sub_ships.AddTab("Owned");
     foreach (Ship ship in EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).GetShips())
     {
         if (ship.fleet != null || !ship.Active)
         {
             continue;
         }
         this.AvailableShips.Add(ship);
     }
     this.PopulateShipSL();
     this.SelectedStuffRect = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 220, -13 + base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 200, 440, 210);
     Vector2 OrdersBarPos = new Vector2((float)(this.SelectedStuffRect.X + 20), (float)(this.SelectedStuffRect.Y + 65));
     ToggleButton AttackRuns = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_headon")
     {
         Action = "attack",
         HasToolTip = true,
         WhichToolTip = 1
     };
     OrdersBarPos.X = OrdersBarPos.X + 29f;
     ToggleButton Artillery = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_aft")
     {
         Action = "arty",
         HasToolTip = true,
         WhichToolTip = 2
     };
     OrdersBarPos.X = OrdersBarPos.X + 29f;
     ToggleButton HoldPos = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_x")
     {
         Action = "hold",
         HasToolTip = true,
         WhichToolTip = 65
     };
     OrdersBarPos.X = OrdersBarPos.X + 29f;
     ToggleButton OrbitLeft = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_left")
     {
         Action = "orbit_left",
         HasToolTip = true,
         WhichToolTip = 3
     };
     OrdersBarPos.Y = OrdersBarPos.Y + 29f;
     ToggleButton BroadsideLeft = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_bleft")
     {
         Action = "broadside_left",
         HasToolTip = true,
         WhichToolTip = 159
     };
     OrdersBarPos.Y = OrdersBarPos.Y - 29f;
     OrdersBarPos.X = OrdersBarPos.X + 29f;
     ToggleButton OrbitRight = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_right")
     {
         Action = "orbit_right",
         HasToolTip = true,
         WhichToolTip = 4
     };
     OrdersBarPos.Y = OrdersBarPos.Y + 29f;
     ToggleButton BroadsideRight = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_bright")
     {
         Action = "broadside_right",
         HasToolTip = true,
         WhichToolTip = 160
     };
     OrdersBarPos.Y = OrdersBarPos.Y - 29f;
     OrdersBarPos.X = OrdersBarPos.X + 29f;
     ToggleButton Evade = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_stop")
     {
         Action = "evade",
         HasToolTip = true,
         WhichToolTip = 6
     };
     this.OrdersButtons.Add(Artillery);
     this.OrdersButtons.Add(HoldPos);
     this.OrdersButtons.Add(OrbitLeft);
     this.OrdersButtons.Add(BroadsideLeft);
     this.OrdersButtons.Add(OrbitRight);
     this.OrdersButtons.Add(BroadsideRight);
     this.OrdersButtons.Add(Evade);
     this.OrdersButtons.Add(AttackRuns);
     this.RequisitionForces = new BlueButton(new Vector2((float)(this.SelectedStuffRect.X + 240), (float)(this.SelectedStuffRect.Y + Fonts.Arial20Bold.LineSpacing + 20)), "Requisition...");
     this.SaveDesign = new BlueButton(new Vector2((float)(this.SelectedStuffRect.X + 240), (float)(this.SelectedStuffRect.Y + Fonts.Arial20Bold.LineSpacing + 20 + 50)), "Save Design...");
     this.LoadDesign = new BlueButton(new Vector2((float)(this.SelectedStuffRect.X + 240), (float)(this.SelectedStuffRect.Y + Fonts.Arial20Bold.LineSpacing + 20 + 100)), "Load Design...");
     this.RequisitionForces.ToggleOn = true;
     this.SaveDesign.ToggleOn = true;
     this.LoadDesign.ToggleOn = true;
     this.OperationsRect = new Rectangle(this.SelectedStuffRect.X + this.SelectedStuffRect.Width + 2, this.SelectedStuffRect.Y + 30, 360, this.SelectedStuffRect.Height - 30);
     Rectangle AssistRect = new Rectangle(this.OperationsRect.X + 15, this.OperationsRect.Y + Fonts.Arial12Bold.LineSpacing + 20, 150, 40);
     this.Slider_Assist = new WeightSlider(AssistRect, "Assist Nearby Weight")
     {
         Tip_ID = 7
     };
     Rectangle DefenderRect = new Rectangle(this.OperationsRect.X + 15, this.OperationsRect.Y + Fonts.Arial12Bold.LineSpacing + 70, 150, 40);
     this.Slider_Defend = new WeightSlider(DefenderRect, "Defend Nearby Weight")
     {
         Tip_ID = 8
     };
     Rectangle VultureRect = new Rectangle(this.OperationsRect.X + 15, this.OperationsRect.Y + Fonts.Arial12Bold.LineSpacing + 120, 150, 40);
     this.Slider_Vulture = new WeightSlider(VultureRect, "Target Damaged Weight")
     {
         Tip_ID = 9
     };
     Rectangle ArmoredRect = new Rectangle(this.OperationsRect.X + 15 + 180, this.OperationsRect.Y + Fonts.Arial12Bold.LineSpacing + 20, 150, 40);
     this.Slider_Armor = new WeightSlider(ArmoredRect, "Target Armored Weight")
     {
         Tip_ID = 10
     };
     Rectangle ShieldedRect = new Rectangle(this.OperationsRect.X + 15 + 180, this.OperationsRect.Y + Fonts.Arial12Bold.LineSpacing + 70, 150, 40);
     this.Slider_Shield = new WeightSlider(ShieldedRect, "Target Shielded Weight")
     {
         Tip_ID = 11
     };
     Rectangle DPSRect = new Rectangle(this.OperationsRect.X + 15 + 180, this.OperationsRect.Y + Fonts.Arial12Bold.LineSpacing + 120, 150, 40);
     this.Slider_DPS = new WeightSlider(DPSRect, "Target DPS Weight")
     {
         Tip_ID = 12
     };
     this.PrioritiesRect = new Rectangle(this.SelectedStuffRect.X - this.OperationsRect.Width - 2, this.OperationsRect.Y, this.OperationsRect.Width, this.OperationsRect.Height);
     Rectangle oprect = new Rectangle(this.PrioritiesRect.X + 15, this.PrioritiesRect.Y + Fonts.Arial12Bold.LineSpacing + 20, 300, 40);
     this.OperationalRadius = new FloatSlider(oprect, "Operational Radius");
     this.OperationalRadius.SetAmount(0.2f);
     this.OperationalRadius.Tip_ID = 13;
     Rectangle sizerect = new Rectangle(this.PrioritiesRect.X + 15, this.PrioritiesRect.Y + Fonts.Arial12Bold.LineSpacing + 70, 300, 40);
     this.Slider_Size = new SizeSlider(sizerect, "Target Size Preference");
     this.Slider_Size.SetAmount(0.5f);
     this.Slider_Size.Tip_ID = 14;
     this.starfield = new Starfield(Vector2.Zero, base.ScreenManager.GraphicsDevice, base.ScreenManager.Content);
     this.starfield.LoadContent();
     this.bg = new Background();
     float width = (float)base.ScreenManager.GraphicsDevice.Viewport.Width;
     Viewport viewport = base.ScreenManager.GraphicsDevice.Viewport;
     float aspectRatio = width / (float)viewport.Height;
     this.projection = Matrix.CreatePerspectiveFieldOfView(0.7853982f, aspectRatio, 100f, 15000f);
     foreach (Ship ship in this.fleet.Ships)
     {
         ship.GetSO().World = Matrix.CreateTranslation(new Vector3(ship.RelativeFleetOffset, 0f));
     }
     base.LoadContent();
 }
 public override void LoadContent()
 {
     this.window = new Menu2(base.ScreenManager, new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 197, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight / 2 - 225, 394, 450));
     this.close = new CloseButton(new Rectangle(this.window.Menu.X + this.window.Menu.Width - 40, this.window.Menu.Y + 20, 20, 20));
     Rectangle rectangle = new Rectangle();
     this.TaxSlider = new GenericSlider(rectangle, Localizer.Token(309), 0f, 100f)
     {
         amount = EmpireManager.GetEmpireByName(this.screen.PlayerLoyalty).data.TaxRate
     };
     this.TaxRateRect = new Rectangle(this.window.Menu.X + 20, this.window.Menu.Y + 37, 350, 52);
     this.IncomesRect = new Rectangle(this.TaxRateRect.X, this.TaxRateRect.Y + this.TaxRateRect.Height + 6, 168, 118);
     this.TradeRect = new Rectangle(this.TaxRateRect.X, this.IncomesRect.Y + this.IncomesRect.Height + 6, 168, 208);
     this.CostRect = new Rectangle(this.TaxRateRect.X + 12 + this.IncomesRect.Width, this.IncomesRect.Y, 168, 118);
     base.LoadContent();
 }
 public override void LoadContent()
 {
     float screenWidth = (float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth;
     float screenHeight = (float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight;
     Rectangle titleRect = new Rectangle((int)screenWidth / 2 - 200, 44, 400, 80);
     this.TitleBar = new Menu2(base.ScreenManager, titleRect);
     this.TitlePos = new Vector2((float)(titleRect.X + titleRect.Width / 2) - Fonts.Laserian14.MeasureString(Localizer.Token(1600)).X / 2f, (float)(titleRect.Y + titleRect.Height / 2 - Fonts.Laserian14.LineSpacing / 2));
     Rectangle leftRect = new Rectangle((int)screenWidth / 2 - 640, (screenHeight > 768f ? titleRect.Y + titleRect.Height + 5 : 44), 1280, 660);
     this.DMenu = new Menu2(base.ScreenManager, leftRect);
     this.close = new CloseButton(new Rectangle(leftRect.X + leftRect.Width - 40, leftRect.Y + 20, 20, 20));
     this.SelectedInfoRect = new Rectangle(leftRect.X + 60, leftRect.Y + 250, 368, 376);
     this.IntelligenceRect = new Rectangle(this.SelectedInfoRect.X + this.SelectedInfoRect.Width + 30, this.SelectedInfoRect.Y, 368, 376);
     this.OperationsRect = new Rectangle(this.IntelligenceRect.X + this.IntelligenceRect.Width + 30, this.SelectedInfoRect.Y, 368, 376);
     this.ArtifactsRect = new Rectangle(this.SelectedInfoRect.X + 20, this.SelectedInfoRect.Y + 180, this.SelectedInfoRect.Width - 40, 130);
     Submenu ArtifactsSub = new Submenu(base.ScreenManager, this.ArtifactsRect);
     this.ArtifactsSL = new ScrollList(ArtifactsSub, 40);
     this.Contact = new DanButton(new Vector2((float)(this.SelectedInfoRect.X + this.SelectedInfoRect.Width / 2 - 91), (float)(this.SelectedInfoRect.Y + this.SelectedInfoRect.Height - 45)), Localizer.Token(1644))
     {
         Toggled = true
     };
     foreach (Empire e in EmpireManager.EmpireList)
     {
         if (e != EmpireManager.GetEmpireByName(this.screen.PlayerLoyalty))
         {
             if (e.isFaction || e.MinorRace)
             {
                 continue;
             }
             RaceEntry re = new RaceEntry()
             {
                 e = e
             };
             this.Races.Add(re);
         }
         else
         {
             RaceEntry re = new RaceEntry()
             {
                 e = e
             };
             this.SelectedEmpire = e;
             this.ArtifactsSL.Entries.Clear();
             this.ArtifactsSL.indexAtTop = 0;
             ArtifactEntry entry = new ArtifactEntry();
             for (int i = 0; i < e.data.OwnedArtifacts.Count; i++)
             {
                 Artifact art = e.data.OwnedArtifacts[i];
                 SkinnableButton button = new SkinnableButton(new Rectangle(0, 0, 32, 32), string.Concat("Artifact Icons/", art.Name))
                 {
                     IsToggle = false,
                     ReferenceObject = art,
                     BaseColor = Color.White
                 };
                 if (entry.ArtifactButtons.Count < 5)
                 {
                     entry.ArtifactButtons.Add(button);
                 }
                 if (entry.ArtifactButtons.Count == 5 || i == e.data.OwnedArtifacts.Count - 1)
                 {
                     this.ArtifactsSL.AddItem(entry);
                     entry = new ArtifactEntry();
                 }
             }
             this.Races.Add(re);
         }
     }
     Vector2 Cursor = new Vector2(screenWidth / 2f - (float)(148 * this.Races.Count / 2), (float)(leftRect.Y + 10));
     int j = 0;
     foreach (RaceEntry re in this.Races)
     {
         re.container = new Rectangle((int)Cursor.X + 10 + j * 148, leftRect.Y + 40, 124, 148);
         j++;
     }
     base.ScreenManager.racialMusic.SetVolume(0f);
 }