public EspionageScreen(UniverseScreen screen) { this.screen = screen; base.IsPopup = true; base.TransitionOnTime = TimeSpan.FromSeconds(0.25); base.TransitionOffTime = TimeSpan.FromSeconds(0.25); }
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 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 GameplayMMScreen(UniverseScreen screen, GameScreen caller) { this.caller = caller; this.screen = screen; base.IsPopup = true; base.TransitionOnTime = TimeSpan.FromSeconds(0.25); base.TransitionOffTime = TimeSpan.FromSeconds(0.25); }
//private float transitionElapsedTime; public EventScreen(UniverseScreen screen, Empire playerEmpire, ExplorationEvent e, Outcome outcome) { this.outcome = outcome; this.ExpEvent = e; this.screen = screen; base.IsPopup = true; base.TransitionOnTime = TimeSpan.FromSeconds(0.25); base.TransitionOffTime = TimeSpan.FromSeconds(0.25); }
public Background3D(UniverseScreen screen) { this.screen = screen; this.CreateRandomLargeNebula(new Rectangle(30000, 30000, 6000000, 6000000)); for (int i = 0; i < 5; i++) { this.CreateRandomSmallObject(); } }
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(); }
//private ProgressBar pBar; //private ProgressBar sBar; //private ProgressBar oBar; //private SlidingElement sliding_element; //private string fmt = "0"; public VariableUIElement(Rectangle r, Ship_Game.ScreenManager sm, UniverseScreen screen) { this.screen = screen; this.ScreenManager = sm; this.ElementRect = r; base.TransitionOnTime = TimeSpan.FromSeconds(0.25); base.TransitionOffTime = TimeSpan.FromSeconds(0.25); this.Housing = r; this.LeftRect = new Rectangle(r.X, r.Y + 44, 180, r.Height - 44); this.RightRect = new Rectangle(this.LeftRect.X + this.LeftRect.Width, this.LeftRect.Y, 220, this.LeftRect.Height); }
public EventPopup(UniverseScreen s, Empire playerEmpire, ExplorationEvent e, Outcome outcome) { this.screen = s; this.outcome = outcome; this.ExpEvent = e; this.fade = true; base.IsPopup = true; this.FromGame = true; base.TransitionOnTime = TimeSpan.FromSeconds(0.25); base.TransitionOffTime = TimeSpan.FromSeconds(0); this.r = new Rectangle(0, 0, 600, 600); }
public OptionsScreen(UniverseScreen s, GameplayMMScreen gpmmscreen, Rectangle dimensions) { this.gpmmscreen = gpmmscreen; this.uScreen = s; this.fade = false; base.IsPopup = true; this.FromGame = true; base.TransitionOnTime = TimeSpan.FromSeconds(0); base.TransitionOffTime = TimeSpan.FromSeconds(0); this.r = dimensions; this.ModeToSet = Game1.Instance.CurrentMode; }
//private float transitionElapsedTime; public EncounterScreen(UniverseScreen screen, Empire playerEmpire, Empire targetEmp, SolarSystem tarSys, Encounter e) { this.encounter = e; this.encounter.CurrentMessage = 0; this.encounter.SetPlayerEmpire(playerEmpire); this.encounter.SetSys(tarSys); this.encounter.SetTarEmp(targetEmp); this.screen = screen; base.IsPopup = true; base.TransitionOnTime = TimeSpan.FromSeconds(0.25); base.TransitionOffTime = TimeSpan.FromSeconds(0.25); }
public SystemInfoUIElement(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); }
public EncounterPopup(UniverseScreen s, Empire playerEmpire, Empire targetEmp, SolarSystem tarSys, Encounter e) { this.screen = s; this.encounter = e; this.encounter.CurrentMessage = 0; this.encounter.SetPlayerEmpire(playerEmpire); this.encounter.SetSys(tarSys); this.encounter.SetTarEmp(targetEmp); this.fade = true; base.IsPopup = true; this.FromGame = true; base.TransitionOnTime = TimeSpan.FromSeconds(0.25); base.TransitionOffTime = TimeSpan.FromSeconds(0); this.r = new Rectangle(0, 0, 600, 600); }
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 ResearchPopup(UniverseScreen s, Rectangle dimensions, string uid) { if (GlobalStats.Config.Language != "English") { dimensions.X = dimensions.X - 20; dimensions.Width = dimensions.Width + 40; } this.TechUID = uid; this.screen = s; this.fade = true; base.IsPopup = true; this.FromGame = true; base.TransitionOnTime = TimeSpan.FromSeconds(0.25); base.TransitionOffTime = TimeSpan.FromSeconds(0); this.r = dimensions; this.TitleText = string.Concat(Localizer.Token(ResourceManager.TechTree[uid].NameIndex), ResourceManager.TechTree[uid].MaxLevel > 1 ? " " + NumberToRomanConvertor.NumberToRoman(EmpireManager.GetEmpireByName(this.screen.PlayerLoyalty).TechnologyDict[uid].level) + "/" + NumberToRomanConvertor.NumberToRoman(ResourceManager.TechTree[uid].MaxLevel) : ""); this.MiddleText = Localizer.Token(ResourceManager.TechTree[uid].DescriptionIndex); }
//private string fmt = "0.#"; public OrbitalAssetsUIElement(Rectangle r, Ship_Game.ScreenManager sm, UniverseScreen screen, Planet p) { this.p = p; 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.BombardButton = new DanButton(new Vector2((float)(this.LeftRect.X + 20), (float)(this.LeftRect.Y + 25)), Localizer.Token(1431)) { IsToggle = true, ToggledText = Localizer.Token(1426) }; this.LandTroops = new DanButton(new Vector2((float)(this.LeftRect.X + 20), (float)(this.LeftRect.Y + 75)), Localizer.Token(1432)) { IsToggle = true, ToggledText = Localizer.Token(1433) }; 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, 85, 85); OrbitalAssetsUIElement.TippedItem bomb = new OrbitalAssetsUIElement.TippedItem() { r = this.BombardButton.r, TIP_ID = 32 }; this.ToolTipItems.Add(bomb); bomb = new OrbitalAssetsUIElement.TippedItem() { r = this.LandTroops.r, TIP_ID = 36 }; this.ToolTipItems.Add(bomb); }
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 ShipInfoUIElement(Rectangle r, Ship_Game.ScreenManager sm, UniverseScreen screen) { this.screen = screen; this.ScreenManager = sm; this.ElementRect = r; this.FlagRect = new Rectangle(r.X + 150, r.Y + 50, 40, 40); 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.sliding_element = new SlidingElement(this.SliderRect); this.Housing = r; this.LeftRect = new Rectangle(r.X, r.Y + 44, 180, r.Height - 44); this.RightRect = new Rectangle(this.LeftRect.X + this.LeftRect.Width, this.LeftRect.Y, 220, this.LeftRect.Height); this.ShipNameArea = new UITextEntry() { ClickableArea = new Rectangle(this.Housing.X + 41, this.Housing.Y + 65, 200, Fonts.Arial20Bold.LineSpacing) }; int spacing = 2; this.Power = new Rectangle(this.Housing.X + 187, this.Housing.Y + 110, 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" }; ShipInfoUIElement.TippedItem ti = new ShipInfoUIElement.TippedItem() { r = this.Power, TIP_ID = 27 }; this.ToolTipItems.Add(ti); this.Shields = new Rectangle(this.Housing.X + 187, this.Housing.Y + 110 + 20 + 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 ShipInfoUIElement.TippedItem() { r = this.Shields, TIP_ID = 28 }; this.ToolTipItems.Add(ti); this.Ordnance = new Rectangle(this.Housing.X + 187, this.Housing.Y + 110 + 20 + spacing + 20 + spacing, 20, 20); Rectangle pordrect = new Rectangle(this.Ordnance.X + this.Ordnance.Width + 15, this.Ordnance.Y, 150, 18); this.oBar = new ProgressBar(pordrect); ti = new ShipInfoUIElement.TippedItem() { r = this.Ordnance, TIP_ID = 29 }; this.ToolTipItems.Add(ti); this.DefenseRect = new Rectangle(this.Housing.X + 13, this.Housing.Y + 112, 22, 22); ti = new ShipInfoUIElement.TippedItem() { r = this.DefenseRect, TIP_ID = 30 }; this.ToolTipItems.Add(ti); this.TroopRect = new Rectangle(this.Housing.X + 13, this.Housing.Y + 137, 22, 22); ti = new ShipInfoUIElement.TippedItem() { r = this.TroopRect, TIP_ID = 37 }; this.ToolTipItems.Add(ti); this.ShipInfoRect = new Rectangle(this.Housing.X + 60, this.Housing.Y + 110, 115, 115); 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 }; Vector2 OrdersBarPos = new Vector2((float)(this.Power.X + 15), (float)(this.Ordnance.Y + this.Ordnance.Height + spacing + 3)); OrdersBarPos.X = pordrect.X; 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 + 25f; 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 + 25f; 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 + 25f; 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 + 25f; 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 - 25f; OrdersBarPos.X = OrdersBarPos.X + 25f; 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 + 25f; 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 - 25f; OrdersBarPos.X = OrdersBarPos.X + 25f; 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; }
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); }
public SavedGame(UniverseScreen screenToSave, string SaveAs) { Building building; this.data.RemnantKills = GlobalStats.RemnantKills; this.data.RemnantArmageddon = GlobalStats.RemnantArmageddon; this.data.gameDifficulty = screenToSave.GameDifficulty; this.data.AutoColonize = EmpireManager.GetEmpireByName(screenToSave.PlayerLoyalty).AutoColonize; this.data.AutoExplore = EmpireManager.GetEmpireByName(screenToSave.PlayerLoyalty).AutoExplore; this.data.AutoFreighters = EmpireManager.GetEmpireByName(screenToSave.PlayerLoyalty).AutoFreighters; this.data.AutoProjectors = EmpireManager.GetEmpireByName(screenToSave.PlayerLoyalty).AutoBuild; this.data.GamePacing = UniverseScreen.GamePaceStatic; this.data.GameScale = UniverseScreen.GameScaleStatic; this.data.StarDate = screenToSave.StarDate; this.data.SolarSystemDataList = new List<SavedGame.SolarSystemSaveData>(); this.data.FTLModifier = screenToSave.FTLModifier; this.data.EnemyFTLModifier = screenToSave.EnemyFTLModifier; this.data.GravityWells = screenToSave.GravityWells; this.data.PlayerLoyalty = screenToSave.PlayerLoyalty; this.data.RandomEvent = RandomEventManager.ActiveEvent; this.data.campos = new Vector2(screenToSave.camPos.X, screenToSave.camPos.Y); this.data.camheight = screenToSave.camHeight; this.data.MemoryLimiter = GlobalStats.MemoryLimiter; this.data.MinimumWarpRange = GlobalStats.MinimumWarpRange; this.data.OptionIncreaseShipMaintenance = GlobalStats.OptionIncreaseShipMaintenance; this.data.TurnTimer = GlobalStats.TurnTimer; this.data.IconSize=GlobalStats.IconSize; this.data.preventFederations=GlobalStats.preventFederations; this.data.GravityWellRange=GlobalStats.GravityWellRange; this.data.EliminationMode = GlobalStats.EliminationMode; foreach (SolarSystem system in UniverseScreen.SolarSystemList) { SavedGame.SolarSystemSaveData sdata = new SavedGame.SolarSystemSaveData() { Name = system.Name, Position = system.Position, SunPath = system.SunPath, AsteroidsList = new List<Asteroid>(), Moons = new List<Moon>(), }; foreach (Asteroid roid in system.AsteroidsList) { sdata.AsteroidsList.Add(roid); } foreach (Moon moon in system.MoonList) sdata.Moons.Add(moon); sdata.guid = system.guid; sdata.RingList = new List<SavedGame.RingSave>(); foreach (SolarSystem.Ring ring in system.RingList) { SavedGame.RingSave rsave = new SavedGame.RingSave() { Asteroids = ring.Asteroids, OrbitalDistance = ring.Distance }; if (ring.planet == null) { sdata.RingList.Add(rsave); } else { SavedGame.PlanetSaveData pdata = new SavedGame.PlanetSaveData() { Crippled_Turns = ring.planet.Crippled_Turns, guid = ring.planet.guid, FoodState = ring.planet.fs, ProdState = ring.planet.ps, FoodLock = ring.planet.FoodLocked, ProdLock = ring.planet.ProdLocked, ResLock = ring.planet.ResLocked, Name = ring.planet.Name, Scale = ring.planet.scale, ShieldStrength = ring.planet.ShieldStrengthCurrent, Population = ring.planet.Population, PopulationMax = ring.planet.MaxPopulation, Fertility = ring.planet.Fertility, Richness = ring.planet.MineralRichness, Owner = (ring.planet.Owner != null ? ring.planet.Owner.data.Traits.Name : ""), WhichPlanet = ring.planet.planetType, OrbitalAngle = ring.planet.OrbitalAngle, OrbitalDistance = ring.planet.OrbitalRadius, HasRings = ring.planet.hasRings, Radius = ring.planet.ObjectRadius, farmerPercentage = ring.planet.FarmerPercentage, workerPercentage = ring.planet.WorkerPercentage, researcherPercentage = ring.planet.ResearcherPercentage, foodHere = ring.planet.FoodHere, TerraformPoints = ring.planet.TerraformPoints, prodHere = ring.planet.ProductionHere, GovernorOn = ring.planet.GovernorOn, ColonyType = ring.planet.colonyType, StationsList = new List<Guid>() }; foreach (KeyValuePair<Guid, Ship> station in ring.planet.Shipyards) { if(station.Value.Active) pdata.StationsList.Add(station.Key); } pdata.QISaveList = new List<SavedGame.QueueItemSave>(); if (ring.planet.Owner != null) { foreach (QueueItem item in ring.planet.ConstructionQueue) { SavedGame.QueueItemSave qi = new SavedGame.QueueItemSave() { isBuilding = item.isBuilding, IsRefit = item.isRefit }; if (qi.IsRefit) { qi.RefitCost = item.Cost; } if (qi.isBuilding) { qi.UID = item.Building.Name; } qi.isShip = item.isShip; qi.DisplayName = item.DisplayName; if (qi.isShip) { qi.UID = item.sData.Name; } qi.isTroop = item.isTroop; if (qi.isTroop) { qi.UID = item.troop.Name; } qi.ProgressTowards = item.productionTowards; if (item.Goal != null) { qi.GoalGUID = item.Goal.guid; } if (item.pgs != null) { qi.pgsVector = new Vector2((float)item.pgs.x, (float)item.pgs.y); } pdata.QISaveList.Add(qi); } } pdata.PGSList = new List<SavedGame.PGSData>(); foreach (PlanetGridSquare tile in ring.planet.TilesList) { SavedGame.PGSData pgs = new SavedGame.PGSData() { x = tile.x, y = tile.y, resbonus = tile.resbonus, prodbonus = tile.prodbonus, Habitable = tile.Habitable, foodbonus = tile.foodbonus, Biosphere = tile.Biosphere }; if (tile.building != null) { building = tile.building; } else { building = null; } pgs.building = building; pgs.TroopsHere = tile.TroopsHere; pdata.PGSList.Add(pgs); } pdata.EmpiresThatKnowThisPlanet = new List<string>(); foreach (KeyValuePair<Empire, bool> ExploreItem in system.ExploredDict) { if (!ExploreItem.Value) { continue; } pdata.EmpiresThatKnowThisPlanet.Add(ExploreItem.Key.data.Traits.Name); } rsave.Planet = pdata; sdata.RingList.Add(rsave); } sdata.EmpiresThatKnowThisSystem = new List<string>(); foreach (KeyValuePair<Empire, bool> ExploreItem in system.ExploredDict) { if (!ExploreItem.Value) { continue; } sdata.EmpiresThatKnowThisSystem.Add(ExploreItem.Key.data.Traits.Name); } } this.data.SolarSystemDataList.Add(sdata); } this.data.EmpireDataList = new List<SavedGame.EmpireSaveData>(); foreach (Empire e in EmpireManager.EmpireList) { SavedGame.EmpireSaveData empireToSave = new SavedGame.EmpireSaveData() { IsFaction = e.isFaction, isMinorRace = e.MinorRace, Relations = new List<Relationship>() }; foreach (KeyValuePair<Empire, Relationship> relation in e.GetRelations()) { empireToSave.Relations.Add(relation.Value); } empireToSave.Name = e.data.Traits.Name; empireToSave.empireData = e.data.GetClone(); empireToSave.Traits = e.data.Traits; empireToSave.Research = e.Research; empireToSave.ResearchTopic = e.ResearchTopic; empireToSave.Money = e.Money; empireToSave.CurrentAutoScout = e.data.CurrentAutoScout; empireToSave.CurrentAutoFreighter = e.data.CurrentAutoFreighter; empireToSave.CurrentAutoColony = e.data.CurrentAutoColony; empireToSave.CurrentConstructor = e.data.CurrentConstructor; empireToSave.OwnedShips = new List<SavedGame.ShipSaveData>(); empireToSave.TechTree = new List<TechEntry>(); foreach (AO area in e.GetGSAI().AreasOfOperations) { area.PrepareForSave(); } empireToSave.AOs = e.GetGSAI().AreasOfOperations; empireToSave.FleetsList = new List<SavedGame.FleetSave>(); foreach (KeyValuePair<int, Ship_Game.Gameplay.Fleet> Fleet in e.GetFleetsDict()) { SavedGame.FleetSave fs = new SavedGame.FleetSave() { Name = Fleet.Value.Name, IsCoreFleet = Fleet.Value.IsCoreFleet, TaskStep = Fleet.Value.TaskStep, Key = Fleet.Key, facing = Fleet.Value.facing, FleetGuid = Fleet.Value.guid, Position = Fleet.Value.Position, ShipsInFleet = new List<SavedGame.FleetShipSave>() }; foreach (FleetDataNode node in Fleet.Value.DataNodes) { if (node.GetShip() == null) { continue; } node.ShipGuid = node.GetShip().guid; } fs.DataNodes = Fleet.Value.DataNodes; foreach (Ship ship in Fleet.Value.Ships) { SavedGame.FleetShipSave ssave = new SavedGame.FleetShipSave() { fleetOffset = ship.RelativeFleetOffset, shipGuid = ship.guid }; fs.ShipsInFleet.Add(ssave); } empireToSave.FleetsList.Add(fs); } empireToSave.SpaceRoadData = new List<SavedGame.SpaceRoadSave>(); foreach (SpaceRoad road in e.SpaceRoadsList) { SavedGame.SpaceRoadSave rdata = new SavedGame.SpaceRoadSave() { OriginGUID = road.GetOrigin().guid, DestGUID = road.GetDestination().guid, RoadNodes = new List<SavedGame.RoadNodeSave>() }; foreach (RoadNode node in road.RoadNodesList) { SavedGame.RoadNodeSave ndata = new SavedGame.RoadNodeSave() { Position = node.Position }; if (node.Platform != null) { ndata.Guid_Platform = node.Platform.guid; } rdata.RoadNodes.Add(ndata); } empireToSave.SpaceRoadData.Add(rdata); } SavedGame.GSAISAVE gsaidata = new SavedGame.GSAISAVE() { UsedFleets = e.GetGSAI().UsedFleets, Goals = new List<SavedGame.GoalSave>(), PinGuids = new List<Guid>(), PinList = new List<ThreatMatrix.Pin>() }; foreach (KeyValuePair<Guid, ThreatMatrix.Pin> guid in e.GetGSAI().ThreatMatrix.Pins) { gsaidata.PinGuids.Add(guid.Key); gsaidata.PinList.Add(guid.Value); } gsaidata.MilitaryTaskList = new List<MilitaryTask>(); foreach (MilitaryTask task in e.GetGSAI().TaskList) { gsaidata.MilitaryTaskList.Add(task); if (task.GetTargetPlanet() == null) { continue; } task.TargetPlanetGuid = task.GetTargetPlanet().guid; } for (int i = 0; i < e.GetGSAI().Goals.Count; i++) { Goal g = e.GetGSAI().Goals[i]; SavedGame.GoalSave gdata = new SavedGame.GoalSave() { BuildPosition = g.BuildPosition }; if (g.GetColonyShip() != null) { gdata.colonyShipGuid = g.GetColonyShip().guid; } gdata.GoalStep = g.Step; if (g.GetMarkedPlanet() != null) { gdata.markedPlanetGuid = g.GetMarkedPlanet().guid; } gdata.ToBuildUID = g.ToBuildUID; gdata.type = g.type; if (g.GetPlanetWhereBuilding() != null) { gdata.planetWhereBuildingAtGuid = g.GetPlanetWhereBuilding().guid; } if (g.GetFleet() != null) { gdata.fleetGuid = g.GetFleet().guid; } gdata.GoalGuid = g.guid; gdata.GoalName = g.GoalName; if (g.beingBuilt != null) { gdata.beingBuiltGUID = g.beingBuilt.guid; } gsaidata.Goals.Add(gdata); } empireToSave.GSAIData = gsaidata; foreach (KeyValuePair<string, TechEntry> Tech in e.GetTDict()) { empireToSave.TechTree.Add(Tech.Value); } foreach (Ship ship in e.GetShips()) { SavedGame.ShipSaveData sdata = new SavedGame.ShipSaveData() { guid = ship.guid, data = ship.ToShipData(), Position = ship.Position, experience = ship.experience, kills = ship.kills, Velocity = ship.Velocity, }; if (ship.GetTether() != null) { sdata.TetheredTo = ship.GetTether().guid; sdata.TetherOffset = ship.TetherOffset; } sdata.Name = ship.Name; sdata.VanityName = ship.VanityName; if (ship.PlayerShip) { sdata.IsPlayerShip = true; } sdata.Hull = ship.GetShipData().Hull; sdata.Power = ship.PowerCurrent; sdata.Ordnance = ship.Ordinance; sdata.yRotation = ship.yRotation; sdata.Rotation = ship.Rotation; sdata.InCombatTimer = ship.InCombatTimer; if (ship.GetCargo().ContainsKey("Food")) { sdata.FoodCount = ship.GetCargo()["Food"]; } if (ship.GetCargo().ContainsKey("Production")) { sdata.ProdCount = ship.GetCargo()["Production"]; } if (ship.GetCargo().ContainsKey("Colonists_1000")) { sdata.PopCount = ship.GetCargo()["Colonists_1000"]; } sdata.TroopList = ship.TroopList; sdata.AreaOfOperation = ship.AreaOfOperation; sdata.AISave = new SavedGame.ShipAISave() { FoodOrProd = ship.GetAI().FoodOrProd, state = ship.GetAI().State }; if (ship.GetAI().Target != null && ship.GetAI().Target is Ship) { sdata.AISave.AttackTarget = (ship.GetAI().Target as Ship).guid; } sdata.AISave.defaultstate = ship.GetAI().DefaultAIState; if (ship.GetAI().start != null) { sdata.AISave.startGuid = ship.GetAI().start.guid; } if (ship.GetAI().end != null) { sdata.AISave.endGuid = ship.GetAI().end.guid; } sdata.AISave.GoToStep = ship.GetAI().GotoStep; sdata.AISave.MovePosition = ship.GetAI().MovePosition; sdata.AISave.ActiveWayPoints = new List<Vector2>(); foreach (Vector2 waypoint in ship.GetAI().ActiveWayPoints) { sdata.AISave.ActiveWayPoints.Add(waypoint); } sdata.AISave.ShipGoalsList = new List<SavedGame.ShipGoalSave>(); foreach (ArtificialIntelligence.ShipGoal sgoal in ship.GetAI().OrderQueue) { SavedGame.ShipGoalSave gsave = new SavedGame.ShipGoalSave() { DesiredFacing = sgoal.DesiredFacing }; if (sgoal.fleet != null) { gsave.fleetGuid = sgoal.fleet.guid; } gsave.FacingVector = sgoal.FacingVector; if (sgoal.goal != null) { gsave.goalGuid = sgoal.goal.guid; } gsave.MovePosition = sgoal.MovePosition; gsave.Plan = sgoal.Plan; if (sgoal.TargetPlanet != null) { gsave.TargetPlanetGuid = sgoal.TargetPlanet.guid; } gsave.VariableString = sgoal.VariableString; gsave.SpeedLimit = sgoal.SpeedLimit; sdata.AISave.ShipGoalsList.Add(gsave); } if (ship.GetAI().OrbitTarget != null) { sdata.AISave.OrbitTarget = ship.GetAI().OrbitTarget.guid; } if (ship.GetAI().ColonizeTarget != null) { sdata.AISave.ColonizeTarget = ship.GetAI().ColonizeTarget.guid; } if (ship.GetAI().SystemToDefend != null) { sdata.AISave.SystemToDefend = ship.GetAI().SystemToDefend.guid; } if (ship.GetAI().EscortTarget != null) { sdata.AISave.EscortTarget = ship.GetAI().EscortTarget.guid; } sdata.Projectiles = new List<SavedGame.ProjectileSaveData>(); for (int i = 0; i < ship.Projectiles.Count; i++) { Projectile p = ship.Projectiles[i]; SavedGame.ProjectileSaveData pdata = new SavedGame.ProjectileSaveData() { Velocity = p.Velocity, Rotation = p.Rotation, Weapon = p.weapon.UID, Position = p.Center, Duration = p.duration }; sdata.Projectiles.Add(pdata); } empireToSave.OwnedShips.Add(sdata); } this.data.EmpireDataList.Add(empireToSave); } this.data.Snapshots = new SerializableDictionary<string, SerializableDictionary<int, Snapshot>>(); foreach (KeyValuePair<string, SerializableDictionary<int, Snapshot>> Entry in StatTracker.SnapshotsDict) { this.data.Snapshots.Add(Entry.Key, Entry.Value); } string path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); this.data.path = path; this.data.SaveAs = SaveAs; this.data.Size = screenToSave.Size; this.data.FogMapName = string.Concat(SaveAs, "fog"); screenToSave.FogMap.Save(string.Concat(path, "/StarDrive/Saved Games/Fog Maps/", SaveAs, "fog.png"), ImageFileFormat.Png); SavedGame.thread = new Thread(new ParameterizedThreadStart(this.DoSave)); SavedGame.thread.Start(this.data); }
public void DrawGalaxyBackdrop(UniverseScreen universe, Starfield starfield) { Vector2 camPos = new Vector2(universe.camPos.X, universe.camPos.Y); Vector2 vector2 = -1f * (camPos - this.lastCamPos); int width = universe.ScreenManager.GraphicsDevice.Viewport.Width; Viewport viewport = universe.ScreenManager.GraphicsDevice.Viewport; Rectangle blackRect = new Rectangle(0, 0, width, viewport.Height); Viewport viewport1 = universe.ScreenManager.GraphicsDevice.Viewport; Viewport viewport2 = universe.ScreenManager.GraphicsDevice.Viewport; Rectangle rectangle = new Rectangle(0, 0, viewport1.Width * 2, viewport2.Height * 2); universe.ScreenManager.SpriteBatch.Begin(); Color color = new Color(255, 255, 255, 160); Primitives2D.FillRectangle(universe.ScreenManager.SpriteBatch, blackRect, Color.Black); Viewport viewport3 = universe.ScreenManager.GraphicsDevice.Viewport; Vector3 UpperLeft = viewport3.Project(Vector3.Zero, universe.projection, universe.view, Matrix.Identity); Viewport viewport4 = universe.ScreenManager.GraphicsDevice.Viewport; Vector3 LowerRight = viewport4.Project(new Vector3(universe.Size.X, universe.Size.Y, 0f), universe.projection, universe.view, Matrix.Identity); Viewport viewport5 = universe.ScreenManager.GraphicsDevice.Viewport; viewport5.Project(new Vector3(universe.Size.X / 2f, universe.Size.Y / 2f, 0f), universe.projection, universe.view, Matrix.Identity); Rectangle drawRect = new Rectangle((int)UpperLeft.X, (int)UpperLeft.Y, (int)LowerRight.X - (int)UpperLeft.X, (int)LowerRight.Y - (int)UpperLeft.Y); universe.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["Textures/galaxy"], drawRect, Color.White); universe.ScreenManager.SpriteBatch.End(); this.lastCamPos = camPos; }
public void Go() { this.ScreenManager.musicCategory.Stop(AudioStopOptions.AsAuthored); this.us = new UniverseScreen(this.data); this.us.player = this.playerEmpire; this.us.ScreenManager = this.ScreenManager; this.us.camPos = new Vector3(-this.playerShip.Center.X, this.playerShip.Center.Y, 5000f); this.us.GameDifficulty = this.difficulty; this.us.GameScale = this.scale; UniverseScreen.GameScaleStatic = this.scale; this.WorkerThread.Abort(); this.WorkerThread = (Thread)null; this.ScreenManager.AddScreen((GameScreen)this.us); this.us.UpdateAllSystems(0.01f); this.mmscreen.OnPlaybackStopped((object)null, (EventArgs)null); this.ScreenManager.RemoveScreen((GameScreen)this.mmscreen); //this.Dispose(); this.ExitScreen(); }
//private float TipTimer = 0.35f; //private bool FirstRun = true; public EmpireUIOverlay(Ship_Game.Empire playerEmpire, GraphicsDevice device, UniverseScreen screen) { this.screen = screen; this.empire = playerEmpire; if (device.PresentationParameters.BackBufferWidth > 1366) { Vector2 Cursor = Vector2.Zero; this.res1 = new Rectangle((int)Cursor.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res1"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res1"].Height); Cursor.X = Cursor.X + (float)ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res1"].Width; this.res2 = new Rectangle((int)Cursor.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res2"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res2"].Height); Cursor.X = Cursor.X + (float)ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res2"].Width; this.res3 = new Rectangle((int)Cursor.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res3"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res3"].Height); Cursor.X = Cursor.X + (float)ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res3"].Width; this.res4 = new Rectangle((int)Cursor.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res4"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res4"].Height); Cursor.X = Cursor.X + (float)ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res4"].Width; Cursor.X = (float)(screen.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res5"].Width); this.res5 = new Rectangle((int)Cursor.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res5"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res5"].Height); EmpireUIOverlay.Button r1 = new EmpireUIOverlay.Button(); r1.Rect = this.res1; r1.NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res1"]; r1.HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res1_hover"]; r1.PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res1_press"]; r1.launches = "Research"; this.Buttons.Add(r1); EmpireUIOverlay.Button r2 = new EmpireUIOverlay.Button(); r2.Rect = this.res2; r2.NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res2"]; r2.HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res2"]; r2.PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res2"]; r2.launches = "Research"; this.Buttons.Add(r2); EmpireUIOverlay.Button r3 = new EmpireUIOverlay.Button(); r3.Rect = this.res3; r3.NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res3"]; r3.HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res3_hover"]; r3.PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res3_press"]; r3.launches = "Budget"; this.Buttons.Add(r3); EmpireUIOverlay.Button r4 = new EmpireUIOverlay.Button(); r4.Rect = this.res4; r4.NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res4"]; r4.HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res4"]; r4.PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res4"]; r4.launches = "Budget"; this.Buttons.Add(r4); EmpireUIOverlay.Button r5 = new EmpireUIOverlay.Button(); r5.Rect = this.res5; r5.NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res5"]; r5.HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res5"]; r5.PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_res5"]; this.Buttons.Add(r5); float rangeforbuttons = (float)(r5.Rect.X - (r4.Rect.X + r4.Rect.Width)); float roomoneitherside = (rangeforbuttons - 734f) / 2f; //Added by McShooterz: Shifted buttons to add new ones, added dummy espionage button Cursor.X = (float)(r4.Rect.X + r4.Rect.Width) + roomoneitherside; if (this.screen.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth >= 1920) { Cursor.X -= 220f; EmpireUIOverlay.Button ShipList = new EmpireUIOverlay.Button(); ShipList.Rect = new Rectangle((int)Cursor.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height); ShipList.NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_military"]; ShipList.HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_military_hover"]; ShipList.PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_military_pressed"]; ShipList.Text = Localizer.Token(104); ShipList.launches = "ShipList"; this.Buttons.Add(ShipList); Cursor.X = Cursor.X + (float)ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_hover"].Width + 5; EmpireUIOverlay.Button Fleets = new EmpireUIOverlay.Button(); Fleets.Rect = new Rectangle((int)Cursor.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height); Fleets.NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_military"]; Fleets.HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_military_hover"]; Fleets.PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_military_pressed"]; Fleets.Text = Localizer.Token(103); Fleets.launches = "Fleets"; this.Buttons.Add(Fleets); Cursor.X = Cursor.X + (float)ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_hover"].Width + 5; } else Cursor.X -= 50f; EmpireUIOverlay.Button Shipyard = new EmpireUIOverlay.Button(); Shipyard.Rect = new Rectangle((int)Cursor.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height); Shipyard.NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_military"]; Shipyard.HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_military_hover"]; Shipyard.PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_military_pressed"]; Shipyard.Text = Localizer.Token(98); Shipyard.launches = "Shipyard"; this.Buttons.Add(Shipyard); Cursor.X = Cursor.X + (float)ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_hover"].Width + 40; EmpireUIOverlay.Button Empire = new EmpireUIOverlay.Button(); Empire.Rect = new Rectangle((int)Cursor.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height); Empire.NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"]; Empire.HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_hover"]; Empire.PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_pressed"]; Empire.launches = "Empire"; Empire.Text = Localizer.Token(99); this.Buttons.Add(Empire); Cursor.X = Cursor.X + (float)ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_hover"].Width + 40; EmpireUIOverlay.Button Espionage = new EmpireUIOverlay.Button(); Espionage.Rect = new Rectangle((int)Cursor.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height); Espionage.NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_dip"]; Espionage.HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_dip_hover"]; Espionage.PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_dip_pressed"]; Espionage.Text = Localizer.Token(6088); Espionage.launches = "Espionage"; this.Buttons.Add(Espionage); Cursor.X = Cursor.X + (float)ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_hover"].Width + 5; EmpireUIOverlay.Button Diplomacy = new EmpireUIOverlay.Button(); Diplomacy.Rect = new Rectangle((int)Cursor.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px"].Height); Diplomacy.NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_dip"]; Diplomacy.HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_dip_hover"]; Diplomacy.PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_dip_pressed"]; Diplomacy.launches = "Diplomacy"; Diplomacy.Text = Localizer.Token(100); this.Buttons.Add(Diplomacy); Cursor.X = Cursor.X + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_168px_hover"].Width + 7); EmpireUIOverlay.Button MainMenu = new EmpireUIOverlay.Button(); MainMenu.Rect = new Rectangle(this.res5.X + 52, 39, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"].Height); MainMenu.NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_menu"]; MainMenu.HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_menu_hover"]; MainMenu.PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_menu_pressed"]; MainMenu.launches = "Main Menu"; MainMenu.Text = Localizer.Token(101); this.Buttons.Add(MainMenu); Cursor.X = Cursor.X + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_hover"].Width + 5); EmpireUIOverlay.Button Help = new EmpireUIOverlay.Button(); Help.Rect = new Rectangle(this.res5.X + 72, 64, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"].Height); Help.NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px_menu"]; Help.HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px_menu_hover"]; Help.PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px_menu_pressed"]; Help.Text = "Help"; Help.launches = "?"; this.Buttons.Add(Help); return; } this.LowRes = true; Vector2 Cursor0 = Vector2.Zero; this.res1 = new Rectangle((int)Cursor0.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res1"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res1"].Height); Cursor0.X = Cursor0.X + (float)ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res1"].Width; this.res2 = new Rectangle((int)Cursor0.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res2"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res2"].Height); Cursor0.X = Cursor0.X + (float)ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res2"].Width; this.res3 = new Rectangle((int)Cursor0.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res3"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res3"].Height); Cursor0.X = Cursor0.X + (float)ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res3"].Width; this.res4 = new Rectangle((int)Cursor0.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res4"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res4"].Height); Cursor0.X = Cursor0.X + (float)ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res4"].Width; Cursor0.X = (float)(screen.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res5"].Width); this.res5 = new Rectangle((int)Cursor0.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res5"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res5"].Height); EmpireUIOverlay.Button r1n = new EmpireUIOverlay.Button() { Rect = this.res1, NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res1"], HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res1_hover"], PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res1_press"] }; this.Buttons.Add(r1n); r1n.launches = "Research"; EmpireUIOverlay.Button r2n = new EmpireUIOverlay.Button() { Rect = this.res2, NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res2"], HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res2"], PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res2"] }; this.Buttons.Add(r2n); r2n.launches = "Research"; EmpireUIOverlay.Button r3n = new EmpireUIOverlay.Button() { Rect = this.res3, NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res3"], HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res3_hover"], PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res3_press"], launches = "Budget" }; this.Buttons.Add(r3n); EmpireUIOverlay.Button r4n = new EmpireUIOverlay.Button() { Rect = this.res4, NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res4"], HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res4"], PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res4"], launches = "Budget" }; this.Buttons.Add(r4n); EmpireUIOverlay.Button r5n = new EmpireUIOverlay.Button() { Rect = this.res5, NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res5"], HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res5"], PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_res5"] }; this.Buttons.Add(r5n); float rangeforbuttons0 = (float)(r5n.Rect.X - (r4n.Rect.X + r4n.Rect.Width)); float roomoneitherside0 = (rangeforbuttons0 - 607f) / 2f; Cursor0.X = (float)(r4n.Rect.X + r4n.Rect.Width) + roomoneitherside0 - 50f; EmpireUIOverlay.Button Shipyard0 = new EmpireUIOverlay.Button() { Rect = new Rectangle((int)Cursor0.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px"].Height), NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px"], HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px_hover"], PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px_pressed"], Text = Localizer.Token(98), launches = "Shipyard" }; this.Buttons.Add(Shipyard0); Cursor0.X = Cursor0.X + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px_hover"].Width + 18); EmpireUIOverlay.Button Empire0 = new EmpireUIOverlay.Button() { Rect = new Rectangle((int)Cursor0.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px"].Height), NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px"], HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px_hover"], PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px_pressed"], launches = "Empire", Text = Localizer.Token(99) }; this.Buttons.Add(Empire0); Cursor0.X = Cursor0.X + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px_hover"].Width + 18); EmpireUIOverlay.Button Espionage0 = new EmpireUIOverlay.Button() { Rect = new Rectangle((int)Cursor0.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px"].Height), NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px"], HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px_hover"], PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px_pressed"], launches = "Espionage", Text = Localizer.Token(6088) }; this.Buttons.Add(Espionage0); Cursor0.X = Cursor0.X + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px_hover"].Width + 6); EmpireUIOverlay.Button Diplomacy0 = new EmpireUIOverlay.Button() { Rect = new Rectangle((int)Cursor0.X, 2, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px"].Height), NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px"], HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px_hover"], PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px_pressed"], launches = "Diplomacy", Text = Localizer.Token(100) }; this.Buttons.Add(Diplomacy0); Cursor0.X = Cursor0.X + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_124px_hover"].Width + 6); EmpireUIOverlay.Button MainMenu0 = new EmpireUIOverlay.Button() { Rect = new Rectangle(this.res5.X + 52, 39, 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"], launches = "Main Menu", Text = Localizer.Token(101) }; this.Buttons.Add(MainMenu0); Cursor0.X = Cursor0.X + (float)(ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_100px_hover"].Width + 5); EmpireUIOverlay.Button Help0 = new EmpireUIOverlay.Button() { Rect = new Rectangle(this.res5.X + 72, 64, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_80px"].Width, ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_100px"].Height), NormalTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_80px"], HoverTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_80px_hover"], PressedTexture = ResourceManager.TextureDict["EmpireTopBar/empiretopbar_low_btn_80px_pressed"], Text = "Help", launches = "?" }; this.Buttons.Add(Help0); }
protected void Dispose(bool disposing) { if (!disposing) return; lock (this) { if (this.WorkerBeginEvent != null) this.WorkerBeginEvent.Dispose(); if (this.WorkerCompletedEvent != null) this.WorkerCompletedEvent.Dispose(); if (this.us != null) this.us.Dispose(); this.WorkerBeginEvent = null; this.WorkerCompletedEvent = null; this.us = null; } }
public bool HandleInput(InputState input, UniverseScreen screen) { if (HelperFunctions.CheckIntersection(this.zIn.r, input.CursorPosition)) { ToolTip.CreateTooltip(57, screen.ScreenManager, "Page Up"); } if (this.zIn.HandleInput(input)) { AudioManager.PlayCue("sd_ui_accept_alt3"); screen.AdjustCamTimer = 1f; screen.transitionElapsedTime = 0f; screen.transitionDestination.Z = 4500f; screen.snappingToShip = true; screen.ViewingShip = true; return true; } if (HelperFunctions.CheckIntersection(this.zOut.r, input.CursorPosition)) { ToolTip.CreateTooltip(58, screen.ScreenManager, "Page Down"); } if (this.zOut.HandleInput(input)) { AudioManager.PlayCue("sd_ui_accept_alt3"); screen.AdjustCamTimer = 1f; screen.transitionElapsedTime = 0f; screen.transitionDestination.X = screen.camPos.X; screen.transitionDestination.Y = screen.camPos.Y; screen.transitionDestination.Z = 4200000f * UniverseScreen.GameScaleStatic; return true; } if (HelperFunctions.CheckIntersection(this.DSB.r, input.CursorPosition)) { ToolTip.CreateTooltip(54, screen.ScreenManager, "B"); } if (this.DSB.HandleInput(input)) { AudioManager.PlayCue("sd_ui_accept_alt3"); if (screen.showingDSBW) { screen.showingDSBW = false; } else { screen.dsbw = new DeepSpaceBuildingWindow(screen.ScreenManager, screen); screen.showingDSBW = true; } return true; } if (HelperFunctions.CheckIntersection(this.pList.r, input.CursorPosition)) { ToolTip.CreateTooltip(56, screen.ScreenManager); } if (this.pList.HandleInput(input)) { AudioManager.PlayCue("sd_ui_accept_alt3"); screen.ScreenManager.AddScreen(new PlanetListScreen(screen.ScreenManager, screen.EmpireUI)); return true; } if (HelperFunctions.CheckIntersection(this.sList.r, input.CursorPosition)) { ToolTip.CreateTooltip(223, screen.ScreenManager, "F1"); } if (this.sList.HandleInput(input)) { AudioManager.PlayCue("sd_ui_accept_alt3"); if (screen.showingFTLOverlay) { screen.showingFTLOverlay = false; } else { screen.showingFTLOverlay = true; } return true; } if (HelperFunctions.CheckIntersection(this.Fleets.r, input.CursorPosition)) { ToolTip.CreateTooltip(224, screen.ScreenManager, "F2"); } if (this.Fleets.HandleInput(input)) { AudioManager.PlayCue("sd_ui_accept_alt3"); if (screen.showingRangeOverlay) { screen.showingRangeOverlay = false; } else { screen.showingRangeOverlay = true; } //screen.ScreenManager.AddScreen(new FleetDesignScreen(screen.EmpireUI)); return true; } if (HelperFunctions.CheckIntersection(this.Auto.r, input.CursorPosition)) { ToolTip.CreateTooltip(59, screen.ScreenManager, "H"); } if (!this.Auto.HandleInput(input)) { return false; } AudioManager.PlayCue("sd_ui_accept_alt3"); screen.aw.isOpen = !screen.aw.isOpen; return true; }
public void SnapViewSystem(SolarSystem system, UniverseScreen.UnivScreenState camHeight) { float x = this.GetZfromScreenState(camHeight); this.transitionDestination = new Vector3(system.Position.X, system.Position.Y + 400f, x);//80000);// this.transitionStartPosition = this.camPos; this.AdjustCamTimer = 2f; this.transitionElapsedTime = 0.0f; this.transDuration = 5f; this.ViewingShip = false; this.snappingToShip = false; if (this.ViewingShip) this.returnToShip = true; this.ViewingShip = false; this.snappingToShip = false; this.SelectedFleet = (Fleet)null; this.SelectedShip = (Ship)null; this.SelectedShipList.Clear(); this.SelectedItem = (UniverseScreen.ClickableItemUnderConstruction)null; //this.input.CursorPosition = //this.ClickTimer2 = this.TimerDelay; }
public void Draw(UniverseScreen universe, Starfield starfield) { Vector2 camPos = new Vector2(universe.camPos.X, universe.camPos.Y); Vector2 vector2 = -1f * (camPos - this.lastCamPos); int width = universe.ScreenManager.GraphicsDevice.Viewport.Width; Viewport viewport = universe.ScreenManager.GraphicsDevice.Viewport; Rectangle blackRect = new Rectangle(0, 0, width, viewport.Height); universe.ScreenManager.SpriteBatch.Begin(); Color c = new Color(255, 255, 255, 160); Primitives2D.FillRectangle(universe.ScreenManager.SpriteBatch, blackRect, new Color(12, 17, 24)); if (universe.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth > 2048) { universe.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["Textures/hqstarfield1"], blackRect, c); } else { universe.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["Textures/hqstarfield1"], blackRect, new Rectangle?(blackRect), c); } Vector2 vector21 = new Vector2(camPos.X, camPos.Y); float percentX = camPos.X / 500000f; float percentY = camPos.Y / 500000f; float xDiff = (float)blackRect.Width / 10f; float yDiff = (float)blackRect.Height / 10f; float xPerc = percentX * xDiff; this.cam.Pos = new Vector2(xPerc, percentY * yDiff); starfield.Draw(this.cam.Pos, universe.ScreenManager.SpriteBatch); universe.ScreenManager.SpriteBatch.End(); Rectangle bgRect = new Rectangle(); if (universe.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth > 2048) { float x = this.cam.Pos.X; Viewport viewport1 = universe.ScreenManager.GraphicsDevice.Viewport; bgRect = new Rectangle((int)(x - (float)(viewport1.Width / 2) - this.cam.Pos.X / 30f - 200f), (int)(this.cam.Pos.Y - (float)(universe.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight / 2) - this.cam.Pos.Y / 30f) - 200, 2600, 2600); } else { float single = this.cam.Pos.X; Viewport viewport2 = universe.ScreenManager.GraphicsDevice.Viewport; bgRect = new Rectangle((int)(single - (float)(viewport2.Width / 2) - this.cam.Pos.X / 30f - 200f), (int)(this.cam.Pos.Y - (float)(universe.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight / 2) - this.cam.Pos.Y / 30f) - 200, 2048, 2048); } Vector2 vector22 = new Vector2(200f, 50f); universe.ScreenManager.SpriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None, this.cam.get_transformation(universe.ScreenManager.GraphicsDevice)); universe.ScreenManager.SpriteBatch.Draw(ResourceManager.BigNebulas[1], bgRect, new Color(255, 255, 255, 60)); universe.ScreenManager.SpriteBatch.Draw(ResourceManager.BigNebulas[3], bgRect, new Color(255, 255, 255, 60)); if (universe.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth > 2048) { float x1 = this.cam.Pos.X; Viewport viewport3 = universe.ScreenManager.GraphicsDevice.Viewport; bgRect = new Rectangle((int)(x1 - (float)(viewport3.Width / 2) - this.cam.Pos.X / 15f - 200f), (int)(this.cam.Pos.Y - (float)(universe.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight / 2) - this.cam.Pos.Y / 15f) - 200, 2600, 2600); } else { float single1 = this.cam.Pos.X; Viewport viewport4 = universe.ScreenManager.GraphicsDevice.Viewport; bgRect = new Rectangle((int)(single1 - (float)(viewport4.Width / 2) - this.cam.Pos.X / 15f - 200f), (int)(this.cam.Pos.Y - (float)(universe.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight / 2) - this.cam.Pos.Y / 15f) - 200, 2500, 2500); } universe.ScreenManager.SpriteBatch.End(); this.lastCamPos = camPos; }
public void Draw(Ship_Game.ScreenManager ScreenManager, UniverseScreen screen) { ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["Minimap/radar"], this.Housing, Color.White); float scale = (float)this.ActualMap.Width / screen.Size.X; Vector2 MinimapZero = new Vector2((float)this.ActualMap.X, (float)this.ActualMap.Y); foreach (Empire e in EmpireManager.EmpireList) { if (e != EmpireManager.GetEmpireByName(screen.PlayerLoyalty) && !EmpireManager.GetEmpireByName(screen.PlayerLoyalty).GetRelations()[e].Known) { continue; } List<Circle> circles = new List<Circle>(); e.BorderNodeLocker.EnterReadLock(); { foreach (Empire.InfluenceNode node in e.BorderNodes) { float radius = node.Radius * scale; Vector2 nodepos = new Vector2(MinimapZero.X + node.Position.X * scale, MinimapZero.Y + node.Position.Y * scale); Vector2 Origin = new Vector2((float)(ResourceManager.TextureDict["UI/node"].Width / 2), (float)(ResourceManager.TextureDict["UI/node"].Height / 2)); Color ec = new Color(e.EmpireColor.R, e.EmpireColor.G, e.EmpireColor.B, 30); float rscale = radius * 0.005f; if ((double)rscale < 0.006) { rscale = 0.006f; } Rectangle? nullable = null; ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/node1"], nodepos, nullable, ec, 0f, Origin, rscale, SpriteEffects.None, 1f); } } e.BorderNodeLocker.ExitReadLock(); } foreach (SolarSystem system in UniverseScreen.SolarSystemList) { Rectangle star = new Rectangle((int)(MinimapZero.X + system.Position.X * scale), (int)(MinimapZero.Y + system.Position.Y * scale), 2, 2); if (system.OwnerList.Count <= 0 || !system.ExploredDict[EmpireManager.GetEmpireByName(screen.PlayerLoyalty)]) { Primitives2D.FillRectangle(ScreenManager.SpriteBatch, star, Color.Gray); } else { Primitives2D.FillRectangle(ScreenManager.SpriteBatch, star, system.OwnerList.ToList()[0].EmpireColor); } } Vector2 upperLeftView = screen.GetWorldSpaceFromScreenSpace(new Vector2(0f, 0f)); upperLeftView = new Vector2((float)HelperFunctions.RoundTo(upperLeftView.X, 20000), (float)HelperFunctions.RoundTo(upperLeftView.Y, 20000)); Vector2 right = screen.GetWorldSpaceFromScreenSpace(new Vector2((float)ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth, 0f)); right = new Vector2((float)HelperFunctions.RoundTo(right.X, 20000), 0f); float xdist = (right.X - upperLeftView.X) * scale; xdist = (float)HelperFunctions.RoundTo(xdist, 1); float ydist = xdist * (float)ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight / (float)ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth; Rectangle LookingAt = new Rectangle((int)MinimapZero.X + (int)(upperLeftView.X * scale), (int)MinimapZero.Y + (int)(upperLeftView.Y * scale), (int)xdist, (int)ydist); if (LookingAt.Width < 2) { LookingAt.Width = 2; LookingAt.Height = 2; } if (LookingAt.X < this.ActualMap.X) { LookingAt.X = this.ActualMap.X; } if (LookingAt.Y < this.ActualMap.Y) { LookingAt.Y = this.ActualMap.Y; } Primitives2D.FillRectangle(ScreenManager.SpriteBatch, LookingAt, new Color(255, 255, 255, 30)); Primitives2D.DrawRectangle(ScreenManager.SpriteBatch, LookingAt, Color.White); Vector2 topMiddleView = new Vector2((float)(LookingAt.X + LookingAt.Width / 2), (float)LookingAt.Y); Vector2 botMiddleView = new Vector2(topMiddleView.X - 1f, (float)(LookingAt.Y + LookingAt.Height)); Vector2 leftMiddleView = new Vector2((float)LookingAt.X, (float)(LookingAt.Y + LookingAt.Height / 2)); Vector2 rightMiddleView = new Vector2((float)(LookingAt.X + LookingAt.Width), leftMiddleView.Y + 1f); Primitives2D.DrawLine(ScreenManager.SpriteBatch, new Vector2(topMiddleView.X, MinimapZero.Y), topMiddleView, Color.White); Primitives2D.DrawLine(ScreenManager.SpriteBatch, new Vector2(botMiddleView.X, (float)(this.ActualMap.Y + this.ActualMap.Height)), botMiddleView, Color.White); Primitives2D.DrawLine(ScreenManager.SpriteBatch, new Vector2((float)this.ActualMap.X, leftMiddleView.Y), leftMiddleView, Color.White); Primitives2D.DrawLine(ScreenManager.SpriteBatch, new Vector2((float)(this.ActualMap.X + this.ActualMap.Width), rightMiddleView.Y), rightMiddleView, Color.White); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["Minimap/radar_over"], this.Housing, Color.White); if (screen.showingFTLOverlay) { this.sList.Active = true; } else { this.sList.Active = false; } if (screen.showingDSBW) { this.DSB.Active = true; } else { this.DSB.Active = false; } if (screen.aw.isOpen) { this.Auto.Active = true; } else { this.Auto.Active = false; } if (screen.showingRangeOverlay) { this.Fleets.Active = true; } else { this.Fleets.Active = false; } this.zOut.DrawIconResized(ScreenManager); this.zIn.DrawIconResized(ScreenManager); this.DSB.DrawIconResized(ScreenManager); this.pList.DrawIconResized(ScreenManager); this.sList.DrawIconResized(ScreenManager); this.Fleets.DrawIconResized(ScreenManager); this.Auto.DrawIconResized(ScreenManager); }
public void TriggerPlanetEvent(Planet p, Empire Triggerer, PlanetGridSquare eventLocation, Empire PlayerEmpire, UniverseScreen screen) { int ranMax = 0; int ranMin = 0; foreach (Outcome outcome in this.PotentialOutcomes) { if (outcome.onlyTriggerOnce && outcome.alreadyTriggered && Triggerer.isPlayer) { continue; } else { ranMax += outcome.Chance; } } int Random = (int)RandomMath.RandomBetween(ranMin, ranMax); Outcome triggeredOutcome = new Outcome(); int cursor = 0; foreach (Outcome outcome in this.PotentialOutcomes) { if (outcome.onlyTriggerOnce && outcome.alreadyTriggered && Triggerer.isPlayer) { continue; } else { cursor = cursor + outcome.Chance; if (Random > cursor) { continue; } triggeredOutcome = outcome; if (Triggerer.isPlayer) { outcome.alreadyTriggered = true; } break; } } if (triggeredOutcome != null) { if (triggeredOutcome.GrantArtifact) { List<Ship_Game.Artifact> Potentials = new List<Ship_Game.Artifact>(); foreach (KeyValuePair<string, Ship_Game.Artifact> Artifact in ResourceManager.ArtifactsDict) { if (Artifact.Value.Discovered) { continue; } Potentials.Add(Artifact.Value); } if (Potentials.Count <= 0) { triggeredOutcome.MoneyGranted = 500; } else { int ranart = (int)RandomMath.RandomBetween(0f, (float)Potentials.Count + 0.8f); if (ranart > Potentials.Count - 1) { ranart = Potentials.Count - 1; } Triggerer.data.OwnedArtifacts.Add(Potentials[ranart]); ResourceManager.ArtifactsDict[Potentials[ranart].Name].Discovered = true; triggeredOutcome.SetArtifact(Potentials[ranart]); if (triggeredOutcome.GetArtifact().DiplomacyMod > 0f) { RacialTrait traits = Triggerer.data.Traits; traits.DiplomacyMod = traits.DiplomacyMod + (triggeredOutcome.GetArtifact().DiplomacyMod + triggeredOutcome.GetArtifact().DiplomacyMod * Triggerer.data.Traits.Spiritual); } if (triggeredOutcome.GetArtifact().FertilityMod > 0f) { EmpireData triggerer = Triggerer.data; triggerer.EmpireFertilityBonus = triggerer.EmpireFertilityBonus + triggeredOutcome.GetArtifact().FertilityMod; foreach (Planet planet in Triggerer.GetPlanets()) { Planet fertility = planet; fertility.Fertility = fertility.Fertility + (triggeredOutcome.GetArtifact().FertilityMod + triggeredOutcome.GetArtifact().FertilityMod * Triggerer.data.Traits.Spiritual); } } if (triggeredOutcome.GetArtifact().GroundCombatMod > 0f) { RacialTrait groundCombatModifier = Triggerer.data.Traits; groundCombatModifier.GroundCombatModifier = groundCombatModifier.GroundCombatModifier + (triggeredOutcome.GetArtifact().GroundCombatMod + triggeredOutcome.GetArtifact().GroundCombatMod * Triggerer.data.Traits.Spiritual); } if (triggeredOutcome.GetArtifact().ModuleHPMod > 0f) { RacialTrait modHpModifier = Triggerer.data.Traits; modHpModifier.ModHpModifier = modHpModifier.ModHpModifier + (triggeredOutcome.GetArtifact().ModuleHPMod + triggeredOutcome.GetArtifact().ModuleHPMod * Triggerer.data.Traits.Spiritual); } if (triggeredOutcome.GetArtifact().PlusFlatMoney > 0f) { EmpireData flatMoneyBonus = Triggerer.data; flatMoneyBonus.FlatMoneyBonus = flatMoneyBonus.FlatMoneyBonus + (triggeredOutcome.GetArtifact().PlusFlatMoney + triggeredOutcome.GetArtifact().PlusFlatMoney * Triggerer.data.Traits.Spiritual); } if (triggeredOutcome.GetArtifact().ProductionMod > 0f) { RacialTrait productionMod = Triggerer.data.Traits; productionMod.ProductionMod = productionMod.ProductionMod + (triggeredOutcome.GetArtifact().ProductionMod + triggeredOutcome.GetArtifact().ProductionMod * Triggerer.data.Traits.Spiritual); } if (triggeredOutcome.GetArtifact().ReproductionMod > 0f) { RacialTrait reproductionMod = Triggerer.data.Traits; reproductionMod.ReproductionMod = reproductionMod.ReproductionMod + (triggeredOutcome.GetArtifact().ReproductionMod + triggeredOutcome.GetArtifact().ReproductionMod * Triggerer.data.Traits.Spiritual); } if (triggeredOutcome.GetArtifact().ResearchMod > 0f) { RacialTrait researchMod = Triggerer.data.Traits; researchMod.ResearchMod = researchMod.ResearchMod + (triggeredOutcome.GetArtifact().ResearchMod + triggeredOutcome.GetArtifact().ResearchMod * Triggerer.data.Traits.Spiritual); } if (triggeredOutcome.GetArtifact().SensorMod > 0f) { EmpireData sensorModifier = Triggerer.data; sensorModifier.SensorModifier = sensorModifier.SensorModifier + (triggeredOutcome.GetArtifact().SensorMod + triggeredOutcome.GetArtifact().SensorMod * Triggerer.data.Traits.Spiritual); } if (triggeredOutcome.GetArtifact().ShieldPenBonus > 0f) { EmpireData shieldPenBonusChance = Triggerer.data; shieldPenBonusChance.ShieldPenBonusChance = shieldPenBonusChance.ShieldPenBonusChance + (triggeredOutcome.GetArtifact().ShieldPenBonus + triggeredOutcome.GetArtifact().ShieldPenBonus * Triggerer.data.Traits.Spiritual); } } } if (triggeredOutcome.BeginArmageddon) { GlobalStats.RemnantArmageddon = true; } foreach (string ship in triggeredOutcome.FriendlyShipsToSpawn) { Triggerer.ForcePoolAdd(ResourceManager.CreateShipAt(ship, Triggerer, p, true)); } foreach (string ship in triggeredOutcome.RemnantShipsToSpawn) { Ship tomake = ResourceManager.CreateShipAt(ship, EmpireManager.GetEmpireByName("The Remnant"), p, true); tomake.GetAI().DefaultAIState = AIState.Exterminate; } if (triggeredOutcome.UnlockTech != null) { if (!Triggerer.GetTDict()[triggeredOutcome.UnlockTech].Unlocked) { Triggerer.UnlockTech(triggeredOutcome.UnlockTech); } else { triggeredOutcome.WeHadIt = true; } } if (triggeredOutcome.RemoveTrigger) { p.BuildingList.Remove(eventLocation.building); eventLocation.building = null; } if (!string.IsNullOrEmpty(triggeredOutcome.ReplaceWith)) { eventLocation.building = ResourceManager.GetBuilding(triggeredOutcome.ReplaceWith); p.BuildingList.Add(eventLocation.building); } Empire money = Triggerer; money.Money = money.Money + (float)triggeredOutcome.MoneyGranted; RacialTrait racialTrait = Triggerer.data.Traits; racialTrait.ResearchMod = racialTrait.ResearchMod + triggeredOutcome.ScienceBonus; RacialTrait traits1 = Triggerer.data.Traits; traits1.ProductionMod = traits1.ProductionMod + triggeredOutcome.IndustryBonus; if (triggeredOutcome.TroopsGranted != null) { foreach (string troopname in triggeredOutcome.TroopsGranted) { Troop t = ResourceManager.CreateTroop(ResourceManager.TroopsDict[troopname], Triggerer); t.SetOwner(Triggerer); if (p.AssignTroopToNearestAvailableTile(t, eventLocation)) { continue; } p.AssignTroopToTile(t); } } if (triggeredOutcome.TroopsToSpawn != null) { foreach (string troopname in triggeredOutcome.TroopsToSpawn) { Troop t = ResourceManager.CreateTroop(ResourceManager.TroopsDict[troopname], EmpireManager.GetEmpireByName("Unknown")); t.SetOwner(EmpireManager.GetEmpireByName("Unknown")); if (p.AssignTroopToNearestAvailableTile(t, eventLocation)) { continue; } p.AssignTroopToTile(t); } } } if (Triggerer == PlayerEmpire) { screen.ScreenManager.AddScreen(new EventPopup(screen, PlayerEmpire, this, triggeredOutcome)); AudioManager.PlayCue("sd_notify_alert"); } }
public void Draw(Vector2 position, float zoom, UniverseScreen universe) { if (zoom > 1f) { zoom = 1f; } this.lastPosition = this.position; this.position = position; Vector2 movement = -1f * (position - this.lastPosition); if (movement.Length() > 20000f) { this.Reset(position); return; } Ship.universeScreen.ScreenManager.SpriteBatch.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.None); this.cloudEffect.Begin(); Starfield starfield = this; starfield.cloudPos = starfield.cloudPos - ((movement * 0.3f) * zoom); this.cloudEffectPosition.SetValue(this.cloudPos); this.cloudEffect.CurrentTechnique.Passes[0].Begin(); Rectangle? nullable = null; Ship.universeScreen.ScreenManager.SpriteBatch.Draw(this.cloudTexture, this.starfieldRectangle, nullable, new Color(255, 0, 0, 255), 0f, Vector2.Zero, SpriteEffects.None, 1f); this.cloudEffect.CurrentTechnique.Passes[0].End(); this.cloudEffect.End(); Ship.universeScreen.ScreenManager.SpriteBatch.End(); Ship.universeScreen.ScreenManager.SpriteBatch.Begin(); for (int i = 0; i < (int)this.stars.Length; i++) { this.stars[i].Position = this.stars[i].Position + ((movement * Starfield.movementFactors[this.stars[i].whichLayer]) * zoom); if (this.stars[i].Position.X < (float)this.starfieldRectangle.X) { this.stars[i].Position.X = (float)(this.starfieldRectangle.X + this.starfieldRectangle.Width); this.stars[i].Position.Y = (float)(this.starfieldRectangle.Y + RandomMath.Random.Next(this.starfieldRectangle.Height)); } if (this.stars[i].Position.X > (float)(this.starfieldRectangle.X + this.starfieldRectangle.Width)) { this.stars[i].Position.X = (float)this.starfieldRectangle.X; this.stars[i].Position.Y = (float)(this.starfieldRectangle.Y + RandomMath.Random.Next(this.starfieldRectangle.Height)); } if (this.stars[i].Position.Y < (float)this.starfieldRectangle.Y) { this.stars[i].Position.X = (float)(this.starfieldRectangle.X + RandomMath.Random.Next(this.starfieldRectangle.Width)); this.stars[i].Position.Y = (float)(this.starfieldRectangle.Y + this.starfieldRectangle.Height); } if (this.stars[i].Position.Y > (float)(this.starfieldRectangle.Y + Ship.universeScreen.ScreenManager.GraphicsDevice.Viewport.Height)) { this.stars[i].Position.X = (float)(this.starfieldRectangle.X + RandomMath.Random.Next(this.starfieldRectangle.Width)); this.stars[i].Position.Y = (float)this.starfieldRectangle.Y; } float alpha = 4.08E+07f / universe.camHeight; if (alpha > 255f) { alpha = 255f; } if (alpha < 10f) { alpha = 0f; } switch (this.stars[i].whichLayer) { case 2: { Ship.universeScreen.ScreenManager.SpriteBatch.Draw(ResourceManager.SmallStars[this.stars[i].whichStar], this.stars[i].Position, Starfield.layerColors[this.stars[i].whichLayer]); break; } case 3: { Color c = new Color(Starfield.layerColors[this.stars[i].whichLayer].R, Starfield.layerColors[this.stars[i].whichLayer].G, Starfield.layerColors[this.stars[i].whichLayer].B, (byte)alpha); Ship.universeScreen.ScreenManager.SpriteBatch.Draw(ResourceManager.MediumStars[this.stars[i].whichStar], this.stars[i].Position, c); break; } case 4: { Color c1 = new Color(Starfield.layerColors[this.stars[i].whichLayer].R, Starfield.layerColors[this.stars[i].whichLayer].G, Starfield.layerColors[this.stars[i].whichLayer].B, (byte)alpha); Ship.universeScreen.ScreenManager.SpriteBatch.Draw(ResourceManager.LargeStars[this.stars[i].whichStar], this.stars[i].Position, c1); break; } default: { Rectangle r = new Rectangle((int)this.stars[i].Position.X, (int)this.stars[i].Position.Y, this.stars[i].Size, this.stars[i].Size); Rectangle? nullable1 = null; Ship.universeScreen.ScreenManager.SpriteBatch.Draw(this.starTex[this.stars[i].whichStar], r, nullable1, Starfield.layerColors[this.stars[i].whichLayer]); break; } } } Ship.universeScreen.ScreenManager.SpriteBatch.End(); }