public Submenu(bool Blue, Ship_Game.ScreenManager sm, Rectangle theMenu) { this.blue = Blue; if (sm.GraphicsDevice.PresentationParameters.BackBufferWidth <= 1280) { this.LowRes = true; } if (!this.LowRes) { this.toUse = Fonts.Arial12Bold; } else { this.toUse = Fonts.Arial12Bold; } this.toUse = Fonts.Pirulen12; this.ScreenManager = sm; this.Menu = theMenu; this.UpperLeft = new Rectangle(theMenu.X, theMenu.Y, ResourceManager.TextureDict["ResearchMenu/submenu_header_left"].Width, ResourceManager.TextureDict["ResearchMenu/submenu_header_left"].Height); this.TL = new Rectangle(theMenu.X, theMenu.Y + 25 - 2, ResourceManager.TextureDict["ResearchMenu/submenu_corner_TL"].Width, ResourceManager.TextureDict["ResearchMenu/submenu_corner_TL"].Height); this.TR = new Rectangle(theMenu.X + theMenu.Width - ResourceManager.TextureDict["ResearchMenu/submenu_corner_TR"].Width, theMenu.Y + 25 - 2, ResourceManager.TextureDict["ResearchMenu/submenu_corner_TR"].Width, ResourceManager.TextureDict["ResearchMenu/submenu_corner_TR"].Height); this.BL = new Rectangle(theMenu.X, theMenu.Y + theMenu.Height - ResourceManager.TextureDict["ResearchMenu/submenu_corner_BL"].Height + 2, ResourceManager.TextureDict["ResearchMenu/submenu_corner_BL"].Width, ResourceManager.TextureDict["ResearchMenu/submenu_corner_BL"].Height); this.BR = new Rectangle(theMenu.X + theMenu.Width - ResourceManager.TextureDict["ResearchMenu/submenu_corner_BR"].Width, theMenu.Y + theMenu.Height + 2 - ResourceManager.TextureDict["ResearchMenu/submenu_corner_BR"].Height, ResourceManager.TextureDict["ResearchMenu/submenu_corner_BR"].Width, ResourceManager.TextureDict["ResearchMenu/submenu_corner_BR"].Height); this.topHoriz = new Rectangle(theMenu.X + ResourceManager.TextureDict["ResearchMenu/submenu_corner_TL"].Width, theMenu.Y + 25 - 2, theMenu.Width - this.TR.Width - ResourceManager.TextureDict["ResearchMenu/submenu_corner_TL"].Width, 2); this.botHoriz = new Rectangle(theMenu.X + this.BL.Width, theMenu.Y + theMenu.Height, theMenu.Width - this.BL.Width - this.BR.Width, 2); this.VL = new Rectangle(theMenu.X, theMenu.Y + 25 + this.TR.Height - 2, 2, theMenu.Height - 25 - this.BL.Height - 2); this.VR = new Rectangle(theMenu.X + theMenu.Width - 2, theMenu.Y + 25 + this.TR.Height - 2, 2, theMenu.Height - 25 - this.BR.Height - 2); }
public NotificationManager(Ship_Game.ScreenManager ScreenManager, UniverseScreen screen) { this.screen = screen; this.ScreenManager = ScreenManager; this.NotificationArea = new Rectangle(ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 70, 70, 70, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 70 - 275); this.numentriesToDisplay = this.NotificationArea.Height / 70; }
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 DeepSpaceBuildingWindow(Ship_Game.ScreenManager ScreenManager, UniverseScreen screen) { this.screen = screen; this.ScreenManager = ScreenManager; int WindowWidth = 320; this.win = new Rectangle(ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 5 - WindowWidth, 260, WindowWidth, 225); Rectangle rectangle = new Rectangle(ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 5 - WindowWidth + 20, 225, WindowWidth - 40, 455); this.ConstructionSubMenu = new Submenu(ScreenManager, this.win, true); this.ConstructionSubMenu.AddTab("Build Menu"); this.SL = new ScrollList(this.ConstructionSubMenu, 40); //The Doctor: Ensure Subspace Projector is always the first entry on the DSBW list so that the player never has to scroll to find it. foreach (string s in EmpireManager.GetEmpireByName(screen.PlayerLoyalty).structuresWeCanBuild) { if (ResourceManager.GetShip(s).Name == "Subspace Projector") { this.SL.AddItem(ResourceManager.ShipsDict[s], 0, 0); break; } else continue; } foreach (string s in EmpireManager.GetEmpireByName(screen.PlayerLoyalty).structuresWeCanBuild) { if (ResourceManager.GetShip(s).Name != "Subspace Projector") { this.SL.AddItem(ResourceManager.ShipsDict[s], 0, 0); } else continue; } this.TextPos = new Vector2((float)(this.win.X + this.win.Width / 2) - Fonts.Arial12Bold.MeasureString("Deep Space Construction").X / 2f, (float)(this.win.Y + 25)); }
public AutomationWindow(Ship_Game.ScreenManager ScreenManager, UniverseScreen screen) { this.screen = screen; this.ScreenManager = ScreenManager; int WindowWidth = 210; this.win = new Rectangle(ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 115 - WindowWidth, 490, WindowWidth, 300); Rectangle rectangle = new Rectangle(ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 5 - WindowWidth + 20, 225, WindowWidth - 40, 455); this.ConstructionSubMenu = new Submenu(ScreenManager, this.win, true); this.ConstructionSubMenu.AddTab(Localizer.Token(304)); Ref<bool> aeRef = new Ref<bool>(() => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoExplore, (bool x) => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoExplore = x); Checkbox cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 25)), Localizer.Token(305), aeRef, Fonts.Arial12Bold); this.Checkboxes.Add(cb); cb.Tip_Token = 2226; this.ScoutDropDown = new DropOptions(new Rectangle(this.win.X + 12, this.win.Y + 25 + Fonts.Arial12Bold.LineSpacing + 7, 190, 18)); Ref<bool> acRef = new Ref<bool>(() => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoColonize, (bool x) => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoColonize = x); cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 65)), Localizer.Token(306), acRef, Fonts.Arial12Bold); this.Checkboxes.Add(cb); cb.Tip_Token = 2227; this.ColonyShipDropDown = new DropOptions(new Rectangle(this.win.X + 12, this.win.Y + 65 + Fonts.Arial12Bold.LineSpacing + 7, 190, 18)); Ref<bool> afRef = new Ref<bool>(() => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoFreighters, (bool x) => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoFreighters = x); cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 105)), Localizer.Token(308), afRef, Fonts.Arial12Bold); this.Checkboxes.Add(cb); cb.Tip_Token = 2229; this.AutoFreighterDropDown = new DropOptions(new Rectangle(this.win.X + 12, this.win.Y + 105 + Fonts.Arial12Bold.LineSpacing + 7, 190, 18)); this.ConstructorTitle = new Vector2((float)this.win.X + 29, (float)(this.win.Y + 155)); this.ConstructorString = Localizer.Token(6181); this.ConstructorDropDown = new DropOptions(new Rectangle(this.win.X + 12, this.win.Y + 155 + Fonts.Arial12Bold.LineSpacing + 7, 190, 18)); Ref<bool> abRef = new Ref<bool>(() => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoBuild, (bool x) => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoBuild = x); cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 210)), string.Concat(Localizer.Token(307), " Projectors"), abRef, Fonts.Arial12Bold); this.Checkboxes.Add(cb); cb.Tip_Token = 2228; Ref<bool> acomRef = new Ref<bool>(() => GlobalStats.AutoCombat, (bool x) => GlobalStats.AutoCombat = x); cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 210 + Fonts.Arial12Bold.LineSpacing + 3)), Localizer.Token(2207), acomRef, Fonts.Arial12Bold); this.Checkboxes.Add(cb); cb.Tip_Token = 2230; Ref<bool> arRef = new Ref<bool>(() => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoResearch, (bool x) => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoResearch = x); cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 210 + Fonts.Arial12Bold.LineSpacing * 2 + 6)), Localizer.Token(6136), arRef, Fonts.Arial12Bold); this.Checkboxes.Add(cb); cb.Tip_Token = 7039; Ref<bool> atRef = new Ref<bool>(() => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoTaxes, (bool x) => EmpireManager.GetEmpireByName(screen.PlayerLoyalty).AutoTaxes = x); cb = new Checkbox(new Vector2((float)this.win.X, (float)(this.win.Y + 210 + Fonts.Arial12Bold.LineSpacing * 3 + 9)), Localizer.Token(6138), atRef, Fonts.Arial12Bold); this.Checkboxes.Add(cb); cb.Tip_Token = 7040; this.SetDropDowns(); }
public Menu1(Ship_Game.ScreenManager sm, Rectangle theMenu) { this.ScreenManager = sm; this.Menu = theMenu; this.corner_TL = new Rectangle(theMenu.X, theMenu.Y, ResourceManager.TextureDict["NewUI/menu_1_corner_TL"].Width, ResourceManager.TextureDict["NewUI/menu_1_corner_TL"].Height); this.corner_TR = new Rectangle(theMenu.X + theMenu.Width - ResourceManager.TextureDict["NewUI/menu_1_corner_TR"].Width, theMenu.Y, ResourceManager.TextureDict["NewUI/menu_1_corner_TR"].Width, ResourceManager.TextureDict["NewUI/menu_1_corner_TR"].Height); this.corner_BL = new Rectangle(theMenu.X, theMenu.Y + theMenu.Height - ResourceManager.TextureDict["NewUI/menu_1_corner_BL"].Height, ResourceManager.TextureDict["NewUI/menu_1_corner_BL"].Width, ResourceManager.TextureDict["NewUI/menu_1_corner_BL"].Height); this.corner_BR = new Rectangle(theMenu.X + theMenu.Width - ResourceManager.TextureDict["NewUI/menu_1_corner_BR"].Width, theMenu.Y + theMenu.Height - ResourceManager.TextureDict["NewUI/menu_1_corner_BR"].Height, ResourceManager.TextureDict["NewUI/menu_1_corner_BR"].Width, ResourceManager.TextureDict["NewUI/menu_1_corner_BR"].Height); this.horizTop = new Rectangle(this.corner_TL.X + this.corner_TL.Width, this.corner_TL.Y, theMenu.Width - this.corner_TL.Width - this.corner_TR.Width, ResourceManager.TextureDict["NewUI/menu_1_horiz_upper"].Height); this.horizBot = new Rectangle(this.corner_BL.X + this.corner_BL.Width, theMenu.Y + theMenu.Height - ResourceManager.TextureDict["NewUI/menu_1_horiz_lower"].Height, theMenu.Width - this.corner_BL.Width - this.corner_BR.Width, ResourceManager.TextureDict["NewUI/menu_1_horiz_lower"].Height); this.vertLeft = new Rectangle(this.corner_TL.X + 1, this.corner_TL.Y + this.corner_TL.Height, ResourceManager.TextureDict["NewUI/menu_1_vert_left"].Width, theMenu.Height - this.corner_TL.Height - this.corner_BL.Height); this.vertRight = new Rectangle(theMenu.X + theMenu.Width - 1 - ResourceManager.TextureDict["NewUI/menu_1_vert_right"].Width, this.corner_TR.Y + this.corner_TR.Height, ResourceManager.TextureDict["NewUI/menu_1_vert_right"].Width, theMenu.Height - this.corner_TR.Height - this.corner_BR.Height); this.fillRect = new Rectangle(this.Menu.X + 8, this.Menu.Y + 8, this.Menu.Width - 16, this.Menu.Height - 16); }
public Selector(Ship_Game.ScreenManager sm, Rectangle theMenu, bool UseRealRect) { this.ScreenManager = sm; this.Menu = theMenu; this.UpperLeft = new Rectangle(theMenu.X, theMenu.Y, ResourceManager.TextureDict["NewUI/submenu_header_left"].Width, ResourceManager.TextureDict["NewUI/submenu_header_left"].Height); this.TL = new Rectangle(theMenu.X, theMenu.Y - 2, ResourceManager.TextureDict["NewUI/submenu_corner_TL"].Width, ResourceManager.TextureDict["NewUI/submenu_corner_TL"].Height); this.TR = new Rectangle(theMenu.X + theMenu.Width - ResourceManager.TextureDict["NewUI/submenu_corner_TR"].Width, theMenu.Y - 2, ResourceManager.TextureDict["NewUI/submenu_corner_TR"].Width, ResourceManager.TextureDict["NewUI/submenu_corner_TR"].Height); this.BL = new Rectangle(theMenu.X, theMenu.Y + theMenu.Height - ResourceManager.TextureDict["NewUI/submenu_corner_BL"].Height + 2, ResourceManager.TextureDict["NewUI/submenu_corner_BL"].Width, ResourceManager.TextureDict["NewUI/submenu_corner_BL"].Height); this.BR = new Rectangle(theMenu.X + theMenu.Width - ResourceManager.TextureDict["NewUI/submenu_corner_BR"].Width, theMenu.Y + theMenu.Height + 2 - ResourceManager.TextureDict["NewUI/submenu_corner_BR"].Height, ResourceManager.TextureDict["NewUI/submenu_corner_BR"].Width, ResourceManager.TextureDict["NewUI/submenu_corner_BR"].Height); this.topHoriz = new Rectangle(theMenu.X + ResourceManager.TextureDict["NewUI/submenu_corner_TL"].Width, theMenu.Y - 2, theMenu.Width - this.TR.Width - ResourceManager.TextureDict["NewUI/submenu_corner_TL"].Width, 2); this.botHoriz = new Rectangle(theMenu.X + this.BL.Width, theMenu.Y + theMenu.Height, theMenu.Width - this.BL.Width - this.BR.Width, 2); this.VL = new Rectangle(theMenu.X, theMenu.Y + this.TR.Height - 2, 2, theMenu.Height - this.BL.Height - 2); this.VR = new Rectangle(theMenu.X + theMenu.Width - 2, theMenu.Y + this.TR.Height - 2, 2, theMenu.Height - this.BR.Height - 2); }
public QueueComponent(Ship_Game.ScreenManager ScreenManager, Rectangle container, ResearchScreenNew screen) { this.container = container; this.screen = screen; this.ScreenManager = ScreenManager; this.Current = new Rectangle(container.X, container.Y, container.Width, 150); this.ShowQueue = new DanButton(new Vector2((float)(container.X + container.Width - 192), (float)(ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 55)), Localizer.Token(2136)); this.TimeLeft = new Rectangle(this.Current.X + this.Current.Width - 119, this.Current.Y + this.Current.Height - 24, 111, 20); this.csub = new Submenu(true, ScreenManager, this.Current); this.csub.AddTab(Localizer.Token(1405)); this.Queue = new Rectangle(this.Current.X, this.Current.Y + 165, container.Width, container.Height - 165); this.qsub = new Submenu(true, ScreenManager, this.Queue); this.qsub.AddTab(Localizer.Token(1404)); this.QSL = new ScrollList(this.qsub, 125); }
public DebugInfoScreen(Ship_Game.ScreenManager ScreenManager, UniverseScreen screen) { this.screen = screen; this.ScreenManager = ScreenManager; this.win = new Rectangle(30, 200, 1200, 700); try { foreach (Empire empire in EmpireManager.EmpireList) { if (empire == Empire.universeScreen.player || empire.isFaction || empire.MinorRace) continue; bool flag = false; foreach (Ship ship in empire.GetShips()) { if (!empire.GetForcePool().Contains(ship)) { foreach (AO ao in empire.GetGSAI().AreasOfOperations) { if (ao.GetOffensiveForcePool().Contains(ship)) if (ship.Role != "troop" && ship.BaseStrength > 0) flag = true; } if (!flag) if (!empire.GetGSAI().DefensiveCoordinator.DefensiveForcePool.Contains(ship)) { if (ship.Role != "troop" && ship.BaseStrength > 0) ++this.shipsnotinDefforcepool; } else { if (ship.Role != "troop" && ship.BaseStrength > 0) ++this.shipsnotinforcepool; } } } } } catch { } }
public AgentComponent(Rectangle r, EspionageScreen Escreen) { this.Escreen = Escreen; this.ComponentRect = r; this.ScreenManager = Ship.universeScreen.ScreenManager; this.SubRect = new Rectangle(this.ComponentRect.X, this.ComponentRect.Y + 25, this.ComponentRect.Width, this.ComponentRect.Height - 25); this.OpsSubRect = new Rectangle(Escreen.OperationsRect.X + 20, this.ComponentRect.Y + 25, this.ComponentRect.Width, this.ComponentRect.Height - 25); Submenu sub = new Submenu(this.ScreenManager, this.ComponentRect); this.AgentSL = new ScrollList(sub, 40); foreach (Agent agent in EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).data.AgentList) { this.AgentSL.AddItem(agent); } Rectangle c = this.ComponentRect; c.X = this.OpsSubRect.X; Submenu opssub = new Submenu(this.ScreenManager, c); this.OpsSL = new ScrollList(opssub, 30); this.Training = new MissionEntry(AgentMission.Training, this); this.Infiltrate = new MissionEntry(AgentMission.Infiltrate, this); this.Assassinate = new MissionEntry(AgentMission.Assassinate, this); this.Sabotage = new MissionEntry(AgentMission.Sabotage, this); this.StealTech = new MissionEntry(AgentMission.StealTech, this); this.StealShip = new MissionEntry(AgentMission.Robbery, this); this.InciteRebellion = new MissionEntry(AgentMission.InciteRebellion, this); this.OpsSL.AddItem(this.Training); this.OpsSL.AddItem(this.Infiltrate); this.OpsSL.AddItem(this.Assassinate); this.OpsSL.AddItem(this.Sabotage); this.OpsSL.AddItem(this.StealTech); this.OpsSL.AddItem(this.StealShip); this.OpsSL.AddItem(this.InciteRebellion); this.RecruitButton = new DanButton(new Vector2((float)(this.ComponentRect.X), (float)(this.ComponentRect.Y + this.ComponentRect.Height + 5f)), Localizer.Token(2179)) { Toggled = true }; }
public Menu2(Ship_Game.ScreenManager sm, Rectangle theMenu) { this.ScreenManager = sm; this.Menu = theMenu; this.corner_TL = new Rectangle(theMenu.X, theMenu.Y, ResourceManager.TextureDict["NewUI/menu_2_corner_TL"].Width, ResourceManager.TextureDict["NewUI/menu_2_corner_TL"].Height); this.corner_TR = new Rectangle(theMenu.X + theMenu.Width - ResourceManager.TextureDict["NewUI/menu_2_corner_TR"].Width, theMenu.Y, ResourceManager.TextureDict["NewUI/menu_2_corner_TR"].Width, ResourceManager.TextureDict["NewUI/menu_2_corner_TR"].Height); this.corner_BL = new Rectangle(theMenu.X, theMenu.Y + theMenu.Height - ResourceManager.TextureDict["NewUI/menu_2_corner_BL"].Height, ResourceManager.TextureDict["NewUI/menu_2_corner_BL"].Width, ResourceManager.TextureDict["NewUI/menu_2_corner_BL"].Height); this.corner_BR = new Rectangle(theMenu.X + theMenu.Width - ResourceManager.TextureDict["NewUI/menu_2_corner_BR"].Width, theMenu.Y + theMenu.Height - ResourceManager.TextureDict["NewUI/menu_2_corner_BR"].Height, ResourceManager.TextureDict["NewUI/menu_2_corner_BR"].Width, ResourceManager.TextureDict["NewUI/menu_2_corner_BR"].Height); int topDistance = theMenu.Width - this.corner_TL.Width - this.corner_TR.Width; int numberRepeats = topDistance / ResourceManager.TextureDict["NewUI/menu_2_horiz_upper_repeat"].Width; int remainder = numberRepeats * ResourceManager.TextureDict["NewUI/menu_2_horiz_upper_repeat"].Width - topDistance; this.extendTopLeft = new Rectangle(this.corner_TL.X + this.corner_TL.Width, this.corner_TL.Y + 3, remainder / 2, ResourceManager.TextureDict["NewUI/menu_2_horiz_upper_extender"].Height); this.extendTopRight = new Rectangle(this.corner_TL.X + this.corner_TL.Width - remainder / 2, this.corner_TL.Y + 3, remainder / 2, ResourceManager.TextureDict["NewUI/menu_2_horiz_upper_extender"].Height); this.topExtender = new Rectangle(theMenu.X + 8, this.corner_TL.Y + 3, theMenu.Width - 16, ResourceManager.TextureDict["NewUI/menu_2_horiz_upper_extender"].Height); for (int i = 0; i < numberRepeats + 1; i++) { Rectangle repeat = new Rectangle(this.corner_TL.X + this.corner_TL.Width + remainder + ResourceManager.TextureDict["NewUI/menu_2_horiz_upper_repeat"].Width * i, this.extendTopLeft.Y, ResourceManager.TextureDict["NewUI/menu_2_horiz_upper_repeat"].Width, ResourceManager.TextureDict["NewUI/menu_2_horiz_upper_repeat"].Height); this.RepeatTops.Add(repeat); } this.horizTop = new Rectangle(this.corner_TL.X + this.corner_TL.Width, this.corner_TL.Y + 3, theMenu.Width - this.corner_TL.Width - this.corner_TR.Width, ResourceManager.TextureDict["NewUI/menu_2_horiz_upper_extender"].Height); this.horizBot = new Rectangle(this.corner_BL.X + this.corner_BL.Width, theMenu.Y + theMenu.Height - ResourceManager.TextureDict["NewUI/menu_2_horiz_lower"].Height, theMenu.Width - this.corner_BL.Width - this.corner_BR.Width, ResourceManager.TextureDict["NewUI/menu_2_horiz_lower"].Height); this.vertLeft = new Rectangle(this.corner_TL.X + 1, this.corner_TL.Y + this.corner_TL.Height, ResourceManager.TextureDict["NewUI/menu_2_vert_left"].Width, theMenu.Height - this.corner_TL.Height - this.corner_BL.Height); this.vertRight = new Rectangle(theMenu.X - 1 + theMenu.Width - ResourceManager.TextureDict["NewUI/menu_2_vert_right"].Width, this.corner_TR.Y + this.corner_TR.Height, ResourceManager.TextureDict["NewUI/menu_2_vert_right"].Width, theMenu.Height - this.corner_TR.Height - this.corner_BR.Height); }
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; }
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 BloomComponent(Ship_Game.ScreenManager screenManager) { this.ScreenManager = screenManager; this.GraphicsDevice = screenManager.GraphicsDevice; }