コード例 #1
0
 public SortButton(SortButton sb, string text)
 {
     this.Text = text;
     if(sb!=null && sb.Text == this.Text)
     {
         this.Ascending = sb.Ascending;
         this.saved = true;
     }
     this.saveButton = sb;
 }
コード例 #2
0
        //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
        }
コード例 #3
0
        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 void ResetList()
        {
            List<Planet> pList = new List<Planet>();
            foreach (ScrollList.Entry entry in this.PlanetSL.Entries)
            {
                pList.Add((entry.item as PlanetListScreenEntry).planet);
            }
            this.PlanetSL.Entries.Clear();
            this.PlanetSL.Copied.Clear();
            this.PlanetSL.indexAtTop = 0;
            if (this.LastSorted == null)
            {
                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);
                }
            }
            else
            {
                if (this.LastSorted.Text == this.sb_Sys.Text)   // (this.sb_Sys == this.LastSorted)
                {
                    if (!this.sb_Sys.Ascending)
                    {
                        IOrderedEnumerable<Planet> sortedList =
                            from planet in this.planets
                            orderby planet.system.Name descending
                            select planet;
                        foreach (Planet p in sortedList)
                        {
                            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);
                        }
                    }
                    else
                    {
                        IOrderedEnumerable<Planet> sortedList =
                            from planet in this.planets
                            orderby planet.system.Name
                            select planet;
                        foreach (Planet p in sortedList)
                        {
                            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);
                        }
                    }
                }
                if (this.sb_Name.Text == this.LastSorted.Text)
                {
                    if (!this.sb_Name.Ascending)
                    {
                        IOrderedEnumerable<Planet> sortedList =
                            from planet in this.planets
                            orderby planet.Name descending
                            select planet;
                        foreach (Planet p in sortedList)
                        {
                            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);
                        }
                    }
                    else
                    {
                        IOrderedEnumerable<Planet> sortedList =
                            from planet in this.planets
                            orderby planet.Name
                            select planet;
                        foreach (Planet p in sortedList)
                        {
                            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);
                        }
                    }
                }
                if (this.sb_Fert.Text == this.LastSorted.Text)
                {
                    AudioManager.PlayCue("blip_click");

                    this.PlanetSL.Entries.Clear();
                    this.PlanetSL.Copied.Clear();
                    if (!this.sb_Fert.Ascending)
                    {
                        IOrderedEnumerable<Planet> sortedList =
                            from planet in this.planets
                            orderby planet.Fertility descending
                            select planet;
                        foreach (Planet p in sortedList)
                        {
                            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);
                        }
                    }
                    else
                    {
                        IOrderedEnumerable<Planet> sortedList =
                            from planet in this.planets
                            orderby planet.Fertility
                            select planet;
                        foreach (Planet p in sortedList)
                        {
                            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);
                        }
                    }
                }
                if (this.LastSorted.Text == this.sb_Rich.Text   )//1this.sb_Rich == this.LastSorted)
                {
                    this.LastSorted = this.sb_Rich;
                    AudioManager.PlayCue("blip_click");
                    //this.sb_Rich.Ascending = !this.sb_Rich.Ascending;
                    this.PlanetSL.Entries.Clear();
                    this.PlanetSL.Copied.Clear();
                    if (!this.sb_Rich.Ascending)
                    {
                        IOrderedEnumerable<Planet> sortedList =
                            from planet in this.planets
                            orderby planet.MineralRichness descending
                            select planet;
                        foreach (Planet p in sortedList)
                        {
                            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);
                        }
                    }
                    else
                    {
                        IOrderedEnumerable<Planet> sortedList =
                            from planet in this.planets
                            orderby planet.MineralRichness
                            select planet;
                        foreach (Planet p in sortedList)
                        {
                            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);
                        }
                    }
                }
                if (this.sb_Pop.Text == this.LastSorted.Text)
                {
                    this.LastSorted = this.sb_Pop;
                    AudioManager.PlayCue("blip_click");
                    //this.sb_Pop.Ascending = !this.sb_Pop.Ascending;
                    this.PlanetSL.Entries.Clear();
                    this.PlanetSL.Copied.Clear();
                    if (!this.sb_Pop.Ascending)
                    {
                        IOrderedEnumerable<Planet> sortedList =
                            from planet in this.planets
                            orderby planet.MaxPopulation descending
                            select planet;
                        foreach (Planet p in sortedList)
                        {
                            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);
                        }
                    }
                    else
                    {
                        IOrderedEnumerable<Planet> sortedList =
                            from planet in this.planets
                            orderby planet.MaxPopulation
                            select planet;
                        foreach (Planet p in sortedList)
                        {
                            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);
                        }
                    }
                }
                if (this.sb_Owned.Text == this.LastSorted.Text)
                {
                    this.LastSorted = this.sb_Owned;
                    AudioManager.PlayCue("blip_click");
                    //this.sb_Owned.Ascending = !this.sb_Owned.Ascending;
                    this.PlanetSL.Entries.Clear();
                    this.PlanetSL.Copied.Clear();
                    if (!this.sb_Owned.Ascending)
                    {
                        IOrderedEnumerable<Planet> sortedList =
                            from planet in this.planets
                            orderby planet.GetOwnerName() descending
                            select planet;
                        foreach (Planet p in sortedList)
                        {
                            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);
                        }
                    }
                    else
                    {
                        IOrderedEnumerable<Planet> sortedList =
                            from planet in this.planets
                            orderby planet.GetOwnerName()
                            select planet;
                        foreach (Planet p in sortedList)
                        {
                            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);
                        }
                    }
                }
            }
            if (this.PlanetSL.Entries.Count <= 0)
            {
                this.SelectedPlanet = null;
                return;
            }
            this.SelectedPlanet = (this.PlanetSL.Entries[this.PlanetSL.indexAtTop].item as PlanetListScreenEntry).planet;

            //this.empUI.empire.data.PLSort = this.LastSorted;
        }
        //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 HandleInput(InputState input)
        {
            //this.LastSorted = empUI.empire.data.PLSort;
            if (this.PlanetSL.Entries.Count == 0)
                this.ResetList();
            this.PlanetSL.HandleInput(input);
            this.cb_hideOwned.HandleInput(input);
            this.cb_hideUninhabitable.HandleInput(input);
            if (this.sb_Sys.HandleInput(input))
            {
                this.LastSorted = this.sb_Sys;
                AudioManager.PlayCue("blip_click");
                this.sb_Sys.Ascending = !this.sb_Sys.Ascending;
                this.PlanetSL.Entries.Clear();
                this.PlanetSL.Copied.Clear();
                if (!this.sb_Sys.Ascending)
                {
                    IOrderedEnumerable<Planet> sortedList =
                        from planet in this.planets
                        orderby planet.system.Name descending
                        select planet;
                    foreach (Planet p in sortedList)
                    {
                        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);
                    }
                }
                else
                {
                    IOrderedEnumerable<Planet> sortedList =
                        from planet in this.planets
                        orderby planet.system.Name
                        select planet;
                    foreach (Planet p in sortedList)
                    {
                        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);
                    }
                }
            }
            if (this.sb_Name.HandleInput(input))
            {
                this.LastSorted = this.sb_Name;
                AudioManager.PlayCue("blip_click");
                this.sb_Name.Ascending = !this.sb_Name.Ascending;
                this.PlanetSL.Entries.Clear();
                this.PlanetSL.Copied.Clear();
                if (!this.sb_Name.Ascending)
                {
                    IOrderedEnumerable<Planet> sortedList =
                        from planet in this.planets
                        orderby planet.Name descending
                        select planet;
                    foreach (Planet p in sortedList)
                    {
                        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);
                    }
                }
                else
                {
                    IOrderedEnumerable<Planet> sortedList =
                        from planet in this.planets
                        orderby planet.Name
                        select planet;
                    foreach (Planet p in sortedList)
                    {
                        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);
                    }
                }
            }
            if (this.sb_Fert.HandleInput(input))
            {
                this.LastSorted = this.sb_Fert;
                AudioManager.PlayCue("blip_click");
                this.sb_Fert.Ascending = !this.sb_Fert.Ascending;
                this.PlanetSL.Entries.Clear();
                this.PlanetSL.Copied.Clear();
                if (!this.sb_Fert.Ascending)
                {
                    IOrderedEnumerable<Planet> sortedList =
                        from planet in this.planets
                        orderby planet.Fertility descending
                        select planet;
                    foreach (Planet p in sortedList)
                    {
                        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);
                    }
                }
                else
                {
                    IOrderedEnumerable<Planet> sortedList =
                        from planet in this.planets
                        orderby planet.Fertility
                        select planet;
                    foreach (Planet p in sortedList)
                    {
                        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);
                    }
                }
            }
            if (this.sb_Rich.HandleInput(input))
            {
                this.LastSorted = this.sb_Rich;
                AudioManager.PlayCue("blip_click");
                this.sb_Rich.Ascending = !this.sb_Rich.Ascending;
                this.PlanetSL.Entries.Clear();
                this.PlanetSL.Copied.Clear();
                if (!this.sb_Rich.Ascending)
                {
                    IOrderedEnumerable<Planet> sortedList =
                        from planet in this.planets
                        orderby planet.MineralRichness descending
                        select planet;
                    foreach (Planet p in sortedList)
                    {
                        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);
                    }
                }
                else
                {
                    IOrderedEnumerable<Planet> sortedList =
                        from planet in this.planets
                        orderby planet.MineralRichness
                        select planet;
                    foreach (Planet p in sortedList)
                    {
                        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);
                    }
                }
            }
            if (this.sb_Pop.HandleInput(input))
            {
                //this.LastSorted = this.sb_Pop;
                AudioManager.PlayCue("blip_click");
                this.sb_Pop.Ascending = !this.sb_Pop.Ascending;
                this.PlanetSL.Entries.Clear();
                this.PlanetSL.Copied.Clear();
                if (!this.sb_Pop.Ascending)
                {
                    IOrderedEnumerable<Planet> sortedList =
                        from planet in this.planets
                        orderby planet.MaxPopulation descending
                        select planet;
                    foreach (Planet p in sortedList)
                    {
                        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);
                    }
                }
                else
                {
                    IOrderedEnumerable<Planet> sortedList =
                        from planet in this.planets
                        orderby planet.MaxPopulation
                        select planet;
                    foreach (Planet p in sortedList)
                    {
                        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);
                    }
                }
            }
            if (this.sb_Owned.HandleInput(input))
            {
                this.LastSorted = this.sb_Owned;
                AudioManager.PlayCue("blip_click");
                this.sb_Owned.Ascending = !this.sb_Owned.Ascending;
                this.PlanetSL.Entries.Clear();
                this.PlanetSL.Copied.Clear();
                if (!this.sb_Owned.Ascending)
                {
                    IOrderedEnumerable<Planet> sortedList =
                        from planet in this.planets
                        orderby planet.GetOwnerName() descending
                        select planet;
                    foreach (Planet p in sortedList)
                    {
                        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);
                    }
                }
                else
                {
                    IOrderedEnumerable<Planet> sortedList =
                        from planet in this.planets
                        orderby planet.GetOwnerName()
                        select planet;
                    foreach (Planet p in sortedList)
                    {
                        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);
                    }
                }
            }

            for (int i = this.PlanetSL.indexAtTop; i < this.PlanetSL.Entries.Count && i < this.PlanetSL.indexAtTop + this.PlanetSL.entriesToDisplay; i++)
            {
                PlanetListScreenEntry entry = this.PlanetSL.Entries[i].item as PlanetListScreenEntry;
                entry.HandleInput(input);
                entry.SetNewPos(this.eRect.X + 22, this.PlanetSL.Entries[i].clickRect.Y);
                if (!GlobalStats.TakingInput
                    && HelperFunctions.CheckIntersection(entry.TotalEntrySize, input.CursorPosition) && input.CurrentMouseState.LeftButton == ButtonState.Pressed && input.LastMouseState.LeftButton == ButtonState.Released)
                {
                    if (this.ClickTimer >= this.ClickDelay)
                    {
                        this.ClickTimer = 0f;
                    }
                    else
                    {
                        {
                            this.ExitScreen();
                            this.empUI.screen.SelectedPlanet = entry.planet;
                            this.empUI.screen.ViewPlanet(null);
                            this.empUI.screen.transitionStartPosition = new Vector3(this.SelectedPlanet.Position.X, this.SelectedPlanet.Position.Y, 10000f);
                            this.empUI.screen.returnToShip = false;
                        }
                        if (this.SelectedPlanet != entry.planet)
                        {
                            AudioManager.PlayCue("sd_ui_accept_alt3");
                            this.SelectedPlanet = entry.planet;
                        }
                    }
                }
            }
            if (input.CurrentKeyboardState.IsKeyDown(Keys.L) && !input.LastKeyboardState.IsKeyDown(Keys.L) && !GlobalStats.TakingInput)
            {
                AudioManager.PlayCue("echo_affirm");
                this.ExitScreen();
                return;
            }
            if (input.Escaped || input.RightMouseClick || this.close.HandleInput(input) )
            {
                //this.empUI.empire.data.PLSort = this.LastSorted;
                this.ExitScreen();
            }
            //if(this.LastSorted !=null && this.empUI.empire.data.PLSort != this.LastSorted)
        }