public bool HandleInput(InputState input, ScrollList.Entry e) { if (!HelperFunctions.CheckIntersection(e.clickRect, input.CursorPosition)) { this.Hover = false; } else { this.Hover = true; if (input.CurrentMouseState.LeftButton == ButtonState.Pressed && input.LastMouseState.LeftButton == ButtonState.Released) { AudioManager.PlayCue("sd_ui_accept_alt3"); this.Open = !this.Open; e.ShowingSub = !e.ShowingSub; if (!this.Open) { int num = 0; foreach (ScrollList.Entry subEntry in e.SubEntries) { num++; } ScrollList parentList = e.ParentList; parentList.indexAtTop = parentList.indexAtTop - num; if (e.ParentList.indexAtTop < 0) { e.ParentList.indexAtTop = 0; } } e.ParentList.Update(); return true; } } return false; }
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 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 string HandleInput(InputState input, ScrollList.Entry e) { if (!HelperFunctions.CheckIntersection(this.ClickRect, input.CursorPosition)) { this.Hover = false; } else { this.Hover = true; string response = (e.item as ItemToOffer).Response; string str = response; if (response != null) { if (str == "NAPact") { ToolTip.CreateTooltip(129, Ship.universeScreen.ScreenManager); } else if (str == "OpenBorders") { ToolTip.CreateTooltip(130, Ship.universeScreen.ScreenManager); } else if (str == "Peace Treaty") { ToolTip.CreateTooltip(131, Ship.universeScreen.ScreenManager); } else if (str == "TradeTreaty") { ToolTip.CreateTooltip(132, Ship.universeScreen.ScreenManager); } else if (str == "OfferAlliance") { ToolTip.CreateTooltip(133, Ship.universeScreen.ScreenManager); } } if (input.CurrentMouseState.LeftButton == ButtonState.Pressed && input.LastMouseState.LeftButton == ButtonState.Released) { this.Selected = !this.Selected; e.ShowingSub = !e.ShowingSub; return this.Response; } } return null; }
public TroopInfoUIElement(Rectangle r, Ship_Game.ScreenManager sm, UniverseScreen screen) { this.screen = screen; this.ScreenManager = sm; this.ElementRect = r; this.sel = new Selector(this.ScreenManager, r, Color.Black); base.TransitionOnTime = TimeSpan.FromSeconds(0.25); base.TransitionOffTime = TimeSpan.FromSeconds(0.25); this.SliderRect = new Rectangle(r.X + r.Width - 100, r.Y + r.Height - 40, 500, 40); this.clickRect = new Rectangle(this.ElementRect.X + this.ElementRect.Width - 16, this.ElementRect.Y + this.ElementRect.Height / 2 - 11, 11, 22); this.LeftRect = new Rectangle(r.X, r.Y + 44, 200, r.Height - 44); this.RightRect = new Rectangle(r.X + 200, r.Y + 44, 200, r.Height - 44); this.flagRect = new Rectangle(r.X + r.Width - 31, r.Y + 22 - 13, 26, 26); this.DefenseRect = new Rectangle(this.LeftRect.X + 12, this.LeftRect.Y + 18, 22, 22); this.SoftAttackRect = new Rectangle(this.LeftRect.X + 12, this.DefenseRect.Y + 22 + 5, 16, 16); this.HardAttackRect = new Rectangle(this.LeftRect.X + 12, this.SoftAttackRect.Y + 16 + 5, 16, 16); this.DefenseRect.X = this.DefenseRect.X - 3; this.ItemDisplayRect = new Rectangle(this.LeftRect.X + 85, this.LeftRect.Y + 5, 128, 128); Rectangle DesRect = new Rectangle(this.HardAttackRect.X, this.HardAttackRect.Y - 10, this.LeftRect.Width + 8, 95); Submenu sub = new Submenu(this.ScreenManager, DesRect); this.DescriptionSL = new ScrollList(sub, Fonts.Arial12.LineSpacing + 1); TroopInfoUIElement.TippedItem def = new TroopInfoUIElement.TippedItem() { r = this.DefenseRect, TIP_ID = 33 }; this.ToolTipItems.Add(def); def = new TroopInfoUIElement.TippedItem() { r = this.SoftAttackRect, TIP_ID = 34 }; this.ToolTipItems.Add(def); def = new TroopInfoUIElement.TippedItem() { r = this.HardAttackRect, TIP_ID = 35 }; this.ToolTipItems.Add(def); }
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 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); }
protected virtual void Dispose(bool disposing) { if (!disposed) { if (disposing) { if (this.traitsSL != null) this.traitsSL.Dispose(); if (this.RaceArchetypeSL != null) this.RaceArchetypeSL.Dispose(); if (this.DescriptionSL != null) this.DescriptionSL.Dispose(); } this.traitsSL = null; this.RaceArchetypeSL = null; this.DescriptionSL = null; this.disposed = true; } }
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(); }
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 void LoadContent(Ship_Game.ScreenManager ScreenManager, Rectangle FitRect) { this.MainRect = new Rectangle(ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 300, ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight / 2 - 300, 600, 600); this.TopRect = new Rectangle(this.MainRect.X, this.MainRect.Y, this.MainRect.Width, 28); this.BlackRect = new Rectangle(FitRect.X, FitRect.Y, FitRect.Width, 240); this.ResponseRect = new Rectangle(FitRect.X, this.BlackRect.Y + this.BlackRect.Height + 10, FitRect.Width, 180); Submenu resp = new Submenu(ScreenManager, this.ResponseRect); this.ResponseSL = new ScrollList(resp, 20); this.SetResponses(); }
protected void Dispose(bool disposing) { if (!disposed) { if (disposing) { if (this.SelectedShipsSL != null) this.SelectedShipsSL.Dispose(); } this.SelectedShipsSL = null; this.disposed = true; } }
protected void Dispose(bool disposing) { if (!disposed) { if (disposing) { if (this.hullSL != null) this.hullSL.Dispose(); if (this.weaponSL != null) this.weaponSL.Dispose(); if (this.ChooseFighterSL != null) this.ChooseFighterSL.Dispose(); } this.hullSL = null; this.weaponSL = null; this.ChooseFighterSL = null; this.disposed = true; } }
private string parseTextToSL(string text, float Width, SpriteFont font, ref ScrollList List) { string line = string.Empty; string returnString = string.Empty; string[] wordArray = text.Split(new char[] { ' ' }); for (int i = 0; i < (int)wordArray.Length; i++) { if (wordArray[i] == "SING") { wordArray[i] = this.playerEmpire.data.Traits.Singular; } else if (wordArray[i] == "SING.") { wordArray[i] = string.Concat(this.playerEmpire.data.Traits.Singular, "."); } else if (wordArray[i] == "SING,") { wordArray[i] = string.Concat(this.playerEmpire.data.Traits.Singular, ","); } else if (wordArray[i] == "SING?") { wordArray[i] = string.Concat(this.playerEmpire.data.Traits.Singular, "?"); } if (wordArray[i] == "PLURAL") { wordArray[i] = this.playerEmpire.data.Traits.Plural; } else if (wordArray[i] == "PLURAL.") { wordArray[i] = string.Concat(this.playerEmpire.data.Traits.Plural, "."); } else if (wordArray[i] == "PLURAL,") { wordArray[i] = string.Concat(this.playerEmpire.data.Traits.Plural, ","); } else if (wordArray[i] == "PLURAL?") { wordArray[i] = string.Concat(this.playerEmpire.data.Traits.Plural, "?"); } if (wordArray[i] == "TARSYS") { wordArray[i] = this.empToDiscuss.data.Traits.Name; } else if (wordArray[i] == "TARSYS.") { wordArray[i] = string.Concat(this.empToDiscuss.data.Traits.Name, "."); } else if (wordArray[i] == "TARSYS,") { wordArray[i] = string.Concat(this.empToDiscuss.data.Traits.Name, ","); } if (wordArray[i] == "TAREMP") { wordArray[i] = this.empToDiscuss.data.Traits.Name; } else if (wordArray[i] == "TAREMP.") { wordArray[i] = string.Concat(this.empToDiscuss.data.Traits.Name, "."); } else if (wordArray[i] == "TAREMP,") { wordArray[i] = string.Concat(this.empToDiscuss.data.Traits.Name, ","); } else if (wordArray[i] == "TAREMP?") { wordArray[i] = string.Concat(this.empToDiscuss.data.Traits.Name, "?"); } if (wordArray[i] == "TECH_DEMAND") { wordArray[i] = Localizer.Token(ResourceManager.TechTree[this.OurOffer.TechnologiesOffered[0]].NameIndex); } else if (wordArray[i] == "TECH_DEMAND.") { wordArray[i] = string.Concat(Localizer.Token(ResourceManager.TechTree[this.OurOffer.TechnologiesOffered[0]].NameIndex), "."); } else if (wordArray[i] == "TECH_DEMAND,") { wordArray[i] = string.Concat(Localizer.Token(ResourceManager.TechTree[this.OurOffer.TechnologiesOffered[0]].NameIndex), ","); } else if (wordArray[i] == "TECH_DEMAND?") { wordArray[i] = string.Concat(Localizer.Token(ResourceManager.TechTree[this.OurOffer.TechnologiesOffered[0]].NameIndex), "?"); } else if (wordArray[i] == "TECH_DEMAND!") { wordArray[i] = string.Concat(Localizer.Token(ResourceManager.TechTree[this.OurOffer.TechnologiesOffered[0]].NameIndex), "!"); } } string[] strArrays = wordArray; for (int j = 0; j < (int)strArrays.Length; j++) { string word = strArrays[j]; if (font.MeasureString(string.Concat(line, word)).Length() > Width) { returnString = string.Concat(returnString, line, '\n'); line = string.Empty; } line = string.Concat(line, word, ' '); } string[] lineArray = returnString.Split(new char[] { '\n' }); for (int i = 0; i < (int)lineArray.Length; i++) { string sent = lineArray[i]; if (sent.Length > 0) { this.OfferTextSL.AddItem(sent); } else if (string.IsNullOrEmpty(sent) && (int)lineArray.Length > i + 1 && !string.IsNullOrEmpty(lineArray[i + 1])) { this.OfferTextSL.AddItem("\n"); } } this.OfferTextSL.AddItem(line); return string.Concat(returnString, line); }
public override void LoadContent() { Rectangle shipDesignsRect = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 140, 100, 280, 500); this.sub_ships = new Submenu(base.ScreenManager, shipDesignsRect); this.ShipSL = new ScrollList(this.sub_ships, 40); this.sub_ships.AddTab("Refit to..."); foreach (string shipname in this.shiptorefit.loyalty.ShipsWeCanBuild) { if (!(ResourceManager.ShipsDict[shipname].GetShipData().Hull == this.shiptorefit.GetShipData().Hull) || !(shipname != this.shiptorefit.Name) || ResourceManager.ShipRoles[ResourceManager.ShipsDict[shipname].Role].Protected) { continue; } this.ShipSL.AddItem(shipname); } this.ConfirmRefit = new DanButton(new Vector2((float)shipDesignsRect.X, (float)(shipDesignsRect.Y + 505)), "Do Refit"); this.RefitOne = new UIButton() { Rect = new Rectangle(shipDesignsRect.X + 25, shipDesignsRect.Y + 505, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_100px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_100px"].Height), NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_100px"], HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_100px_hover"], PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_100px_pressed"], Text = Localizer.Token(2265) }; this.RefitAll = new UIButton() { Rect = new Rectangle(shipDesignsRect.X + 140, shipDesignsRect.Y + 505, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_100px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_100px"].Height), NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_100px"], HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_100px_hover"], PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_100px_pressed"], Text = Localizer.Token(2266) }; base.LoadContent(); }
protected void Dispose(bool disposing) { if (!disposed) { if (disposing) { if (this.OurItemsSL != null) this.OurItemsSL.Dispose(); if (this.TheirItemsSL != null) this.TheirItemsSL.Dispose(); if (this.StatementsSL != null) this.StatementsSL.Dispose(); if (this.OfferTextSL != null) this.OfferTextSL.Dispose(); } this.OurItemsSL = null; this.TheirItemsSL = null; this.StatementsSL = null; this.OfferTextSL = null; this.disposed = true; } }
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)); }
protected void Dispose(bool disposing) { if (!disposed) { if (disposing) { if (this.ColoniesList != null) this.ColoniesList.Dispose(); } this.ColoniesList = null; this.disposed = true; } }
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; }
protected void Dispose(bool disposing) { if (!disposed) { if (disposing) { if (this.buildSL != null) this.buildSL.Dispose(); if (this.QSL != null) this.QSL.Dispose(); if (this.CommoditiesSL != null) this.CommoditiesSL.Dispose(); } this.buildSL = null; this.QSL = null; this.CommoditiesSL = null; this.disposed = true; } }
public ShipListInfoUIElement(Rectangle r, Ship_Game.ScreenManager sm, UniverseScreen screen) { this.Housing = r; this.screen = screen; this.ScreenManager = sm; this.ElementRect = r; this.sel = new Selector(this.ScreenManager, r, Color.Black); base.TransitionOnTime = TimeSpan.FromSeconds(0.25); base.TransitionOffTime = TimeSpan.FromSeconds(0.25); this.SliderRect = new Rectangle(r.X - 100, r.Y + r.Height - 140, 530, 130); this.LeftRect = new Rectangle(r.X, r.Y + 44, 180, r.Height - 44); this.sliding_element = new SlidingElement(this.SliderRect); this.RightRect = new Rectangle(this.LeftRect.X + this.LeftRect.Width, this.LeftRect.Y, 220, this.LeftRect.Height); float spacing = (float)(this.LeftRect.Height - 26 - 96); this.Power = new Rectangle(this.RightRect.X, this.LeftRect.Y + 12, 20, 20); Rectangle pbarrect = new Rectangle(this.Power.X + this.Power.Width + 15, this.Power.Y, 150, 18); this.pBar = new ProgressBar(pbarrect) { color = "green" }; ShipListInfoUIElement.TippedItem ti = new ShipListInfoUIElement.TippedItem() { r = this.Power, TIP_ID = 27 }; this.Shields = new Rectangle(this.RightRect.X, this.LeftRect.Y + 12 + 20 + (int)spacing, 20, 20); Rectangle pshieldsrect = new Rectangle(this.Shields.X + this.Shields.Width + 15, this.Shields.Y, 150, 18); this.sBar = new ProgressBar(pshieldsrect) { color = "blue" }; ti = new ShipListInfoUIElement.TippedItem() { r = this.Shields, TIP_ID = 28 }; this.DefenseRect = new Rectangle(this.Housing.X + 13, this.Housing.Y + 112, 22, 22); ti = new ShipListInfoUIElement.TippedItem() { r = this.DefenseRect, TIP_ID = 30 }; this.TroopRect = new Rectangle(this.Housing.X + 13, this.Housing.Y + 137, 22, 22); ti = new ShipListInfoUIElement.TippedItem() { r = this.TroopRect, TIP_ID = 37 }; Rectangle gridRect = new Rectangle(this.Housing.X + 16, this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 45, 34, 24); this.gridbutton = new ToggleButton(gridRect, "SelectionBox/button_grid_active", "SelectionBox/button_grid_inactive", "SelectionBox/button_grid_hover", "SelectionBox/button_grid_pressed", "SelectionBox/icon_grid") { Active = true }; this.clickRect = new Rectangle(this.ElementRect.X + this.ElementRect.Width - 16, this.ElementRect.Y + this.ElementRect.Height / 2 - 11, 11, 22); this.ShipInfoRect = new Rectangle(this.Housing.X + 60, this.Housing.Y + 110, 115, 115); Rectangle rectangle = new Rectangle(this.Housing.X + 187, this.Housing.Y + 120 + 20 + (int)spacing + 20 + (int)spacing, 20, 20); Vector2 OrdersBarPos = new Vector2((float)(this.Power.X + 12), (float)(this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 45)); 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"); this.CombatStatusButtons.Add(AttackRuns); AttackRuns.Action = "attack"; AttackRuns.HasToolTip = true; AttackRuns.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"); this.CombatStatusButtons.Add(Artillery); Artillery.Action = "arty"; Artillery.HasToolTip = true; Artillery.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"); this.CombatStatusButtons.Add(HoldPos); HoldPos.Action = "hold"; HoldPos.HasToolTip = true; HoldPos.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"); this.CombatStatusButtons.Add(OrbitLeft); OrbitLeft.Action = "orbit_left"; OrbitLeft.HasToolTip = true; OrbitLeft.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"); this.CombatStatusButtons.Add(BroadsideLeft); BroadsideLeft.Action = "broadside_left"; BroadsideLeft.HasToolTip = true; BroadsideLeft.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"); this.CombatStatusButtons.Add(OrbitRight); OrbitRight.Action = "orbit_right"; OrbitRight.HasToolTip = true; OrbitRight.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"); this.CombatStatusButtons.Add(BroadsideRight); BroadsideRight.Action = "broadside_right"; BroadsideRight.HasToolTip = true; BroadsideRight.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"); this.CombatStatusButtons.Add(Evade); Evade.Action = "evade"; Evade.HasToolTip = true; Evade.WhichToolTip = 6; Rectangle slsubRect = new Rectangle(this.RightRect.X, this.Housing.Y + 110 - 35, this.RightRect.Width - 5, 140); Submenu shipssub = new Submenu(this.ScreenManager, slsubRect); this.SelectedShipsSL = new ScrollList(shipssub, 24); }
protected void Dispose(bool disposing) { if (!disposed) { if (disposing) { if (this.OperationsSL != null) this.OperationsSL.Dispose(); if (this.AgentComponent != null) this.AgentComponent.Dispose(); } this.OperationsSL = null; this.AgentComponent = null; this.disposed = true; } }
public override void LoadContent() { LightRig rig = base.ScreenManager.Content.Load<LightRig>("example/ShipyardLightrig"); lock (GlobalStats.ObjectManagerLocker) { base.ScreenManager.inter.LightManager.Clear(); base.ScreenManager.inter.LightManager.Submit(rig); } if (base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth <= 1280 || base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight <= 768) { this.LowRes = true; } Rectangle leftRect = new Rectangle(5, 45, 405, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 45 - (int)(0.4f * (float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight) + 10); this.ModuleSelectionMenu = new Menu1(base.ScreenManager, leftRect); Rectangle modSelR = new Rectangle(0, (this.LowRes ? 45 : 100), 305, (this.LowRes ? 350 : 400)); this.modSel = new Submenu(base.ScreenManager, modSelR, true); this.modSel.AddTab("Wpn"); this.modSel.AddTab("Pwr"); this.modSel.AddTab("Def"); this.modSel.AddTab("Spc"); this.weaponSL = new ScrollList(this.modSel); Vector2 Cursor = new Vector2((float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 175), 80f); Rectangle active = new Rectangle(modSelR.X, modSelR.Y + modSelR.Height + 15, modSelR.Width, 300); this.activeModWindow = new Menu1(base.ScreenManager, active); Rectangle acsub = new Rectangle(active.X, modSelR.Y + modSelR.Height + 15, 305, 320); if (base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight > 760) { acsub.Height = acsub.Height + 120; } this.activeModSubMenu = new Submenu(base.ScreenManager, acsub); this.activeModSubMenu.AddTab("Active Module"); this.choosefighterrect = new Rectangle(acsub.X + acsub.Width + 5, acsub.Y, 240, 270); if (this.choosefighterrect.Y + this.choosefighterrect.Height > base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight) { int diff = this.choosefighterrect.Y + this.choosefighterrect.Height - base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight; this.choosefighterrect.Height = this.choosefighterrect.Height - (diff + 10); } this.choosefighterrect.Height = acsub.Height; this.ChooseFighterSub = new Submenu(base.ScreenManager, this.choosefighterrect); this.ChooseFighterSub.AddTab("Choose Fighter"); this.ChooseFighterSL = new ScrollList(this.ChooseFighterSub, 40); foreach (KeyValuePair<string, bool> hull in EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).GetHDict()) { if (!hull.Value) { continue; } this.AvailableHulls.Add(Ship_Game.ResourceManager.HullsDict[hull.Key]); } PrimitiveQuad.graphicsDevice = base.ScreenManager.GraphicsDevice; float width = (float)base.ScreenManager.GraphicsDevice.Viewport.Width; Viewport viewport = base.ScreenManager.GraphicsDevice.Viewport; float aspectRatio = width / (float)viewport.Height; this.offset = new Vector2(); Viewport viewport1 = base.ScreenManager.GraphicsDevice.Viewport; this.offset.X = (float)(viewport1.Width / 2 - 256); Viewport viewport2 = base.ScreenManager.GraphicsDevice.Viewport; this.offset.Y = (float)(viewport2.Height / 2 - 256); this.camera = new Camera2d(); Camera2d vector2 = this.camera; Viewport viewport3 = base.ScreenManager.GraphicsDevice.Viewport; float single = (float)viewport3.Width / 2f; Viewport viewport4 = base.ScreenManager.GraphicsDevice.Viewport; vector2.Pos = new Vector2(single, (float)viewport4.Height / 2f); Vector3 camPos = this.cameraPosition * new Vector3(-1f, 1f, 1f); this.view = ((Matrix.CreateTranslation(0f, 0f, 0f) * Matrix.CreateRotationY(MathHelper.ToRadians(180f))) * Matrix.CreateRotationX(MathHelper.ToRadians(0f))) * Matrix.CreateLookAt(camPos, new Vector3(camPos.X, camPos.Y, 0f), new Vector3(0f, -1f, 0f)); this.projection = Matrix.CreatePerspectiveFieldOfView(0.7853982f, aspectRatio, 1f, 20000f); this.ChangeHull(this.AvailableHulls[0]); lock (GlobalStats.ObjectManagerLocker) { if (!this.ActiveHull.Animated) { this.ActiveModel = base.ScreenManager.Content.Load<Model>(this.ActiveHull.ModelPath); this.CreateSOFromHull(); } else { base.ScreenManager.inter.ObjectManager.Remove(this.shipSO); SkinnedModel sm = Ship_Game.ResourceManager.GetSkinnedModel(this.ActiveHull.ModelPath); this.shipSO = new SceneObject(sm.Model) { ObjectType = ObjectType.Dynamic, World = this.worldMatrix }; base.ScreenManager.inter.ObjectManager.Submit(this.shipSO); this.SetupSlots(); } } foreach (ModuleSlotData slot in this.ActiveHull.ModuleSlotList) { if (slot.Position.X < this.LowestX) { this.LowestX = slot.Position.X; } if (slot.Position.X <= this.HighestX) { continue; } this.HighestX = slot.Position.X; } float xDistance = this.HighestX - this.LowestX; BoundingSphere bs = this.shipSO.WorldBoundingSphere; Viewport viewport5 = base.ScreenManager.GraphicsDevice.Viewport; Vector3 pScreenSpace = viewport5.Project(Vector3.Zero, this.projection, this.view, Matrix.Identity); Vector2 pPos = new Vector2(pScreenSpace.X, pScreenSpace.Y); Vector2 radialPos = this.GeneratePointOnCircle(90f, Vector2.Zero, xDistance); Viewport viewport6 = base.ScreenManager.GraphicsDevice.Viewport; Vector3 insetRadialPos = viewport6.Project(new Vector3(radialPos, 0f), this.projection, this.view, Matrix.Identity); Vector2 insetRadialSS = new Vector2(insetRadialPos.X, insetRadialPos.Y); float Radius = Vector2.Distance(insetRadialSS, pPos) + 10f; if (Radius >= xDistance) { while (Radius > xDistance) { camPos = this.cameraPosition * new Vector3(-1f, 1f, 1f); this.view = ((Matrix.CreateTranslation(0f, 0f, 0f) * Matrix.CreateRotationY(MathHelper.ToRadians(180f))) * Matrix.CreateRotationX(MathHelper.ToRadians(0f))) * Matrix.CreateLookAt(camPos, new Vector3(camPos.X, camPos.Y, 0f), new Vector3(0f, -1f, 0f)); bs = this.shipSO.WorldBoundingSphere; Viewport viewport7 = base.ScreenManager.GraphicsDevice.Viewport; pScreenSpace = viewport7.Project(Vector3.Zero, this.projection, this.view, Matrix.Identity); pPos = new Vector2(pScreenSpace.X, pScreenSpace.Y); radialPos = this.GeneratePointOnCircle(90f, Vector2.Zero, xDistance); Viewport viewport8 = base.ScreenManager.GraphicsDevice.Viewport; insetRadialPos = viewport8.Project(new Vector3(radialPos, 0f), this.projection, this.view, Matrix.Identity); insetRadialSS = new Vector2(insetRadialPos.X, insetRadialPos.Y); Radius = Vector2.Distance(insetRadialSS, pPos) + 10f; this.cameraPosition.Z = this.cameraPosition.Z + 1f; } } else { while (Radius < xDistance) { camPos = this.cameraPosition * new Vector3(-1f, 1f, 1f); this.view = ((Matrix.CreateTranslation(0f, 0f, 0f) * Matrix.CreateRotationY(MathHelper.ToRadians(180f))) * Matrix.CreateRotationX(MathHelper.ToRadians(0f))) * Matrix.CreateLookAt(camPos, new Vector3(camPos.X, camPos.Y, 0f), new Vector3(0f, -1f, 0f)); bs = this.shipSO.WorldBoundingSphere; Viewport viewport9 = base.ScreenManager.GraphicsDevice.Viewport; pScreenSpace = viewport9.Project(Vector3.Zero, this.projection, this.view, Matrix.Identity); pPos = new Vector2(pScreenSpace.X, pScreenSpace.Y); radialPos = this.GeneratePointOnCircle(90f, Vector2.Zero, xDistance); Viewport viewport10 = base.ScreenManager.GraphicsDevice.Viewport; insetRadialPos = viewport10.Project(new Vector3(radialPos, 0f), this.projection, this.view, Matrix.Identity); insetRadialSS = new Vector2(insetRadialPos.X, insetRadialPos.Y); Radius = Vector2.Distance(insetRadialSS, pPos) + 10f; this.cameraPosition.Z = this.cameraPosition.Z - 1f; } } this.BlackBar = new Rectangle(0, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 70, 3000, 70); this.SideBar = new Rectangle(0, 0, 280, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight); Rectangle w = new Rectangle(20, this.modSel.Menu.Y - 10, 32, 32); Rectangle p = new Rectangle(80, w.Y, 32, 32); Rectangle df = new Rectangle(150, w.Y, 32, 32); Rectangle sp = new Rectangle(220, w.Y, 32, 32); this.wpn = new SkinnableButton(w, "Modules/FlakTurret3x3") { IsToggle = true, Toggled = true }; this.pwr = new SkinnableButton(p, "Modules/NuclearReactorMedium") { IsToggle = true }; this.def = new SkinnableButton(df, "Modules/SteelArmorMedium") { IsToggle = true }; this.spc = new SkinnableButton(sp, "Modules/sensors_2x2") { IsToggle = true }; this.SelectedCatTextPos = new Vector2(20f, (float)(w.Y - 25 - Fonts.Arial20Bold.LineSpacing / 2)); this.SearchBar = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 585, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 47, 210, 25); Cursor = new Vector2((float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 370), (float)(modSelR.Y + modSelR.Height + 408)); Vector2 OrdersBarPos = new Vector2(Cursor.X - 60f, (float)((int)Cursor.Y + 10)); 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"); this.CombatStatusButtons.Add(AttackRuns); AttackRuns.Action = "attack"; AttackRuns.HasToolTip = true; AttackRuns.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"); this.CombatStatusButtons.Add(Artillery); Artillery.Action = "arty"; Artillery.HasToolTip = true; Artillery.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"); this.CombatStatusButtons.Add(HoldPos); HoldPos.Action = "hold"; HoldPos.HasToolTip = true; HoldPos.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"); this.CombatStatusButtons.Add(OrbitLeft); OrbitLeft.Action = "orbit_left"; OrbitLeft.HasToolTip = true; OrbitLeft.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"); this.CombatStatusButtons.Add(BroadsideLeft); BroadsideLeft.Action = "broadside_left"; BroadsideLeft.HasToolTip = true; BroadsideLeft.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"); this.CombatStatusButtons.Add(OrbitRight); OrbitRight.Action = "orbit_right"; OrbitRight.HasToolTip = true; OrbitRight.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"); this.CombatStatusButtons.Add(BroadsideRight); BroadsideRight.Action = "broadside_right"; BroadsideRight.HasToolTip = true; BroadsideRight.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"); this.CombatStatusButtons.Add(Evade); Evade.Action = "evade"; Evade.HasToolTip = true; Evade.WhichToolTip = 6; Cursor = new Vector2((float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 150), (float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 47); this.SaveButton = new UIButton() { Rect = new Rectangle((int)Cursor.X, (int)Cursor.Y, Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"].Width, Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"].Height), NormalTexture = Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"], HoverTexture = Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_hover"], PressedTexture = Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_pressed"], Text = Localizer.Token(105), Launches = "Save As..." }; this.Buttons.Add(this.SaveButton); this.LoadButton = new UIButton() { Rect = new Rectangle((int)Cursor.X - 78, (int)Cursor.Y, Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px"].Width, Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px"].Height), NormalTexture = Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px"], HoverTexture = Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px_hover"], PressedTexture = Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px_pressed"], Text = Localizer.Token(8), Launches = "Load" }; this.Buttons.Add(this.LoadButton); this.ToggleOverlayButton = new UIButton() { Rect = new Rectangle(this.LoadButton.Rect.X - 140, (int)Cursor.Y, Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"].Width, Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px"].Height), NormalTexture = Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"], HoverTexture = Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_hover"], PressedTexture = Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_pressed"], Launches = "Toggle Overlay", Text = Localizer.Token(106) }; this.Buttons.Add(this.ToggleOverlayButton); this.bottom_sep = new Rectangle(this.BlackBar.X, this.BlackBar.Y, this.BlackBar.Width, 1); this.HullSelectionRect = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 285, (this.LowRes ? 45 : 100), 280, (this.LowRes ? 350 : 400)); this.hullSelectionSub = new Submenu(base.ScreenManager, this.HullSelectionRect, true); this.weaponSL = new ScrollList(this.modSel); this.hullSelectionSub.AddTab(Localizer.Token(107)); this.hullSL = new ScrollList(this.hullSelectionSub); List<string> Categories = new List<string>(); foreach (KeyValuePair<string, ShipData> hull in Ship_Game.ResourceManager.HullsDict) { if (!EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).GetHDict()[hull.Key]) { continue; } string cat = Localizer.GetRole(hull.Value.Role, EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty)); if (Categories.Contains(cat)) { continue; } Categories.Add(cat); } Categories.Sort(); foreach (string cat in Categories) { ModuleHeader type = new ModuleHeader(cat, 240f); this.hullSL.AddItem(type); } foreach (ScrollList.Entry e in this.hullSL.Entries) { foreach (KeyValuePair<string, ShipData> hull in Ship_Game.ResourceManager.HullsDict) { if (!EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).GetHDict()[hull.Key] || !((e.item as ModuleHeader).Text == Localizer.GetRole(hull.Value.Role, EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty)))) { continue; } e.AddItem(hull.Value); } } Rectangle ShipStatsPanel = new Rectangle(this.HullSelectionRect.X + 50, this.HullSelectionRect.Y + this.HullSelectionRect.Height - 20, 280, 320); this.classifCursor = new Vector2(ShipStatsPanel.X - 100, ShipStatsPanel.Y + ShipStatsPanel.Height + 92); dropdownRect = new Rectangle((int)ShipStatsPanel.X, (int)ShipStatsPanel.Y + ShipStatsPanel.Height + 118, 100, 18); this.CategoryList = new DropOptions(dropdownRect); this.CategoryList.AddOption("Unclassified", 1); this.CategoryList.AddOption("Civilian", 2); this.CategoryList.AddOption("Recon", 3); this.CategoryList.AddOption("Fighter", 4); this.CategoryList.AddOption("Bomber", 5); this.CarrierOnly = this.ActiveHull.CarrierShip; Ref<bool> CORef = new Ref<bool>(() => this.CarrierOnly, (bool x) => { this.CarrierOnly = x; }); this.COBoxCursor = new Vector2(dropdownRect.X + 106, dropdownRect.Y); this.CarrierOnlyBox = new Checkbox(this.COBoxCursor, "Carrier Only", CORef, Fonts.Arial12Bold); this.ShipStats = new Menu1(base.ScreenManager, ShipStatsPanel); this.statsSub = new Submenu(base.ScreenManager, ShipStatsPanel); this.statsSub.AddTab(Localizer.Token(108)); this.ArcsButton = new GenericButton(new Vector2((float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 32), 97f), "Arcs", Fonts.Pirulen20, Fonts.Pirulen16); this.close = new CloseButton(new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 27, 99, 20, 20)); this.OriginalZ = this.cameraPosition.Z; }
//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 static void parseTextToSL(string text, float Width, SpriteFont font, ref ScrollList List) { string line = string.Empty; string returnString = string.Empty; char[] chrArray = new char[] { ' ', '\n' }; string[] wordArray = text.Split(chrArray); for (int i = 0; i < (int)wordArray.Length; i++) { string word = wordArray[i]; if (string.IsNullOrEmpty(word)) { word = "\n"; } if (word == "\\n" || word == "\n") { word = ""; returnString = string.Concat(returnString, line, '\n'); line = string.Empty; } else if (font.MeasureString(string.Concat(line, word)).Length() > Width) { returnString = string.Concat(returnString, line, '\n'); line = string.Empty; } if (!string.IsNullOrEmpty(word)) { line = string.Concat(line, word, ' '); } } string[] lineArray = returnString.Split(new char[] { '\n' }); for (int i = 0; i < (int)lineArray.Length; i++) { string sent = lineArray[i]; if (sent.Length > 0) { List.AddItem(sent); } else if (string.IsNullOrEmpty(sent) && (int)lineArray.Length > i + 1 && !string.IsNullOrEmpty(lineArray[i + 1])) { List.AddItem("\n"); } } List.AddItem(line); }
public override void LoadContent() { this.Window = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 350, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight / 2 - 300, 700, 600); this.SaveMenu = new Menu1(base.ScreenManager, this.Window); Rectangle sub = new Rectangle(this.Window.X + 20, this.Window.Y + 20, this.Window.Width - 40, 80); this.NameSave = new Submenu(base.ScreenManager, sub); this.NameSave.AddTab("Load Saved Game..."); Vector2 Cursor = new Vector2((float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 84), (float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight / 2 - 100)); this.TitlePosition = new Vector2((float)(sub.X + 20), (float)(sub.Y + 45)); Rectangle scrollList = new Rectangle(sub.X, sub.Y + 90, sub.Width, this.Window.Height - sub.Height - 50); this.AllSaves = new Submenu(base.ScreenManager, scrollList); this.AllSaves.AddTab("Saved Fleets"); this.SavesSL = new ScrollList(this.AllSaves); FileInfo[] filesFromDirectory; if (GlobalStats.ActiveMod != null && Directory.Exists(string.Concat(Ship_Game.ResourceManager.WhichModPath, "/FleetDesigns"))) { filesFromDirectory = HelperFunctions.GetFilesFromDirectory(string.Concat(Ship_Game.ResourceManager.WhichModPath, "/FleetDesigns")); } else { filesFromDirectory = HelperFunctions.GetFilesFromDirectory("Content/FleetDesigns"); } for (int i = 0; i < (int)filesFromDirectory.Length; i++) { FileInfo FI = filesFromDirectory[i]; bool OK = true; XmlSerializer serializer1 = new XmlSerializer(typeof(FleetDesign)); foreach (FleetDataNode node in ((FleetDesign)serializer1.Deserialize(FI.OpenRead())).Data) { if (EmpireManager.GetEmpireByName(this.parentScreen.EmpireUI.screen.PlayerLoyalty).WeCanBuildThis(node.ShipName)) { continue; } OK = false; break; } if (OK) { this.SavesSL.AddItem(FI); } } string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); FileInfo[] fileInfoArray = HelperFunctions.GetFilesFromDirectory(string.Concat(path, "/StarDrive/Fleet Designs")); for (int j = 0; j < (int)fileInfoArray.Length; j++) { FileInfo FI = fileInfoArray[j]; bool OK = true; XmlSerializer serializer1 = new XmlSerializer(typeof(FleetDesign)); foreach (FleetDataNode node in ((FleetDesign)serializer1.Deserialize(FI.OpenRead())).Data) { if (EmpireManager.GetEmpireByName(this.parentScreen.EmpireUI.screen.PlayerLoyalty).WeCanBuildThis(node.ShipName)) { continue; } OK = false; break; } if (OK) { this.SavesSL.AddItem(FI); } } this.EnternamePos = this.TitlePosition; this.EnterNameArea = new UITextEntry(); this.EnterNameArea.Text = ""; this.EnterNameArea.ClickableArea = new Rectangle((int)this.EnternamePos.X, (int)this.EnternamePos.Y - 2, (int)Fonts.Arial20Bold.MeasureString(this.EnterNameArea.Text).X + 20, Fonts.Arial20Bold.LineSpacing); this.Save = new UIButton() { Rect = new Rectangle(sub.X + sub.Width - 88, this.EnterNameArea.ClickableArea.Y - 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px"].Height), NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px"], HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px_hover"], PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px_pressed"], Text = "Load" }; this.Buttons.Add(this.Save); Cursor.Y = Cursor.Y + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px"].Height + 15); base.LoadContent(); base.LoadContent(); }
protected void Dispose(bool disposing) { if (!disposed) { if (disposing) { if (this.AgentSL != null) this.AgentSL.Dispose(); if (this.OpsSL != null) this.OpsSL.Dispose(); } this.AgentSL = null; this.OpsSL = null; this.disposed = true; } }
public override void LoadContent() { base.Setup(); Vector2 vector2 = new Vector2((float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 84), (float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight / 2 - 100)); this.CategoriesRect = new Rectangle(this.r.X + 25, this.r.Y + 130, 330, 430); Submenu blah = new Submenu(base.ScreenManager, this.CategoriesRect); this.CategoriesSL = new ScrollList(blah, 40); this.TextRect = new Rectangle(this.CategoriesRect.X + this.CategoriesRect.Width + 5, this.CategoriesRect.Y + 10, 375, 420); Rectangle TextSLRect = new Rectangle(this.CategoriesRect.X + this.CategoriesRect.Width + 5, this.CategoriesRect.Y + 10, 375, 420); Submenu bler = new Submenu(base.ScreenManager, TextSLRect); this.TextSL = new ScrollList(bler, Fonts.Arial12Bold.LineSpacing + 2); this.SmallViewer = new Rectangle(this.TextRect.X + 20, this.TextRect.Y + 40, 336, 189); this.BigViewer = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 640, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight / 2 - 360, 1280, 720); this.VideoPlayer = new Microsoft.Xna.Framework.Media.VideoPlayer(); this.ActiveTopic = new HelpTopic() { Title = Localizer.Token(1401), Text = Localizer.Token(1400) }; HelperFunctions.parseTextToSL(this.ActiveTopic.Text, (float)(this.TextRect.Width - 40), Fonts.Arial12Bold, ref this.TextSL); this.TitlePosition = new Vector2((float)(this.TextRect.X + this.TextRect.Width / 2) - Fonts.Arial20Bold.MeasureString(this.ActiveTopic.Title).X / 2f - 15f, (float)(this.TextRect.Y + 10)); List<string> Categories = new List<string>(); foreach (HelpTopic halp in this.ht.HelpTopicsList) { if (Categories.Contains(halp.Category)) { continue; } Categories.Add(halp.Category); ModuleHeader mh = new ModuleHeader(halp.Category, 295f); this.CategoriesSL.AddItem(mh); } foreach (ScrollList.Entry e in this.CategoriesSL.Entries) { foreach (HelpTopic halp in this.ht.HelpTopicsList) { if (halp.Category != (e.item as ModuleHeader).Text) { continue; } e.AddItem(halp); } } base.LoadContent(); }
protected void Dispose(bool disposing) { if (!disposed) { if (disposing) { if (this.ResponseSL != null) this.ResponseSL.Dispose(); } this.ResponseSL = null; this.disposed = true; } }
protected void Dispose(bool disposing) { if (!disposed) { if (disposing) { if (this.VideoPlayer != null) this.VideoPlayer.Dispose(); if (this.CategoriesSL != null) this.CategoriesSL.Dispose(); if (this.TextSL != null) this.TextSL.Dispose(); } this.VideoPlayer = null; this.CategoriesSL = null; this.TextSL = null; this.disposed = true; } }