public override void Draw(GameTime gameTime) { base.ScreenManager.FadeBackBufferToBlack(base.TransitionAlpha * 2 / 3); base.ScreenManager.SpriteBatch.Begin(); this.sub_ships.Draw(); Rectangle r = this.sub_ships.Menu; r.Y = r.Y + 25; r.Height = r.Height - 25; Selector sel = new Selector(base.ScreenManager, r, new Color(0, 0, 0, 210)); sel.Draw(); if (this.selector != null) { this.selector.Draw(); } this.ShipSL.Draw(base.ScreenManager.SpriteBatch); Vector2 bCursor = new Vector2((float)(this.sub_ships.Menu.X + 5), (float)(this.sub_ships.Menu.Y + 25)); for (int i = this.ShipSL.indexAtTop; i < this.ShipSL.Copied.Count && i < this.ShipSL.indexAtTop + this.ShipSL.entriesToDisplay; i++) { ScrollList.Entry e = this.ShipSL.Copied[i]; Ship ship = ResourceManager.ShipsDict[e.item as string]; bCursor.Y = (float)e.clickRect.Y; base.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[ResourceManager.HullsDict[ship.GetShipData().Hull].IconPath], new Rectangle((int)bCursor.X, (int)bCursor.Y, 29, 30), Color.White); Vector2 tCursor = new Vector2(bCursor.X + 40f, bCursor.Y + 3f); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, ship.Name, tCursor, Color.White); tCursor.Y = tCursor.Y + (float)Fonts.Arial12Bold.LineSpacing; if (this.sub_ships.Tabs[0].Selected) { base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, ship.Role, tCursor, Color.Orange); } Rectangle MoneyRect = new Rectangle(e.clickRect.X + 165, e.clickRect.Y, 21, 20); Vector2 moneyText = new Vector2((float)(MoneyRect.X + 25), (float)(MoneyRect.Y - 2)); base.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/icon_production"], MoneyRect, Color.White); int refitCost = (int)(ship.GetCost(ship.loyalty) - this.shiptorefit.GetCost(ship.loyalty)); if (refitCost < 0) { refitCost = 0; } refitCost = refitCost + 10; base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, refitCost.ToString(), moneyText, Color.White); } if (this.RefitTo != null) { this.RefitOne.Draw(base.ScreenManager.SpriteBatch); this.RefitAll.Draw(base.ScreenManager.SpriteBatch); Vector2 Cursor = new Vector2((float)this.ConfirmRefit.r.X, (float)(this.ConfirmRefit.r.Y + 30)); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, HelperFunctions.parseText(Fonts.Arial12Bold, string.Concat("Refit ", this.shiptorefit.Name, " to ", this.RefitTo), 270f), Cursor, Color.White); } if (base.IsActive) { ToolTip.Draw(base.ScreenManager); } base.ScreenManager.SpriteBatch.End(); }
public void Draw(GameTime gameTime) { Rectangle r = this.ConstructionSubMenu.Menu; r.Y = r.Y + 25; r.Height = r.Height - 25; Selector sel = new Selector(this.ScreenManager, r, new Color(0, 0, 0, 210)); sel.Draw(); this.ConstructionSubMenu.Draw(); foreach (Checkbox cb in this.Checkboxes) { cb.Draw(this.ScreenManager); } this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, this.ConstructorString, this.ConstructorTitle, Color.White); this.ConstructorDropDown.Draw(this.ScreenManager.SpriteBatch); this.AutoFreighterDropDown.Draw(this.ScreenManager.SpriteBatch); this.ColonyShipDropDown.Draw(this.ScreenManager.SpriteBatch); this.ScoutDropDown.Draw(this.ScreenManager.SpriteBatch); }
private void DrawModuleSelection() { Rectangle r = this.modSel.Menu; r.Y = r.Y + 25; r.Height = r.Height - 25; Selector sel = new Selector(base.ScreenManager, r, new Color(0, 0, 0, 210)); sel.Draw(); this.modSel.Draw(); this.weaponSL.Draw(base.ScreenManager.SpriteBatch); float x = (float)Mouse.GetState().X; MouseState state = Mouse.GetState(); Vector2 vector2 = new Vector2(x, (float)state.Y); if (this.modSel.Tabs[0].Selected) { if (this.Reset) { this.weaponSL.Entries.Clear(); List<string> WeaponCategories = new List<string>(); foreach (KeyValuePair<string, ShipModule> module in Ship_Game.ResourceManager.ShipModulesDict) { if (!EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).GetMDict()[module.Key] || module.Value.UID == "Dummy") { continue; } module.Value.ModuleType.ToString(); ShipModule tmp = Ship_Game.ResourceManager.GetModule(module.Key); tmp.SetAttributesNoParent(); bool restricted = tmp.FighterModule || tmp.CorvetteModule || tmp.FrigateModule || tmp.StationModule || tmp.DestroyerModule || tmp.CruiserModule || tmp.CarrierModule || tmp.CapitalModule || tmp.FreighterModule || tmp.PlatformModule || tmp.DroneModule; if (restricted) { if (this.ActiveHull.Role == "drone" && tmp.DroneModule == false) { continue; } if ((this.ActiveHull.Role == "fighter" || this.ActiveHull.Role == "scout" )&& tmp.FighterModule == false) { continue; } if (this.ActiveHull.Role == "corvette" && tmp.CorvetteModule == false) { continue; } if (this.ActiveHull.Role == "frigate" && tmp.FrigateModule == false) { continue; } if (this.ActiveHull.Role == "destroyer" && tmp.DestroyerModule == false) { continue; } if (this.ActiveHull.Role == "cruiser" && tmp.CruiserModule == false) { continue; } if (this.ActiveHull.Role == "carrier" && tmp.CarrierModule == false) { continue; } if (this.ActiveHull.Role == "capital" && tmp.CapitalModule == false) { continue; } if (this.ActiveHull.Role == "freighter" && tmp.FreighterModule == false) { continue; } if (this.ActiveHull.Role == "platform" && tmp.PlatformModule == false) { continue; } if (this.ActiveHull.Role == "station" && tmp.StationModule == false) { continue; } } // if not using new tags, ensure original <FightersOnly> still functions as in vanilla. else if (!restricted && tmp.FightersOnly && this.ActiveHull.Role != "fighter" && this.ActiveHull.Role != "scout" && this.ActiveHull.Role != "corvette") continue; if (tmp.isWeapon) { if (GlobalStats.ActiveModInfo != null && GlobalStats.ActiveModInfo.expandedWeaponCats) { if (tmp.InstalledWeapon.Tag_Flak && !WeaponCategories.Contains("Flak Cannon")) { WeaponCategories.Add("Flak Cannon"); ModuleHeader type = new ModuleHeader("Flak Cannon", 240f); this.weaponSL.AddItem(type); } if (tmp.InstalledWeapon.Tag_Railgun && !WeaponCategories.Contains("Magnetic Cannon")) { WeaponCategories.Add("Magnetic Cannon"); ModuleHeader type = new ModuleHeader("Magnetic Cannon", 240f); this.weaponSL.AddItem(type); } if (tmp.InstalledWeapon.Tag_Array && !WeaponCategories.Contains("Beam Array")) { WeaponCategories.Add("Beam Array"); ModuleHeader type = new ModuleHeader("Beam Array", 240f); this.weaponSL.AddItem(type); } if (tmp.InstalledWeapon.Tag_Tractor && !WeaponCategories.Contains("Tractor Beam")) { WeaponCategories.Add("Tractor Beam"); ModuleHeader type = new ModuleHeader("Tractor Beam", 240f); this.weaponSL.AddItem(type); } if (tmp.InstalledWeapon.Tag_Missile && !tmp.InstalledWeapon.Tag_Guided && !WeaponCategories.Contains("Unguided Rocket")) { WeaponCategories.Add("Unguided Rocket"); ModuleHeader type = new ModuleHeader("Unguided Rocket", 240f); this.weaponSL.AddItem(type); } else if (!WeaponCategories.Contains(tmp.InstalledWeapon.WeaponType)) { WeaponCategories.Add(tmp.InstalledWeapon.WeaponType); ModuleHeader type = new ModuleHeader(tmp.InstalledWeapon.WeaponType, 240f); this.weaponSL.AddItem(type); } } else { if (!WeaponCategories.Contains(tmp.InstalledWeapon.WeaponType)) { WeaponCategories.Add(tmp.InstalledWeapon.WeaponType); ModuleHeader type = new ModuleHeader(tmp.InstalledWeapon.WeaponType, 240f); this.weaponSL.AddItem(type); } } } else if (tmp.ModuleType == ShipModuleType.Bomb && !WeaponCategories.Contains("Bomb")) { WeaponCategories.Add("Bomb"); ModuleHeader type = new ModuleHeader("Bomb", 240f); this.weaponSL.AddItem(type); } tmp = null; } foreach (ScrollList.Entry e in this.weaponSL.Entries) { foreach (KeyValuePair<string, ShipModule> module in Ship_Game.ResourceManager.ShipModulesDict) { if (!EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).GetMDict()[module.Key] || module.Value.UID == "Dummy") { continue; } ShipModule tmp = Ship_Game.ResourceManager.GetModule(module.Key); tmp.SetAttributesNoParent(); bool restricted = tmp.FighterModule || tmp.CorvetteModule || tmp.FrigateModule || tmp.StationModule || tmp.DestroyerModule || tmp.CruiserModule || tmp.CarrierModule || tmp.CapitalModule || tmp.FreighterModule || tmp.PlatformModule || tmp.DroneModule; if (restricted) { if (this.ActiveHull.Role == "drone" && tmp.DroneModule == false) { continue; } if (this.ActiveHull.Role == "scout" && tmp.FighterModule == false) { continue; } if (this.ActiveHull.Role == "fighter" && tmp.FighterModule == false) { continue; } if (this.ActiveHull.Role == "corvette" && tmp.CorvetteModule == false) { continue; } if (this.ActiveHull.Role == "frigate" && tmp.FrigateModule == false) { continue; } if (this.ActiveHull.Role == "destroyer" && tmp.DestroyerModule == false) { continue; } if (this.ActiveHull.Role == "cruiser" && tmp.CruiserModule == false) { continue; } if (this.ActiveHull.Role == "carrier" && tmp.CarrierModule == false) { continue; } if (this.ActiveHull.Role == "capital" && tmp.CapitalModule == false) { continue; } if (this.ActiveHull.Role == "freighter" && tmp.FreighterModule == false) { continue; } if (this.ActiveHull.Role == "platform" && tmp.PlatformModule == false) { continue; } if (this.ActiveHull.Role == "station" && tmp.StationModule == false) { continue; } } // if not using new tags, ensure original <FightersOnly> still functions as in vanilla. else if (!restricted && tmp.FightersOnly && this.ActiveHull.Role != "fighter" && this.ActiveHull.Role != "scout" && this.ActiveHull.Role != "corvette") continue; if (tmp.isWeapon) { if (GlobalStats.ActiveModInfo != null && GlobalStats.ActiveModInfo.expandedWeaponCats) { if (tmp.InstalledWeapon.Tag_Flak || tmp.InstalledWeapon.Tag_Array || tmp.InstalledWeapon.Tag_Railgun || tmp.InstalledWeapon.Tag_Tractor || (tmp.InstalledWeapon.Tag_Missile && !tmp.InstalledWeapon.Tag_Guided)) { if ((e.item as ModuleHeader).Text == "Flak Cannon" && tmp.InstalledWeapon.Tag_Flak) e.AddItem(module.Value); if ((e.item as ModuleHeader).Text == "Magnetic Cannon" && tmp.InstalledWeapon.Tag_Railgun) e.AddItem(module.Value); if ((e.item as ModuleHeader).Text == "Beam Array" && tmp.InstalledWeapon.Tag_Array) e.AddItem(module.Value); if ((e.item as ModuleHeader).Text == "Tractor Beam" && tmp.InstalledWeapon.Tag_Tractor) e.AddItem(module.Value); if ((e.item as ModuleHeader).Text == "Unguided Rocket" && tmp.InstalledWeapon.Tag_Missile && !tmp.InstalledWeapon.Tag_Guided) e.AddItem(module.Value); } else if ((e.item as ModuleHeader).Text == tmp.InstalledWeapon.WeaponType) { e.AddItem(module.Value); } } else { if ((e.item as ModuleHeader).Text == tmp.InstalledWeapon.WeaponType) { e.AddItem(module.Value); } } } else if (tmp.ModuleType == ShipModuleType.Bomb && (e.item as ModuleHeader).Text == "Bomb") { e.AddItem(module.Value); } tmp = null; } } this.Reset = false; } this.DrawList(); } if (this.modSel.Tabs[2].Selected) { if (this.Reset) { this.weaponSL.Entries.Clear(); List<string> ModuleCategories = new List<string>(); foreach (KeyValuePair<string, ShipModule> module in Ship_Game.ResourceManager.ShipModulesDict) { if (!EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).GetMDict()[module.Key] || module.Value.UID == "Dummy") { continue; } module.Value.ModuleType.ToString(); ShipModule tmp = Ship_Game.ResourceManager.GetModule(module.Key); tmp.SetAttributesNoParent(); bool restricted = tmp.FighterModule || tmp.CorvetteModule || tmp.FrigateModule || tmp.StationModule || tmp.DestroyerModule || tmp.CruiserModule || tmp.CarrierModule || tmp.CapitalModule || tmp.FreighterModule || tmp.PlatformModule || tmp.DroneModule; if (restricted) { if (this.ActiveHull.Role == "drone" && tmp.DroneModule == false) { continue; } if (this.ActiveHull.Role == "scout" && tmp.FighterModule == false) { continue; } if (this.ActiveHull.Role == "fighter" && tmp.FighterModule == false) { continue; } if (this.ActiveHull.Role == "corvette" && tmp.CorvetteModule == false) { continue; } if (this.ActiveHull.Role == "frigate" && tmp.FrigateModule == false) { continue; } if (this.ActiveHull.Role == "destroyer" && tmp.DestroyerModule == false) { continue; } if (this.ActiveHull.Role == "cruiser" && tmp.CruiserModule == false) { continue; } if (this.ActiveHull.Role == "carrier" && tmp.CarrierModule == false) { continue; } if (this.ActiveHull.Role == "capital" && tmp.CapitalModule == false) { continue; } if (this.ActiveHull.Role == "freighter" && tmp.FreighterModule == false) { continue; } if (this.ActiveHull.Role == "platform" && tmp.PlatformModule == false) { continue; } if (this.ActiveHull.Role == "station" && tmp.StationModule == false) { continue; } } // if not using new tags, ensure original <FightersOnly> still functions as in vanilla. else if (!restricted && tmp.FightersOnly && this.ActiveHull.Role != "fighter" && this.ActiveHull.Role != "scout" && this.ActiveHull.Role != "corvette") continue; if ((tmp.ModuleType == ShipModuleType.Armor || tmp.ModuleType == ShipModuleType.Shield || tmp.ModuleType == ShipModuleType.Countermeasure) && !tmp.isBulkhead && !tmp.isPowerArmour && !ModuleCategories.Contains(tmp.ModuleType.ToString())) { ModuleCategories.Add(tmp.ModuleType.ToString()); ModuleHeader type = new ModuleHeader(tmp.ModuleType.ToString(), 240f); this.weaponSL.AddItem(type); } // These need special booleans as they are ModuleType ARMOR - and the armor ModuleType is needed for vsArmor damage calculations - don't want to use new moduletype therefore. if (tmp.isPowerArmour && tmp.ModuleType == ShipModuleType.Armor && !ModuleCategories.Contains(Localizer.Token(6172))) { ModuleCategories.Add(Localizer.Token(6172)); ModuleHeader type = new ModuleHeader(Localizer.Token(6172), 240f); this.weaponSL.AddItem(type); } if (tmp.isBulkhead && tmp.ModuleType == ShipModuleType.Armor && !ModuleCategories.Contains(Localizer.Token(6173))) { ModuleCategories.Add(Localizer.Token(6173)); ModuleHeader type = new ModuleHeader(Localizer.Token(6173), 240f); this.weaponSL.AddItem(type); } tmp = null; } foreach (ScrollList.Entry e in this.weaponSL.Entries) { foreach (KeyValuePair<string, ShipModule> module in Ship_Game.ResourceManager.ShipModulesDict) { if (!EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).GetMDict()[module.Key] || module.Value.UID == "Dummy") { continue; } ShipModule tmp = Ship_Game.ResourceManager.GetModule(module.Key); tmp.SetAttributesNoParent(); bool restricted = tmp.FighterModule || tmp.CorvetteModule || tmp.FrigateModule || tmp.StationModule || tmp.DestroyerModule || tmp.CruiserModule || tmp.CarrierModule || tmp.CapitalModule || tmp.FreighterModule || tmp.PlatformModule || tmp.DroneModule; if (restricted) { if (this.ActiveHull.Role == "drone" && tmp.DroneModule == false) { continue; } if (this.ActiveHull.Role == "scout" && tmp.FighterModule == false) { continue; } if (this.ActiveHull.Role == "fighter" && tmp.FighterModule == false) { continue; } if (this.ActiveHull.Role == "corvette" && tmp.CorvetteModule == false) { continue; } if (this.ActiveHull.Role == "frigate" && tmp.FrigateModule == false) { continue; } if (this.ActiveHull.Role == "destroyer" && tmp.DestroyerModule == false) { continue; } if (this.ActiveHull.Role == "cruiser" && tmp.CruiserModule == false) { continue; } if (this.ActiveHull.Role == "carrier" && tmp.CarrierModule == false) { continue; } if (this.ActiveHull.Role == "capital" && tmp.CapitalModule == false) { continue; } if (this.ActiveHull.Role == "freighter" && tmp.FreighterModule == false) { continue; } if (this.ActiveHull.Role == "platform" && tmp.PlatformModule == false) { continue; } if (this.ActiveHull.Role == "station" && tmp.StationModule == false) { continue; } } if ((tmp.ModuleType == ShipModuleType.Armor || tmp.ModuleType == ShipModuleType.Shield || tmp.ModuleType == ShipModuleType.Countermeasure) && !tmp.isBulkhead && !tmp.isPowerArmour && (e.item as ModuleHeader).Text == tmp.ModuleType.ToString()) { e.AddItem(module.Value); } if (tmp.isPowerArmour && (e.item as ModuleHeader).Text == Localizer.Token(6172)) { e.AddItem(module.Value); } if (tmp.isBulkhead && (e.item as ModuleHeader).Text == Localizer.Token(6173)) { e.AddItem(module.Value); } tmp = null; } } this.Reset = false; } this.DrawList(); } if (this.modSel.Tabs[1].Selected) { if (this.Reset) { this.weaponSL.Entries.Clear(); List<string> ModuleCategories = new List<string>(); foreach (KeyValuePair<string, ShipModule> module in Ship_Game.ResourceManager.ShipModulesDict) { if (!EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).GetMDict()[module.Key] || module.Value.UID == "Dummy") { continue; } module.Value.ModuleType.ToString(); ShipModule tmp = Ship_Game.ResourceManager.GetModule(module.Key); tmp.SetAttributesNoParent(); bool restricted = tmp.FighterModule || tmp.CorvetteModule || tmp.FrigateModule || tmp.StationModule || tmp.DestroyerModule || tmp.CruiserModule || tmp.CarrierModule || tmp.CapitalModule || tmp.FreighterModule || tmp.PlatformModule || tmp.DroneModule; if (restricted) { if (this.ActiveHull.Role == "drone" && tmp.DroneModule == false) { continue; } if (this.ActiveHull.Role == "scout" && tmp.FighterModule == false) { continue; } if (this.ActiveHull.Role == "fighter" && tmp.FighterModule == false) { continue; } if (this.ActiveHull.Role == "corvette" && tmp.CorvetteModule == false) { continue; } if (this.ActiveHull.Role == "frigate" && tmp.FrigateModule == false) { continue; } if (this.ActiveHull.Role == "destroyer" && tmp.DestroyerModule == false) { continue; } if (this.ActiveHull.Role == "cruiser" && tmp.CruiserModule == false) { continue; } if (this.ActiveHull.Role == "carrier" && tmp.CarrierModule == false) { continue; } if (this.ActiveHull.Role == "capital" && tmp.CapitalModule == false) { continue; } if (this.ActiveHull.Role == "freighter" && tmp.FreighterModule == false) { continue; } if (this.ActiveHull.Role == "platform" && tmp.PlatformModule == false) { continue; } if (this.ActiveHull.Role == "station" && tmp.StationModule == false) { continue; } } if ((tmp.ModuleType == ShipModuleType.Engine || tmp.ModuleType == ShipModuleType.FuelCell || tmp.ModuleType == ShipModuleType.PowerPlant || tmp.ModuleType == ShipModuleType.PowerConduit) && !ModuleCategories.Contains(tmp.ModuleType.ToString())) { ModuleCategories.Add(tmp.ModuleType.ToString()); ModuleHeader type = new ModuleHeader(tmp.ModuleType.ToString(), 240f); this.weaponSL.AddItem(type); } tmp = null; } foreach (ScrollList.Entry e in this.weaponSL.Entries) { foreach (KeyValuePair<string, ShipModule> module in Ship_Game.ResourceManager.ShipModulesDict) { if (!EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).GetMDict()[module.Key] || module.Value.UID == "Dummy") { continue; } ShipModule tmp = Ship_Game.ResourceManager.GetModule(module.Key); tmp.SetAttributesNoParent(); bool restricted = tmp.FighterModule || tmp.CorvetteModule || tmp.FrigateModule || tmp.StationModule || tmp.DestroyerModule || tmp.CruiserModule || tmp.CarrierModule || tmp.CapitalModule || tmp.FreighterModule || tmp.PlatformModule || tmp.DroneModule; if (restricted) { if (this.ActiveHull.Role == "drone" && tmp.DroneModule == false) { continue; } if (this.ActiveHull.Role == "scout" && tmp.FighterModule == false) { continue; } if (this.ActiveHull.Role == "fighter" && tmp.FighterModule == false) { continue; } if (this.ActiveHull.Role == "corvette" && tmp.CorvetteModule == false) { continue; } if (this.ActiveHull.Role == "frigate" && tmp.FrigateModule == false) { continue; } if (this.ActiveHull.Role == "destroyer" && tmp.DestroyerModule == false) { continue; } if (this.ActiveHull.Role == "cruiser" && tmp.CruiserModule == false) { continue; } if (this.ActiveHull.Role == "carrier" && tmp.CarrierModule == false) { continue; } if (this.ActiveHull.Role == "capital" && tmp.CapitalModule == false) { continue; } if (this.ActiveHull.Role == "freighter" && tmp.FreighterModule == false) { continue; } if (this.ActiveHull.Role == "platform" && tmp.PlatformModule == false) { continue; } if (this.ActiveHull.Role == "station" && tmp.StationModule == false) { continue; } } if ((tmp.ModuleType == ShipModuleType.Engine || tmp.ModuleType == ShipModuleType.FuelCell || tmp.ModuleType == ShipModuleType.PowerPlant || tmp.ModuleType == ShipModuleType.PowerConduit) && (e.item as ModuleHeader).Text == tmp.ModuleType.ToString()) { e.AddItem(module.Value); } tmp = null; } } this.Reset = false; } this.DrawList(); } if (this.modSel.Tabs[3].Selected) { if (this.Reset) { this.weaponSL.Entries.Clear(); List<string> ModuleCategories = new List<string>(); foreach (KeyValuePair<string, ShipModule> module in Ship_Game.ResourceManager.ShipModulesDict) { if (!EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).GetMDict()[module.Key] || module.Value.UID == "Dummy") { continue; } module.Value.ModuleType.ToString(); ShipModule tmp = Ship_Game.ResourceManager.GetModule(module.Key); tmp.SetAttributesNoParent(); bool restricted = tmp.FighterModule || tmp.CorvetteModule || tmp.FrigateModule || tmp.StationModule || tmp.DestroyerModule || tmp.CruiserModule || tmp.CarrierModule || tmp.CapitalModule || tmp.FreighterModule || tmp.PlatformModule || tmp.DroneModule; if (restricted) { if (this.ActiveHull.Role == "drone" && tmp.DroneModule == false) { continue; } if (this.ActiveHull.Role == "scout" && tmp.FighterModule == false) { continue; } if (this.ActiveHull.Role == "fighter" && tmp.FighterModule == false) { continue; } if (this.ActiveHull.Role == "corvette" && tmp.CorvetteModule == false) { continue; } if (this.ActiveHull.Role == "frigate" && tmp.FrigateModule == false) { continue; } if (this.ActiveHull.Role == "destroyer" && tmp.DestroyerModule == false) { continue; } if (this.ActiveHull.Role == "cruiser" && tmp.CruiserModule == false) { continue; } if (this.ActiveHull.Role == "carrier" && tmp.CarrierModule == false) { continue; } if (this.ActiveHull.Role == "capital" && tmp.CapitalModule == false) { continue; } if (this.ActiveHull.Role == "freighter" && tmp.FreighterModule == false) { continue; } if (this.ActiveHull.Role == "platform" && tmp.PlatformModule == false) { continue; } if (this.ActiveHull.Role == "station" && tmp.StationModule == false) { continue; } } if ((tmp.ModuleType == ShipModuleType.Troop || tmp.ModuleType == ShipModuleType.Colony || tmp.ModuleType == ShipModuleType.Command || tmp.ModuleType == ShipModuleType.Storage || tmp.ModuleType == ShipModuleType.Hangar || tmp.ModuleType == ShipModuleType.Sensors || tmp.ModuleType == ShipModuleType.Special || tmp.ModuleType == ShipModuleType.Transporter || tmp.ModuleType == ShipModuleType.Ordnance || tmp.ModuleType == ShipModuleType.Construction) && !ModuleCategories.Contains(tmp.ModuleType.ToString())) { ModuleCategories.Add(tmp.ModuleType.ToString()); ModuleHeader type = new ModuleHeader(tmp.ModuleType.ToString(), 240f); this.weaponSL.AddItem(type); } tmp = null; } foreach (ScrollList.Entry e in this.weaponSL.Entries) { foreach (KeyValuePair<string, ShipModule> module in Ship_Game.ResourceManager.ShipModulesDict) { if (!EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).GetMDict()[module.Key] || module.Value.UID == "Dummy") { continue; } ShipModule tmp = Ship_Game.ResourceManager.GetModule(module.Key); tmp.SetAttributesNoParent(); bool restricted = tmp.FighterModule || tmp.CorvetteModule || tmp.FrigateModule || tmp.StationModule || tmp.DestroyerModule || tmp.CruiserModule || tmp.CarrierModule || tmp.CapitalModule || tmp.FreighterModule || tmp.PlatformModule || tmp.DroneModule; if (restricted) { if (this.ActiveHull.Role == "drone" && tmp.DroneModule == false) { continue; } if (this.ActiveHull.Role == "scout" && tmp.FighterModule == false) { continue; } if (this.ActiveHull.Role == "fighter" && tmp.FighterModule == false) { continue; } if (this.ActiveHull.Role == "corvette" && tmp.CorvetteModule == false) { continue; } if (this.ActiveHull.Role == "frigate" && tmp.FrigateModule == false) { continue; } if (this.ActiveHull.Role == "destroyer" && tmp.DestroyerModule == false) { continue; } if (this.ActiveHull.Role == "cruiser" && tmp.CruiserModule == false) { continue; } if (this.ActiveHull.Role == "carrier" && tmp.CarrierModule == false) { continue; } if (this.ActiveHull.Role == "capital" && tmp.CapitalModule == false) { continue; } if (this.ActiveHull.Role == "freighter" && tmp.FreighterModule == false) { continue; } if (this.ActiveHull.Role == "platform" && tmp.PlatformModule == false) { continue; } if (this.ActiveHull.Role == "station" && tmp.StationModule == false) { continue; } } if ((tmp.ModuleType == ShipModuleType.Troop || tmp.ModuleType == ShipModuleType.Colony || tmp.ModuleType == ShipModuleType.Command || tmp.ModuleType == ShipModuleType.Storage || tmp.ModuleType == ShipModuleType.Hangar || tmp.ModuleType == ShipModuleType.Sensors || tmp.ModuleType == ShipModuleType.Special || tmp.ModuleType == ShipModuleType.Transporter || tmp.ModuleType == ShipModuleType.Ordnance || tmp.ModuleType == ShipModuleType.Construction) && (e.item as ModuleHeader).Text == tmp.ModuleType.ToString()) { e.AddItem(module.Value); } tmp = null; } } this.Reset = false; } this.DrawList(); } }
private void DrawHullSelection() { Rectangle r = this.hullSelectionSub.Menu; r.Y = r.Y + 25; r.Height = r.Height - 25; Selector sel = new Selector(base.ScreenManager, r, new Color(0, 0, 0, 210)); sel.Draw(); this.hullSL.Draw(base.ScreenManager.SpriteBatch); float x = (float)Mouse.GetState().X; MouseState state = Mouse.GetState(); Vector2 MousePos = new Vector2(x, (float)state.Y); this.hullSelectionSub.Draw(); Vector2 bCursor = new Vector2((float)(this.hullSelectionSub.Menu.X + 10), (float)(this.hullSelectionSub.Menu.Y + 45)); for (int i = this.hullSL.indexAtTop; i < this.hullSL.Copied.Count && i < this.hullSL.indexAtTop + this.hullSL.entriesToDisplay; i++) { bCursor = new Vector2((float)(this.hullSelectionSub.Menu.X + 10), (float)(this.hullSelectionSub.Menu.Y + 45)); ScrollList.Entry e = this.hullSL.Copied[i]; bCursor.Y = (float)e.clickRect.Y; if (e.item is ModuleHeader) { (e.item as ModuleHeader).Draw(base.ScreenManager, bCursor); } else if (e.item is ShipData) { bCursor.X = bCursor.X + 10f; base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict[(e.item as ShipData).IconPath], new Rectangle((int)bCursor.X, (int)bCursor.Y, 29, 30), Color.White); Vector2 tCursor = new Vector2(bCursor.X + 40f, bCursor.Y + 3f); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, (e.item as ShipData).Name, tCursor, Color.White); tCursor.Y = tCursor.Y + (float)Fonts.Arial12Bold.LineSpacing; base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, Localizer.GetRole((e.item as ShipData).Role, EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty)), tCursor, Color.Orange); if (HelperFunctions.CheckIntersection(e.clickRect, MousePos)) { if (e.clickRectHover == 0) { AudioManager.PlayCue("sd_ui_mouseover"); } e.clickRectHover = 1; } } } }
private void DrawActiveModuleData() { float powerDraw; this.activeModSubMenu.Draw(); Rectangle r = this.activeModSubMenu.Menu; r.Y = r.Y + 25; r.Height = r.Height - 25; Selector sel = new Selector(base.ScreenManager, r, new Color(0, 0, 0, 210)); sel.Draw(); ShipModule mod = this.ActiveModule; if (this.ActiveModule == null && this.HighlightedModule != null) { mod = this.HighlightedModule; } else if (this.ActiveModule != null) { mod = this.ActiveModule; } if (mod != null) { mod.HealthMax = Ship_Game.ResourceManager.ShipModulesDict[mod.UID].HealthMax; } if (this.activeModSubMenu.Tabs[0].Selected && mod != null) { //Added by McShooterz: Changed how modules names are displayed for allowing longer names Vector2 modTitlePos = new Vector2((float)(this.activeModSubMenu.Menu.X + 10), (float)(this.activeModSubMenu.Menu.Y + 35)); if (Fonts.Arial20Bold.MeasureString(Localizer.Token(Ship_Game.ResourceManager.ShipModulesDict[mod.UID].NameIndex)).X + 16 < this.activeModSubMenu.Menu.Width) { base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial20Bold, Localizer.Token(Ship_Game.ResourceManager.ShipModulesDict[mod.UID].NameIndex), modTitlePos, Color.White); modTitlePos.Y = modTitlePos.Y + (float)(Fonts.Arial20Bold.LineSpacing + 6); } else { base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial14Bold, Localizer.Token(Ship_Game.ResourceManager.ShipModulesDict[mod.UID].NameIndex), modTitlePos, Color.White); modTitlePos.Y = modTitlePos.Y + (float)(Fonts.Arial14Bold.LineSpacing + 4); } string rest = ""; if (Ship_Game.ResourceManager.ShipModulesDict[mod.UID].Restrictions == Restrictions.IO) { rest = "I or O or IO"; } else if (Ship_Game.ResourceManager.ShipModulesDict[mod.UID].Restrictions == Restrictions.I) { rest = "I or IO only"; } else if (Ship_Game.ResourceManager.ShipModulesDict[mod.UID].Restrictions == Restrictions.O) { rest = "O or IO only"; } else if (Ship_Game.ResourceManager.ShipModulesDict[mod.UID].Restrictions == Restrictions.E) { rest = "E only"; } else if (Ship_Game.ResourceManager.ShipModulesDict[mod.UID].Restrictions == Restrictions.IOE) { rest = "I, O, or E"; } else if (Ship_Game.ResourceManager.ShipModulesDict[mod.UID].Restrictions == Restrictions.IE) { rest = "I or E only"; } else if (Ship_Game.ResourceManager.ShipModulesDict[mod.UID].Restrictions == Restrictions.OE) { rest = "O or E only"; } // Concat ship class restrictions string shipRest = ""; bool specialString = false; if (GlobalStats.ActiveModInfo != null && GlobalStats.ActiveModInfo.useDrones && GlobalStats.ActiveModInfo.useDestroyers) { if (!mod.FightersOnly && mod.DroneModule && mod.FighterModule && mod.CorvetteModule && mod.FrigateModule && mod.DestroyerModule && mod.CruiserModule && mod.CruiserModule && mod.CarrierModule && mod.CapitalModule && mod.PlatformModule && mod.StationModule && mod.FreighterModule) { shipRest = "All Hulls"; specialString = true; } else if (!mod.FightersOnly && !mod.DroneModule && mod.FighterModule && mod.CorvetteModule && mod.FrigateModule && mod.DestroyerModule && mod.CruiserModule && mod.CruiserModule && mod.CarrierModule && mod.CapitalModule && mod.PlatformModule && mod.StationModule && mod.FreighterModule) { shipRest = "All Crewed"; specialString = true; } else if (mod.FighterModule && !mod.DroneModule && !mod.CorvetteModule && !mod.FrigateModule && !mod.DestroyerModule && !mod.CruiserModule && !mod.CruiserModule && !mod.CarrierModule && !mod.CapitalModule && !mod.PlatformModule && !mod.StationModule && !mod.FreighterModule) { shipRest = "Fighters Only"; specialString = true; } else if (mod.DroneModule && !mod.FighterModule && !mod.CorvetteModule && !mod.FrigateModule && !mod.DestroyerModule && !mod.CruiserModule && !mod.CruiserModule && !mod.CarrierModule && !mod.CapitalModule && !mod.PlatformModule && !mod.StationModule && !mod.FreighterModule) { shipRest = "Drones Only"; specialString = true; } else if (mod.FightersOnly && !specialString) { shipRest = "Fighters/Corvettes Only"; specialString = true; } else if (!mod.FightersOnly && !mod.DroneModule && !mod.FighterModule && !mod.CorvetteModule && !mod.FrigateModule && !mod.DestroyerModule && !mod.CruiserModule && !mod.CruiserModule && !mod.CarrierModule && !mod.CapitalModule && !mod.PlatformModule && !mod.StationModule && !mod.FreighterModule) { shipRest = "All Hulls"; specialString = true; } } if (GlobalStats.ActiveModInfo != null && !GlobalStats.ActiveModInfo.useDrones && GlobalStats.ActiveModInfo.useDestroyers) { if (!mod.FightersOnly && mod.FighterModule && mod.CorvetteModule && mod.FrigateModule && mod.DestroyerModule && mod.CruiserModule && mod.CruiserModule && mod.CarrierModule && mod.CapitalModule && mod.PlatformModule && mod.StationModule && mod.FreighterModule) { shipRest = "All Hulls"; specialString = true; } else if (mod.FighterModule && !mod.CorvetteModule && !mod.FrigateModule && !mod.DestroyerModule && !mod.CruiserModule && !mod.CruiserModule && !mod.CarrierModule && !mod.CapitalModule && !mod.PlatformModule && !mod.StationModule && !mod.FreighterModule) { shipRest = "Fighters Only"; specialString = true; } else if (mod.FightersOnly && !specialString) { shipRest = "Fighters/Corvettes Only"; specialString = true; } else if (!mod.FightersOnly && !mod.FighterModule && !mod.CorvetteModule && !mod.FrigateModule && !mod.DestroyerModule && !mod.CruiserModule && !mod.CruiserModule && !mod.CarrierModule && !mod.CapitalModule && !mod.PlatformModule && !mod.StationModule && !mod.FreighterModule) { shipRest = "All Hulls"; specialString = true; } } if (GlobalStats.ActiveModInfo != null && GlobalStats.ActiveModInfo.useDrones && !GlobalStats.ActiveModInfo.useDestroyers) { if (!mod.FightersOnly && mod.DroneModule && mod.FighterModule && mod.CorvetteModule && mod.FrigateModule && mod.CruiserModule && mod.CruiserModule && mod.CarrierModule && mod.CapitalModule && mod.PlatformModule && mod.StationModule && mod.FreighterModule) { shipRest = "All Hulls"; specialString = true; } else if (!mod.FightersOnly && !mod.DroneModule && mod.FighterModule && mod.CorvetteModule && mod.FrigateModule && mod.CruiserModule && mod.CruiserModule && mod.CarrierModule && mod.CapitalModule && mod.PlatformModule && mod.StationModule && mod.FreighterModule) { shipRest = "All Crewed"; specialString = true; } else if (mod.FighterModule && !mod.DroneModule && !mod.CorvetteModule && !mod.FrigateModule && !mod.CruiserModule && !mod.CruiserModule && !mod.CarrierModule && !mod.CapitalModule && !mod.PlatformModule && !mod.StationModule && !mod.FreighterModule) { shipRest = "Fighters Only"; specialString = true; } else if (mod.DroneModule && !mod.FighterModule && !mod.CorvetteModule && !mod.FrigateModule && !mod.CruiserModule && !mod.CruiserModule && !mod.CarrierModule && !mod.CapitalModule && !mod.PlatformModule && !mod.StationModule && !mod.FreighterModule) { shipRest = "Drones Only"; specialString = true; } else if (mod.FightersOnly && !specialString) { shipRest = "Fighters/Corvettes Only"; specialString = true; } else if (!mod.FightersOnly && !mod.DroneModule && !mod.FighterModule && !mod.CorvetteModule && !mod.FrigateModule && !mod.CruiserModule && !mod.CruiserModule && !mod.CarrierModule && !mod.CapitalModule && !mod.PlatformModule && !mod.StationModule && !mod.FreighterModule) { shipRest = "All Hulls"; specialString = true; } } if (GlobalStats.ActiveModInfo == null || (!GlobalStats.ActiveModInfo.useDrones && !GlobalStats.ActiveModInfo.useDestroyers)) { if (!mod.FightersOnly && mod.FighterModule && mod.CorvetteModule && mod.FrigateModule && mod.CruiserModule && mod.CruiserModule && mod.CarrierModule && mod.CapitalModule && mod.PlatformModule && mod.StationModule && mod.FreighterModule) { shipRest = "All Hulls"; specialString = true; } else if (mod.FighterModule && !mod.CorvetteModule && !mod.FrigateModule && !mod.CruiserModule && !mod.CruiserModule && !mod.CarrierModule && !mod.CapitalModule && !mod.PlatformModule && !mod.StationModule && !mod.FreighterModule) { shipRest = "Fighters Only"; specialString = true; } else if (mod.FightersOnly && !specialString) { shipRest = "Fighters/Corvettes Only"; specialString = true; } else if (!mod.FightersOnly && !mod.FighterModule && !mod.CorvetteModule && !mod.FrigateModule && !mod.CruiserModule && !mod.CruiserModule && !mod.CarrierModule && !mod.CapitalModule && !mod.PlatformModule && !mod.StationModule && !mod.FreighterModule) { shipRest = "All Hulls"; specialString = true; } } else if (!specialString && (!mod.DroneModule && GlobalStats.ActiveModInfo != null && GlobalStats.ActiveModInfo.useDrones) || !mod.FighterModule || !mod.CorvetteModule || !mod.FrigateModule || (!mod.DestroyerModule && GlobalStats.ActiveModInfo != null && GlobalStats.ActiveModInfo.useDestroyers) || !mod.CruiserModule || !mod.CruiserModule || !mod.CarrierModule || !mod.CapitalModule || !mod.PlatformModule || !mod.StationModule || !mod.FreighterModule) { if (mod.DroneModule && GlobalStats.ActiveModInfo != null && GlobalStats.ActiveModInfo.useDrones) shipRest += "Dr "; if (mod.FighterModule) shipRest += "F "; if (mod.CorvetteModule) shipRest += "CO "; if (mod.FrigateModule) shipRest += "FF "; if (mod.DestroyerModule && GlobalStats.ActiveModInfo != null && GlobalStats.ActiveModInfo.useDestroyers) shipRest += "DD "; if (mod.CruiserModule) shipRest += "CC "; if (mod.CarrierModule) shipRest += "CV "; if (mod.CapitalModule) shipRest += "CA "; if (mod.FreighterModule) shipRest += "Frt "; if (mod.PlatformModule || mod.StationModule) shipRest += "Stat "; } base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, string.Concat(Localizer.Token(122), ": ", rest), modTitlePos, Color.Orange); modTitlePos.Y = modTitlePos.Y + (float)(Fonts.Arial8Bold.LineSpacing); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, string.Concat("Hulls: ", shipRest), modTitlePos, Color.LightSteelBlue); modTitlePos.Y = modTitlePos.Y + (float)(Fonts.Arial8Bold.LineSpacing + 11); int startx = (int)modTitlePos.X; string tag = ""; if (Ship_Game.ResourceManager.ShipModulesDict[mod.UID].IsWeapon && Ship_Game.ResourceManager.ShipModulesDict[mod.UID].BombType == null) { if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Guided) { tag = string.Concat(tag, "GUIDED "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Intercept) { tag = string.Concat(tag, "INTERCEPTABLE "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Energy) { tag = string.Concat(tag, "ENERGY "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Hybrid) { tag = string.Concat(tag, "HYBRID "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Kinetic) { tag = string.Concat(tag, "KINETIC "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Explosive && !Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Flak) { tag = string.Concat(tag, "EXPLOSIVE "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Subspace) { tag = string.Concat(tag, "SUBSPACE "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Warp) { tag = string.Concat(tag, "WARP "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_PD) { tag = string.Concat(tag, "POINT DEFENSE "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Flak) { tag = string.Concat(tag, "FLAK "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (GlobalStats.ActiveModInfo != null && GlobalStats.ActiveModInfo.expandedWeaponCats && (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Missile & !Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Guided)) { tag = string.Concat(tag, "ROCKET "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } else if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Missile) { tag = string.Concat(tag, "MISSILE "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Tractor) { tag = string.Concat(tag, "TRACTOR "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Beam) { tag = string.Concat(tag, "BEAM "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Array) { tag = string.Concat(tag, "ARRAY "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Railgun) { tag = string.Concat(tag, "RAILGUN "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Torpedo) { tag = string.Concat(tag, "TORPEDO "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Bomb) { tag = string.Concat(tag, "BOMB "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_BioWeapon) { tag = string.Concat(tag, "BIOWEAPON "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_SpaceBomb) { tag = string.Concat(tag, "SPACEBOMB "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Drone) { tag = string.Concat(tag, "DRONE "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } if (Ship_Game.ResourceManager.WeaponsDict[Ship_Game.ResourceManager.ShipModulesDict[mod.UID].WeaponType].Tag_Cannon) { tag = string.Concat(tag, "CANNON "); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, tag, modTitlePos, Color.SpringGreen); modTitlePos.X = modTitlePos.X + Fonts.Arial8Bold.MeasureString(tag).X; tag = ""; } modTitlePos.Y = modTitlePos.Y + (float)(Fonts.Arial8Bold.LineSpacing + 5); modTitlePos.X = (float)startx; } else if (Ship_Game.ResourceManager.ShipModulesDict[mod.UID].IsWeapon) { string bombType = Ship_Game.ResourceManager.ShipModulesDict[mod.UID].BombType; } string txt = this.parseText(Localizer.Token(Ship_Game.ResourceManager.ShipModulesDict[mod.UID].DescriptionIndex), (float)(this.activeModSubMenu.Menu.Width - 20), Fonts.Arial12); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12, txt, modTitlePos, Color.White); modTitlePos.Y = modTitlePos.Y + (Fonts.Arial12Bold.MeasureString(txt).Y + 8f); float starty = modTitlePos.Y; if (!mod.isWeapon || mod.InstalledWeapon == null) { if (mod.Cost != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(128), (float)mod.Cost * UniverseScreen.GamePaceStatic, 84); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.Mass != 0) { float MassMod = (float)EmpireManager.GetEmpireByName(ShipDesignScreen.screen.PlayerLoyalty).data.MassModifier; float ArmourMassMod = (float)EmpireManager.GetEmpireByName(ShipDesignScreen.screen.PlayerLoyalty).data.ArmourMassModifier; if (mod.ModuleType == ShipModuleType.Armor) { this.DrawStat(ref modTitlePos, Localizer.Token(123), (ArmourMassMod * mod.Mass) * MassMod, 79); } else { this.DrawStat(ref modTitlePos, Localizer.Token(123), MassMod * mod.Mass, 79); } modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.HealthMax != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(124), (float)mod.HealthMax + mod.HealthMax * (float)EmpireManager.GetEmpireByName(ShipDesignScreen.screen.PlayerLoyalty).data.Traits.ModHpModifier, 80); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.ModuleType != ShipModuleType.PowerPlant) { powerDraw = -(float)mod.PowerDraw; } else { powerDraw = (mod.PowerDraw > 0f ? (float)(-mod.PowerDraw) : mod.PowerFlowMax + mod.PowerFlowMax * EmpireManager.GetEmpireByName(ShipDesignScreen.screen.PlayerLoyalty).data.PowerFlowMod); } if (powerDraw != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(125), powerDraw, 81); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.MechanicalBoardingDefense != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(2231), (float)mod.MechanicalBoardingDefense, 143); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.BonusRepairRate != 0f) { this.DrawStat(ref modTitlePos, string.Concat(Localizer.Token(135), "+"), (float)((mod.BonusRepairRate + mod.BonusRepairRate * EmpireManager.GetEmpireByName(ShipDesignScreen.screen.PlayerLoyalty).data.Traits.RepairMod) * (GlobalStats.ActiveModInfo != null && GlobalStats.ActiveModInfo.useHullBonuses && ResourceManager.HullBonuses.ContainsKey(this.ActiveHull.Hull) ? 1f + Ship_Game.ResourceManager.HullBonuses[this.ActiveHull.Hull].RepairBonus : 1)), 97); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } //Shift to next Column float MaxDepth = modTitlePos.Y; modTitlePos.X = modTitlePos.X + 152f; modTitlePos.Y = starty; if (mod.thrust != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(131), (float)mod.thrust, 91); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.WarpThrust != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(2064), (float)mod.WarpThrust, 92); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.TurnThrust != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(2260), (float)mod.TurnThrust, 148); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.shield_power_max != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(132), mod.shield_power_max * (GlobalStats.ActiveModInfo != null && GlobalStats.ActiveModInfo.useHullBonuses && ResourceManager.HullBonuses.ContainsKey(this.ActiveHull.Hull) ? 1f + Ship_Game.ResourceManager.HullBonuses[this.ActiveHull.Hull].ShieldBonus : 1f) + EmpireManager.GetEmpireByName(ShipDesignScreen.screen.PlayerLoyalty).data.ShieldPowerMod * mod.shield_power_max, 93); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.shield_radius != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(133), (float)mod.shield_radius, 94); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.shield_recharge_rate != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(134), (float)mod.shield_recharge_rate, 95); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } // Doc: new shield resistances, UI info. if (mod.shield_kinetic_resist != 0) { this.DrawStatPCShield(ref modTitlePos, Localizer.Token(6162), (float)mod.shield_kinetic_resist, 209); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.shield_energy_resist != 0) { this.DrawStatPCShield(ref modTitlePos, Localizer.Token(6163), (float)mod.shield_energy_resist, 210); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.shield_explosive_resist != 0) { this.DrawStatPCShield(ref modTitlePos, Localizer.Token(6164), (float)mod.shield_explosive_resist, 211); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.shield_missile_resist != 0) { this.DrawStatPCShield(ref modTitlePos, Localizer.Token(6165), (float)mod.shield_missile_resist, 212); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.shield_flak_resist != 0) { this.DrawStatPCShield(ref modTitlePos, Localizer.Token(6166), (float)mod.shield_flak_resist, 213); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.shield_hybrid_resist != 0) { this.DrawStatPCShield(ref modTitlePos, Localizer.Token(6167), (float)mod.shield_hybrid_resist, 214); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.shield_railgun_resist != 0) { this.DrawStatPCShield(ref modTitlePos, Localizer.Token(6168), (float)mod.shield_railgun_resist, 215); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.shield_subspace_resist != 0) { this.DrawStatPCShield(ref modTitlePos, Localizer.Token(6169), (float)mod.shield_subspace_resist, 216); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.shield_warp_resist != 0) { this.DrawStatPCShield(ref modTitlePos, Localizer.Token(6170), (float)mod.shield_warp_resist, 217); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.shield_beam_resist != 0) { this.DrawStatPCShield(ref modTitlePos, Localizer.Token(6171), (float)mod.shield_beam_resist, 218); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.shield_threshold != 0) { this.DrawStatPCShield(ref modTitlePos, Localizer.Token(6176), (float)mod.shield_threshold, 222); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.SensorRange != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(126), (float)mod.SensorRange, 96); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.SensorBonus != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(6121), (float)mod.SensorBonus, 167); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.HealPerTurn != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(6131), mod.HealPerTurn, 174); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.TransporterRange != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(126), (float)mod.TransporterRange, 168); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.TransporterPower != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(6123), (float)mod.TransporterPower, 169); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.TransporterTimerConstant != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(6122), (float)mod.TransporterTimerConstant, 170); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.TransporterOrdnance != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(6124), (float)mod.TransporterOrdnance, 171); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.TransporterTroopAssault != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(6135), (float)mod.TransporterTroopAssault, 187); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.TransporterTroopLanding != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(6128), (float)mod.TransporterTroopLanding, 172); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.OrdinanceCapacity != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(2129), (float)mod.OrdinanceCapacity, 124); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.Cargo_Capacity != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(119), (float)mod.Cargo_Capacity, 109); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.OrdnanceAddedPerSecond != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(6120), (float)mod.OrdnanceAddedPerSecond, 162); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.InhibitionRadius != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(2233), (float)mod.InhibitionRadius, 144); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.TroopCapacity != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(336), (float)mod.TroopCapacity, 173); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.PowerStoreMax != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(2235), (float)(mod.PowerStoreMax + mod.PowerStoreMax * EmpireManager.GetEmpireByName(ShipDesignScreen.screen.PlayerLoyalty).data.FuelCellModifier), 145); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } //added by McShooterz: Allow Power Draw at Warp variable to show up in design screen for any module if (mod.PowerDrawAtWarp != 0f) { this.DrawStat(ref modTitlePos, Localizer.Token(6011), (float)(-mod.PowerDrawAtWarp), 178); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (GlobalStats.ActiveModInfo != null && GlobalStats.ActiveModInfo.enableECM && mod.ECM != 0) { this.DrawStatPercent(ref modTitlePos, Localizer.Token(6004), (float)mod.ECM, 154); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.ModuleType == ShipModuleType.Hangar && mod.hangarTimerConstant != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(136), (float)mod.hangarTimerConstant, 98); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.explodes) { base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, "Explodes", modTitlePos, Color.OrangeRed); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.KineticResist != 0) { this.DrawStatPC(ref modTitlePos, Localizer.Token(6142), (float)mod.KineticResist, 189); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.EnergyResist != 0) { this.DrawStatPC(ref modTitlePos, Localizer.Token(6143), (float)mod.EnergyResist, 190); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.GuidedResist != 0) { this.DrawStatPC(ref modTitlePos, Localizer.Token(6144), (float)mod.GuidedResist, 191); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.MissileResist != 0) { this.DrawStatPC(ref modTitlePos, Localizer.Token(6145), (float)mod.MissileResist, 192); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.HybridResist != 0) { this.DrawStatPC(ref modTitlePos, Localizer.Token(6146), (float)mod.HybridResist, 193); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.BeamResist != 0) { this.DrawStatPC(ref modTitlePos, Localizer.Token(6147), (float)mod.BeamResist, 194); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.ExplosiveResist != 0) { this.DrawStatPC(ref modTitlePos, Localizer.Token(6148), (float)mod.ExplosiveResist, 195); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.InterceptResist != 0) { this.DrawStatPC(ref modTitlePos, Localizer.Token(6149), (float)mod.InterceptResist, 196); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.RailgunResist != 0) { this.DrawStatPC(ref modTitlePos, Localizer.Token(6150), (float)mod.RailgunResist, 197); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.SpaceBombResist != 0) { this.DrawStatPC(ref modTitlePos, Localizer.Token(6151), (float)mod.SpaceBombResist, 198); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.BombResist != 0) { this.DrawStatPC(ref modTitlePos, Localizer.Token(6152), (float)mod.BombResist, 199); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.BioWeaponResist != 0) { this.DrawStatPC(ref modTitlePos, Localizer.Token(6153), (float)mod.BioWeaponResist, 200); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.DroneResist != 0) { this.DrawStatPC(ref modTitlePos, Localizer.Token(6154), (float)mod.DroneResist, 201); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.WarpResist != 0) { this.DrawStatPC(ref modTitlePos, Localizer.Token(6155), (float)mod.WarpResist, 202); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.TorpedoResist != 0) { this.DrawStatPC(ref modTitlePos, Localizer.Token(6156), (float)mod.TorpedoResist, 203); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.CannonResist != 0) { this.DrawStatPC(ref modTitlePos, Localizer.Token(6157), (float)mod.CannonResist, 204); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.SubspaceResist != 0) { this.DrawStatPC(ref modTitlePos, Localizer.Token(6158), (float)mod.SubspaceResist, 205); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.PDResist != 0) { this.DrawStatPC(ref modTitlePos, Localizer.Token(6159), (float)mod.PDResist, 206); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.FlakResist != 0) { this.DrawStatPC(ref modTitlePos, Localizer.Token(6160), (float)mod.FlakResist, 207); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.APResist != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(6161), (float)mod.APResist, 208); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.DamageThreshold != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(6175), (float)mod.DamageThreshold, 221); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.EMP_Protection != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(6174), (float)mod.EMP_Protection, 219); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.PermittedHangarRoles.Count != 0) { modTitlePos.Y = Math.Max(modTitlePos.Y, MaxDepth) + (float)Fonts.Arial12Bold.LineSpacing; Vector2 shipSelectionPos = new Vector2(modTitlePos.X - 152f, modTitlePos.Y); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial20Bold, string.Concat(Localizer.Token(137), " : ", mod.hangarShipUID), shipSelectionPos, Color.Orange); r = this.ChooseFighterSub.Menu; r.Y = r.Y + 25; r.Height = r.Height - 25; sel = new Selector(base.ScreenManager, r, new Color(0, 0, 0, 210)); sel.Draw(); this.UpdateHangarOptions(mod); this.ChooseFighterSub.Draw(); this.ChooseFighterSL.Draw(base.ScreenManager.SpriteBatch); Vector2 bCursor = new Vector2((float)(this.ChooseFighterSub.Menu.X + 15), (float)(this.ChooseFighterSub.Menu.Y + 25)); for (int i = this.ChooseFighterSL.indexAtTop; i < this.ChooseFighterSL.Entries.Count && i < this.ChooseFighterSL.indexAtTop + this.ChooseFighterSL.entriesToDisplay; i++) { ScrollList.Entry e = this.ChooseFighterSL.Entries[i]; bCursor.Y = (float)e.clickRect.Y; base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict[Ship_Game.ResourceManager.HullsDict[(e.item as Ship).GetShipData().Hull].IconPath], new Rectangle((int)bCursor.X, (int)bCursor.Y, 29, 30), Color.White); Vector2 tCursor = new Vector2(bCursor.X + 40f, bCursor.Y + 3f); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, (!string.IsNullOrEmpty((e.item as Ship).VanityName) ? (e.item as Ship).VanityName : (e.item as Ship).Name), tCursor, Color.White); tCursor.Y = tCursor.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (this.selector != null) { this.selector.Draw(); return; } } return; } else { this.DrawStat(ref modTitlePos, Localizer.Token(128), (float)mod.Cost * UniverseScreen.GamePaceStatic, 84); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; this.DrawStat(ref modTitlePos, Localizer.Token(123), (float)EmpireManager.GetEmpireByName(ShipDesignScreen.screen.PlayerLoyalty).data.MassModifier * mod.Mass, 79); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; this.DrawStat(ref modTitlePos, Localizer.Token(124), (float)mod.HealthMax + EmpireManager.GetEmpireByName(ShipDesignScreen.screen.PlayerLoyalty).data.Traits.ModHpModifier * mod.HealthMax, 80); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; this.DrawStat(ref modTitlePos, Localizer.Token(125), (mod.ModuleType != ShipModuleType.PowerPlant ? -(float)mod.PowerDraw : mod.PowerFlowMax), 81); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; this.DrawStat(ref modTitlePos, Localizer.Token(126), (float)ModifiedWeaponStat(mod.InstalledWeapon, "range"), 82); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; if (!mod.InstalledWeapon.explodes || mod.InstalledWeapon.OrdinanceRequiredToFire <= 0f) { if (mod.InstalledWeapon.isRepairBeam) { this.DrawStat(ref modTitlePos, Localizer.Token(135), (float)ModifiedWeaponStat(mod.InstalledWeapon, "damage") * -90f * mod.InstalledWeapon.BeamDuration * GetHullDamageBonus(), 166); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; this.DrawStat(ref modTitlePos, "Duration", (float)mod.InstalledWeapon.BeamDuration, 188); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } else if (mod.InstalledWeapon.isBeam) { this.DrawStat(ref modTitlePos, Localizer.Token(127), (float)ModifiedWeaponStat(mod.InstalledWeapon, "damage") * 90f * mod.InstalledWeapon.BeamDuration * GetHullDamageBonus(), 83); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; this.DrawStat(ref modTitlePos, "Duration", (float)mod.InstalledWeapon.BeamDuration, 188); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } else { this.DrawStat(ref modTitlePos, Localizer.Token(127), (float)ModifiedWeaponStat(mod.InstalledWeapon, "damage") * GetHullDamageBonus(), 83); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } } else { this.DrawStat(ref modTitlePos, Localizer.Token(127), (float)ModifiedWeaponStat(mod.InstalledWeapon, "damage") * GetHullDamageBonus() + EmpireManager.GetEmpireByName(ShipDesignScreen.screen.PlayerLoyalty).data.OrdnanceEffectivenessBonus * mod.InstalledWeapon.DamageAmount, 83); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } modTitlePos.X = modTitlePos.X + 152f; modTitlePos.Y = starty; if (!mod.InstalledWeapon.isBeam && !mod.InstalledWeapon.isRepairBeam) { this.DrawStat(ref modTitlePos, Localizer.Token(129), (float)ModifiedWeaponStat(mod.InstalledWeapon, "speed"), 85); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.InstalledWeapon.DamageAmount > 0f) { if (mod.InstalledWeapon.isBeam) { float dps = (float)ModifiedWeaponStat(mod.InstalledWeapon, "damage") * GetHullDamageBonus() * 90f * mod.InstalledWeapon.BeamDuration / (ModifiedWeaponStat(mod.InstalledWeapon, "firedelay") * GetHullFireRateBonus()); this.DrawStat(ref modTitlePos, "DPS", dps, 86); modTitlePos.Y += (float)Fonts.Arial12Bold.LineSpacing; } else if (mod.InstalledWeapon.explodes && mod.InstalledWeapon.OrdinanceRequiredToFire > 0f) { if (mod.InstalledWeapon.SalvoCount <= 1) { float dps = 1f / (ModifiedWeaponStat(mod.InstalledWeapon, "firedelay") * GetHullFireRateBonus()) * ((float)ModifiedWeaponStat(mod.InstalledWeapon, "damage") * GetHullDamageBonus() + EmpireManager.GetEmpireByName(ShipDesignScreen.screen.PlayerLoyalty).data.OrdnanceEffectivenessBonus * mod.InstalledWeapon.DamageAmount); dps = dps * (float)mod.InstalledWeapon.ProjectileCount; this.DrawStat(ref modTitlePos, "DPS", dps, 86); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } else { float dps = (float)mod.InstalledWeapon.SalvoCount / (ModifiedWeaponStat(mod.InstalledWeapon, "firedelay") * GetHullFireRateBonus()) * ((float)ModifiedWeaponStat(mod.InstalledWeapon, "damage") * GetHullDamageBonus() + EmpireManager.GetEmpireByName(ShipDesignScreen.screen.PlayerLoyalty).data.OrdnanceEffectivenessBonus * mod.InstalledWeapon.DamageAmount); dps = dps * (float)mod.InstalledWeapon.ProjectileCount; this.DrawStat(ref modTitlePos, "DPS", dps, 86); modTitlePos.Y += (float)Fonts.Arial12Bold.LineSpacing; this.DrawStat(ref modTitlePos, "Salvo", (float)mod.InstalledWeapon.SalvoCount, 182); modTitlePos.Y += (float)Fonts.Arial12Bold.LineSpacing; } } else if (mod.InstalledWeapon.SalvoCount <= 1) { float dps = 1f / (ModifiedWeaponStat(mod.InstalledWeapon, "firedelay") * GetHullFireRateBonus()) * ((float)ModifiedWeaponStat(mod.InstalledWeapon, "damage") * GetHullDamageBonus() + (float)mod.InstalledWeapon.DamageAmount * EmpireManager.GetEmpireByName(ShipDesignScreen.screen.PlayerLoyalty).data.Traits.EnergyDamageMod); dps = dps * (float)mod.InstalledWeapon.ProjectileCount; this.DrawStat(ref modTitlePos, "DPS", dps, 86); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } else { float dps = (float)mod.InstalledWeapon.SalvoCount / (ModifiedWeaponStat(mod.InstalledWeapon, "firedelay") * GetHullFireRateBonus()) * ((float)ModifiedWeaponStat(mod.InstalledWeapon, "damage") * GetHullDamageBonus() + (float)mod.InstalledWeapon.DamageAmount * EmpireManager.GetEmpireByName(ShipDesignScreen.screen.PlayerLoyalty).data.Traits.EnergyDamageMod); dps = dps * (float)mod.InstalledWeapon.ProjectileCount; this.DrawStat(ref modTitlePos, "DPS", dps, 86); modTitlePos.Y += (float)Fonts.Arial12Bold.LineSpacing; this.DrawStat(ref modTitlePos, "Salvo", (float)mod.InstalledWeapon.SalvoCount, 182); modTitlePos.Y += (float)Fonts.Arial12Bold.LineSpacing; } } if (mod.InstalledWeapon.BeamPowerCostPerSecond > 0f) { this.DrawStat(ref modTitlePos, "Pwr/s", (float)mod.InstalledWeapon.BeamPowerCostPerSecond, 87); modTitlePos.Y += (float)Fonts.Arial12Bold.LineSpacing; } this.DrawStat(ref modTitlePos, "Delay", mod.InstalledWeapon.fireDelay, 183); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; if (mod.InstalledWeapon.EMPDamage > 0f) { this.DrawStat(ref modTitlePos, "EMP", 1f / (ModifiedWeaponStat(mod.InstalledWeapon, "firedelay") * GetHullFireRateBonus()) * (float)mod.InstalledWeapon.EMPDamage, 110); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.InstalledWeapon.SiphonDamage > 0f) { float damage; if (mod.InstalledWeapon.isBeam) damage = mod.InstalledWeapon.SiphonDamage * 90f * mod.InstalledWeapon.BeamDuration; else damage = mod.InstalledWeapon.SiphonDamage; this.DrawStat(ref modTitlePos, "Siphon", damage, 184); modTitlePos.Y += (float)Fonts.Arial12Bold.LineSpacing; } if (mod.InstalledWeapon.MassDamage > 0f) { float damage; if (mod.InstalledWeapon.isBeam) damage = mod.InstalledWeapon.MassDamage * 90f * mod.InstalledWeapon.BeamDuration; else damage = mod.InstalledWeapon.MassDamage; this.DrawStat(ref modTitlePos, "Tractor", damage, 185); modTitlePos.Y += (float)Fonts.Arial12Bold.LineSpacing; } if (mod.InstalledWeapon.PowerDamage > 0f) { float damage; if (mod.InstalledWeapon.isBeam) damage = mod.InstalledWeapon.PowerDamage * 90f * mod.InstalledWeapon.BeamDuration; else damage = mod.InstalledWeapon.PowerDamage; this.DrawStat(ref modTitlePos, "Pwr Dmg", damage, 186); modTitlePos.Y += (float)Fonts.Arial12Bold.LineSpacing; } this.DrawStat(ref modTitlePos, Localizer.Token(130), (float)mod.FieldOfFire, 88); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; if (mod.InstalledWeapon.OrdinanceRequiredToFire > 0f) { this.DrawStat(ref modTitlePos, "Ord / Shot", (float)mod.InstalledWeapon.OrdinanceRequiredToFire, 89); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.InstalledWeapon.PowerRequiredToFire > 0f) { this.DrawStat(ref modTitlePos, "Pwr / Shot", (float)mod.InstalledWeapon.PowerRequiredToFire, 90); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.InstalledWeapon.Tag_Guided && GlobalStats.ActiveModInfo != null && GlobalStats.ActiveModInfo.enableECM) { this.DrawStatPercent(ref modTitlePos, Localizer.Token(6005), (float)mod.InstalledWeapon.ECMResist, 155); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.InstalledWeapon.EffectVsArmor != 1f) { if (mod.InstalledWeapon.EffectVsArmor <= 1f) { float effectVsArmor = ModifiedWeaponStat(mod.InstalledWeapon, "armor") * 100f; this.DrawStat105Bad(ref modTitlePos, "VS Armor", string.Concat(effectVsArmor.ToString("#"), "%"), 147); } else { float single = ModifiedWeaponStat(mod.InstalledWeapon, "armor") * 100f; this.DrawStat105(ref modTitlePos, "VS Armor", string.Concat(single.ToString("#"), "%"), 147); } modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.InstalledWeapon.EffectVSShields != 1f) { if (mod.InstalledWeapon.EffectVSShields <= 1f) { float effectVSShields = ModifiedWeaponStat(mod.InstalledWeapon, "shield") * 100f; this.DrawStat105Bad(ref modTitlePos, "VS Shield", string.Concat(effectVSShields.ToString("#"), "%"), 147); } else { float effectVSShields1 = ModifiedWeaponStat(mod.InstalledWeapon, "shield") * 100f; this.DrawStat105(ref modTitlePos, "VS Shield", string.Concat(effectVSShields1.ToString("#"), "%"), 147); } modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.InstalledWeapon.ShieldPenChance > 0) { this.DrawStat(ref modTitlePos, "Shield Pen", mod.InstalledWeapon.ShieldPenChance, 181); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.OrdinanceCapacity != 0) { this.DrawStat(ref modTitlePos, Localizer.Token(2129), (float)mod.OrdinanceCapacity, 124); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.InstalledWeapon.TruePD) { string fireRest = "Cannot Target Ships"; modTitlePos.Y = modTitlePos.Y + 2* ((float)Fonts.Arial12Bold.LineSpacing); modTitlePos.X = modTitlePos.X - 152f; base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, string.Concat(fireRest), modTitlePos, Color.LightCoral); return; } if (!mod.InstalledWeapon.TruePD && mod.InstalledWeapon.Excludes_Fighters || mod.InstalledWeapon.Excludes_Corvettes || mod.InstalledWeapon.Excludes_Capitals || mod.InstalledWeapon.Excludes_Stations) { string fireRest = "Cannot Target:"; modTitlePos.Y = modTitlePos.Y + 2 * ((float)Fonts.Arial12Bold.LineSpacing); modTitlePos.X = modTitlePos.X - 152f; base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, string.Concat(fireRest), modTitlePos, Color.LightCoral); modTitlePos.X = modTitlePos.X + 120f; if (mod.InstalledWeapon.Excludes_Fighters) { if (GlobalStats.ActiveModInfo != null && GlobalStats.ActiveModInfo.useDrones) { base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, "Drones", modTitlePos, Color.LightCoral); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, "Fighters", modTitlePos, Color.LightCoral); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.InstalledWeapon.Excludes_Corvettes) { base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, "Corvettes", modTitlePos, Color.LightCoral); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.InstalledWeapon.Excludes_Capitals) { base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, "Capitals", modTitlePos, Color.LightCoral); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } if (mod.InstalledWeapon.Excludes_Stations) { base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, "Stations", modTitlePos, Color.LightCoral); modTitlePos.Y = modTitlePos.Y + (float)Fonts.Arial12Bold.LineSpacing; } return; } else return; } } }
protected void DrawShipUI(GameTime gameTime) { Vector2 vector2 = new Vector2((float)Mouse.GetState().X, (float)Mouse.GetState().Y); lock (GlobalStats.FleetButtonLocker) { foreach (UniverseScreen.FleetButton item_0 in this.FleetButtons) { Selector local_1 = new Selector(this.ScreenManager, item_0.ClickRect, Color.TransparentBlack); Rectangle local_2 = new Rectangle(item_0.ClickRect.X + 6, item_0.ClickRect.Y + 6, item_0.ClickRect.Width - 12, item_0.ClickRect.Width - 12); bool local_3 = false; for (int local_4 = 0; local_4 < item_0.Fleet.Ships.Count; ++local_4) { try { if (item_0.Fleet.Ships[local_4].InCombat) { local_3 = true; break; } } catch { } } float local_6_1 = Math.Abs((float)Math.Sin(gameTime.TotalGameTime.TotalSeconds)) * 200f; this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/rounded_square"], item_0.ClickRect, local_3 ? new Color(byte.MaxValue, (byte)0, (byte)0, (byte)local_6_1) : new Color((byte)0, (byte)0, (byte)0, (byte)80)); local_1.Draw(); this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["FleetIcons/" + item_0.Fleet.FleetIconIndex.ToString()], local_2, EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).EmpireColor); this.ScreenManager.SpriteBatch.DrawString(Fonts.Pirulen12, item_0.Key.ToString(), new Vector2((float)(item_0.ClickRect.X + 4), (float)(item_0.ClickRect.Y + 4)), Color.Orange); Vector2 local_7 = new Vector2((float)(item_0.ClickRect.X + 50), (float)item_0.ClickRect.Y); for (int local_8 = 0; local_8 < item_0.Fleet.Ships.Count; ++local_8) { try { Ship local_9 = item_0.Fleet.Ships[local_8]; Rectangle local_10 = new Rectangle((int)local_7.X, (int)local_7.Y, 15, 15); local_7.X += (float)(15 ); if ((double)local_7.X > 200.0) { local_7.X = (float)(item_0.ClickRect.X + 50); local_7.Y += 15f; } this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["TacticalIcons/symbol_" + local_9.Role], local_10, item_0.Fleet.Owner.EmpireColor); } catch { } } } } }
public static void Draw(Ship_Game.ScreenManager ScreenManager) { ToolTip.TipTimer = ToolTip.TipTimer - 1; if (ToolTip.TipTimer <= 0) { ToolTip.TipTimer = 0; } float alpha = 210f - 210f * (float)ToolTip.TipTimer / 20f; if (ToolTip.TipTimer < 20 && ToolTip.text != null) { Selector sel = new Selector(ScreenManager, ToolTip.r, new Color(0, 0, 0, (byte)alpha)); sel.Draw(); Vector2 textpos = new Vector2((float)(ToolTip.r.X + 10), (float)(ToolTip.r.Y + 5)); alpha = 255f - 255f * (float)ToolTip.TipTimer / 30f; if (!string.IsNullOrEmpty(ToolTip.Hotkey)) { Vector2 hotkeypos = textpos; ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, string.Concat(Localizer.Token(2300), ": "), textpos, new Color(255, 239, 208, (byte)alpha)); hotkeypos.X = hotkeypos.X + Fonts.Arial12Bold.MeasureString(string.Concat(Localizer.Token(2300), ": ")).X; ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, ToolTip.Hotkey, hotkeypos, new Color(Color.Gold, (byte)alpha)); textpos.Y = textpos.Y + (float)(Fonts.Arial12Bold.LineSpacing * 2); } ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, ToolTip.text, textpos, new Color(255, 239, 208, (byte)alpha)); } if (ToolTip.text == null) { ToolTip.TipTimer = 50; } ToolTip.text = null; }
public override void Draw(GameTime gameTime) { Viewport viewport; Rectangle? nullable; lock (GlobalStats.ObjectManagerLocker) { base.ScreenManager.sceneState.BeginFrameRendering(this.view, this.projection, gameTime, base.ScreenManager.environment, true); base.ScreenManager.editor.BeginFrameRendering(base.ScreenManager.sceneState); base.ScreenManager.inter.BeginFrameRendering(base.ScreenManager.sceneState); } base.ScreenManager.GraphicsDevice.Clear(Color.Black); FleetDesignScreen.screen.bg.Draw(FleetDesignScreen.screen, FleetDesignScreen.screen.starfield); base.ScreenManager.SpriteBatch.Begin(); this.DrawGrid(); if (this.SelectedNodeList.Count == 1) { viewport = base.ScreenManager.GraphicsDevice.Viewport; Vector3 screenSpacePosition = viewport.Project(new Vector3(this.SelectedNodeList[0].FleetOffset.X, this.SelectedNodeList[0].FleetOffset.Y, 0f), this.projection, this.view, Matrix.Identity); Vector2 screenPos = new Vector2(screenSpacePosition.X, screenSpacePosition.Y); Vector2 radialPos = HelperFunctions.GeneratePointOnCircle(90f, this.SelectedNodeList[0].FleetOffset, 10000f * this.OperationalRadius.amount); viewport = base.ScreenManager.GraphicsDevice.Viewport; Vector3 insetRadialPos = viewport.Project(new Vector3(radialPos, 0f), this.projection, this.view, Matrix.Identity); Vector2 insetRadialSS = new Vector2(insetRadialPos.X, insetRadialPos.Y); float SSRadius = (float)Math.Abs(insetRadialSS.X - screenPos.X); Rectangle nodeRect = new Rectangle((int)screenPos.X, (int)screenPos.Y, (int)SSRadius * 2, (int)SSRadius * 2); Vector2 Origin = new Vector2((float)(Ship_Game.ResourceManager.TextureDict["UI/node"].Width / 2), (float)(Ship_Game.ResourceManager.TextureDict["UI/node"].Height / 2)); nullable = null; base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict["UI/node1"], nodeRect, nullable, new Color(0, 255, 0, 75), 0f, Origin, SpriteEffects.None, 1f); } this.ClickableNodes.Clear(); foreach (FleetDataNode node in this.fleet.DataNodes) { if (node.GetShip() == null) { float radius = 150f; viewport = base.ScreenManager.GraphicsDevice.Viewport; Vector3 pScreenSpace = viewport.Project(new Vector3(node.FleetOffset, 0f), this.projection, this.view, Matrix.Identity); Vector2 pPos = new Vector2(pScreenSpace.X, pScreenSpace.Y); Vector2 radialPos = HelperFunctions.GeneratePointOnCircle(90f, node.FleetOffset, radius); viewport = base.ScreenManager.GraphicsDevice.Viewport; Vector3 insetRadialPos = viewport.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; FleetDesignScreen.ClickableNode cs = new FleetDesignScreen.ClickableNode() { Radius = Radius, ScreenPos = pPos, nodeToClick = node }; this.ClickableNodes.Add(cs); } else { Ship ship = node.GetShip(); ship.GetSO().World = Matrix.CreateTranslation(new Vector3(ship.RelativeFleetOffset, 0f)); float radius = ship.GetSO().WorldBoundingSphere.Radius; viewport = base.ScreenManager.GraphicsDevice.Viewport; Vector3 pScreenSpace = viewport.Project(new Vector3(ship.RelativeFleetOffset, 0f), this.projection, this.view, Matrix.Identity); Vector2 pPos = new Vector2(pScreenSpace.X, pScreenSpace.Y); Vector2 radialPos = HelperFunctions.GeneratePointOnCircle(90f, ship.RelativeFleetOffset, radius); viewport = base.ScreenManager.GraphicsDevice.Viewport; Vector3 insetRadialPos = viewport.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; FleetDesignScreen.ClickableNode cs = new FleetDesignScreen.ClickableNode() { Radius = Radius, ScreenPos = pPos, nodeToClick = node }; this.ClickableNodes.Add(cs); } } foreach (FleetDataNode node in this.HoveredNodeList) { if (node.GetShip() == null) { if (node.GetShip() != null) { continue; } float radius = 150f; viewport = base.ScreenManager.GraphicsDevice.Viewport; Vector3 pScreenSpace = viewport.Project(new Vector3(node.FleetOffset, 0f), this.projection, this.view, Matrix.Identity); Vector2 pPos = new Vector2(pScreenSpace.X, pScreenSpace.Y); Vector2 radialPos = HelperFunctions.GeneratePointOnCircle(90f, node.FleetOffset, radius); viewport = base.ScreenManager.GraphicsDevice.Viewport; Vector3 insetRadialPos = viewport.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); foreach (FleetDesignScreen.ClickableSquad squad in this.ClickableSquads) { if (!squad.squad.DataNodes.Contains(node)) { continue; } Primitives2D.DrawLine(base.ScreenManager.SpriteBatch, squad.screenPos, pPos, new Color(0, 255, 0, 70), 2f); } Primitives2D.DrawCircle(base.ScreenManager.SpriteBatch, pPos, Radius, 250, new Color(255, 255, 255, 70), 2f); } else { Ship ship = node.GetShip(); float radius = ship.GetSO().WorldBoundingSphere.Radius; viewport = base.ScreenManager.GraphicsDevice.Viewport; Vector3 pScreenSpace = viewport.Project(new Vector3(ship.RelativeFleetOffset, 0f), this.projection, this.view, Matrix.Identity); Vector2 pPos = new Vector2(pScreenSpace.X, pScreenSpace.Y); Vector2 radialPos = HelperFunctions.GeneratePointOnCircle(90f, ship.RelativeFleetOffset, radius); viewport = base.ScreenManager.GraphicsDevice.Viewport; Vector3 insetRadialPos = viewport.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); foreach (FleetDesignScreen.ClickableSquad squad in this.ClickableSquads) { if (!squad.squad.DataNodes.Contains(node)) { continue; } Primitives2D.DrawLine(base.ScreenManager.SpriteBatch, squad.screenPos, pPos, new Color(0, 255, 0, 70), 2f); } Primitives2D.DrawCircle(base.ScreenManager.SpriteBatch, pPos, Radius, 250, new Color(255, 255, 255, 70), 2f); } } foreach (FleetDataNode node in this.SelectedNodeList) { if (node.GetShip() == null) { if (node.GetShip() != null) { continue; } float radius = 150f; viewport = base.ScreenManager.GraphicsDevice.Viewport; Vector3 pScreenSpace = viewport.Project(new Vector3(node.FleetOffset, 0f), this.projection, this.view, Matrix.Identity); Vector2 pPos = new Vector2(pScreenSpace.X, pScreenSpace.Y); Vector2 radialPos = HelperFunctions.GeneratePointOnCircle(90f, node.FleetOffset, radius); viewport = base.ScreenManager.GraphicsDevice.Viewport; Vector3 insetRadialPos = viewport.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); foreach (FleetDesignScreen.ClickableSquad squad in this.ClickableSquads) { if (!squad.squad.DataNodes.Contains(node)) { continue; } Primitives2D.DrawLine(base.ScreenManager.SpriteBatch, squad.screenPos, pPos, new Color(0, 255, 0, 70), 2f); } Primitives2D.DrawCircle(base.ScreenManager.SpriteBatch, pPos, Radius, 250, Color.White, 2f); } else { Ship ship = node.GetShip(); float radius = ship.GetSO().WorldBoundingSphere.Radius; viewport = base.ScreenManager.GraphicsDevice.Viewport; Vector3 pScreenSpace = viewport.Project(new Vector3(ship.RelativeFleetOffset, 0f), this.projection, this.view, Matrix.Identity); Vector2 pPos = new Vector2(pScreenSpace.X, pScreenSpace.Y); Vector2 radialPos = HelperFunctions.GeneratePointOnCircle(90f, ship.RelativeFleetOffset, radius); viewport = base.ScreenManager.GraphicsDevice.Viewport; Vector3 insetRadialPos = viewport.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); foreach (FleetDesignScreen.ClickableSquad squad in this.ClickableSquads) { if (!squad.squad.DataNodes.Contains(node)) { continue; } Primitives2D.DrawLine(base.ScreenManager.SpriteBatch, squad.screenPos, pPos, new Color(0, 255, 0, 70), 2f); } Primitives2D.DrawCircle(base.ScreenManager.SpriteBatch, pPos, Radius, 250, Color.White, 2f); } } this.DrawFleetManagementIndicators(); Primitives2D.DrawRectangle(base.ScreenManager.SpriteBatch, this.SelectionBox, Color.Green, 1f); base.ScreenManager.SpriteBatch.End(); lock (GlobalStats.ObjectManagerLocker) { base.ScreenManager.inter.RenderManager.Render(); } base.ScreenManager.SpriteBatch.Begin(); this.TitleBar.Draw(); base.ScreenManager.SpriteBatch.DrawString(Fonts.Laserian14, "Fleet Hotkeys", this.TitlePos, new Color(255, 239, 208)); int numEntries = 9; int k = 9; int m = 0; foreach (KeyValuePair<int, Rectangle> rect in this.FleetsRects) { if (m == 9) { break; } Rectangle r = rect.Value; float transitionOffset = MathHelper.Clamp((base.TransitionPosition - 0.5f * (float)k / (float)numEntries) / 0.5f, 0f, 1f); k--; if (base.ScreenState != Ship_Game.ScreenState.TransitionOn) { r.X = r.X + (int)transitionOffset * 512; } else { r.X = r.X - (int)(transitionOffset * 256f); if (transitionOffset == 0f) { AudioManager.PlayCue("blip_click"); } } Selector sel = new Selector(base.ScreenManager, r, Color.TransparentBlack); if (rect.Key != this.FleetToEdit) { base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict["NewUI/rounded_square"], r, Color.Black); } else { base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict["NewUI/rounded_square"], r, new Color(0, 0, 255, 80)); } sel.Draw(); Fleet f = EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).GetFleetsDict()[rect.Key]; if (f.DataNodes.Count > 0) { Rectangle firect = new Rectangle(rect.Value.X + 6, rect.Value.Y + 6, rect.Value.Width - 12, rect.Value.Width - 12); base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict[string.Concat("FleetIcons/", f.FleetIconIndex.ToString())], firect, EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).EmpireColor); } Vector2 num = new Vector2((float)(rect.Value.X + 4), (float)(rect.Value.Y + 4)); SpriteBatch spriteBatch = base.ScreenManager.SpriteBatch; SpriteFont pirulen12 = Fonts.Pirulen12; int key = rect.Key; spriteBatch.DrawString(pirulen12, key.ToString(), num, Color.Orange); num.X = num.X + (float)(rect.Value.Width + 5); if (rect.Key != this.FleetToEdit) { base.ScreenManager.SpriteBatch.DrawString(Fonts.Pirulen12, f.Name, num, Color.Gray); } else { base.ScreenManager.SpriteBatch.DrawString(Fonts.Pirulen12, f.Name, num, Color.White); } m++; } if (this.FleetToEdit != -1) { this.ShipDesigns.Draw(); base.ScreenManager.SpriteBatch.DrawString(Fonts.Laserian14, "Ship Designs", this.ShipDesignsTitlePos, new Color(255, 239, 208)); Primitives2D.FillRectangle(base.ScreenManager.SpriteBatch, this.sub_ships.Menu, new Color(0, 0, 0, 130)); this.sub_ships.Draw(); this.ShipSL.Draw(base.ScreenManager.SpriteBatch); Vector2 bCursor = new Vector2((float)(this.RightMenu.Menu.X + 5), (float)(this.RightMenu.Menu.Y + 25)); for (int i = this.ShipSL.indexAtTop; i < this.ShipSL.Copied.Count && i < this.ShipSL.indexAtTop + this.ShipSL.entriesToDisplay; i++) { ScrollList.Entry e = this.ShipSL.Copied[i]; bCursor.Y = (float)e.clickRect.Y; if (e.item is ModuleHeader) { (e.item as ModuleHeader).DrawWidth(base.ScreenManager, bCursor, 265); } else if (e.clickRectHover != 0) { bCursor.Y = (float)e.clickRect.Y; base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict["Icons/icon_ship_02"], new Rectangle((int)bCursor.X, (int)bCursor.Y, 29, 30), Color.White); Vector2 tCursor = new Vector2(bCursor.X + 40f, bCursor.Y + 3f); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, (e.item as Ship).Name, tCursor, Color.White); tCursor.Y = tCursor.Y + (float)Fonts.Arial12Bold.LineSpacing; base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, (e.item as Ship).Role, tCursor, Color.Orange); if (e.Plus != 0) { if (e.PlusHover != 0) { base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict["NewUI/icon_build_add_hover2"], e.addRect, Color.White); } else { base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict["NewUI/icon_build_add_hover1"], e.addRect, Color.White); } } if (e.Edit != 0) { if (e.EditHover != 0) { base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict["NewUI/icon_build_edit_hover2"], e.editRect, Color.White); } else { base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict["NewUI/icon_build_edit_hover1"], e.editRect, Color.White); } } if (e.clickRect.Y == 0) { } } else { base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict[Ship_Game.ResourceManager.HullsDict[(e.item as Ship).GetShipData().Hull].IconPath], new Rectangle((int)bCursor.X, (int)bCursor.Y, 29, 30), Color.White); Vector2 tCursor = new Vector2(bCursor.X + 40f, bCursor.Y + 3f); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, (!string.IsNullOrEmpty((e.item as Ship).VanityName) ? (e.item as Ship).VanityName : (e.item as Ship).Name), tCursor, Color.White); tCursor.Y = tCursor.Y + (float)Fonts.Arial12Bold.LineSpacing; if (this.sub_ships.Tabs[0].Selected) { base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, (e.item as Ship).Role, tCursor, Color.Orange); } else if ((e.item as Ship).GetSystem() == null) { base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, "Deep Space", tCursor, Color.Orange); } else { base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, string.Concat((e.item as Ship).GetSystem().Name, " system"), tCursor, Color.Orange); } if (e.Plus != 0) { if (e.PlusHover != 0) { base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict["NewUI/icon_build_add_hover2"], e.addRect, Color.White); } else { base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict["NewUI/icon_build_add"], e.addRect, Color.White); } } if (e.Edit != 0) { if (e.EditHover != 0) { base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict["NewUI/icon_build_edit_hover2"], e.editRect, Color.White); } else { base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict["NewUI/icon_build_edit"], e.editRect, Color.White); } } if (e.clickRect.Y == 0) { } } } } this.EmpireUI.Draw(base.ScreenManager.SpriteBatch); foreach (FleetDataNode node in this.fleet.DataNodes) { Vector2 vector2 = new Vector2((float)(Ship_Game.ResourceManager.TextureDict["TacticalIcons/symbol_fighter"].Width / 2), (float)(Ship_Game.ResourceManager.TextureDict["TacticalIcons/symbol_fighter"].Width / 2)); if (node.GetShip() == null || this.CamPos.Z <= 15000f) { if (node.GetShip() != null || node.ShipName == "Troop Shuttle") { continue; } Ship ship = Ship_Game.ResourceManager.ShipsDict[node.ShipName]; float radius = 150f; viewport = base.ScreenManager.GraphicsDevice.Viewport; Vector3 pScreenSpace = viewport.Project(new Vector3(node.FleetOffset, 0f), this.projection, this.view, Matrix.Identity); Vector2 pPos = new Vector2(pScreenSpace.X, pScreenSpace.Y); Vector2 radialPos = HelperFunctions.GeneratePointOnCircle(90f, node.FleetOffset, radius); viewport = base.ScreenManager.GraphicsDevice.Viewport; Vector3 insetRadialPos = viewport.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); Rectangle r = new Rectangle((int)pPos.X - (int)Radius, (int)pPos.Y - (int)Radius, (int)Radius * 2, (int)Radius * 2); Guid goalGUID = node.GoalGUID; if (node.GoalGUID == Guid.Empty) { base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict[string.Concat("TacticalIcons/symbol_", ship.Role)], r, (this.HoveredNodeList.Contains(node) || this.SelectedNodeList.Contains(node) ? Color.White : Color.Red)); } else { base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict[string.Concat("TacticalIcons/symbol_", ship.Role)], r, (this.HoveredNodeList.Contains(node) || this.SelectedNodeList.Contains(node) ? Color.White : Color.Yellow)); string buildingat = ""; foreach (Goal g in this.fleet.Owner.GetGSAI().Goals) { if (!(g.guid == node.GoalGUID) || g.GetPlanetWhereBuilding() == null) { continue; } buildingat = g.GetPlanetWhereBuilding().Name; } base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, (!string.IsNullOrEmpty(buildingat) ? string.Concat("Building at:\n", buildingat) : "Need spaceport"), pPos + new Vector2(5f, -5f), Color.White); } } else { Ship ship = node.GetShip(); float radius = ship.GetSO().WorldBoundingSphere.Radius; viewport = base.ScreenManager.GraphicsDevice.Viewport; Vector3 pScreenSpace = viewport.Project(new Vector3(ship.RelativeFleetOffset, 0f), this.projection, this.view, Matrix.Identity); Vector2 pPos = new Vector2(pScreenSpace.X, pScreenSpace.Y); Vector2 radialPos = HelperFunctions.GeneratePointOnCircle(90f, ship.RelativeFleetOffset, radius); viewport = base.ScreenManager.GraphicsDevice.Viewport; Vector3 insetRadialPos = viewport.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); if (Radius < 10f) { Radius = 10f; } Rectangle r = new Rectangle((int)pPos.X - (int)Radius, (int)pPos.Y - (int)Radius, (int)Radius * 2, (int)Radius * 2); base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict[string.Concat("TacticalIcons/symbol_", ship.Role)], r, (this.HoveredNodeList.Contains(node) || this.SelectedNodeList.Contains(node) ? Color.White : Color.Green)); } } if (this.ActiveShipDesign != null) { Ship ship = this.ActiveShipDesign; int x = Mouse.GetState().X; MouseState state = Mouse.GetState(); Rectangle rectangle = new Rectangle(x, state.Y, ship.Size / 2, ship.Size / 2); float scale = (float)((float)ship.Size) / (float)(30 + Ship_Game.ResourceManager.TextureDict["TacticalIcons/symbol_fighter"].Width); Vector2 IconOrigin = new Vector2((float)(Ship_Game.ResourceManager.TextureDict["TacticalIcons/symbol_fighter"].Width / 2), (float)(Ship_Game.ResourceManager.TextureDict["TacticalIcons/symbol_fighter"].Width / 2)); scale = scale * 4000f / this.CamPos.Z; if (scale > 1f) { scale = 1f; } if (scale < 0.15f) { scale = 0.15f; } SpriteBatch spriteBatch1 = base.ScreenManager.SpriteBatch; Texture2D item = Ship_Game.ResourceManager.TextureDict[string.Concat("TacticalIcons/symbol_", ship.Role)]; float single = (float)Mouse.GetState().X; state = Mouse.GetState(); nullable = null; spriteBatch1.Draw(item, new Vector2(single, (float)state.Y), nullable, EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).EmpireColor, 0f, IconOrigin, scale, SpriteEffects.None, 1f); } this.DrawSelectedData(gameTime); this.close.Draw(base.ScreenManager); ToolTip.Draw(base.ScreenManager); base.ScreenManager.SpriteBatch.End(); lock (GlobalStats.ObjectManagerLocker) { base.ScreenManager.inter.EndFrameRendering(); base.ScreenManager.editor.EndFrameRendering(); base.ScreenManager.sceneState.EndFrameRendering(); } }
public override void Draw(GameTime gameTime) { string text; base.ScreenManager.FadeBackBufferToBlack(base.TransitionAlpha * 2 / 3); base.ScreenManager.SpriteBatch.Begin(); Color c = new Color(255, 239, 208); Selector fleetstats = new Selector(base.ScreenManager, this.FleetStatsRect, new Color(0, 0, 0, 180)); fleetstats.Draw(); this.Cursor = new Vector2((float)(this.FleetStatsRect.X + 25), (float)(this.FleetStatsRect.Y + 25)); base.ScreenManager.SpriteBatch.DrawString(Fonts.Pirulen16, "Fleet Statistics", this.Cursor, c); this.Cursor.Y = this.Cursor.Y + (float)(Fonts.Pirulen16.LineSpacing + 8); this.DrawStat("# Ships in Design:", this.f.DataNodes.Count, ref this.Cursor); int actualnumber = 0; foreach (FleetDataNode node in this.f.DataNodes) { if (node.GetShip() == null) { continue; } actualnumber++; } this.DrawStat("# Ships in Fleet:", actualnumber, ref this.Cursor); this.DrawStat("# Ships being Built:", this.numBeingBuilt, ref this.Cursor); int tofill = this.f.DataNodes.Count - actualnumber - this.numBeingBuilt; this.DrawStat("# Slots To Fill:", tofill, ref this.Cursor, Color.LightPink); float cost = 0f; foreach (FleetDataNode node in this.f.DataNodes) { cost = (node.GetShip() == null ? cost + ResourceManager.ShipsDict[node.ShipName].GetCost(this.f.Owner) : cost + node.GetShip().GetCost(this.f.Owner)); } this.DrawStat("Total Production Cost:", (int)cost, ref this.Cursor); this.Cursor.Y = this.Cursor.Y + 20f; int numships = 0; foreach (Ship s in this.f.Owner.GetShips()) { if (s.fleet != null) { continue; } numships++; } if (tofill != 0) { base.ScreenManager.SpriteBatch.DrawString(Fonts.Pirulen16, "Owned Ships", this.Cursor, c); this.Cursor.Y = this.Cursor.Y + (float)(Fonts.Pirulen16.LineSpacing + 8); if (this.numThatFit <= 0) { text = "There are no ships in your empire that are not already assigned to a fleet that can fit any of the roles required by this fleet's design."; text = HelperFunctions.parseText(Fonts.Arial12Bold, text, (float)(this.FleetStatsRect.Width - 40)); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, text, this.Cursor, c); this.AssignNow.ToggleOn = false; } else { string[] str = new string[] { "Of the ", numships.ToString(), " ships in your empire that are not assigned to fleets, ", this.numThatFit.ToString(), " of them can be assigned to fill in this fleet" }; text = string.Concat(str); text = HelperFunctions.parseText(Fonts.Arial12Bold, text, (float)(this.FleetStatsRect.Width - 40)); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, text, this.Cursor, c); this.AssignNow.Draw(base.ScreenManager); } this.Cursor.Y = (float)(this.AssignNow.Button.Y + 70); base.ScreenManager.SpriteBatch.DrawString(Fonts.Pirulen16, "Build New Ships", this.Cursor, c); this.Cursor.Y = this.Cursor.Y + (float)(Fonts.Pirulen16.LineSpacing + 8); if (tofill > 0) { text = string.Concat("Order ", tofill.ToString(), " new ships to be built at your best available shipyards"); text = HelperFunctions.parseText(Fonts.Arial12Bold, text, (float)(this.FleetStatsRect.Width - 40)); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, text, this.Cursor, c); } this.BuildNow.Draw(base.ScreenManager); } else { base.ScreenManager.SpriteBatch.DrawString(Fonts.Pirulen16, "No Requisition Needed", this.Cursor, c); this.Cursor.Y = this.Cursor.Y + (float)(Fonts.Pirulen16.LineSpacing + 8); text = "This fleet is at full strength, or has build orders in place to bring it to full strength, and does not require further requisitions"; text = HelperFunctions.parseText(Fonts.Arial12Bold, text, (float)(this.FleetStatsRect.Width - 40)); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, text, this.Cursor, c); } base.ScreenManager.SpriteBatch.End(); }
public void Draw(GameTime gameTime) { Rectangle r = this.ConstructionSubMenu.Menu; r.Y = r.Y + 25; r.Height = r.Height - 25; Selector sel = new Selector(this.ScreenManager, r, new Color(0, 0, 0, 210)); sel.Draw(); this.ConstructionSubMenu.Draw(); this.SL.Draw(this.ScreenManager.SpriteBatch); Vector2 bCursor = new Vector2((float)(this.ConstructionSubMenu.Menu.X + 20), (float)(this.ConstructionSubMenu.Menu.Y + 45)); float x = (float)Mouse.GetState().X; MouseState state = Mouse.GetState(); Vector2 MousePos = new Vector2(x, (float)state.Y); for (int i = this.SL.indexAtTop; i < this.SL.Entries.Count && i < this.SL.indexAtTop + this.SL.entriesToDisplay; i++) { ScrollList.Entry e = this.SL.Entries[i]; bCursor.Y = (float)e.clickRect.Y; bCursor.X = (float)e.clickRect.X - 9; if (e.clickRectHover != 0) { if ((e.item as Ship).Name == "Subspace Projector") { this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["ShipIcons/subspace_projector"], new Rectangle((int)bCursor.X, (int)bCursor.Y, 29, 30), Color.White); } else { this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[ResourceManager.HullsDict[(e.item as Ship).GetShipData().Hull].IconPath], new Rectangle((int)bCursor.X, (int)bCursor.Y, 29, 30), Color.White); } Vector2 tCursor = new Vector2(bCursor.X + 40f, bCursor.Y + 3f); string name = (e.item as Ship).Name; SpriteFont nameFont = Fonts.Arial10; this.ScreenManager.SpriteBatch.DrawString(nameFont, name, tCursor, Color.White); tCursor.Y = tCursor.Y + (float)Fonts.Arial12Bold.LineSpacing; this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, (e.item as Ship).Role, tCursor, Color.Orange); // Costs and Upkeeps for the deep space build menu - The Doctor string cost = (e.item as Ship).GetCost(EmpireManager.GetEmpireByName(this.screen.PlayerLoyalty)).ToString(); string upkeep = "Doctor rocks"; if (GlobalStats.ActiveModInfo != null && GlobalStats.ActiveModInfo.useProportionalUpkeep) { upkeep = (e.item as Ship).GetMaintCostRealism(EmpireManager.GetEmpireByName(this.screen.PlayerLoyalty)).ToString("F2"); } else { upkeep = (e.item as Ship).GetMaintCost(EmpireManager.GetEmpireByName(this.screen.PlayerLoyalty)).ToString("F2"); } Rectangle prodiconRect = new Rectangle((int)tCursor.X + 200, (int)tCursor.Y - Fonts.Arial12Bold.LineSpacing, ResourceManager.TextureDict["NewUI/icon_production"].Width, ResourceManager.TextureDict["NewUI/icon_production"].Height); this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/icon_production"], prodiconRect, Color.White); tCursor = new Vector2((float)(prodiconRect.X - 60), (float)(prodiconRect.Y + prodiconRect.Height / 2 - Fonts.Arial12Bold.LineSpacing / 2)); this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, string.Concat(upkeep, " BC/Y"), tCursor, Color.Salmon); tCursor = new Vector2((float)(prodiconRect.X + 26), (float)(prodiconRect.Y + prodiconRect.Height / 2 - Fonts.Arial12Bold.LineSpacing / 2)); this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, cost, tCursor, Color.White); if (e.Plus != 0) { if (e.PlusHover != 0) { this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/icon_build_add_hover2"], e.addRect, Color.White); } else { this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/icon_build_add_hover1"], e.addRect, Color.White); } } if (e.Edit != 0) { if (e.EditHover != 0) { this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/icon_build_edit_hover2"], e.editRect, Color.White); } else { this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/icon_build_edit_hover1"], e.editRect, Color.White); } } if (e.clickRect.Y == 0) { } } else { if ((e.item as Ship).Name == "Subspace Projector") { this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["ShipIcons/subspace_projector"], new Rectangle((int)bCursor.X, (int)bCursor.Y, 29, 30), Color.White); } else { this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[ResourceManager.HullsDict[(e.item as Ship).GetShipData().Hull].IconPath], new Rectangle((int)bCursor.X, (int)bCursor.Y, 29, 30), Color.White); } Vector2 tCursor = new Vector2(bCursor.X + 40f, bCursor.Y + 3f); string name = (e.item as Ship).Name; SpriteFont nameFont = Fonts.Arial10; this.ScreenManager.SpriteBatch.DrawString(nameFont, name, tCursor, Color.White); tCursor.Y = tCursor.Y + (float)Fonts.Arial12Bold.LineSpacing; this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, (e.item as Ship).Role, tCursor, Color.Orange); // Costs and Upkeeps for the deep space build menu - The Doctor string cost = (e.item as Ship).GetCost(EmpireManager.GetEmpireByName(this.screen.PlayerLoyalty)).ToString(); string upkeep = "Doctor rocks"; if (GlobalStats.ActiveModInfo != null && GlobalStats.ActiveModInfo.useProportionalUpkeep) { upkeep = (e.item as Ship).GetMaintCostRealism(EmpireManager.GetEmpireByName(this.screen.PlayerLoyalty)).ToString("F2"); } else { upkeep = (e.item as Ship).GetMaintCost(EmpireManager.GetEmpireByName(this.screen.PlayerLoyalty)).ToString("F2"); } Rectangle prodiconRect = new Rectangle((int)tCursor.X + 200, (int)tCursor.Y - Fonts.Arial12Bold.LineSpacing, ResourceManager.TextureDict["NewUI/icon_production"].Width, ResourceManager.TextureDict["NewUI/icon_production"].Height); this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/icon_production"], prodiconRect, Color.White); tCursor = new Vector2((float)(prodiconRect.X - 60), (float)(prodiconRect.Y + prodiconRect.Height / 2 - Fonts.Arial12Bold.LineSpacing / 2)); this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial8Bold, string.Concat(upkeep, " BC/Y"), tCursor, Color.Salmon); tCursor = new Vector2((float)(prodiconRect.X + 26), (float)(prodiconRect.Y + prodiconRect.Height / 2 - Fonts.Arial12Bold.LineSpacing / 2)); this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, cost, tCursor, Color.White); if (e.Plus != 0) { if (e.PlusHover != 0) { this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/icon_build_add_hover2"], e.addRect, Color.White); } else { this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/icon_build_add"], e.addRect, Color.White); } } if (e.Edit != 0) { if (e.EditHover != 0) { this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/icon_build_edit_hover2"], e.editRect, Color.White); } else { this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/icon_build_edit"], e.editRect, Color.White); } } if (e.clickRect.Y == 0) { } } } if (this.selector != null) { this.selector.Draw(); } if (this.itemToBuild != null) { float scale = (float)((float)this.itemToBuild.Size) / (float)ResourceManager.TextureDict["TacticalIcons/symbol_platform"].Width; Vector2 IconOrigin = new Vector2((float)(ResourceManager.TextureDict["TacticalIcons/symbol_platform"].Width / 2), (float)(ResourceManager.TextureDict["TacticalIcons/symbol_platform"].Width / 2)); scale = scale * 4000f / this.screen.camHeight; if (scale > 1f) { scale = 1f; } if (scale < 0.15f) { scale = 0.15f; } Viewport viewport = this.ScreenManager.GraphicsDevice.Viewport; Vector3 nearPoint = viewport.Unproject(new Vector3(MousePos.X, MousePos.Y, 0f), this.screen.projection, this.screen.view, Matrix.Identity); Viewport viewport1 = this.ScreenManager.GraphicsDevice.Viewport; Vector3 farPoint = viewport1.Unproject(new Vector3(MousePos.X, MousePos.Y, 1f), this.screen.projection, this.screen.view, Matrix.Identity); Vector3 direction = farPoint - nearPoint; direction.Normalize(); Ray pickRay = new Ray(nearPoint, direction); float k = -pickRay.Position.Z / pickRay.Direction.Z; Vector3 pickedPosition = new Vector3(pickRay.Position.X + k * pickRay.Direction.X, pickRay.Position.Y + k * pickRay.Direction.Y, 0f); Vector2 pp = new Vector2(pickedPosition.X, pickedPosition.Y); this.TargetPlanet = Guid.Empty; this.TetherOffset = Vector2.Zero; lock (GlobalStats.ClickableSystemsLock) { foreach (UniverseScreen.ClickablePlanets p in this.screen.ClickPlanetList) { if (Vector2.Distance(p.planetToClick.Position, pp) > (2500f * p.planetToClick.scale)) { continue; } this.TetherOffset = pp - p.planetToClick.Position; this.TargetPlanet = p.planetToClick.guid; Primitives2D.DrawLine(this.ScreenManager.SpriteBatch, p.ScreenPos, MousePos, new Color(255, 165, 0, 150), 3f); this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial20Bold, string.Concat("Will Orbit ", p.planetToClick.Name), new Vector2(MousePos.X, MousePos.Y + 34f), Color.White); } } Rectangle? nullable = null; this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["TacticalIcons/symbol_platform"], MousePos, nullable, new Color(0, 255, 0, 100), 0f, IconOrigin, scale, SpriteEffects.None, 1f); } }