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 SystemInfoUIElement(Rectangle r, Ship_Game.ScreenManager sm, UniverseScreen screen) { this.screen = screen; this.ScreenManager = sm; this.ElementRect = r; this.sel = new Selector(this.ScreenManager, r, Color.Black); base.TransitionOnTime = TimeSpan.FromSeconds(0.25); base.TransitionOffTime = TimeSpan.FromSeconds(0.25); this.SliderRect = new Rectangle(r.X + r.Width - 100, r.Y + r.Height - 40, 500, 40); this.clickRect = new Rectangle(this.ElementRect.X + this.ElementRect.Width - 16, this.ElementRect.Y + this.ElementRect.Height / 2 - 11, 11, 22); this.LeftRect = new Rectangle(r.X, r.Y + 44, 200, r.Height - 44); this.RightRect = new Rectangle(r.X + 200, r.Y + 44, 200, r.Height - 44); }
//private string fmt = "0.#"; public OrbitalAssetsUIElement(Rectangle r, Ship_Game.ScreenManager sm, UniverseScreen screen, Planet p) { this.p = p; this.screen = screen; this.ScreenManager = sm; this.ElementRect = r; this.sel = new Selector(this.ScreenManager, r, Color.Black); base.TransitionOnTime = TimeSpan.FromSeconds(0.25); base.TransitionOffTime = TimeSpan.FromSeconds(0.25); this.SliderRect = new Rectangle(r.X + r.Width - 100, r.Y + r.Height - 40, 500, 40); this.clickRect = new Rectangle(this.ElementRect.X + this.ElementRect.Width - 16, this.ElementRect.Y + this.ElementRect.Height / 2 - 11, 11, 22); this.LeftRect = new Rectangle(r.X, r.Y + 44, 200, r.Height - 44); this.RightRect = new Rectangle(r.X + 200, r.Y + 44, 200, r.Height - 44); this.BombardButton = new DanButton(new Vector2((float)(this.LeftRect.X + 20), (float)(this.LeftRect.Y + 25)), Localizer.Token(1431)) { IsToggle = true, ToggledText = Localizer.Token(1426) }; this.LandTroops = new DanButton(new Vector2((float)(this.LeftRect.X + 20), (float)(this.LeftRect.Y + 75)), Localizer.Token(1432)) { IsToggle = true, ToggledText = Localizer.Token(1433) }; this.flagRect = new Rectangle(r.X + r.Width - 31, r.Y + 22 - 13, 26, 26); this.DefenseRect = new Rectangle(this.LeftRect.X + 12, this.LeftRect.Y + 18, 22, 22); this.SoftAttackRect = new Rectangle(this.LeftRect.X + 12, this.DefenseRect.Y + 22 + 5, 16, 16); this.HardAttackRect = new Rectangle(this.LeftRect.X + 12, this.SoftAttackRect.Y + 16 + 5, 16, 16); this.DefenseRect.X = this.DefenseRect.X - 3; this.ItemDisplayRect = new Rectangle(this.LeftRect.X + 85, this.LeftRect.Y + 5, 85, 85); OrbitalAssetsUIElement.TippedItem bomb = new OrbitalAssetsUIElement.TippedItem() { r = this.BombardButton.r, TIP_ID = 32 }; this.ToolTipItems.Add(bomb); bomb = new OrbitalAssetsUIElement.TippedItem() { r = this.LandTroops.r, TIP_ID = 36 }; this.ToolTipItems.Add(bomb); }
public TroopInfoUIElement(Rectangle r, Ship_Game.ScreenManager sm, UniverseScreen screen) { this.screen = screen; this.ScreenManager = sm; this.ElementRect = r; this.sel = new Selector(this.ScreenManager, r, Color.Black); base.TransitionOnTime = TimeSpan.FromSeconds(0.25); base.TransitionOffTime = TimeSpan.FromSeconds(0.25); this.SliderRect = new Rectangle(r.X + r.Width - 100, r.Y + r.Height - 40, 500, 40); this.clickRect = new Rectangle(this.ElementRect.X + this.ElementRect.Width - 16, this.ElementRect.Y + this.ElementRect.Height / 2 - 11, 11, 22); this.LeftRect = new Rectangle(r.X, r.Y + 44, 200, r.Height - 44); this.RightRect = new Rectangle(r.X + 200, r.Y + 44, 200, r.Height - 44); this.flagRect = new Rectangle(r.X + r.Width - 31, r.Y + 22 - 13, 26, 26); this.DefenseRect = new Rectangle(this.LeftRect.X + 12, this.LeftRect.Y + 18, 22, 22); this.SoftAttackRect = new Rectangle(this.LeftRect.X + 12, this.DefenseRect.Y + 22 + 5, 16, 16); this.HardAttackRect = new Rectangle(this.LeftRect.X + 12, this.SoftAttackRect.Y + 16 + 5, 16, 16); this.DefenseRect.X = this.DefenseRect.X - 3; this.ItemDisplayRect = new Rectangle(this.LeftRect.X + 85, this.LeftRect.Y + 5, 128, 128); Rectangle DesRect = new Rectangle(this.HardAttackRect.X, this.HardAttackRect.Y - 10, this.LeftRect.Width + 8, 95); Submenu sub = new Submenu(this.ScreenManager, DesRect); this.DescriptionSL = new ScrollList(sub, Fonts.Arial12.LineSpacing + 1); TroopInfoUIElement.TippedItem def = new TroopInfoUIElement.TippedItem() { r = this.DefenseRect, TIP_ID = 33 }; this.ToolTipItems.Add(def); def = new TroopInfoUIElement.TippedItem() { r = this.SoftAttackRect, TIP_ID = 34 }; this.ToolTipItems.Add(def); def = new TroopInfoUIElement.TippedItem() { r = this.HardAttackRect, TIP_ID = 35 }; this.ToolTipItems.Add(def); }
public void HandleInputorig(InputState input) { this.currentMouse = Mouse.GetState(); Vector2 mousePos = new Vector2((float)this.currentMouse.X, (float)this.currentMouse.Y); foreach (UIButton b in this.Buttons) { if (!HelperFunctions.CheckIntersection(b.Rect, mousePos)) { b.State = UIButton.PressState.Normal; } else { if (b.State != UIButton.PressState.Hover && b.State != UIButton.PressState.Pressed) { AudioManager.PlayCue("mouse_over4"); } b.State = UIButton.PressState.Hover; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Pressed) { b.State = UIButton.PressState.Pressed; } if (this.currentMouse.LeftButton != ButtonState.Pressed || this.previousMouse.LeftButton != ButtonState.Released) { continue; } string launches = b.Launches; string str = launches; if (launches == null) { continue; } if (str == "Engage") { AudioManager.PlayCue("echo_affirm"); this.OnEngage(); } else if (str == "Rule Options") { base.ScreenManager.AddScreen(new RuleOptionsScreen()); AudioManager.PlayCue("echo_affirm"); } else if (str == "Abort") { AudioManager.PlayCue("echo_affirm"); this.ExitScreen(); } else if (str == "Clear") { foreach (TraitEntry trait in this.AllTraits) { trait.Selected = false; } } } } this.DescriptionSL.HandleInput(input); if (!this.DrawingColorSelector) { this.selector = null; foreach (ScrollList.Entry e in this.RaceArchetypeSL.Entries) { if (!HelperFunctions.CheckIntersection(e.clickRect, mousePos) || this.currentMouse.LeftButton != ButtonState.Pressed || this.previousMouse.LeftButton != ButtonState.Released) { continue; } this.SelectedData = e.item as EmpireData; AudioManager.PlayCue("echo_affirm"); this.SetEmpireData(this.SelectedData); } this.RaceArchetypeSL.HandleInput(input); this.Traits.HandleInput(this); if (!HelperFunctions.CheckIntersection(this.RaceName.ClickableArea, mousePos)) { this.RaceName.Hover = false; } else { this.RaceName.Hover = true; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released && !this.SingEntry.HandlingInput && !this.PlurEntry.HandlingInput && !this.HomeSystemEntry.HandlingInput) { this.RaceName.HandlingInput = true; } } if (!HelperFunctions.CheckIntersection(this.SingEntry.ClickableArea, mousePos)) { this.SingEntry.Hover = false; } else { this.SingEntry.Hover = true; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released && !this.RaceName.HandlingInput && !this.PlurEntry.HandlingInput && !this.HomeSystemEntry.HandlingInput) { this.SingEntry.HandlingInput = true; } } if (!HelperFunctions.CheckIntersection(this.PlurEntry.ClickableArea, mousePos)) { this.PlurEntry.Hover = false; } else { this.PlurEntry.Hover = true; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released && !this.RaceName.HandlingInput && !this.SingEntry.HandlingInput && !this.HomeSystemEntry.HandlingInput) { this.PlurEntry.HandlingInput = true; } } if (!HelperFunctions.CheckIntersection(this.HomeSystemEntry.ClickableArea, mousePos)) { this.HomeSystemEntry.Hover = false; } else { this.HomeSystemEntry.Hover = true; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released && !this.RaceName.HandlingInput && !this.SingEntry.HandlingInput && !this.PlurEntry.HandlingInput) { this.HomeSystemEntry.HandlingInput = true; } } if (this.RaceName.HandlingInput) { this.RaceName.HandleTextInput(ref this.RaceName.Text); } if (this.SingEntry.HandlingInput) { this.SingEntry.HandleTextInput(ref this.SingEntry.Text); } if (this.PlurEntry.HandlingInput) { this.PlurEntry.HandleTextInput(ref this.PlurEntry.Text); } if (this.HomeSystemEntry.HandlingInput) { this.HomeSystemEntry.HandleTextInput(ref this.HomeSystemEntry.Text); } this.traitsSL.HandleInput(input); for (int i = this.traitsSL.indexAtTop; i < this.traitsSL.Entries.Count && i < this.traitsSL.indexAtTop + this.traitsSL.entriesToDisplay; i++) { ScrollList.Entry f = this.traitsSL.Entries[i]; if (!HelperFunctions.CheckIntersection(f.clickRect, mousePos)) { f.clickRectHover = 0; } else { if (f.clickRectHover == 0) { AudioManager.PlayCue("sd_ui_mouseover"); } this.selector = new Selector(base.ScreenManager, f.clickRect); f.clickRectHover = 1; TraitEntry t = f.item as TraitEntry; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { if (t.Selected && this.TotalPointsUsed + t.trait.Cost >= 0) { t.Selected = !t.Selected; RaceDesignScreen totalPointsUsed = this; totalPointsUsed.TotalPointsUsed = totalPointsUsed.TotalPointsUsed + t.trait.Cost; AudioManager.GetCue("blip_click").Play(); int excludes = t.trait.Excludes; foreach (TraitEntry ex in this.AllTraits) { if (t.trait.Excludes != ex.trait.TraitName) { continue; } ex.Excluded = false; } } else if (this.TotalPointsUsed - t.trait.Cost < 0 || t.Selected) { AudioManager.PlayCue("UI_Misc20"); } else { bool OK = true; int num = t.trait.Excludes; foreach (TraitEntry ex in this.AllTraits) { if (t.trait.Excludes != ex.trait.TraitName || !ex.Selected) { continue; } OK = false; } if (OK) { t.Selected = true; RaceDesignScreen raceDesignScreen = this; raceDesignScreen.TotalPointsUsed = raceDesignScreen.TotalPointsUsed - t.trait.Cost; AudioManager.GetCue("blip_click").Play(); int excludes1 = t.trait.Excludes; foreach (TraitEntry ex in this.AllTraits) { if (t.trait.Excludes != ex.trait.TraitName) { continue; } ex.Excluded = true; } } } this.DoRaceDescription(); } } } if (HelperFunctions.CheckIntersection(this.GalaxySizeRect, mousePos) && this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { AudioManager.GetCue("blip_click").Play(); RaceDesignScreen galaxysize = this; galaxysize.Galaxysize = (RaceDesignScreen.GalSize)((int)galaxysize.Galaxysize + (int)RaceDesignScreen.GalSize.Small); if (this.Galaxysize > RaceDesignScreen.GalSize.Epic) { this.Galaxysize = RaceDesignScreen.GalSize.Tiny; } } if (HelperFunctions.CheckIntersection(this.NumberStarsRect, mousePos) && this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { AudioManager.GetCue("blip_click").Play(); RaceDesignScreen starEnum = this; starEnum.StarEnum = (RaceDesignScreen.StarNum)((int)starEnum.StarEnum + (int)RaceDesignScreen.StarNum.Uncommon); if (this.StarEnum > RaceDesignScreen.StarNum.Crowded) { this.StarEnum = RaceDesignScreen.StarNum.Rare; } } if (HelperFunctions.CheckIntersection(this.NumOpponentsRect, mousePos) && this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { AudioManager.GetCue("blip_click").Play(); RaceDesignScreen raceDesignScreen1 = this; raceDesignScreen1.numOpponents = raceDesignScreen1.numOpponents + 1; if (this.numOpponents > 7) { this.numOpponents = 1; } } HelperFunctions.CheckIntersection(this.GameModeRect, mousePos); if (HelperFunctions.CheckIntersection(this.ScaleRect, mousePos)) { if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { AudioManager.GetCue("blip_click").Play(); RaceDesignScreen gameScale = this; gameScale.GameScale = gameScale.GameScale + 1; if (this.GameScale > 4) { this.GameScale = 1; } } if (input.RightMouseClick) { AudioManager.GetCue("blip_click").Play(); RaceDesignScreen gameScale1 = this; gameScale1.GameScale = gameScale1.GameScale - 1; if (this.GameScale < 1) { this.GameScale = 4; } } } if (HelperFunctions.CheckIntersection(this.PacingRect, mousePos)) { if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { AudioManager.GetCue("blip_click").Play(); RaceDesignScreen pacing = this; pacing.Pacing = pacing.Pacing + 25; if (this.Pacing > 400) { this.Pacing = 100; } } if (input.RightMouseClick) { AudioManager.GetCue("blip_click").Play(); RaceDesignScreen pacing1 = this; pacing1.Pacing = pacing1.Pacing - 25; if (this.Pacing < 100) { this.Pacing = 400; } } } if (HelperFunctions.CheckIntersection(this.DifficultyRect, mousePos)) { if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { AudioManager.GetCue("blip_click").Play(); RaceDesignScreen raceDesignScreen2 = this; raceDesignScreen2.difficulty = (UniverseData.GameDifficulty)((int)raceDesignScreen2.difficulty + (int)UniverseData.GameDifficulty.Normal); if (this.difficulty > UniverseData.GameDifficulty.Brutal) { this.difficulty = UniverseData.GameDifficulty.Easy; } } if (input.RightMouseClick) { AudioManager.GetCue("blip_click").Play(); RaceDesignScreen raceDesignScreen3 = this; raceDesignScreen3.difficulty = (UniverseData.GameDifficulty)((int)raceDesignScreen3.difficulty - (int)UniverseData.GameDifficulty.Normal); if (this.difficulty < UniverseData.GameDifficulty.Easy) { this.difficulty = UniverseData.GameDifficulty.Brutal; } } } if (HelperFunctions.CheckIntersection(this.FlagRect, mousePos) && this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.DrawingColorSelector = !this.DrawingColorSelector; } if (HelperFunctions.CheckIntersection(this.FlagRight, mousePos) && this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { if (ResourceManager.FlagTextures.Count - 1 <= this.FlagIndex) { this.FlagIndex = 0; } else { RaceDesignScreen flagIndex = this; flagIndex.FlagIndex = flagIndex.FlagIndex + 1; } AudioManager.GetCue("blip_click").Play(); } if (HelperFunctions.CheckIntersection(this.FlagLeft, mousePos) && this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { if (this.FlagIndex <= 0) { this.FlagIndex = ResourceManager.FlagTextures.Count - 1; } else { RaceDesignScreen flagIndex1 = this; flagIndex1.FlagIndex = flagIndex1.FlagIndex - 1; } AudioManager.GetCue("blip_click").Play(); } } else if (!HelperFunctions.CheckIntersection(this.ColorSelector, input.CursorPosition)) { if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.DrawingColorSelector = false; } } else if (this.currentMouse.LeftButton == ButtonState.Pressed) { int yPosition = this.ColorSelector.Y + 10; int xPositionStart = this.ColorSelector.X + 10; for (int i = 0; i <= 255; i++) { for (int j = 0; j <= 255; j++) { Color thisColor = new Color(Convert.ToByte(i), Convert.ToByte(j), this.currentObjectColor.B); Rectangle ColorRect = new Rectangle(2 * j + xPositionStart - 4, yPosition - 4, 8, 8); if (HelperFunctions.CheckIntersection(ColorRect, input.CursorPosition)) { this.currentObjectColor = thisColor; } } yPosition = yPosition + 2; } yPosition = this.ColorSelector.Y + 10; for (int i = 0; i <= 255; i++) { Color thisColor = new Color(this.currentObjectColor.R, this.currentObjectColor.G, Convert.ToByte(i)); Rectangle ColorRect = new Rectangle(this.ColorSelector.X + 10 + 575, yPosition, 20, 2); if (HelperFunctions.CheckIntersection(ColorRect, input.CursorPosition)) { this.currentObjectColor = thisColor; } yPosition = yPosition + 2; } } this.previousMouse = this.currentMouse; if (input.Escaped) { this.ExitScreen(); } }
public override void HandleInput(InputState input) { this.selector = null; this.currentMouse = input.CurrentMouseState; Vector2 MousePos = new Vector2((float)this.currentMouse.X, (float)this.currentMouse.Y); if (input.Escaped || input.RightMouseClick) { this.ExitScreen(); } foreach (UIButton b in this.Buttons) { if (!HelperFunctions.CheckIntersection(b.Rect, MousePos)) { b.State = UIButton.PressState.Normal; } else { b.State = UIButton.PressState.Hover; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Pressed) { b.State = UIButton.PressState.Pressed; } if (this.currentMouse.LeftButton != ButtonState.Released || this.previousMouse.LeftButton != ButtonState.Pressed) { continue; } string text = b.Text; if (text == null || !(text == "Load")) { continue; } if (this.activeFile != null) { /*if (this.screen != null) //always false { this.screen.ExitScreen(); }*/ XmlSerializer serializer1 = new XmlSerializer(typeof(FleetDesign)); FleetDesign data = (FleetDesign)serializer1.Deserialize(this.activeFile.OpenRead()); this.parentScreen.LoadData(data); } else { AudioManager.PlayCue("UI_Misc20"); } this.ExitScreen(); } } foreach (ScrollList.Entry e in this.SavesSL.Entries) { if (!HelperFunctions.CheckIntersection(e.clickRect, MousePos)) { e.clickRectHover = 0; } else { if (e.clickRectHover == 0) { AudioManager.PlayCue("sd_ui_mouseover"); } e.clickRectHover = 1; this.selector = new Selector(base.ScreenManager, e.clickRect); if (this.currentMouse.LeftButton != ButtonState.Released || this.previousMouse.LeftButton != ButtonState.Pressed) { continue; } this.activeFile = e.item as FileInfo; AudioManager.PlayCue("sd_ui_accept_alt3"); this.EnterNameArea.Text = Path.GetFileNameWithoutExtension(this.activeFile.Name); } } this.previousMouse = input.LastMouseState; base.HandleInput(input); }
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(); }
//added by gremlin deveksmod Spy Handleinput public void HandleInput(InputState input) { string Names; this.AgentSL.HandleInput(input); if (this.SelectedAgent != null) { this.OpsSL.HandleInput(input); } if (HelperFunctions.CheckIntersection(this.RecruitButton.r, input.CursorPosition)) { ToolTip.CreateTooltip(Localizer.Token(2180), this.ScreenManager); } if (this.RecruitButton.HandleInput(input)) { if (EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).Money < (ResourceManager.AgentMissionData.AgentCost + ResourceManager.AgentMissionData.TrainingCost) || spyLimitCount <= 0)//EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).data.AgentList.Count >= EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).GetPlanets().Count) { AudioManager.PlayCue("UI_Misc20"); } else { Empire empireByName = EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty); empireByName.Money -= ResourceManager.AgentMissionData.AgentCost; Names = (!File.Exists(string.Concat("Content/NameGenerators/spynames_", EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).data.Traits.ShipType, ".txt")) ? File.ReadAllText("Content/NameGenerators/spynames_Humans.txt") : File.ReadAllText(string.Concat("Content/NameGenerators/spynames_", EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).data.Traits.ShipType, ".txt"))); string[] Tokens = Names.Split(new char[] { ',' }); Agent a = new Agent(); a.Name = AgentComponent.GetName(Tokens); //Added new agent information a.Age = RandomMath.RandomBetween(20, 30); int RandomPlanetIndex = HelperFunctions.GetRandomIndex(EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).GetPlanets().Count); a.HomePlanet = EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).GetPlanets()[RandomPlanetIndex].Name; EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).data.AgentList.Add(a); this.AgentSL.AddItem(a); a.AssignMission(AgentMission.Training, empireByName, ""); } } this.selector = null; for (int i = this.AgentSL.indexAtTop; i < this.AgentSL.Entries.Count && i < this.AgentSL.indexAtTop + this.AgentSL.entriesToDisplay; i++) { try { ScrollList.Entry e = this.AgentSL.Entries[i]; if (HelperFunctions.CheckIntersection(e.clickRect, input.CursorPosition)) { this.selector = new Selector(this.ScreenManager, e.clickRect); if (input.InGameSelect) { this.SelectedAgent = e.item as Agent; foreach (ScrollList.Entry entry in this.OpsSL.Entries) { (entry.item as MissionEntry).Initialize(); } AudioManager.PlayCue("sd_ui_accept_alt3"); } } } catch { } } if (this.SelectedAgent != null) { for (int i = this.OpsSL.indexAtTop; i < this.OpsSL.Entries.Count && i < this.OpsSL.indexAtTop + this.OpsSL.entriesToDisplay; i++) { try { ScrollList.Entry e = this.OpsSL.Entries[i]; (e.item as MissionEntry).HandleInput(input); if (HelperFunctions.CheckIntersection(e.clickRect, input.CursorPosition)) { if (!HelperFunctions.CheckIntersection((e.item as MissionEntry).DoMission.Rect, input.CursorPosition)) { ToolTip.CreateTooltip(Localizer.Token((e.item as MissionEntry).DescriptionIndex), this.ScreenManager); } else { ToolTip.CreateTooltip(Localizer.Token(2198), Ship.universeScreen.ScreenManager); } } } catch { } } } if (CBAutoRepeat != null && cbSpyMute != null) { CBAutoRepeat.HandleInput(input); cbSpyMute.HandleInput(input); } }
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(); } }
public override void HandleInput(InputState input) { this.selector = null; if (this.CurrentButton==null &&( input.Escaped || input.RightMouseClick)) { this.ExitScreen(); } foreach (UIButton b in this.Buttons) { if (CurrentButton != null && b.Launches != "Visit") continue; if (!HelperFunctions.CheckIntersection(b.Rect, input.CursorPosition) ) { b.State = UIButton.PressState.Normal; } else { b.State = UIButton.PressState.Hover; if (input.InGameSelect) { b.State = UIButton.PressState.Pressed; } if (!input.InGameSelect) { continue; } string launches = b.Launches; string str = launches; if (launches == null) { continue; } if (str == "Load") { if (this.ActiveEntry == null) { continue; } this.CurrentButton = b; b.Text = "Loading"; if (GlobalStats.ActiveMod != null) { ResourceManager.Reset(); ResourceManager.Initialize(base.ScreenManager.Content); } this.modLoad = Task.Factory.StartNew(loadModTask); } else if (str == "Visit") { if (string.IsNullOrEmpty(this.ActiveEntry.mi.URL)) Process.Start("http://www.stardrivegame.com/forum/viewtopic.php?f=6&t=696"); else Process.Start(this.ActiveEntry.mi.URL); } else if (str == "shiptool" && this.CurrentButton == null) { base.ScreenManager.AddScreen(new ShipToolScreen()); } else if (str == "Disable" && this.CurrentButton==null) { GlobalStats.ActiveMod = null; ResourceManager.WhichModPath = "Content"; GlobalStats.ActiveMod = null; GlobalStats.ActiveModInfo = null; ResourceManager.Reset(); ResourceManager.Initialize(base.ScreenManager.Content); ResourceManager.LoadEmpires(); Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); config.AppSettings.Settings["ActiveMod"].Value = ""; config.Save(); this.ExitScreen(); this.mmscreen.ResetMusic(); } } } if (this.CurrentButton != null) { if (this.flip) { if (CurrentButton.PressColor.A > 253) this.flip = false; else CurrentButton.PressColor.A++; } else { if (CurrentButton.PressColor.A < 1) this.flip = true; else CurrentButton.PressColor.A--; } if (CurrentButton.State != UIButton.PressState.Pressed) CurrentButton.State = UIButton.PressState.Pressed; return; } this.ModsSL.HandleInput(input); foreach (ScrollList.Entry e in this.ModsSL.Entries) { if (!HelperFunctions.CheckIntersection(e.clickRect, input.CursorPosition)) { e.clickRectHover = 0; } else { if (e.clickRectHover == 0) { AudioManager.PlayCue("sd_ui_mouseover"); } e.clickRectHover = 1; this.selector = new Selector(base.ScreenManager, e.clickRect); if (!input.InGameSelect) { continue; } AudioManager.PlayCue("sd_ui_accept_alt3"); this.EnterNameArea.Text = (e.item as ModEntry).mi.ModName; this.ActiveEntry = e.item as ModEntry; foreach(UIButton button in this.Buttons) { if (button.Launches =="Visit") { string Text; if (this.ActiveEntry == null || string.IsNullOrEmpty(this.ActiveEntry.mi.URL)) Text = Localizer.Token(4015); else Text = "Goto Mod URL"; button.Text = Text; break; } } } } base.HandleInput(input); }
public override void HandleInput(InputState input) { this.ShipSL.HandleInput(input); if (input.Escaped || input.CurrentMouseState.RightButton == ButtonState.Pressed) { this.ExitScreen(); } this.selector = null; 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]; if (HelperFunctions.CheckIntersection(e.clickRect, input.CursorPosition)) { this.selector = new Selector(base.ScreenManager, e.clickRect); if (input.InGameSelect) { AudioManager.PlayCue("sd_ui_accept_alt3"); this.RefitTo = e.item as string; } } } if (this.RefitTo != null) { if (HelperFunctions.CheckIntersection(this.RefitOne.Rect, input.CursorPosition)) { ToolTip.CreateTooltip(Localizer.Token(2267), base.ScreenManager); if (input.InGameSelect) { this.shiptorefit.GetAI().OrderRefitTo(this.RefitTo); AudioManager.PlayCue("echo_affirm"); this.ExitScreen(); } } if (HelperFunctions.CheckIntersection(this.RefitAll.Rect, input.CursorPosition)) { ToolTip.CreateTooltip(Localizer.Token(2268), base.ScreenManager); if (input.InGameSelect) { foreach (Ship ship in EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).GetShips()) { if (ship.Name != this.shiptorefit.Name) { continue; } ship.GetAI().OrderRefitTo(this.RefitTo); } AudioManager.PlayCue("echo_affirm"); this.ExitScreen(); } } } }
public override void HandleInput(InputState input) { this.selector = null; this.currentMouse = input.CurrentMouseState; Vector2 MousePos = new Vector2((float)this.currentMouse.X, (float)this.currentMouse.Y); if (input.Escaped || input.RightMouseClick || this.close.HandleInput(input)) { this.ExitScreen(); return; } foreach (UIButton b in this.Buttons) { if (!HelperFunctions.CheckIntersection(b.Rect, MousePos)) { b.State = UIButton.PressState.Normal; } else { b.State = UIButton.PressState.Hover; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Pressed) { b.State = UIButton.PressState.Pressed; } if (this.currentMouse.LeftButton != ButtonState.Released || this.previousMouse.LeftButton != ButtonState.Pressed) { continue; } string launches = b.Launches; if (launches == null || !(launches == "Load")) { continue; } if (this.activeFile != null) { if (this.screen != null) { this.screen.ExitScreen(); } base.ScreenManager.AddScreen(new LoadUniverseScreen(this.activeFile)); if (this.mmscreen != null) { this.mmscreen.ExitScreen(); } } else { AudioManager.PlayCue("UI_Misc20"); } this.ExitScreen(); } } this.SavesSL.HandleInput(input); for (int i = this.SavesSL.indexAtTop; i < this.SavesSL.Entries.Count && i < this.SavesSL.indexAtTop + this.SavesSL.entriesToDisplay; i++) { ScrollList.Entry e = this.SavesSL.Entries[i]; if (!HelperFunctions.CheckIntersection(e.clickRect, MousePos)) { e.clickRectHover = 0; } else { if (e.clickRectHover == 0) { AudioManager.PlayCue("sd_ui_mouseover"); } e.clickRectHover = 1; this.selector = new Selector(base.ScreenManager, e.clickRect); if (input.InGameSelect) { this.activeFile = (e.item as HeaderData).GetFileInfo(); AudioManager.PlayCue("sd_ui_accept_alt3"); this.EnterNameArea.Text = (e.item as HeaderData).SaveName; } } } this.previousMouse = input.LastMouseState; base.HandleInput(input); }
public ShipInfoUIElement(Rectangle r, Ship_Game.ScreenManager sm, UniverseScreen screen) { this.screen = screen; this.ScreenManager = sm; this.ElementRect = r; this.FlagRect = new Rectangle(r.X + 150, r.Y + 50, 40, 40); this.sel = new Selector(this.ScreenManager, r, Color.Black); base.TransitionOnTime = TimeSpan.FromSeconds(0.25); base.TransitionOffTime = TimeSpan.FromSeconds(0.25); this.SliderRect = new Rectangle(r.X - 100, r.Y + r.Height - 140, 530, 130); this.sliding_element = new SlidingElement(this.SliderRect); this.Housing = r; this.LeftRect = new Rectangle(r.X, r.Y + 44, 180, r.Height - 44); this.RightRect = new Rectangle(this.LeftRect.X + this.LeftRect.Width, this.LeftRect.Y, 220, this.LeftRect.Height); this.ShipNameArea = new UITextEntry() { ClickableArea = new Rectangle(this.Housing.X + 41, this.Housing.Y + 65, 200, Fonts.Arial20Bold.LineSpacing) }; int spacing = 2; this.Power = new Rectangle(this.Housing.X + 187, this.Housing.Y + 110, 20, 20); Rectangle pbarrect = new Rectangle(this.Power.X + this.Power.Width + 15, this.Power.Y, 150, 18); this.pBar = new ProgressBar(pbarrect) { color = "green" }; ShipInfoUIElement.TippedItem ti = new ShipInfoUIElement.TippedItem() { r = this.Power, TIP_ID = 27 }; this.ToolTipItems.Add(ti); this.Shields = new Rectangle(this.Housing.X + 187, this.Housing.Y + 110 + 20 + spacing, 20, 20); Rectangle pshieldsrect = new Rectangle(this.Shields.X + this.Shields.Width + 15, this.Shields.Y, 150, 18); this.sBar = new ProgressBar(pshieldsrect) { color = "blue" }; ti = new ShipInfoUIElement.TippedItem() { r = this.Shields, TIP_ID = 28 }; this.ToolTipItems.Add(ti); this.Ordnance = new Rectangle(this.Housing.X + 187, this.Housing.Y + 110 + 20 + spacing + 20 + spacing, 20, 20); Rectangle pordrect = new Rectangle(this.Ordnance.X + this.Ordnance.Width + 15, this.Ordnance.Y, 150, 18); this.oBar = new ProgressBar(pordrect); ti = new ShipInfoUIElement.TippedItem() { r = this.Ordnance, TIP_ID = 29 }; this.ToolTipItems.Add(ti); this.DefenseRect = new Rectangle(this.Housing.X + 13, this.Housing.Y + 112, 22, 22); ti = new ShipInfoUIElement.TippedItem() { r = this.DefenseRect, TIP_ID = 30 }; this.ToolTipItems.Add(ti); this.TroopRect = new Rectangle(this.Housing.X + 13, this.Housing.Y + 137, 22, 22); ti = new ShipInfoUIElement.TippedItem() { r = this.TroopRect, TIP_ID = 37 }; this.ToolTipItems.Add(ti); this.ShipInfoRect = new Rectangle(this.Housing.X + 60, this.Housing.Y + 110, 115, 115); Rectangle gridRect = new Rectangle(this.Housing.X + 16, this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 45, 34, 24); this.gridbutton = new ToggleButton(gridRect, "SelectionBox/button_grid_active", "SelectionBox/button_grid_inactive", "SelectionBox/button_grid_hover", "SelectionBox/button_grid_pressed", "SelectionBox/icon_grid") { Active = true }; Vector2 OrdersBarPos = new Vector2((float)(this.Power.X + 15), (float)(this.Ordnance.Y + this.Ordnance.Height + spacing + 3)); OrdersBarPos.X = pordrect.X; ToggleButton AttackRuns = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_headon"); this.CombatStatusButtons.Add(AttackRuns); AttackRuns.Action = "attack"; AttackRuns.HasToolTip = true; AttackRuns.WhichToolTip = 1; OrdersBarPos.X = OrdersBarPos.X + 25f; ToggleButton Artillery = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_aft"); this.CombatStatusButtons.Add(Artillery); Artillery.Action = "arty"; Artillery.HasToolTip = true; Artillery.WhichToolTip = 2; OrdersBarPos.X = OrdersBarPos.X + 25f; ToggleButton HoldPos = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_x"); this.CombatStatusButtons.Add(HoldPos); HoldPos.Action = "hold"; HoldPos.HasToolTip = true; HoldPos.WhichToolTip = 65; OrdersBarPos.X = OrdersBarPos.X + 25f; ToggleButton OrbitLeft = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_left"); this.CombatStatusButtons.Add(OrbitLeft); OrbitLeft.Action = "orbit_left"; OrbitLeft.HasToolTip = true; OrbitLeft.WhichToolTip = 3; OrdersBarPos.Y = OrdersBarPos.Y + 25f; ToggleButton BroadsideLeft = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_bleft"); this.CombatStatusButtons.Add(BroadsideLeft); BroadsideLeft.Action = "broadside_left"; BroadsideLeft.HasToolTip = true; BroadsideLeft.WhichToolTip = 159; OrdersBarPos.Y = OrdersBarPos.Y - 25f; OrdersBarPos.X = OrdersBarPos.X + 25f; ToggleButton OrbitRight = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_right"); this.CombatStatusButtons.Add(OrbitRight); OrbitRight.Action = "orbit_right"; OrbitRight.HasToolTip = true; OrbitRight.WhichToolTip = 4; OrdersBarPos.Y = OrdersBarPos.Y + 25f; ToggleButton BroadsideRight = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_bright"); this.CombatStatusButtons.Add(BroadsideRight); BroadsideRight.Action = "broadside_right"; BroadsideRight.HasToolTip = true; BroadsideRight.WhichToolTip = 160; OrdersBarPos.Y = OrdersBarPos.Y - 25f; OrdersBarPos.X = OrdersBarPos.X + 25f; ToggleButton Evade = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_stop"); this.CombatStatusButtons.Add(Evade); Evade.Action = "evade"; Evade.HasToolTip = true; Evade.WhichToolTip = 6; }
public override void HandleInput(InputState input) { this.currentMouse = Mouse.GetState(); Vector2 MousePos = new Vector2((float)this.currentMouse.X, (float)this.currentMouse.Y); bool SelectedSomethingThisFrame = false; this.assetsUI.HandleInput(input); if (this.ActiveTroop != null && this.tInfo.HandleInput(input)) { SelectedSomethingThisFrame = true; } this.selector = null; this.HoveredSquare = null; foreach (PlanetGridSquare pgs in this.p.TilesList) { if (!HelperFunctions.CheckIntersection(pgs.ClickRect, MousePos) || pgs.TroopsHere.Count == 0 && pgs.building == null) { continue; } this.HoveredSquare = pgs; } if (this.OrbitSL.Entries.Count > 0) { if (!HelperFunctions.CheckIntersection(this.LandAll.Rect, input.CursorPosition)) { this.LandAll.State = UIButton.PressState.Normal; } else { this.LandAll.State = UIButton.PressState.Hover; if (input.InGameSelect) { AudioManager.PlayCue("sd_troop_land"); for (int i = 0; i < this.OrbitSL.Entries.Count; i++) { ScrollList.Entry e = this.OrbitSL.Entries[i]; if (e.item is Ship) { (e.item as Ship).GetAI().OrderLandAllTroops(this.p); } else if (e.item is Troop) { (e.item as Troop).GetShip().TroopList.Remove(e.item as Troop); this.p.AssignTroopToTile(e.item as Troop); } } this.OrbitSL.Entries.Clear(); } } } if (p.TroopsHere.Where(mytroops => mytroops.GetOwner() == universeScreen.player).Count() > 0) { if (!HelperFunctions.CheckIntersection(this.LaunchAll.Rect, input.CursorPosition)) { this.LaunchAll.State = UIButton.PressState.Normal; } else { this.LaunchAll.State = UIButton.PressState.Hover; if (input.InGameSelect) { bool play = false; foreach (PlanetGridSquare pgs in this.p.TilesList) { if ( pgs.TroopsHere.Count <= 0 || pgs.TroopsHere[0].GetOwner() !=universeScreen.player || pgs.TroopsHere[0].Launchtimer >= 0) { continue; } try { pgs.TroopsHere[0].AvailableAttackActions = 0; pgs.TroopsHere[0].AvailableMoveActions = 0; pgs.TroopsHere[0].Launchtimer = pgs.TroopsHere[0].MoveTimerBase; pgs.TroopsHere[0].AttackTimer = (float)pgs.TroopsHere[0].AttackTimerBase; pgs.TroopsHere[0].MoveTimer = (float)pgs.TroopsHere[0].MoveTimerBase; play = true; ResourceManager.CreateTroopShipAtPoint((pgs.TroopsHere[0].GetOwner().data.DefaultTroopShip != null) ? pgs.TroopsHere[0].GetOwner().data.DefaultTroopShip : pgs.TroopsHere[0].GetOwner().data.DefaultSmallTransport, pgs.TroopsHere[0].GetOwner(), this.p.Position, pgs.TroopsHere[0]); this.p.TroopsHere.Remove(pgs.TroopsHere[0]); pgs.TroopsHere[0].SetPlanet(null); pgs.TroopsHere.Clear(); } catch { System.Diagnostics.Debug.WriteLine("Troop Launch Crash"); } } if (play) { AudioManager.PlayCue("sd_troop_takeoff"); this.ResetNextFrame = true; } } } } this.OrbitSL.HandleInput(input); foreach (ScrollList.Entry e in this.OrbitSL.Copied) { if (!HelperFunctions.CheckIntersection(e.clickRect, MousePos)) { e.clickRectHover = 0; } else { this.selector = new Selector(this.ScreenManager, e.clickRect); if (this.currentMouse.LeftButton != ButtonState.Pressed || this.previousMouse.LeftButton != ButtonState.Released) { continue; } this.draggedTroop = e; } } if (this.draggedTroop != null && this.currentMouse.LeftButton == ButtonState.Released && this.previousMouse.LeftButton == ButtonState.Pressed) { bool foundPlace = false; foreach (PlanetGridSquare pgs in this.p.TilesList) { if (!HelperFunctions.CheckIntersection(pgs.ClickRect, MousePos)) { continue; } if (!(this.draggedTroop.item is Ship) || (this.draggedTroop.item as Ship).TroopList.Count <= 0) { if (!(this.draggedTroop.item is Troop) || (pgs.building != null || pgs.TroopsHere.Count != 0) && (pgs.building == null || pgs.building.CombatStrength != 0 || pgs.TroopsHere.Count != 0)) { continue; } try { AudioManager.PlayCue("sd_troop_land"); pgs.TroopsHere.Add(this.draggedTroop.item as Troop); pgs.TroopsHere[0].AvailableAttackActions = 0; pgs.TroopsHere[0].AvailableMoveActions = 0; pgs.TroopsHere[0].Launchtimer = pgs.TroopsHere[0].MoveTimerBase; pgs.TroopsHere[0].AttackTimer = (float)pgs.TroopsHere[0].AttackTimerBase; pgs.TroopsHere[0].MoveTimer = (float)pgs.TroopsHere[0].MoveTimerBase; this.p.TroopsHere.Add(this.draggedTroop.item as Troop); (this.draggedTroop.item as Troop).SetPlanet(this.p); this.OrbitSL.Entries.Remove(this.draggedTroop); (this.draggedTroop.item as Troop).GetShip().TroopList.Remove(this.draggedTroop.item as Troop); foundPlace = true; this.draggedTroop = null; } catch { System.Diagnostics.Debug.WriteLine("Troop Launch Crash"); } } else { if ((pgs.building != null || pgs.TroopsHere.Count != 0) && (pgs.building == null || pgs.building.CombatStrength != 0 || pgs.TroopsHere.Count != 0)) { continue; } try { AudioManager.PlayCue("sd_troop_land"); pgs.TroopsHere.Add((this.draggedTroop.item as Ship).TroopList[0]); pgs.TroopsHere[0].AvailableAttackActions = 0; pgs.TroopsHere[0].AvailableMoveActions = 0; pgs.TroopsHere[0].Launchtimer = pgs.TroopsHere[0].MoveTimerBase; pgs.TroopsHere[0].AttackTimer = (float)pgs.TroopsHere[0].AttackTimerBase; pgs.TroopsHere[0].MoveTimer = (float)pgs.TroopsHere[0].MoveTimerBase; this.p.TroopsHere.Add((this.draggedTroop.item as Ship).TroopList[0]); (this.draggedTroop.item as Ship).TroopList[0].SetPlanet(this.p); if (pgs.building != null && !string.IsNullOrEmpty(pgs.building.EventTriggerUID) && pgs.TroopsHere.Count > 0 && !pgs.TroopsHere[0].GetOwner().isFaction && !pgs.TroopsHere[0].GetOwner().MinorRace) { ResourceManager.EventsDict[pgs.building.EventTriggerUID].TriggerPlanetEvent(this.p, pgs.TroopsHere[0].GetOwner(), pgs, EmpireManager.GetEmpireByName(CombatScreen.universeScreen.PlayerLoyalty), CombatScreen.universeScreen); } this.OrbitSL.Entries.Remove(this.draggedTroop); this.OrbitSL.Copied.Remove(this.draggedTroop); (this.draggedTroop.item as Ship).QueueTotalRemoval(); foundPlace = true; this.draggedTroop = null; } catch { System.Diagnostics.Debug.WriteLine("Troop Launch Crash"); } } } if (!foundPlace) { this.draggedTroop = null; AudioManager.PlayCue("UI_Misc20"); } } foreach (PlanetGridSquare pgs in this.p.TilesList) { if (!HelperFunctions.CheckIntersection(pgs.ClickRect, MousePos)) { pgs.highlighted = false; } else { if (!pgs.highlighted) { AudioManager.PlayCue("sd_ui_mouseover"); } pgs.highlighted = true; } if (pgs.CanAttack) { if (!pgs.CanAttack || this.ActiveTroop == null) { continue; } if (!HelperFunctions.CheckIntersection(pgs.TroopClickRect, MousePos)) { pgs.ShowAttackHover = false; } else if (this.ActiveTroop.TroopsHere.Count <= 0) { if (this.ActiveTroop.building == null || this.ActiveTroop.building.CombatStrength <= 0 || this.ActiveTroop.building.AvailableAttackActions <= 0 || this.p.Owner == null || this.p.Owner != EmpireManager.GetEmpireByName(PlanetScreen.screen.PlayerLoyalty)) { continue; } if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { Building activeTroop = this.ActiveTroop.building; activeTroop.AvailableAttackActions = activeTroop.AvailableAttackActions - 1; this.ActiveTroop.building.AttackTimer = 10f; this.StartCombat(this.ActiveTroop, pgs); } pgs.ShowAttackHover = true; } else { if (this.ActiveTroop.TroopsHere[0].AvailableAttackActions <= 0 || this.ActiveTroop.TroopsHere[0].GetOwner() != EmpireManager.GetEmpireByName(PlanetScreen.screen.PlayerLoyalty)) { continue; } if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { if (pgs.x > this.ActiveTroop.x) { this.ActiveTroop.TroopsHere[0].facingRight = true; } else if (pgs.x < this.ActiveTroop.x) { this.ActiveTroop.TroopsHere[0].facingRight = false; } Troop item = this.ActiveTroop.TroopsHere[0]; item.AvailableAttackActions = item.AvailableAttackActions - 1; this.ActiveTroop.TroopsHere[0].AttackTimer = (float)this.ActiveTroop.TroopsHere[0].AttackTimerBase; Troop availableMoveActions = this.ActiveTroop.TroopsHere[0]; availableMoveActions.AvailableMoveActions = availableMoveActions.AvailableMoveActions - 1; this.ActiveTroop.TroopsHere[0].MoveTimer = (float)this.ActiveTroop.TroopsHere[0].MoveTimerBase; this.StartCombat(this.ActiveTroop, pgs); } pgs.ShowAttackHover = true; } } else { if (pgs.TroopsHere.Count > 0) { if (HelperFunctions.CheckIntersection(pgs.TroopClickRect, MousePos) && this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { if (pgs.TroopsHere[0].GetOwner() != EmpireManager.GetEmpireByName(CombatScreen.universeScreen.PlayerLoyalty)) { this.ActiveTroop = pgs; this.tInfo.SetPGS(pgs); SelectedSomethingThisFrame = true; } else { foreach (PlanetGridSquare p1 in this.p.TilesList) { p1.CanAttack = false; p1.CanMoveTo = false; p1.ShowAttackHover = false; } this.ActiveTroop = pgs; this.tInfo.SetPGS(pgs); SelectedSomethingThisFrame = true; } } } else if (pgs.building != null && !pgs.CanMoveTo && HelperFunctions.CheckIntersection(pgs.TroopClickRect, MousePos) && this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { if (this.p.Owner != EmpireManager.GetEmpireByName(CombatScreen.universeScreen.PlayerLoyalty)) { this.ActiveTroop = pgs; this.tInfo.SetPGS(pgs); SelectedSomethingThisFrame = true; } else { foreach (PlanetGridSquare p1 in this.p.TilesList) { p1.CanAttack = false; p1.CanMoveTo = false; p1.ShowAttackHover = false; } this.ActiveTroop = pgs; this.tInfo.SetPGS(pgs); SelectedSomethingThisFrame = true; } } if (this.ActiveTroop == null || !pgs.CanMoveTo || this.ActiveTroop.TroopsHere.Count == 0 || !HelperFunctions.CheckIntersection(pgs.ClickRect, MousePos) || this.ActiveTroop.TroopsHere[0].GetOwner() != EmpireManager.GetEmpireByName(PlanetScreen.screen.PlayerLoyalty) || this.currentMouse.LeftButton != ButtonState.Pressed || this.previousMouse.LeftButton != ButtonState.Released || this.ActiveTroop.TroopsHere[0].AvailableMoveActions <= 0) { continue; } if (pgs.x > this.ActiveTroop.x) { this.ActiveTroop.TroopsHere[0].facingRight = true; } else if (pgs.x < this.ActiveTroop.x) { this.ActiveTroop.TroopsHere[0].facingRight = false; } pgs.TroopsHere.Add(this.ActiveTroop.TroopsHere[0]); Troop troop = pgs.TroopsHere[0]; troop.AvailableMoveActions = troop.AvailableMoveActions - 1; pgs.TroopsHere[0].MoveTimer = (float)pgs.TroopsHere[0].MoveTimerBase; pgs.TroopsHere[0].MovingTimer = 0.75f; pgs.TroopsHere[0].SetFromRect(this.ActiveTroop.TroopClickRect); AudioManager.PlayCue(pgs.TroopsHere[0].MovementCue); this.ActiveTroop.TroopsHere.Clear(); this.ActiveTroop = null; this.ActiveTroop = pgs; pgs.CanMoveTo = false; SelectedSomethingThisFrame = true; } } if (this.ActiveTroop != null && !SelectedSomethingThisFrame && this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released && !HelperFunctions.CheckIntersection(this.SelectedItemRect, input.CursorPosition)) { this.ActiveTroop = null; } if (this.ActiveTroop != null) { this.tInfo.pgs = this.ActiveTroop; } this.DetermineAttackAndMove(); this.hInfo.SetPGS(this.HoveredSquare); this.previousMouse = this.currentMouse; if (input.CurrentMouseState.RightButton != ButtonState.Released || input.LastMouseState.RightButton != ButtonState.Released) { universeScreen.ShipsInCombat.Active = true; universeScreen.PlanetsInCombat.Active = true; } }
public override void HandleInput(InputState input) { this.currentMouse = input.CurrentMouseState; Vector2 MousePos = new Vector2((float)this.currentMouse.X, (float)this.currentMouse.Y); this.ShipDesigns.HandleInput(input); if (input.Escaped || input.RightMouseClick) { this.ExitScreen(); } this.selector = null; for (int i = 0; i < this.ShipDesigns.Entries.Count; i++) { ScrollList.Entry e = this.ShipDesigns.Entries[i]; if (!HelperFunctions.CheckIntersection(e.clickRect, MousePos)) { e.clickRectHover = 0; } else { this.selector = new Selector(base.ScreenManager, e.clickRect); if (e.clickRectHover == 0) { AudioManager.PlayCue("sd_ui_mouseover"); } e.clickRectHover = 1; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.EnterNameArea.Text = (e.item as Ship).Name; AudioManager.PlayCue("sd_ui_accept_alt3"); } } } foreach (UIButton b in this.Buttons) { if (!HelperFunctions.CheckIntersection(b.Rect, MousePos)) { b.State = UIButton.PressState.Normal; } else { if (b.State != UIButton.PressState.Hover && b.State != UIButton.PressState.Pressed) { AudioManager.PlayCue("mouse_over4"); } b.State = UIButton.PressState.Hover; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Pressed) { b.State = UIButton.PressState.Pressed; } if (this.currentMouse.LeftButton != ButtonState.Pressed || this.previousMouse.LeftButton != ButtonState.Released) { continue; } string text = b.Text; if (text == null || !(text == "Save")) { continue; } AudioManager.PlayCue("sd_ui_accept_alt3"); GlobalStats.TakingInput = false; this.EnterNameArea.HandlingInput = false; this.TrySave(); } } this.EnterNameArea.ClickableArea = new Rectangle((int)this.EnternamePos.X, (int)this.EnternamePos.Y, 200, 30); if (!HelperFunctions.CheckIntersection(this.EnterNameArea.ClickableArea, MousePos)) { this.EnterNameArea.Hover = false; } else { this.EnterNameArea.Hover = true; if (this.currentMouse.LeftButton == ButtonState.Released && this.previousMouse.LeftButton == ButtonState.Pressed) { this.EnterNameArea.HandlingInput = true; } } if (!this.EnterNameArea.HandlingInput) { GlobalStats.TakingInput = false; } else { GlobalStats.TakingInput = true; this.EnterNameArea.HandleTextInput(ref this.EnterNameArea.Text); if (input.CurrentKeyboardState.IsKeyDown(Keys.Enter)) { this.EnterNameArea.HandlingInput = false; } } this.previousMouse = input.LastMouseState; base.HandleInput(input); }
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; }
private void DrawSelectedData(GameTime gameTime) { if (this.SelectedNodeList.Count == 1) { this.stuffSelector = new Selector(base.ScreenManager, this.SelectedStuffRect, new Color(0, 0, 0, 180)); this.stuffSelector.Draw(); Vector2 Cursor = new Vector2((float)(this.SelectedStuffRect.X + 20), (float)(this.SelectedStuffRect.Y + 10)); if (this.SelectedNodeList[0].GetShip() == null) { base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial20Bold, string.Concat("(", this.SelectedNodeList[0].ShipName, ")"), Cursor, new Color(255, 239, 208)); } else { base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial20Bold, (!string.IsNullOrEmpty(this.SelectedNodeList[0].GetShip().VanityName) ? this.SelectedNodeList[0].GetShip().VanityName : string.Concat(this.SelectedNodeList[0].GetShip().Name, " (", this.SelectedNodeList[0].GetShip().Role, ")")), Cursor, new Color(255, 239, 208)); } Cursor.Y = (float)(this.OperationsRect.Y + 10); base.ScreenManager.SpriteBatch.DrawString(Fonts.Pirulen12, "Movement Orders", Cursor, new Color(255, 239, 208)); foreach (ToggleButton button in this.OrdersButtons) { button.Draw(base.ScreenManager); } this.operationsSelector = new Selector(base.ScreenManager, this.OperationsRect, new Color(0, 0, 0, 180)); this.operationsSelector.Draw(); Cursor = new Vector2((float)(this.OperationsRect.X + 20), (float)(this.OperationsRect.Y + 10)); base.ScreenManager.SpriteBatch.DrawString(Fonts.Pirulen12, "Target Selection", Cursor, new Color(255, 239, 208)); this.Slider_Armor.Draw(base.ScreenManager); this.Slider_Assist.Draw(base.ScreenManager); this.Slider_Defend.Draw(base.ScreenManager); this.Slider_DPS.Draw(base.ScreenManager); this.Slider_Shield.Draw(base.ScreenManager); this.Slider_Vulture.Draw(base.ScreenManager); this.priorityselector = new Selector(base.ScreenManager, this.PrioritiesRect, new Color(0, 0, 0, 180)); this.priorityselector.Draw(); Cursor = new Vector2((float)(this.PrioritiesRect.X + 20), (float)(this.PrioritiesRect.Y + 10)); base.ScreenManager.SpriteBatch.DrawString(Fonts.Pirulen12, "Priorities", Cursor, new Color(255, 239, 208)); this.OperationalRadius.Draw(base.ScreenManager); this.Slider_Size.Draw(base.ScreenManager); return; } if (this.SelectedNodeList.Count > 1) { this.stuffSelector = new Selector(base.ScreenManager, this.SelectedStuffRect, new Color(0, 0, 0, 180)); this.stuffSelector.Draw(); Vector2 Cursor = new Vector2((float)(this.SelectedStuffRect.X + 20), (float)(this.SelectedStuffRect.Y + 10)); if (this.SelectedNodeList[0].GetShip() == null) { SpriteBatch spriteBatch = base.ScreenManager.SpriteBatch; SpriteFont arial20Bold = Fonts.Arial20Bold; int count = this.SelectedNodeList.Count; spriteBatch.DrawString(arial20Bold, string.Concat("Group of ", count.ToString(), " ships selected"), Cursor, new Color(255, 239, 208)); } else { SpriteBatch spriteBatch1 = base.ScreenManager.SpriteBatch; SpriteFont spriteFont = Fonts.Arial20Bold; int num = this.SelectedNodeList.Count; spriteBatch1.DrawString(spriteFont, string.Concat("Group of ", num.ToString(), " ships selected"), Cursor, new Color(255, 239, 208)); } Cursor.Y = (float)(this.OperationsRect.Y + 10); base.ScreenManager.SpriteBatch.DrawString(Fonts.Pirulen12, "Group Movement Orders", Cursor, new Color(255, 239, 208)); foreach (ToggleButton button in this.OrdersButtons) { button.Draw(base.ScreenManager); } this.operationsSelector = new Selector(base.ScreenManager, this.OperationsRect, new Color(0, 0, 0, 180)); this.operationsSelector.Draw(); Cursor = new Vector2((float)(this.OperationsRect.X + 20), (float)(this.OperationsRect.Y + 10)); base.ScreenManager.SpriteBatch.DrawString(Fonts.Pirulen12, "Group Target Selection", Cursor, new Color(255, 239, 208)); this.Slider_Armor.Draw(base.ScreenManager); this.Slider_Assist.Draw(base.ScreenManager); this.Slider_Defend.Draw(base.ScreenManager); this.Slider_DPS.Draw(base.ScreenManager); this.Slider_Shield.Draw(base.ScreenManager); this.Slider_Vulture.Draw(base.ScreenManager); this.priorityselector = new Selector(base.ScreenManager, this.PrioritiesRect, new Color(0, 0, 0, 180)); this.priorityselector.Draw(); Cursor = new Vector2((float)(this.PrioritiesRect.X + 20), (float)(this.PrioritiesRect.Y + 10)); base.ScreenManager.SpriteBatch.DrawString(Fonts.Pirulen12, "Group Priorities", Cursor, new Color(255, 239, 208)); this.OperationalRadius.Draw(base.ScreenManager); this.Slider_Size.Draw(base.ScreenManager); return; } if (this.FleetToEdit == -1) { float transitionOffset = (float)Math.Pow((double)base.TransitionPosition, 2); Rectangle r = this.SelectedStuffRect; if (base.ScreenState == Ship_Game.ScreenState.TransitionOn) { r.Y = r.Y + (int)(transitionOffset * 256f); } this.stuffSelector = new Selector(base.ScreenManager, r, new Color(0, 0, 0, 180)); this.stuffSelector.Draw(); Vector2 Cursor = new Vector2((float)(r.X + 20), (float)(r.Y + 10)); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial20Bold, "No Fleet Selected", Cursor, new Color(255, 239, 208)); Cursor.Y = Cursor.Y + (float)(Fonts.Arial20Bold.LineSpacing + 2); string txt = "You are not currently editing a fleet. Click a hotkey on the left side of the screen to begin creating or editing the corresponding fleet. \n\nWhen you are finished editing, you can save your fleet design to disk for quick access in the future."; txt = HelperFunctions.parseText(Fonts.Arial12Bold, txt, (float)(this.SelectedStuffRect.Width - 40)); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, txt, Cursor, new Color(255, 239, 208)); return; } this.stuffSelector = new Selector(base.ScreenManager, this.SelectedStuffRect, new Color(0, 0, 0, 180)); this.stuffSelector.Draw(); Fleet f = EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).GetFleetsDict()[this.FleetToEdit]; Vector2 Cursor1 = new Vector2((float)(this.SelectedStuffRect.X + 20), (float)(this.SelectedStuffRect.Y + 10)); this.FleetNameEntry.Text = f.Name; this.FleetNameEntry.ClickableArea = new Rectangle((int)Cursor1.X, (int)Cursor1.Y, (int)Fonts.Arial20Bold.MeasureString(f.Name).X, Fonts.Arial20Bold.LineSpacing); this.FleetNameEntry.Draw(Fonts.Arial20Bold, base.ScreenManager.SpriteBatch, Cursor1, gameTime, (this.FleetNameEntry.Hover ? Color.Orange : new Color(255, 239, 208))); Cursor1.Y = Cursor1.Y + (float)(Fonts.Arial20Bold.LineSpacing + 10); Cursor1 = Cursor1 + new Vector2(50f, 30f); base.ScreenManager.SpriteBatch.DrawString(Fonts.Pirulen12, "Fleet Icon", Cursor1, new Color(255, 239, 208)); Rectangle ficonrect = new Rectangle((int)Cursor1.X + 12, (int)Cursor1.Y + Fonts.Pirulen12.LineSpacing + 5, 64, 64); base.ScreenManager.SpriteBatch.Draw(Ship_Game.ResourceManager.TextureDict[string.Concat("FleetIcons/", f.FleetIconIndex.ToString())], ficonrect, f.Owner.EmpireColor); this.RequisitionForces.Draw(base.ScreenManager); this.SaveDesign.Draw(base.ScreenManager); this.LoadDesign.Draw(base.ScreenManager); this.priorityselector = new Selector(base.ScreenManager, this.PrioritiesRect, new Color(0, 0, 0, 180)); this.priorityselector.Draw(); Cursor1 = new Vector2((float)(this.PrioritiesRect.X + 20), (float)(this.PrioritiesRect.Y + 10)); base.ScreenManager.SpriteBatch.DrawString(Fonts.Pirulen12, "Fleet Design Overview", Cursor1, new Color(255, 239, 208)); Cursor1.Y = Cursor1.Y + (float)(Fonts.Pirulen12.LineSpacing + 2); string txt0 = Localizer.Token(4043); txt0 = HelperFunctions.parseText(Fonts.Arial12Bold, txt0, (float)(this.PrioritiesRect.Width - 40)); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, txt0, Cursor1, new Color(255, 239, 208)); }
public ShipListInfoUIElement(Rectangle r, Ship_Game.ScreenManager sm, UniverseScreen screen) { this.Housing = r; this.screen = screen; this.ScreenManager = sm; this.ElementRect = r; this.sel = new Selector(this.ScreenManager, r, Color.Black); base.TransitionOnTime = TimeSpan.FromSeconds(0.25); base.TransitionOffTime = TimeSpan.FromSeconds(0.25); this.SliderRect = new Rectangle(r.X - 100, r.Y + r.Height - 140, 530, 130); this.LeftRect = new Rectangle(r.X, r.Y + 44, 180, r.Height - 44); this.sliding_element = new SlidingElement(this.SliderRect); this.RightRect = new Rectangle(this.LeftRect.X + this.LeftRect.Width, this.LeftRect.Y, 220, this.LeftRect.Height); float spacing = (float)(this.LeftRect.Height - 26 - 96); this.Power = new Rectangle(this.RightRect.X, this.LeftRect.Y + 12, 20, 20); Rectangle pbarrect = new Rectangle(this.Power.X + this.Power.Width + 15, this.Power.Y, 150, 18); this.pBar = new ProgressBar(pbarrect) { color = "green" }; ShipListInfoUIElement.TippedItem ti = new ShipListInfoUIElement.TippedItem() { r = this.Power, TIP_ID = 27 }; this.Shields = new Rectangle(this.RightRect.X, this.LeftRect.Y + 12 + 20 + (int)spacing, 20, 20); Rectangle pshieldsrect = new Rectangle(this.Shields.X + this.Shields.Width + 15, this.Shields.Y, 150, 18); this.sBar = new ProgressBar(pshieldsrect) { color = "blue" }; ti = new ShipListInfoUIElement.TippedItem() { r = this.Shields, TIP_ID = 28 }; this.DefenseRect = new Rectangle(this.Housing.X + 13, this.Housing.Y + 112, 22, 22); ti = new ShipListInfoUIElement.TippedItem() { r = this.DefenseRect, TIP_ID = 30 }; this.TroopRect = new Rectangle(this.Housing.X + 13, this.Housing.Y + 137, 22, 22); ti = new ShipListInfoUIElement.TippedItem() { r = this.TroopRect, TIP_ID = 37 }; Rectangle gridRect = new Rectangle(this.Housing.X + 16, this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 45, 34, 24); this.gridbutton = new ToggleButton(gridRect, "SelectionBox/button_grid_active", "SelectionBox/button_grid_inactive", "SelectionBox/button_grid_hover", "SelectionBox/button_grid_pressed", "SelectionBox/icon_grid") { Active = true }; this.clickRect = new Rectangle(this.ElementRect.X + this.ElementRect.Width - 16, this.ElementRect.Y + this.ElementRect.Height / 2 - 11, 11, 22); this.ShipInfoRect = new Rectangle(this.Housing.X + 60, this.Housing.Y + 110, 115, 115); Rectangle rectangle = new Rectangle(this.Housing.X + 187, this.Housing.Y + 120 + 20 + (int)spacing + 20 + (int)spacing, 20, 20); Vector2 OrdersBarPos = new Vector2((float)(this.Power.X + 12), (float)(this.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 45)); ToggleButton AttackRuns = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_headon"); this.CombatStatusButtons.Add(AttackRuns); AttackRuns.Action = "attack"; AttackRuns.HasToolTip = true; AttackRuns.WhichToolTip = 1; OrdersBarPos.X = OrdersBarPos.X + 29f; ToggleButton Artillery = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_aft"); this.CombatStatusButtons.Add(Artillery); Artillery.Action = "arty"; Artillery.HasToolTip = true; Artillery.WhichToolTip = 2; OrdersBarPos.X = OrdersBarPos.X + 29f; ToggleButton HoldPos = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_x"); this.CombatStatusButtons.Add(HoldPos); HoldPos.Action = "hold"; HoldPos.HasToolTip = true; HoldPos.WhichToolTip = 65; OrdersBarPos.X = OrdersBarPos.X + 29f; ToggleButton OrbitLeft = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_left"); this.CombatStatusButtons.Add(OrbitLeft); OrbitLeft.Action = "orbit_left"; OrbitLeft.HasToolTip = true; OrbitLeft.WhichToolTip = 3; OrdersBarPos.Y = OrdersBarPos.Y - 29f; ToggleButton BroadsideLeft = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_bleft"); this.CombatStatusButtons.Add(BroadsideLeft); BroadsideLeft.Action = "broadside_left"; BroadsideLeft.HasToolTip = true; BroadsideLeft.WhichToolTip = 159; OrdersBarPos.Y = OrdersBarPos.Y + 29f; OrdersBarPos.X = OrdersBarPos.X + 29f; ToggleButton OrbitRight = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_right"); this.CombatStatusButtons.Add(OrbitRight); OrbitRight.Action = "orbit_right"; OrbitRight.HasToolTip = true; OrbitRight.WhichToolTip = 4; OrdersBarPos.Y = OrdersBarPos.Y - 29f; ToggleButton BroadsideRight = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_bright"); this.CombatStatusButtons.Add(BroadsideRight); BroadsideRight.Action = "broadside_right"; BroadsideRight.HasToolTip = true; BroadsideRight.WhichToolTip = 160; OrdersBarPos.Y = OrdersBarPos.Y + 29f; OrdersBarPos.X = OrdersBarPos.X + 29f; ToggleButton Evade = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_stop"); this.CombatStatusButtons.Add(Evade); Evade.Action = "evade"; Evade.HasToolTip = true; Evade.WhichToolTip = 6; Rectangle slsubRect = new Rectangle(this.RightRect.X, this.Housing.Y + 110 - 35, this.RightRect.Width - 5, 140); Submenu shipssub = new Submenu(this.ScreenManager, slsubRect); this.SelectedShipsSL = new ScrollList(shipssub, 24); }
public override void Draw(GameTime gameTime) { if (this.fade) { base.ScreenManager.FadeBackBufferToBlack(base.TransitionAlpha * 2 / 3); } base.DrawBase(gameTime); base.ScreenManager.SpriteBatch.Begin(); Selector selector = new Selector(base.ScreenManager, this.MainOptionsRect, true); Selector selector1 = new Selector(base.ScreenManager, this.SecondaryOptionsRect, true); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, this.Resolution.Name, this.Resolution.NamePosition, new Color(255, 239, 208)); base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, this.FullScreen.Name, this.FullScreen.NamePosition, new Color(255, 239, 208)); Vector2 valuePos = new Vector2((float)(this.FullScreen.ClickableArea.X + 2), (float)this.FullScreen.ClickableArea.Y); if (!this.FullScreen.highlighted) { base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, this.FullScreen.Value.ToString(), valuePos, Color.White); } else { base.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, this.FullScreen.Value.ToString(), valuePos, new Color(255, 239, 208)); } foreach (UIButton b in this.Buttons) { b.Draw(base.ScreenManager.SpriteBatch); } this.GamespeedCap.Draw(base.ScreenManager); this.ForceFullSim.Draw(base.ScreenManager); this.pauseOnNotification.Draw(base.ScreenManager); this.KeyboardArc.Draw(base.ScreenManager); this.MusicVolumeSlider.DrawDecimal(base.ScreenManager); this.EffectsVolumeSlider.DrawDecimal(base.ScreenManager); this.IconSize.Draw(base.ScreenManager); this.memoryLimit.Draw(base.ScreenManager); //this.AntiAliasingDD.Draw(base.ScreenManager.SpriteBatch); this.ResolutionDropDown.Draw(base.ScreenManager.SpriteBatch); this.FreighterLimiter.Draw(base.ScreenManager); this.ShipLimiter.Draw(base.ScreenManager); ToolTip.Draw(base.ScreenManager); base.ScreenManager.SpriteBatch.End(); }
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; } } }
public void Draw(Ship_Game.ScreenManager ScreenManager, Rectangle r) { Selector selector = new Selector(ScreenManager, r, Color.TransparentBlack); Rectangle iconRect = new Rectangle(r.X + 6, r.Y + 6, 44, 44); float x = (float)Mouse.GetState().X; MouseState state = Mouse.GetState(); Vector2 MousePos = new Vector2(x, (float)state.Y); if (this.SimpleToggle) { if (!HelperFunctions.CheckIntersection(r, MousePos)) { ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["SelectionBox/button_action_disabled"], r, Color.White); } else { ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["SelectionBox/button_action_hover"], r, Color.White); } switch (this.orderType) { case OrderType.FighterToggle: { iconRect = new Rectangle(r.X + r.Width / 2 - 12, r.Y + r.Height / 2 - 12, 24, 24); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["OrderButtons/UI_Fighters"], iconRect, Color.White); return; } case OrderType.FighterRecall: { iconRect = new Rectangle(r.X + r.Width / 2 - 12, r.Y + r.Height / 2 - 12, 24, 24); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["OrderButtons/UI_FighterRecall"], iconRect, Color.White); return; } case OrderType.ShieldToggle: { iconRect = new Rectangle(r.X + r.Width / 2 - 12, r.Y + r.Height / 2 - 12, 24, 24); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["OrderButtons/UI_Shields"], iconRect, Color.White); return; } case OrderType.DefineAO: { iconRect = new Rectangle(r.X + r.Width / 2 - 12, r.Y + r.Height / 2 - 12, 24, 24); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["OrderButtons/UI_AO"], iconRect, Color.White); return; } case OrderType.TradeFood: { iconRect = new Rectangle(r.X + r.Width / 2 - ResourceManager.TextureDict["NewUI/icon_food"].Width / 2, r.Y + r.Height / 2 - ResourceManager.TextureDict["NewUI/icon_food"].Height / 2, ResourceManager.TextureDict["NewUI/icon_food"].Width, ResourceManager.TextureDict["NewUI/icon_food"].Height); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/icon_food"], iconRect, Color.White); return; } case OrderType.TradeProduction: { iconRect = new Rectangle(r.X + r.Width / 2 - ResourceManager.TextureDict["NewUI/icon_production"].Width / 2, r.Y + r.Height / 2 - ResourceManager.TextureDict["NewUI/icon_production"].Height / 2, ResourceManager.TextureDict["NewUI/icon_production"].Width, ResourceManager.TextureDict["NewUI/icon_production"].Height); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/icon_production"], iconRect, Color.White); return; } case OrderType.PassTran: { iconRect = new Rectangle(r.X + r.Width / 2 - ResourceManager.TextureDict["UI/icon_passtran"].Width / 2, r.Y + r.Height / 2 - ResourceManager.TextureDict["UI/icon_passtran"].Height / 2, ResourceManager.TextureDict["UI/icon_passtran"].Width, ResourceManager.TextureDict["UI/icon_passtran"].Height); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/icon_passtran"], iconRect, Color.White); return; } case OrderType.TroopToggle: { iconRect = new Rectangle(r.X + r.Width / 2 - 13, r.Y + r.Height / 2 - 14, 23, 28); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/icon_troop"], iconRect, Color.White); return; } case OrderType.Explore: { iconRect = new Rectangle(r.X + r.Width / 2 - ResourceManager.TextureDict["UI/icon_explore"].Width / 2, r.Y + r.Height / 2 - ResourceManager.TextureDict["UI/icon_explore"].Height / 2, ResourceManager.TextureDict["UI/icon_explore"].Width, ResourceManager.TextureDict["UI/icon_explore"].Height); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/icon_explore"], iconRect, Color.White); return; } case OrderType.OrderResupply: { iconRect = new Rectangle(r.X + r.Width / 2 - 16, r.Y + r.Height / 2 - 16, 32, 32); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["Modules/Ordnance"], iconRect, Color.White); return; } case OrderType.EmpireDefense: { iconRect = new Rectangle(r.X + r.Width / 2 - ResourceManager.TextureDict["UI/icon_shield"].Width / 2, r.Y + r.Height / 2 - ResourceManager.TextureDict["UI/icon_shield"].Height / 2, ResourceManager.TextureDict["UI/icon_shield"].Width, ResourceManager.TextureDict["UI/icon_shield"].Height); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/icon_shield"], iconRect, Color.White); return; } case OrderType.Scrap: { iconRect = new Rectangle(r.X + r.Width / 2 - ResourceManager.TextureDict["UI/icon_planetslist"].Width / 2, r.Y + r.Height / 2 - ResourceManager.TextureDict["UI/icon_planetslist"].Height / 2, ResourceManager.TextureDict["UI/icon_planetslist"].Width, ResourceManager.TextureDict["UI/icon_planetslist"].Height); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/icon_planetslist"], iconRect, Color.White); return; } case OrderType.Refit: { iconRect = new Rectangle(r.X + r.Width / 2 - ResourceManager.TextureDict["UI/icon_dsbw"].Width / 2, r.Y + r.Height / 2 - ResourceManager.TextureDict["UI/icon_dsbw"].Height / 2, ResourceManager.TextureDict["UI/icon_dsbw"].Width, ResourceManager.TextureDict["UI/icon_dsbw"].Height); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/icon_dsbw"], iconRect, Color.White); return; } default: { return; } } } if (HelperFunctions.CheckIntersection(r, MousePos)) { ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["SelectionBox/button_action_hover"], r, Color.White); } else if (this.RightClickValueToModify != null && !this.RightClickValueToModify.Value) { ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["SelectionBox/button_action_disabled"], r, Color.LightPink); } else if (!this.ValueToModify.Value) { ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["SelectionBox/button_action_disabled"], r, Color.White); } else { ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["SelectionBox/button_action"], r, Color.White); } switch (this.orderType) { case OrderType.FighterToggle: { iconRect = new Rectangle(r.X + r.Width / 2 - 12, r.Y + r.Height / 2 - 12, 24, 24); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["OrderButtons/UI_Fighters"], iconRect, Color.White); return; } case OrderType.FighterRecall: { iconRect = new Rectangle(r.X + r.Width / 2 - 12, r.Y + r.Height / 2 - 12, 24, 24); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["OrderButtons/UI_FighterRecall"], iconRect, Color.White); return; } case OrderType.ShieldToggle: { iconRect = new Rectangle(r.X + r.Width / 2 - 12, r.Y + r.Height / 2 - 12, 24, 24); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["OrderButtons/UI_Shields"], iconRect, Color.White); return; } case OrderType.DefineAO: { iconRect = new Rectangle(r.X + r.Width / 2 - 12, r.Y + r.Height / 2 - 12, 24, 24); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["OrderButtons/UI_AO"], iconRect, Color.White); return; } case OrderType.TradeFood: { iconRect = new Rectangle(r.X + r.Width / 2 - ResourceManager.TextureDict["NewUI/icon_food"].Width / 2, r.Y + r.Height / 2 - ResourceManager.TextureDict["NewUI/icon_food"].Height / 2, ResourceManager.TextureDict["NewUI/icon_food"].Width, ResourceManager.TextureDict["NewUI/icon_food"].Height); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/icon_food"], iconRect, Color.White); return; } case OrderType.TradeProduction: { iconRect = new Rectangle(r.X + r.Width / 2 - ResourceManager.TextureDict["NewUI/icon_production"].Width / 2, r.Y + r.Height / 2 - ResourceManager.TextureDict["NewUI/icon_production"].Height / 2, ResourceManager.TextureDict["NewUI/icon_production"].Width, ResourceManager.TextureDict["NewUI/icon_production"].Height); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/icon_production"], iconRect, Color.White); return; } case OrderType.PassTran: { iconRect = new Rectangle(r.X + r.Width / 2 - ResourceManager.TextureDict["UI/icon_passtran"].Width / 2, r.Y + r.Height / 2 - ResourceManager.TextureDict["UI/icon_passtran"].Height / 2, ResourceManager.TextureDict["UI/icon_passtran"].Width, ResourceManager.TextureDict["UI/icon_passtran"].Height); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/icon_passtran"], iconRect, Color.White); return; } case OrderType.TroopToggle: { iconRect = new Rectangle(r.X + r.Width / 2 - 13, r.Y + r.Height / 2 - 14, 23, 28); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/icon_troop"], iconRect, Color.White); return; } case OrderType.Explore: { iconRect = new Rectangle(r.X + r.Width / 2 - ResourceManager.TextureDict["UI/icon_explore"].Width / 2, r.Y + r.Height / 2 - ResourceManager.TextureDict["UI/icon_explore"].Height / 2, ResourceManager.TextureDict["UI/icon_explore"].Width, ResourceManager.TextureDict["UI/icon_explore"].Height); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/icon_explore"], iconRect, Color.White); return; } case OrderType.OrderResupply: { iconRect = new Rectangle(r.X + r.Width / 2 - 16, r.Y + r.Height / 2 - 16, 32, 32); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["Modules/Ordnance"], iconRect, Color.White); return; } case OrderType.EmpireDefense: { iconRect = new Rectangle(r.X + r.Width / 2 - ResourceManager.TextureDict["UI/icon_shield"].Width / 2, r.Y + r.Height / 2 - ResourceManager.TextureDict["UI/icon_shield"].Height / 2, ResourceManager.TextureDict["UI/icon_shield"].Width, ResourceManager.TextureDict["UI/icon_shield"].Height); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/icon_shield"], iconRect, Color.White); return; } case OrderType.Scrap: { iconRect = new Rectangle(r.X + r.Width / 2 - ResourceManager.TextureDict["UI/icon_planetslist"].Width / 2, r.Y + r.Height / 2 - ResourceManager.TextureDict["UI/icon_planetslist"].Height / 2, ResourceManager.TextureDict["UI/icon_planetslist"].Width, ResourceManager.TextureDict["UI/icon_planetslist"].Height); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/icon_planetslist"], iconRect, Color.White); return; } case OrderType.Refit: { iconRect = new Rectangle(r.X + r.Width / 2 - ResourceManager.TextureDict["UI/icon_dsbw"].Width / 2, r.Y + r.Height / 2 - ResourceManager.TextureDict["UI/icon_dsbw"].Height / 2, ResourceManager.TextureDict["UI/icon_dsbw"].Width, ResourceManager.TextureDict["UI/icon_dsbw"].Height); ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/icon_dsbw"], iconRect, Color.White); return; } default: { return; } } }
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 HandleInput(InputState input) { this.CategoryList.HandleInput(input); this.CarrierOnlyBox.HandleInput(input); if (this.ActiveModule != null && (this.ActiveModule.InstalledWeapon != null && this.ActiveModule.ModuleType != ShipModuleType.Turret || this.ActiveModule.XSIZE != this.ActiveModule.YSIZE)) { if (input.Left) this.ChangeModuleState(ShipDesignScreen.ActiveModuleState.Left); if (input.Right) this.ChangeModuleState(ShipDesignScreen.ActiveModuleState.Right); if (input.Down) this.ChangeModuleState(ShipDesignScreen.ActiveModuleState.Rear); if (input.Up) this.ChangeModuleState(ShipDesignScreen.ActiveModuleState.Normal); } if (input.CurrentKeyboardState.IsKeyDown(Keys.Y) && !input.LastKeyboardState.IsKeyDown(Keys.Y) && !GlobalStats.TakingInput) { AudioManager.PlayCue("echo_affirm"); this.ExitScreen(); } if (this.close.HandleInput(input)) this.ExitScreen(); else if (input.CurrentKeyboardState.IsKeyDown(Keys.Z) && input.LastKeyboardState.IsKeyUp(Keys.Z) && input.CurrentKeyboardState.IsKeyDown(Keys.LeftControl)) { if (this.DesignStack.Count <= 0) return; ShipModule shipModule = this.ActiveModule; DesignAction designAction = this.DesignStack.Pop(); SlotStruct slot1 = new SlotStruct(); foreach (SlotStruct slot2 in this.Slots) { if (slot2.pq == designAction.clickedSS.pq) { this.ClearSlotNoStack(slot2); slot1 = slot2; slot1.facing = designAction.clickedSS.facing; } foreach (SlotStruct slotStruct in designAction.AlteredSlots) { if (slot2.pq == slotStruct.pq) { this.ClearSlotNoStack(slot2); break; } } } if (designAction.clickedSS.ModuleUID != null) { this.ActiveModule = ResourceManager.GetModule(designAction.clickedSS.ModuleUID); this.ResetModuleState(); this.InstallModuleNoStack(slot1); } foreach (SlotStruct slotStruct in designAction.AlteredSlots) { foreach (SlotStruct slot2 in this.Slots) { if (slot2.pq == slotStruct.pq && slotStruct.ModuleUID != null) { this.ActiveModule = ResourceManager.GetModule(slotStruct.ModuleUID); this.ResetModuleState(); this.InstallModuleNoStack(slot2); slot2.facing = slotStruct.facing; slot2.ModuleUID = slotStruct.ModuleUID; } } } this.ActiveModule = shipModule; this.ResetModuleState(); } else { if (!HelperFunctions.CheckIntersection(this.ModuleSelectionMenu.Menu, input.CursorPosition) && !HelperFunctions.CheckIntersection(this.HullSelectionRect, input.CursorPosition) && !HelperFunctions.CheckIntersection(this.ChooseFighterSub.Menu, input.CursorPosition)) { if (input.ScrollOut) { this.TransitionZoom -= 0.1f; if ((double)this.TransitionZoom < 0.300000011920929) this.TransitionZoom = 0.3f; if ((double)this.TransitionZoom > 2.65000009536743) this.TransitionZoom = 2.65f; } if (input.ScrollIn) { this.TransitionZoom += 0.1f; if ((double)this.TransitionZoom < 0.300000011920929) this.TransitionZoom = 0.3f; if ((double)this.TransitionZoom > 2.65000009536743) this.TransitionZoom = 2.65f; } } if (input.CurrentKeyboardState.IsKeyDown(Keys.OemTilde)) input.LastKeyboardState.IsKeyUp(Keys.OemTilde); if (this.Debug) { if (input.CurrentKeyboardState.IsKeyDown(Keys.Enter) && input.LastKeyboardState.IsKeyUp(Keys.Enter)) { foreach (ModuleSlotData moduleSlotData in this.ActiveHull.ModuleSlotList) moduleSlotData.InstalledModuleUID = (string)null; new XmlSerializer(typeof(ShipData)).Serialize((TextWriter)new StreamWriter("Content/Hulls/" + this.ActiveHull.ShipStyle + "/" + this.ActiveHull.Name + ".xml"), (object)this.ActiveHull); } if (input.Right) ++this.operation; if (this.operation > (ShipDesignScreen.SlotModOperation)6) this.operation = ShipDesignScreen.SlotModOperation.Delete; } this.HoveredModule = (ShipModule)null; this.mouseStateCurrent = Mouse.GetState(); Vector2 vector2 = new Vector2((float)this.mouseStateCurrent.X, (float)this.mouseStateCurrent.Y); this.selector = (Selector)null; this.EmpireUI.HandleInput(input, (GameScreen)this); this.activeModSubMenu.HandleInputNoReset((object)this); this.hullSL.HandleInput(input); for (int index = this.hullSL.indexAtTop; index < this.hullSL.Copied.Count && index < this.hullSL.indexAtTop + this.hullSL.entriesToDisplay; ++index) { ScrollList.Entry e = this.hullSL.Copied[index]; if (e.item is ModuleHeader) { if ((e.item as ModuleHeader).HandleInput(input, e)) return; } else if (HelperFunctions.CheckIntersection(e.clickRect, vector2)) { this.selector = new Selector(this.ScreenManager, e.clickRect); e.clickRectHover = 1; this.selector = new Selector(this.ScreenManager, e.clickRect); if (input.InGameSelect) { AudioManager.PlayCue("sd_ui_accept_alt3"); if (!this.ShipSaved && !this.CheckDesign()) { MessageBoxScreen messageBoxScreen = new MessageBoxScreen(Localizer.Token(2121), "Save", "No"); messageBoxScreen.Accepted += new EventHandler<EventArgs>(this.SaveWIPThenChangeHull); messageBoxScreen.Cancelled += new EventHandler<EventArgs>(this.JustChangeHull); this.changeto = e.item as ShipData; this.ScreenManager.AddScreen((GameScreen)messageBoxScreen); return; } else { this.ChangeHull(e.item as ShipData); return; } } } else e.clickRectHover = 0; } this.modSel.HandleInput((object)this); if (this.ActiveModule != null) { if (this.ActiveModule.ModuleType == ShipModuleType.Hangar && !this.ActiveModule.IsTroopBay && !this.ActiveModule.IsSupplyBay) { this.UpdateHangarOptions(this.ActiveModule); this.ChooseFighterSL.HandleInput(input); for (int index = this.ChooseFighterSL.indexAtTop; index < this.ChooseFighterSL.Copied.Count && index < this.ChooseFighterSL.indexAtTop + this.ChooseFighterSL.entriesToDisplay; ++index) { ScrollList.Entry entry = this.ChooseFighterSL.Copied[index]; if (HelperFunctions.CheckIntersection(entry.clickRect, vector2)) { this.selector = new Selector(this.ScreenManager, entry.clickRect); entry.clickRectHover = 1; this.selector = new Selector(this.ScreenManager, entry.clickRect); if (input.InGameSelect) { this.ActiveModule.hangarShipUID = (entry.item as Ship).Name; this.HangarShipUIDLast = (entry.item as Ship).Name; AudioManager.PlayCue("sd_ui_accept_alt3"); return; } } } } } else if (this.HighlightedModule != null && this.HighlightedModule.ModuleType == ShipModuleType.Hangar && (!this.HighlightedModule.IsTroopBay && !this.HighlightedModule.IsSupplyBay)) { this.ChooseFighterSL.HandleInput(input); for (int index = this.ChooseFighterSL.indexAtTop; index < this.ChooseFighterSL.Copied.Count && index < this.ChooseFighterSL.indexAtTop + this.ChooseFighterSL.entriesToDisplay; ++index) { ScrollList.Entry entry = this.ChooseFighterSL.Copied[index]; if (HelperFunctions.CheckIntersection(entry.clickRect, vector2)) { this.selector = new Selector(this.ScreenManager, entry.clickRect); entry.clickRectHover = 1; this.selector = new Selector(this.ScreenManager, entry.clickRect); if (input.InGameSelect) { this.HighlightedModule.hangarShipUID = (entry.item as Ship).Name; this.HangarShipUIDLast = (entry.item as Ship).Name; AudioManager.PlayCue("sd_ui_accept_alt3"); return; } } } } for (int index = this.weaponSL.indexAtTop; index < this.weaponSL.Copied.Count && index < this.weaponSL.indexAtTop + this.weaponSL.entriesToDisplay; ++index) { ScrollList.Entry e = this.weaponSL.Copied[index]; if (e.item is ModuleHeader) { if ((e.item as ModuleHeader).HandleInput(input, e)) return; } else if (HelperFunctions.CheckIntersection(e.clickRect, vector2)) { this.selector = new Selector(this.ScreenManager, e.clickRect); e.clickRectHover = 1; this.selector = new Selector(this.ScreenManager, e.clickRect); if (input.InGameSelect) { this.SetActiveModule(ResourceManager.GetModule((e.item as ShipModule).UID)); this.ResetModuleState(); return; } } else e.clickRectHover = 0; } this.weaponSL.HandleInput(input); if (HelperFunctions.CheckIntersection(this.HullSelectionRect, input.CursorPosition) && input.CurrentMouseState.LeftButton == ButtonState.Pressed || HelperFunctions.CheckIntersection(this.modSel.Menu, input.CursorPosition) && input.CurrentMouseState.LeftButton == ButtonState.Pressed || HelperFunctions.CheckIntersection(this.activeModSubMenu.Menu, input.CursorPosition) && input.CurrentMouseState.LeftButton == ButtonState.Pressed) return; if (HelperFunctions.CheckIntersection(this.modSel.Menu, vector2)) { if (this.mouseStateCurrent.ScrollWheelValue > this.mouseStatePrevious.ScrollWheelValue && this.weaponSL.indexAtTop > 0) --this.weaponSL.indexAtTop; if (this.mouseStateCurrent.ScrollWheelValue < this.mouseStatePrevious.ScrollWheelValue && this.weaponSL.indexAtTop + this.weaponSL.entriesToDisplay < this.weaponSL.Entries.Count) ++this.weaponSL.indexAtTop; } if (HelperFunctions.CheckIntersection(this.ArcsButton.R, input.CursorPosition)) ToolTip.CreateTooltip(134, this.ScreenManager); if (this.ArcsButton.HandleInput(input)) { this.ArcsButton.ToggleOn = !this.ArcsButton.ToggleOn; this.ShowAllArcs = this.ArcsButton.ToggleOn; } if (input.Tab) { this.ShowAllArcs = !this.ShowAllArcs; this.ArcsButton.ToggleOn = this.ShowAllArcs; } if (input.CurrentMouseState.RightButton == ButtonState.Pressed && input.LastMouseState.RightButton == ButtonState.Released) { this.StartDragPos = input.CursorPosition; this.cameraVelocity.X = 0.0f; this.cameraVelocity.Y = 0.0f; } if (input.CurrentMouseState.RightButton == ButtonState.Pressed && input.LastMouseState.RightButton == ButtonState.Pressed) { float num1 = input.CursorPosition.X - this.StartDragPos.X; float num2 = input.CursorPosition.Y - this.StartDragPos.Y; this.camera._pos += new Vector2(-num1, -num2); this.StartDragPos = input.CursorPosition; this.cameraPosition.X += -num1; this.cameraPosition.Y += -num2; } else { this.cameraVelocity.X = 0.0f; this.cameraVelocity.Y = 0.0f; } this.cameraVelocity.X = MathHelper.Clamp(this.cameraVelocity.X, -10f, 10f); this.cameraVelocity.Y = MathHelper.Clamp(this.cameraVelocity.Y, -10f, 10f); if (input.Escaped) this.ExitScreen(); if (this.ToggleOverlay) { foreach (SlotStruct slotStruct in this.Slots) { Vector2 spaceFromWorldSpace = this.camera.GetScreenSpaceFromWorldSpace(new Vector2((float)slotStruct.pq.enclosingRect.X, (float)slotStruct.pq.enclosingRect.Y)); if (HelperFunctions.CheckIntersection(new Rectangle((int)spaceFromWorldSpace.X, (int)spaceFromWorldSpace.Y, (int)(16.0 * (double)this.camera.Zoom), (int)(16.0 * (double)this.camera.Zoom)), vector2)) { if (slotStruct.isDummy && slotStruct.parent.module != null) this.HoveredModule = slotStruct.parent.module; else if (slotStruct.module != null) this.HoveredModule = slotStruct.module; if (input.CurrentMouseState.LeftButton == ButtonState.Pressed && input.LastMouseState.LeftButton == ButtonState.Released) { AudioManager.GetCue("simple_beep").Play(); if (this.Debug) { this.DebugAlterSlot(slotStruct.slotReference.Position, this.operation); return; } else if (slotStruct.isDummy && slotStruct.parent.module != null) this.HighlightedModule = slotStruct.parent.module; else if (slotStruct.module != null) this.HighlightedModule = slotStruct.module; } } } } if (HelperFunctions.CheckIntersection(this.upArrow, vector2) && this.mouseStateCurrent.LeftButton == ButtonState.Released && (this.mouseStatePrevious.LeftButton == ButtonState.Pressed && this.scrollPosition > 0)) { --this.scrollPosition; AudioManager.GetCue("blip_click").Play(); foreach (ModuleButton moduleButton in this.ModuleButtons) moduleButton.moduleRect.Y += 128; } if (HelperFunctions.CheckIntersection(this.downArrow, vector2) && this.mouseStateCurrent.LeftButton == ButtonState.Released && this.mouseStatePrevious.LeftButton == ButtonState.Pressed) { ++this.scrollPosition; AudioManager.GetCue("blip_click").Play(); foreach (ModuleButton moduleButton in this.ModuleButtons) moduleButton.moduleRect.Y -= 128; } if (HelperFunctions.CheckIntersection(this.ModuleSelectionArea, vector2)) { if (input.ScrollIn && this.scrollPosition > 0) { --this.scrollPosition; AudioManager.GetCue("blip_click").Play(); foreach (ModuleButton moduleButton in this.ModuleButtons) moduleButton.moduleRect.Y += 128; } if (input.ScrollOut) { ++this.scrollPosition; AudioManager.GetCue("blip_click").Play(); foreach (ModuleButton moduleButton in this.ModuleButtons) moduleButton.moduleRect.Y -= 128; } } if (this.mouseStateCurrent.RightButton == ButtonState.Released && this.mouseStatePrevious.RightButton == ButtonState.Pressed) { //this should actually clear slots this.ActiveModule = (ShipModule)null; foreach (SlotStruct parent in this.Slots) { parent.ShowInvalid = false; parent.ShowValid = false; Vector2 spaceFromWorldSpace = this.camera.GetScreenSpaceFromWorldSpace(new Vector2((float)parent.pq.enclosingRect.X, (float)parent.pq.enclosingRect.Y)); Rectangle rect = new Rectangle((int)spaceFromWorldSpace.X, (int)spaceFromWorldSpace.Y, (int)(16.0 * (double)this.camera.Zoom), (int)(16.0 * (double)this.camera.Zoom)); if ((parent.module != null || parent.isDummy) && HelperFunctions.CheckIntersection(rect, vector2)) //if clicked at this slot { DesignAction designAction = new DesignAction(); designAction.clickedSS = new SlotStruct(); designAction.clickedSS.pq = parent.isDummy ? parent.parent.pq : parent.pq; designAction.clickedSS.Restrictions = parent.Restrictions; designAction.clickedSS.facing = parent.module != null ? parent.module.facing : 0.0f; designAction.clickedSS.ModuleUID = parent.isDummy ? parent.parent.ModuleUID : parent.ModuleUID; designAction.clickedSS.module = parent.module; designAction.clickedSS.slotReference = parent.isDummy ? parent.parent.slotReference : parent.slotReference; this.DesignStack.Push(designAction); AudioManager.GetCue("sub_bass_whoosh").Play(); if (parent.isDummy) this.ClearParentSlot(parent.parent); else this.ClearParentSlot(parent); this.RecalculatePower(); } } } foreach (ModuleButton moduleButton in this.ModuleButtons) { if (HelperFunctions.CheckIntersection(this.ModuleSelectionArea, new Vector2((float)(moduleButton.moduleRect.X + 30), (float)(moduleButton.moduleRect.Y + 30)))) { if (HelperFunctions.CheckIntersection(moduleButton.moduleRect, vector2)) { if (input.InGameSelect) this.SetActiveModule(ResourceManager.GetModule(moduleButton.ModuleUID)); moduleButton.isHighlighted = true; } else moduleButton.isHighlighted = false; } } if (input.CurrentMouseState.LeftButton == ButtonState.Pressed && this.ActiveModule != null) { foreach (SlotStruct slot in this.Slots) { Vector2 spaceFromWorldSpace = this.camera.GetScreenSpaceFromWorldSpace(new Vector2((float)slot.pq.enclosingRect.X, (float)slot.pq.enclosingRect.Y)); if (HelperFunctions.CheckIntersection(new Rectangle((int)spaceFromWorldSpace.X, (int)spaceFromWorldSpace.Y, (int)(16.0 * (double)this.camera.Zoom), (int)(16.0 * (double)this.camera.Zoom)), vector2)) { AudioManager.GetCue("sub_bass_mouseover").Play(); this.InstallModule(slot); } } } else if (this.mouseStateCurrent.LeftButton == ButtonState.Pressed && this.mouseStatePrevious.LeftButton == ButtonState.Pressed) this.HoldTimer -= .01666f; else this.HoldTimer = 0.50f; foreach (SlotStruct slotStruct in this.Slots) { if (slotStruct.ModuleUID != null && this.HighlightedModule != null && (slotStruct.module == this.HighlightedModule && (double)slotStruct.module.FieldOfFire != 0.0) && slotStruct.module.ModuleType == ShipModuleType.Turret) { float num1 = slotStruct.module.FieldOfFire / 2f; Vector2 spaceFromWorldSpace = this.camera.GetScreenSpaceFromWorldSpace(new Vector2((float)(slotStruct.pq.enclosingRect.X + 16 * (int)slotStruct.module.XSIZE / 2), (float)(slotStruct.pq.enclosingRect.Y + 16 * (int)slotStruct.module.YSIZE / 2))); float num2 = Math.Abs(this.findAngleToTarget(spaceFromWorldSpace, vector2)); float num3 = this.HighlightedModule.facing; float num4 = Math.Abs(num2 - num3); if ((double)num4 > (double)num1) { if ((double)num2 > 180.0) num2 = (float)(-1.0 * (360.0 - (double)num2)); if ((double)num3 > 180.0) num3 = (float)(-1.0 * (360.0 - (double)num3)); num4 = Math.Abs(num2 - num3); } if (GlobalStats.AltArcControl) { //The Doctor: ALT (either) + LEFT CLICK to pick and move arcs. This way, it's impossible to accidentally pick the wrong arc, while it's just as responsive and smooth as the original method when you are trying to. if ((double)num4 < (double)num1 && (this.mouseStateCurrent.LeftButton == ButtonState.Pressed && this.mouseStatePrevious.LeftButton == ButtonState.Pressed && ((input.CurrentKeyboardState.IsKeyDown(Keys.LeftAlt) || input.LastKeyboardState.IsKeyDown(Keys.LeftAlt)) || (input.CurrentKeyboardState.IsKeyDown(Keys.RightAlt) || input.LastKeyboardState.IsKeyDown(Keys.RightAlt))))) { this.HighlightedModule.facing = Math.Abs(this.findAngleToTarget(spaceFromWorldSpace, vector2)); } } else { //Delay method if ((double)num4 < (double)num1 && (this.mouseStateCurrent.LeftButton == ButtonState.Pressed && this.mouseStatePrevious.LeftButton == ButtonState.Pressed && this.HoldTimer < 0)) { this.HighlightedModule.facing = Math.Abs(this.findAngleToTarget(spaceFromWorldSpace, vector2)); } } } } foreach (UIButton uiButton in this.Buttons) { if (HelperFunctions.CheckIntersection(uiButton.Rect, vector2)) { uiButton.State = UIButton.PressState.Hover; if (this.mouseStateCurrent.LeftButton == ButtonState.Pressed && this.mouseStatePrevious.LeftButton == ButtonState.Pressed) uiButton.State = UIButton.PressState.Pressed; if (this.mouseStateCurrent.LeftButton == ButtonState.Released && this.mouseStatePrevious.LeftButton == ButtonState.Pressed) { switch (uiButton.Launches) { case "Toggle Overlay": AudioManager.PlayCue("blip_click"); this.ToggleOverlay = !this.ToggleOverlay; continue; case "Save As...": if (this.CheckDesign()) { this.ScreenManager.AddScreen((GameScreen)new DesignManager(this, this.ActiveHull.Name)); continue; } else { AudioManager.PlayCue("UI_Misc20"); this.ScreenManager.AddScreen((GameScreen)new MessageBoxScreen(Localizer.Token(2049))); continue; } case "Load": this.ScreenManager.AddScreen((GameScreen)new LoadDesigns(this)); continue; default: continue; } } } else uiButton.State = UIButton.PressState.Normal; } if (this.ActiveHull != null) { foreach (ToggleButton toggleButton in this.CombatStatusButtons) { if (HelperFunctions.CheckIntersection(toggleButton.r, input.CursorPosition)) { if (toggleButton.HasToolTip) ToolTip.CreateTooltip(toggleButton.WhichToolTip, this.ScreenManager); if (input.InGameSelect) { AudioManager.PlayCue("sd_ui_accept_alt3"); switch (toggleButton.Action) { case "attack": this.CombatState = CombatState.AttackRuns; break; case "arty": this.CombatState = CombatState.Artillery; break; case "hold": this.CombatState = CombatState.HoldPosition; break; case "orbit_left": this.CombatState = CombatState.OrbitLeft; break; case "broadside_left": this.CombatState = CombatState.BroadsideLeft; break; case "orbit_right": this.CombatState = CombatState.OrbitRight; break; case "broadside_right": this.CombatState = CombatState.BroadsideRight; break; case "evade": this.CombatState = CombatState.Evade; break; } } } else toggleButton.Hover = false; switch (toggleButton.Action) { case "attack": toggleButton.Active = this.CombatState == CombatState.AttackRuns; continue; case "arty": toggleButton.Active = this.CombatState == CombatState.Artillery; continue; case "hold": toggleButton.Active = this.CombatState == CombatState.HoldPosition; continue; case "orbit_left": toggleButton.Active = this.CombatState == CombatState.OrbitLeft; continue; case "broadside_left": toggleButton.Active = this.CombatState == CombatState.BroadsideLeft; continue; case "orbit_right": toggleButton.Active = this.CombatState == CombatState.OrbitRight; continue; case "broadside_right": toggleButton.Active = this.CombatState == CombatState.BroadsideRight; continue; case "evade": toggleButton.Active = this.CombatState == CombatState.Evade; continue; default: continue; } } } this.mouseStatePrevious = this.mouseStateCurrent; base.HandleInput(input); } }
public override void HandleInput(InputState input) { this.pFacilities.HandleInputNoReset(this); if (HelperFunctions.CheckIntersection(this.RightColony.r, input.CursorPosition)) { ToolTip.CreateTooltip(Localizer.Token(2279), this.ScreenManager); } if (HelperFunctions.CheckIntersection(this.LeftColony.r, input.CursorPosition)) { ToolTip.CreateTooltip(Localizer.Token(2280), this.ScreenManager); } if ((input.Right || this.RightColony.HandleInput(input)) && (PlanetScreen.screen.Debug || this.p.Owner == EmpireManager.GetEmpireByName(PlanetScreen.screen.PlayerLoyalty))) { try { this.p.Owner.GetPlanets().thisLock.EnterReadLock(); int thisindex = this.p.Owner.GetPlanets().IndexOf(this.p); thisindex = (thisindex >= this.p.Owner.GetPlanets().Count - 1 ? 0 : thisindex + 1); if (this.p.Owner.GetPlanets()[thisindex] != this.p) { this.p = this.p.Owner.GetPlanets()[thisindex]; PlanetScreen.screen.workersPanel = new ColonyScreen(this.p, this.ScreenManager, this.eui); } this.p.Owner.GetPlanets().thisLock.ExitReadLock(); } catch { System.Diagnostics.Debug.WriteLine("Colony Screen Handle Inpu. Likely null reference."); } if (input.CurrentMouseState.RightButton != ButtonState.Released || this.previousMouse.RightButton != ButtonState.Released) { this.eui.screen.ShipsInCombat.Active = true; this.eui.screen.PlanetsInCombat.Active = true; } return; } if ((input.Left || this.LeftColony.HandleInput(input)) && (PlanetScreen.screen.Debug || this.p.Owner == EmpireManager.GetEmpireByName(PlanetScreen.screen.PlayerLoyalty))) { int thisindex = this.p.Owner.GetPlanets().IndexOf(this.p); thisindex = (thisindex <= 0 ? this.p.Owner.GetPlanets().Count - 1 : thisindex - 1); if (this.p.Owner.GetPlanets()[thisindex] != this.p) { this.p = this.p.Owner.GetPlanets()[thisindex]; PlanetScreen.screen.workersPanel = new ColonyScreen(this.p, this.ScreenManager, this.eui); } if (input.CurrentMouseState.RightButton != ButtonState.Released || this.previousMouse.RightButton != ButtonState.Released) { this.eui.screen.ShipsInCombat.Active = true; this.eui.screen.PlanetsInCombat.Active = true; } return; } this.p.UpdateIncomes(); this.HandleDetailInfo(input); this.currentMouse = Mouse.GetState(); Vector2 MousePos = new Vector2((float)this.currentMouse.X, (float)this.currentMouse.Y); this.buildSL.HandleInput(input); this.buildSL.Update(); this.build.HandleInput(this); if (this.p.Owner != EmpireManager.GetEmpireByName(PlanetScreen.screen.PlayerLoyalty)) { this.HandleDetailInfo(input); if (input.CurrentMouseState.RightButton != ButtonState.Released || this.previousMouse.RightButton != ButtonState.Released) { this.eui.screen.ShipsInCombat.Active = true; this.eui.screen.PlanetsInCombat.Active = true; } return; } if (!HelperFunctions.CheckIntersection(this.launchTroops.Rect, input.CursorPosition)) { this.launchTroops.State = UIButton.PressState.Normal; } else { this.launchTroops.State = UIButton.PressState.Hover; if (input.InGameSelect) { bool play = false; foreach (PlanetGridSquare pgs in this.p.TilesList) { if (pgs.TroopsHere.Count <= 0 || pgs.TroopsHere[0].GetOwner() != EmpireManager.GetEmpireByName(PlanetScreen.screen.PlayerLoyalty)) { continue; } play = true; ResourceManager.CreateTroopShipAtPoint((this.p.Owner.data.DefaultTroopShip != null) ? this.p.Owner.data.DefaultTroopShip : this.p.Owner.data.DefaultSmallTransport, this.p.Owner, this.p.Position, pgs.TroopsHere[0]); this.p.TroopsHere.Remove(pgs.TroopsHere[0]); pgs.TroopsHere[0].SetPlanet(null); pgs.TroopsHere.Clear(); this.ClickedTroop = true; this.detailInfo = null; } if (play) { AudioManager.PlayCue("sd_troop_takeoff"); } } } //fbedard: Click button to send troops if (!HelperFunctions.CheckIntersection(this.SendTroops.Rect, input.CursorPosition)) { this.SendTroops.State = UIButton.PressState.Normal; } else { this.SendTroops.State = UIButton.PressState.Hover; if (input.InGameSelect) { this.eui.empire.GetShips().thisLock.EnterReadLock(); List<Ship> troopShips = new List<Ship>(this.eui.empire.GetShips() .Where(troop => troop.TroopList.Count > 0 && troop.GetAI().State == AIState.AwaitingOrders && troop.fleet == null && !troop.InCombat).OrderBy(distance => Vector2.Distance(distance.Center, this.p.Position))); this.eui.empire.GetShips().thisLock.ExitReadLock(); this.eui.empire.GetPlanets().thisLock.EnterReadLock(); List<Planet> planetTroops = new List<Planet>(this.eui.empire.GetPlanets() .Where(troops => troops.TroopsHere.Count > 1).OrderBy(distance => Vector2.Distance(distance.Position, this.p.Position)) .Where(Name => Name.Name != this.p.Name)); this.eui.empire.GetPlanets().thisLock.ExitReadLock(); if (troopShips.Count > 0) { AudioManager.PlayCue("echo_affirm"); troopShips.First().GetAI().OrderRebase(this.p,true); } else if (planetTroops.Count > 0) { { planetTroops.First().TroopsHere.thisLock.EnterWriteLock(); Ship troop = planetTroops.First().TroopsHere.First().Launch(); if (troop != null) { AudioManager.PlayCue("echo_affirm"); troop.GetAI().OrderRebase(this.p,true); } planetTroops.First().TroopsHere.thisLock.ExitWriteLock(); } } else { AudioManager.PlayCue("blip_click"); } } } if (!HelperFunctions.CheckIntersection(this.edit_name_button, MousePos)) { this.editHoverState = 0; } else { this.editHoverState = 1; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.PlanetName.HandlingInput = true; } } if (!this.PlanetName.HandlingInput) { GlobalStats.TakingInput = false; bool empty = true; string text = this.PlanetName.Text; int num = 0; while (num < text.Length) { if (text[num] == ' ') { num++; } else { empty = false; break; } } if (empty) { int ringnum = 1; foreach (SolarSystem.Ring ring in this.p.system.RingList) { if (ring.planet == this.p) { this.PlanetName.Text = string.Concat(this.p.system.Name, " ", NumberToRomanConvertor.NumberToRoman(ringnum)); } ringnum++; } } } else { GlobalStats.TakingInput = true; this.PlanetName.HandleTextInput(ref this.PlanetName.Text, input); } this.GovernorDropdown.HandleInput(input); if (this.GovernorDropdown.Options[this.GovernorDropdown.ActiveIndex].@value != (int)this.p.colonyType) { this.p.colonyType = (Planet.ColonyType)this.GovernorDropdown.Options[this.GovernorDropdown.ActiveIndex].@value; if (this.p.colonyType != Planet.ColonyType.Colony) { this.p.FoodLocked = true; this.p.ProdLocked = true; this.p.ResLocked = true; this.p.GovernorOn = true; } else { this.p.GovernorOn = false; this.p.FoodLocked = false; this.p.ProdLocked = false; this.p.ResLocked = false; } } this.HandleSlider(); if (this.p.HasShipyard && this.build.Tabs.Count > 1 && this.build.Tabs[1].Selected) { if (HelperFunctions.CheckIntersection(this.playerDesignsToggle.r, input.CursorPosition)) { ToolTip.CreateTooltip(Localizer.Token(2225), this.ScreenManager); } if (this.playerDesignsToggle.HandleInput(input)) { AudioManager.PlayCue("sd_ui_accept_alt3"); GlobalStats.ShowAllDesigns = !GlobalStats.ShowAllDesigns; if (GlobalStats.ShowAllDesigns) { this.playerDesignsToggle.Active = true; } else { this.playerDesignsToggle.Active = false; } this.Reset = true; } } if (this.p.colonyType != Planet.ColonyType.Colony) { this.FoodLock.Locked = true; this.ProdLock.Locked = true; this.ResLock.Locked = true; } else { if (!HelperFunctions.CheckIntersection(this.FoodLock.LockRect, MousePos) || this.p.Owner == null || this.p.Owner.data.Traits.Cybernetic != 0) { this.FoodLock.Hover = false; } else { if (this.FoodLock.Locked) { this.FoodLock.Hover = false; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.p.FoodLocked = false; this.FoodLock.Locked = false; AudioManager.PlayCue("sd_ui_accept_alt3"); } } else { this.FoodLock.Hover = true; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.p.FoodLocked = true; this.FoodLock.Locked = true; AudioManager.PlayCue("sd_ui_accept_alt3"); } } ToolTip.CreateTooltip(69, this.ScreenManager); } if (!HelperFunctions.CheckIntersection(this.ProdLock.LockRect, MousePos)) { this.ProdLock.Hover = false; } else { if (this.ProdLock.Locked) { this.ProdLock.Hover = false; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.p.ProdLocked = false; this.ProdLock.Locked = false; AudioManager.PlayCue("sd_ui_accept_alt3"); } } else { this.ProdLock.Hover = true; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.p.ProdLocked = true; this.ProdLock.Locked = true; AudioManager.PlayCue("sd_ui_accept_alt3"); } } ToolTip.CreateTooltip(69, this.ScreenManager); } if (!HelperFunctions.CheckIntersection(this.ResLock.LockRect, MousePos)) { this.ResLock.Hover = false; } else { if (this.ResLock.Locked) { this.ResLock.Hover = false; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.p.ResLocked = false; this.ResLock.Locked = false; AudioManager.PlayCue("sd_ui_accept_alt3"); } } else { this.ResLock.Hover = true; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.p.ResLocked = true; this.ResLock.Locked = true; AudioManager.PlayCue("sd_ui_accept_alt3"); } } ToolTip.CreateTooltip(69, this.ScreenManager); } } this.selector = null; this.ClickedTroop = false; foreach (PlanetGridSquare pgs in this.p.TilesList) { if (!HelperFunctions.CheckIntersection(pgs.ClickRect, MousePos)) { pgs.highlighted = false; } else { if (!pgs.highlighted) { AudioManager.PlayCue("sd_ui_mouseover"); } pgs.highlighted = true; } if (pgs.TroopsHere.Count <= 0 || !HelperFunctions.CheckIntersection(pgs.TroopClickRect, MousePos)) { continue; } this.detailInfo = pgs.TroopsHere[0]; if (input.RightMouseClick && pgs.TroopsHere[0].GetOwner() == EmpireManager.GetEmpireByName(PlanetScreen.screen.PlayerLoyalty)) { AudioManager.PlayCue("sd_troop_takeoff"); ResourceManager.CreateTroopShipAtPoint((this.p.Owner.data.DefaultTroopShip != null) ? this.p.Owner.data.DefaultTroopShip : this.p.Owner.data.DefaultSmallTransport, this.p.Owner, this.p.Position, pgs.TroopsHere[0]); this.p.TroopsHere.Remove(pgs.TroopsHere[0]); pgs.TroopsHere[0].SetPlanet(null); pgs.TroopsHere.Clear(); this.ClickedTroop = true; this.detailInfo = null; rmouse = true; } return; } if (!this.ClickedTroop) { foreach (PlanetGridSquare pgs in this.p.TilesList) { if (HelperFunctions.CheckIntersection(pgs.ClickRect, input.CursorPosition)) { this.detailInfo = pgs; Rectangle bRect = new Rectangle(pgs.ClickRect.X + pgs.ClickRect.Width / 2 - 32, pgs.ClickRect.Y + pgs.ClickRect.Height / 2 - 32, 64, 64); if (pgs.building != null && pgs.building.Scrappable && HelperFunctions.CheckIntersection(bRect, input.CursorPosition) && input.RightMouseClick) { this.toScrap = pgs.building; string message = string.Concat("Do you wish to scrap ", Localizer.Token(pgs.building.NameTranslationIndex), "? Half of the building's construction cost will be recovered to your storage."); MessageBoxScreen messageBox = new MessageBoxScreen(message); messageBox.Accepted += new EventHandler<EventArgs>(this.ScrapAccepted); this.ScreenManager.AddScreen(messageBox); this.ClickedTroop = true; rmouse = true; return; } } if (pgs.TroopsHere.Count <= 0 || !HelperFunctions.CheckIntersection(pgs.TroopClickRect, input.CursorPosition)) { continue; } this.detailInfo = pgs.TroopsHere; } } if (!GlobalStats.HardcoreRuleset) { if (HelperFunctions.CheckIntersection(this.foodDropDown.r, MousePos) && this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.foodDropDown.Toggle(); Planet planet = this.p; planet.fs = (Planet.GoodState)((int)planet.fs + (int)Planet.GoodState.IMPORT); if (this.p.fs > Planet.GoodState.EXPORT) { this.p.fs = Planet.GoodState.STORE; } AudioManager.PlayCue("sd_ui_accept_alt3"); } if (HelperFunctions.CheckIntersection(this.prodDropDown.r, MousePos) && this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { this.prodDropDown.Toggle(); AudioManager.PlayCue("sd_ui_accept_alt3"); Planet planet1 = this.p; planet1.ps = (Planet.GoodState)((int)planet1.ps + (int)Planet.GoodState.IMPORT); if (this.p.ps > Planet.GoodState.EXPORT) { this.p.ps = Planet.GoodState.STORE; } } } else { foreach (ThreeStateButton b in this.ResourceButtons) { b.HandleInput(input, this.ScreenManager); } } for (int i = this.QSL.indexAtTop; i < this.QSL.Copied.Count && i < this.QSL.indexAtTop + this.QSL.entriesToDisplay; i++) { try { ScrollList.Entry e = this.QSL.Copied[i]; if (!HelperFunctions.CheckIntersection(e.clickRect, MousePos)) { e.clickRectHover = 0; } else { this.selector = new Selector(this.ScreenManager, e.clickRect); if (e.clickRectHover == 0) { AudioManager.PlayCue("sd_ui_mouseover"); } e.clickRectHover = 1; } if (HelperFunctions.CheckIntersection(e.up, MousePos)) { ToolTip.CreateTooltip(63, PlanetScreen.screen.ScreenManager); if (!input.CurrentKeyboardState.IsKeyDown(Keys.RightControl) && !input.CurrentKeyboardState.IsKeyDown(Keys.LeftControl) || this.currentMouse.LeftButton != ButtonState.Pressed || this.previousMouse.LeftButton != ButtonState.Released) { if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released && i > 0) { object tmp = this.p.ConstructionQueue[i - 1]; this.p.ConstructionQueue[i - 1] = this.p.ConstructionQueue[i]; this.p.ConstructionQueue[i] = tmp as QueueItem; AudioManager.PlayCue("sd_ui_accept_alt3"); } } else if (i > 0) { LinkedList<QueueItem> copied = new LinkedList<QueueItem>(); foreach (QueueItem qi in this.p.ConstructionQueue) { copied.AddLast(qi); } copied.Remove(this.p.ConstructionQueue[i]); copied.AddFirst(this.p.ConstructionQueue[i]); this.p.ConstructionQueue.Clear(); foreach (QueueItem qi in copied) { this.p.ConstructionQueue.Add(qi); } AudioManager.PlayCue("sd_ui_accept_alt3"); break; } } if (HelperFunctions.CheckIntersection(e.down, MousePos)) { ToolTip.CreateTooltip(64, PlanetScreen.screen.ScreenManager); if (!input.CurrentKeyboardState.IsKeyDown(Keys.RightControl) && !input.CurrentKeyboardState.IsKeyDown(Keys.LeftControl) || this.currentMouse.LeftButton != ButtonState.Pressed || this.previousMouse.LeftButton != ButtonState.Released) { if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released && i + 1 < this.QSL.Copied.Count) { object tmp = this.p.ConstructionQueue[i + 1]; this.p.ConstructionQueue[i + 1] = this.p.ConstructionQueue[i]; this.p.ConstructionQueue[i] = tmp as QueueItem; AudioManager.PlayCue("sd_ui_accept_alt3"); } } else if (i + 1 < this.QSL.Copied.Count) { LinkedList<QueueItem> copied = new LinkedList<QueueItem>(); foreach (QueueItem qi in this.p.ConstructionQueue) { copied.AddLast(qi); } copied.Remove(this.p.ConstructionQueue[i]); copied.AddLast(this.p.ConstructionQueue[i]); this.p.ConstructionQueue.Clear(); foreach (QueueItem qi in copied) { this.p.ConstructionQueue.Add(qi); } AudioManager.PlayCue("sd_ui_accept_alt3"); break; } } if (HelperFunctions.CheckIntersection(e.apply, MousePos) && !this.p.RecentCombat && this.p.Crippled_Turns <= 0) { if (!input.CurrentKeyboardState.IsKeyDown(Keys.RightControl) && !input.CurrentKeyboardState.IsKeyDown(Keys.LeftControl) || this.currentMouse.LeftButton != ButtonState.Pressed || this.previousMouse.LeftButton != ButtonState.Released) { if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { if (this.p.ApplyStoredProduction(i)) { AudioManager.PlayCue("sd_ui_accept_alt3"); } else { AudioManager.PlayCue("UI_Misc20"); } } } //else if (PlanetScreen.screen.Debug) //{ // this.p.ApplyProductiontoQueue(this.p.ConstructionQueue[i].Cost - this.p.ConstructionQueue[i].productionTowards, i); //} else if (this.p.ProductionHere == 0f) { AudioManager.PlayCue("UI_Misc20"); } else { this.p.ApplyAllStoredProduction(i); AudioManager.PlayCue("sd_ui_accept_alt3"); } } if (HelperFunctions.CheckIntersection(e.cancel, MousePos) && this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { Planet productionHere2 = this.p; productionHere2.ProductionHere = productionHere2.ProductionHere + (e.item as QueueItem).productionTowards; if (this.p.ProductionHere > this.p.MAX_STORAGE) { this.p.ProductionHere = this.p.MAX_STORAGE; } QueueItem item = (e.item as QueueItem); if (item.pgs != null) { (e.item as QueueItem).pgs.QItem = null; } if(item.Goal !=null) { if(item.Goal.GoalName=="BuildConstructionShip") { p.Owner.GetGSAI().Goals.Remove(item.Goal); } if(item.Goal.GetFleet() !=null) p.Owner.GetGSAI().Goals.Remove(item.Goal); } this.p.ConstructionQueue.Remove(e.item as QueueItem); AudioManager.PlayCue("sd_ui_accept_alt3"); } } catch { } } this.QSL.HandleInput(input, this.p); if (this.ActiveBuildingEntry != null) { foreach (PlanetGridSquare pgs in this.p.TilesList) { if (!HelperFunctions.CheckIntersection(pgs.ClickRect, MousePos) || this.currentMouse.LeftButton != ButtonState.Released || this.previousMouse.LeftButton != ButtonState.Pressed) { continue; } if (pgs.Habitable && pgs.building == null && pgs.QItem == null && (this.ActiveBuildingEntry.item as Building).Name != "Biospheres") { QueueItem qi = new QueueItem(); //{ qi.isBuilding = true; qi.Building = this.ActiveBuildingEntry.item as Building; qi.Cost = ResourceManager.BuildingsDict[qi.Building.Name].Cost * UniverseScreen.GamePaceStatic; qi.productionTowards = 0f; qi.pgs = pgs; //}; pgs.QItem = qi; this.p.ConstructionQueue.Add(qi); this.ActiveBuildingEntry = null; break; } else if (pgs.Habitable || pgs.Biosphere || pgs.QItem != null || !(this.ActiveBuildingEntry.item as Building).CanBuildAnywhere) { AudioManager.PlayCue("UI_Misc20"); this.ActiveBuildingEntry = null; break; } else { QueueItem qi = new QueueItem(); //{ qi.isBuilding = true; qi.Building = this.ActiveBuildingEntry.item as Building; qi.Cost = ResourceManager.BuildingsDict[qi.Building.Name].Cost * UniverseScreen.GamePaceStatic; qi.productionTowards = 0f; qi.pgs = pgs; //}; pgs.QItem = qi; this.p.ConstructionQueue.Add(qi); this.ActiveBuildingEntry = null; break; } } if (this.ActiveBuildingEntry != null) { foreach (QueueItem qi in this.p.ConstructionQueue) { if (!qi.isBuilding || !(qi.Building.Name == (this.ActiveBuildingEntry.item as Building).Name) || !(this.ActiveBuildingEntry.item as Building).Unique) { continue; } this.ActiveBuildingEntry = null; break; } } if (this.currentMouse.RightButton == ButtonState.Pressed && this.previousMouse.RightButton == ButtonState.Released) { this.ClickedTroop = true; this.ActiveBuildingEntry = null; } if (this.currentMouse.LeftButton == ButtonState.Released && this.previousMouse.LeftButton == ButtonState.Pressed) { this.ClickedTroop = true; this.ActiveBuildingEntry = null; } } for (int i = this.buildSL.indexAtTop; i < this.buildSL.Copied.Count && i < this.buildSL.indexAtTop + this.buildSL.entriesToDisplay; i++) { ScrollList.Entry e = this.buildSL.Copied[i]; if (e.item is ModuleHeader) { (e.item as ModuleHeader).HandleInput(input, e); } else if (!HelperFunctions.CheckIntersection(e.clickRect, MousePos)) { e.clickRectHover = 0; } else { this.selector = new Selector(this.ScreenManager, e.clickRect); if (e.clickRectHover == 0) { AudioManager.PlayCue("sd_ui_mouseover"); } e.clickRectHover = 1; if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Pressed && e.item is Building && this.ActiveBuildingEntry == null) { this.ActiveBuildingEntry = e; } if (this.currentMouse.LeftButton == ButtonState.Released && this.previousMouse.LeftButton == ButtonState.Pressed) { if (this.ClickTimer >= this.TimerDelay) { this.ClickTimer = 0f; } else { Rectangle rectangle = e.addRect; if (!HelperFunctions.CheckIntersection(e.addRect, input.CursorPosition)) { QueueItem qi = new QueueItem(); if (e.item is Ship) { qi.isShip = true; qi.sData = (e.item as Ship).GetShipData(); qi.Cost = (e.item as Ship).GetCost(this.p.Owner); qi.productionTowards = 0f; this.p.ConstructionQueue.Add(qi); AudioManager.PlayCue("sd_ui_mouseover"); } else if (e.item is Troop) { qi.isTroop = true; qi.troop = e.item as Troop; qi.Cost = (e.item as Troop).GetCost(); qi.productionTowards = 0f; this.p.ConstructionQueue.Add(qi); AudioManager.PlayCue("sd_ui_mouseover"); } else if (e.item is Building) { this.p.AddBuildingToCQ(ResourceManager.GetBuilding((e.item as Building).Name)); AudioManager.PlayCue("sd_ui_mouseover"); } } } } } Rectangle rectangle1 = e.addRect; if (!HelperFunctions.CheckIntersection(e.addRect, MousePos)) { e.PlusHover = 0; } else { e.PlusHover = 1; ToolTip.CreateTooltip(51, this.ScreenManager); if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { QueueItem qi = new QueueItem(); if (e.item is Building) { this.p.AddBuildingToCQ(ResourceManager.GetBuilding((e.item as Building).Name)); } else if (e.item is Ship) { qi.isShip = true; qi.sData = (e.item as Ship).GetShipData(); qi.Cost = (e.item as Ship).GetCost(this.p.Owner); qi.productionTowards = 0f; this.p.ConstructionQueue.Add(qi); } else if (e.item is Troop) { qi.isTroop = true; qi.troop = e.item as Troop; qi.Cost = (e.item as Troop).GetCost(); qi.productionTowards = 0f; this.p.ConstructionQueue.Add(qi); } } } Rectangle rectangle2 = e.editRect; if (!HelperFunctions.CheckIntersection(e.editRect, MousePos)) { e.EditHover = 0; } else { e.EditHover = 1; ToolTip.CreateTooltip(52, this.ScreenManager); if (this.currentMouse.LeftButton == ButtonState.Pressed && this.previousMouse.LeftButton == ButtonState.Released) { ShipDesignScreen sdScreen = new ShipDesignScreen(this.eui); this.ScreenManager.AddScreen(sdScreen); sdScreen.ChangeHull((e.item as Ship).GetShipData()); } } } this.shipsCanBuildLast = this.p.Owner.ShipsWeCanBuild.Count; this.buildingsHereLast = this.p.BuildingList.Count; this.buildingsCanBuildLast = this.BuildingsCanBuild.Count; if (input.RightMouseClick && !this.ClickedTroop) rmouse = false; if (!rmouse && (input.CurrentMouseState.RightButton != ButtonState.Released || this.previousMouse.RightButton != ButtonState.Released)) { this.eui.screen.ShipsInCombat.Active = true; this.eui.screen.PlanetsInCombat.Active = true; } this.previousMouse = this.currentMouse; }
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; } } } }
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 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 DrawPlanetInfoForUI() { this.stuffSelector = new Selector(this.ScreenManager, this.SelectedStuffRect, new Color((byte)0, (byte)0, (byte)0, (byte)80)); Planet planet = this.SelectedPlanet; if (planet.Owner != null) planet.UpdateIncomes(); this.stuffSelector.Draw(); if (this.SelectedPlanet.ExploredDict[this.player]) { Rectangle destinationRectangle1 = new Rectangle(this.SelectedStuffRect.X + 30, this.SelectedStuffRect.Y + 60, this.SelectedStuffRect.Height - 80, this.SelectedStuffRect.Height - 80); this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["Planets/" + (object)planet.planetType], destinationRectangle1, Color.White); Vector2 position1 = new Vector2((float)(this.stuffSelector.Menu.X + 40), (float)(this.stuffSelector.Menu.Y + 20)); if (planet.Owner != null) this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial20Bold, this.SelectedPlanet.Name + " - " + planet.Owner.data.Traits.Name, position1, new Color(byte.MaxValue, (byte)239, (byte)208)); else this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial20Bold, this.SelectedPlanet.Name, position1, new Color(byte.MaxValue, (byte)239, (byte)208)); position1.X += 135f; position1.Y += (float)(Fonts.Arial20Bold.LineSpacing + 5); string format = "0.#"; this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, Localizer.Token(384) + ":", position1, Color.Orange); Vector2 position2 = new Vector2(position1.X + 80f, position1.Y); this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, planet.GetTypeTranslation(), position2, new Color(byte.MaxValue, (byte)239, (byte)208)); position1.Y += (float)(Fonts.Arial12Bold.LineSpacing + 2); position2 = new Vector2(position1.X + 80f, position1.Y); this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, Localizer.Token(385) + ":", position1, Color.Orange); this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, (planet.Population / 1000f).ToString(format) + " / " + ((float)(((double)planet.MaxPopulation + (double)planet.MaxPopBonus) / 1000.0)).ToString(format), position2, new Color(byte.MaxValue, (byte)239, (byte)208)); position1.Y += (float)(Fonts.Arial12Bold.LineSpacing + 2); position2 = new Vector2(position1.X + 80f, position1.Y); this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, Localizer.Token(386) + ":", position1, Color.Orange); this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, planet.Fertility.ToString(format), position2, new Color(byte.MaxValue, (byte)239, (byte)208)); position1.Y += (float)(Fonts.Arial12Bold.LineSpacing + 2); position2 = new Vector2(position1.X + 80f, position1.Y); this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, Localizer.Token(387) + ":", position1, Color.Orange); this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, planet.MineralRichness.ToString(format), position2, new Color(byte.MaxValue, (byte)239, (byte)208)); position1.Y += (float)(Fonts.Arial12Bold.LineSpacing + 2); position1.Y += (float)(Fonts.Arial12Bold.LineSpacing + 2); Vector2 position3 = position1; if (planet.Owner == null) return; this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial20Bold, (planet.NetFoodPerTurn - planet.consumption).ToString(UniverseScreen.fmt2), position3, (double)planet.NetFoodPerTurn - (double)planet.consumption > 0.0 ? new Color(byte.MaxValue, (byte)239, (byte)208) : Color.LightPink); position3.X += Fonts.Arial20Bold.MeasureString((planet.NetFoodPerTurn - planet.consumption).ToString(UniverseScreen.fmt2)).X + 4f; Rectangle destinationRectangle2 = new Rectangle((int)position3.X, (int)position3.Y, ResourceManager.TextureDict["NewUI/icon_food"].Width, ResourceManager.TextureDict["NewUI/icon_food"].Height); this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/icon_food"], destinationRectangle2, Color.White); position3.X += (float)ResourceManager.TextureDict["NewUI/icon_food"].Width; this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial20Bold, " / ", position3, Color.Gray); position3.X += Fonts.Arial20Bold.MeasureString(" / ").X; this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial20Bold, planet.Owner.data.Traits.Cybernetic > 0 ? (planet.NetProductionPerTurn - planet.consumption).ToString(UniverseScreen.fmt2) : planet.NetProductionPerTurn.ToString(UniverseScreen.fmt2), position3, planet.Owner.data.Traits.Cybernetic > 0 ? ((double)planet.NetProductionPerTurn - (double)planet.consumption > 0.0 ? new Color(byte.MaxValue, (byte)239, (byte)208) : Color.LightPink) : new Color(byte.MaxValue, (byte)239, (byte)208)); position3.X += Fonts.Arial20Bold.MeasureString(planet.Owner.data.Traits.Cybernetic > 0 ? (planet.NetProductionPerTurn - planet.consumption).ToString(UniverseScreen.fmt2) : planet.NetProductionPerTurn.ToString(UniverseScreen.fmt2)).X + 4f; Rectangle destinationRectangle3 = new Rectangle((int)position3.X, (int)position3.Y, ResourceManager.TextureDict["NewUI/icon_food"].Width, ResourceManager.TextureDict["NewUI/icon_food"].Height); this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/icon_production"], destinationRectangle3, Color.White); position3.X += (float)ResourceManager.TextureDict["NewUI/icon_food"].Width; this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial20Bold, " / ", position3, Color.Gray); position3.X += Fonts.Arial20Bold.MeasureString(" / ").X; this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial20Bold, planet.NetResearchPerTurn.ToString(UniverseScreen.fmt2), position3, new Color(byte.MaxValue, (byte)239, (byte)208)); position3.X += Fonts.Arial20Bold.MeasureString(planet.NetResearchPerTurn.ToString(UniverseScreen.fmt2)).X + 4f; Rectangle destinationRectangle4 = new Rectangle((int)position3.X, (int)position3.Y, ResourceManager.TextureDict["NewUI/icon_food"].Width, ResourceManager.TextureDict["NewUI/icon_food"].Height); this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["NewUI/icon_science"], destinationRectangle4, Color.White); position1.Y += (float)(Fonts.Arial12Bold.LineSpacing + 2); position1.Y += (float)(Fonts.Arial12Bold.LineSpacing + 2); Vector2 vector2 = position1; if (planet.ConstructionQueue.Count <= 0) return; QueueItem queueItem = planet.ConstructionQueue[0]; if (queueItem.isBuilding) { this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["Buildings/icon_" + queueItem.Building.Icon + "_48x48"], new Rectangle((int)vector2.X, (int)vector2.Y, 29, 30), Color.White); Vector2 position4 = new Vector2(vector2.X + 40f, vector2.Y); this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, queueItem.Building.Name, position4, Color.White); position4.Y += (float)Fonts.Arial12Bold.LineSpacing; new ProgressBar(new Rectangle((int)position4.X, (int)position4.Y, 150, 18)) { Max = queueItem.Cost, Progress = queueItem.productionTowards }.Draw(this.ScreenManager.SpriteBatch); } if (queueItem.isShip) { this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["Icons/icon_structure_placeholder"], new Rectangle((int)vector2.X, (int)vector2.Y, 29, 30), Color.White); Vector2 position4 = new Vector2(vector2.X + 40f, vector2.Y); this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, queueItem.sData.Name, position4, Color.White); position4.Y += (float)Fonts.Arial12Bold.LineSpacing; new ProgressBar(new Rectangle((int)position4.X, (int)position4.Y, 150, 18)) { Max = queueItem.Cost, Progress = queueItem.productionTowards }.Draw(this.ScreenManager.SpriteBatch); } if (!queueItem.isTroop) return; this.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["Troops/" + queueItem.troop.TexturePath], new Rectangle((int)vector2.X, (int)vector2.Y, 29, 30), Color.White); Vector2 position5 = new Vector2(vector2.X + 40f, vector2.Y); this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial12Bold, queueItem.troop.Name, position5, Color.White); position5.Y += (float)Fonts.Arial12Bold.LineSpacing; new ProgressBar(new Rectangle((int)position5.X, (int)position5.Y, 150, 18)) { Max = queueItem.Cost, Progress = queueItem.productionTowards }.Draw(this.ScreenManager.SpriteBatch); } else this.ScreenManager.SpriteBatch.DrawString(Fonts.Arial20Bold, Localizer.Token(1408), new Vector2((float)(this.stuffSelector.Menu.X + 40), (float)(this.stuffSelector.Menu.Y + 20)), new Color(byte.MaxValue, (byte)239, (byte)208)); }
public void HandleInputorig(InputState input) { string Names; this.AgentSL.HandleInput(input); if (this.SelectedAgent != null) { this.OpsSL.HandleInput(input); } if (HelperFunctions.CheckIntersection(this.RecruitButton.r, input.CursorPosition)) { ToolTip.CreateTooltip(Localizer.Token(2180), this.ScreenManager); } if (this.RecruitButton.HandleInput(input)) { if (EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).Money < 250f) { AudioManager.PlayCue("UI_Misc20"); } else { Empire empireByName = EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty); empireByName.Money = empireByName.Money - 250f; Names = (!File.Exists(string.Concat("Content/NameGenerators/spynames_", EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).data.Traits.ShipType, ".txt")) ? File.ReadAllText("Content/NameGenerators/spynames_Humans.txt") : File.ReadAllText(string.Concat("Content/NameGenerators/spynames_", EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).data.Traits.ShipType, ".txt"))); string[] Tokens = Names.Split(new char[] { ',' }); Agent a = new Agent() { Name = AgentComponent.GetName(Tokens) }; EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).data.AgentList.Add(a); this.AgentSL.AddItem(a); } } this.selector = null; for (int i = this.AgentSL.indexAtTop; i < this.AgentSL.Entries.Count && i < this.AgentSL.indexAtTop + this.AgentSL.entriesToDisplay; i++) { try { ScrollList.Entry e = this.AgentSL.Entries[i]; if (HelperFunctions.CheckIntersection(e.clickRect, input.CursorPosition)) { this.selector = new Selector(this.ScreenManager, e.clickRect); if (input.InGameSelect) { this.SelectedAgent = e.item as Agent; foreach (ScrollList.Entry entry in this.OpsSL.Entries) { (entry.item as MissionEntry).Initialize(); } AudioManager.PlayCue("sd_ui_accept_alt3"); } } } catch { } } if (this.SelectedAgent != null) { for (int i = this.OpsSL.indexAtTop; i < this.OpsSL.Entries.Count && i < this.OpsSL.indexAtTop + this.OpsSL.entriesToDisplay; i++) { try { ScrollList.Entry e = this.OpsSL.Entries[i]; (e.item as MissionEntry).HandleInput(input); if (HelperFunctions.CheckIntersection(e.clickRect, input.CursorPosition)) { if (!HelperFunctions.CheckIntersection((e.item as MissionEntry).DoMission.Rect, input.CursorPosition)) { ToolTip.CreateTooltip(Localizer.Token((e.item as MissionEntry).DescriptionIndex), this.ScreenManager); } else { ToolTip.CreateTooltip(Localizer.Token(2198), Ship.universeScreen.ScreenManager); } } } catch { } } } }
public override void Draw(GameTime gameTime) { string text; Vector2 Position; Vector2 drawCurs; if (!base.IsActive) { return; } base.ScreenManager.FadeBackBufferToBlack(base.TransitionAlpha * 4 / 5); base.ScreenManager.SpriteBatch.Begin(); if (!string.IsNullOrEmpty(this.them.data.Traits.VideoPath)) { if (this.player.State != MediaState.Stopped) { this.videoTexture = this.player.GetTexture(); } if (this.videoTexture != null) { base.ScreenManager.SpriteBatch.Draw(this.videoTexture, this.Portrait, Color.White); } } else { base.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict[string.Concat("Portraits/", this.them.PortraitName)], this.Portrait, Color.White); } HelperFunctions.DrawDropShadowText(base.ScreenManager, this.them.data.Traits.Name, this.EmpireNamePos, Fonts.Pirulen20); if (this.dState == DiplomacyScreen.DialogState.Negotiate) { Rectangle stripe = new Rectangle(0, this.R.Y, 1920, this.R.Height); Primitives2D.FillRectangle(base.ScreenManager.SpriteBatch, stripe, new Color(0, 0, 0, 150)); } else { Rectangle stripe = new Rectangle(0, this.DialogRect.Y, 1920, this.R.Height); Primitives2D.FillRectangle(base.ScreenManager.SpriteBatch, stripe, new Color(0, 0, 0, 150)); } base.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["GameScreens/Bridge"], this.BridgeRect, Color.White); foreach (GenericButton taf in this.TAFButtons) { taf.DrawWithShadowCaps(base.ScreenManager); this.TrustRect.Width = (int)this.them.GetRelations()[this.playerEmpire].Trust; if (this.TrustRect.Width < 1) { this.TrustRect.Width = 1; } base.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/bw_bargradient_2"], this.TrustRect, Color.Green); this.AngerRect.Width = (int)this.them.GetRelations()[this.playerEmpire].TotalAnger; if (this.AngerRect.Width > 100) { this.AngerRect.Width = 100; } if (this.AngerRect.Width < 1) { this.AngerRect.Width = 1; } base.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/bw_bargradient_2"], this.AngerRect, Color.Yellow); this.FearRect.Width = (int)this.them.GetRelations()[this.playerEmpire].Threat; if (this.FearRect.Width < 1) { this.FearRect.Width = 1; } base.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/bw_bargradient_2"], this.FearRect, Color.Red); } switch (this.dState) { case DiplomacyScreen.DialogState.Them: { Selector selector = new Selector(base.ScreenManager, this.DialogRect, new Color(0, 0, 0, 220)); text = this.parseText(this.TheirText, (float)(this.DialogRect.Width - 25), Fonts.Consolas18); Position = new Vector2((float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2) - Fonts.Consolas18.MeasureString(text).X / 2f, this.TextCursor.Y); HelperFunctions.ClampVectorToInt(ref Position); this.DrawDropShadowText(text, Position, Fonts.Consolas18); goto case DiplomacyScreen.DialogState.Choosing; } case DiplomacyScreen.DialogState.Choosing: { if (this.dState == DiplomacyScreen.DialogState.End || this.dState == DiplomacyScreen.DialogState.TheirOffer) { this.Exit.DrawWithShadowCaps(base.ScreenManager); } else { int numEntries = 4; int k = 4; foreach (GenericButton b in this.Buttons) { Rectangle r = b.R; 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 * 512f); } b.TransitionCaps(r); b.DrawWithShadowCaps(base.ScreenManager); } } Vector2 pos = new Vector2((float)(this.Portrait.X + 200), (float)(this.Portrait.Y + 200)); //{ no idea how this managed to compile in the first place pos.Y = pos.Y + (float)(Fonts.Pirulen16.LineSpacing + 15); pos.X = pos.X - 8f; //};*/ pos.Y = pos.Y + (float)(Fonts.Pirulen16.LineSpacing + 15); pos.X = pos.X - 8f; pos.Y = pos.Y + (float)(Fonts.Pirulen16.LineSpacing + 15); pos.X = pos.X - 8f; ToolTip.Draw(base.ScreenManager); base.ScreenManager.SpriteBatch.End(); return; } case DiplomacyScreen.DialogState.Discuss: { Selector selector1 = new Selector(base.ScreenManager, this.DialogRect, new Color(0, 0, 0, 220)); this.StatementsSL.Draw(base.ScreenManager.SpriteBatch); drawCurs = this.TextCursor; int i = this.StatementsSL.indexAtTop; while (i < this.StatementsSL.Entries.Count) { if (i < this.StatementsSL.indexAtTop + this.StatementsSL.entriesToDisplay) { ScrollList.Entry e = this.StatementsSL.Entries[i]; if (e.clickRectHover == 0) { (e.item as DialogOption).Update(drawCurs); (e.item as DialogOption).Draw(base.ScreenManager, Fonts.Consolas18); drawCurs.Y = drawCurs.Y + (float)(Fonts.Consolas18.LineSpacing + 5); } i++; } else { goto case DiplomacyScreen.DialogState.Choosing; } } goto case DiplomacyScreen.DialogState.Choosing; } case DiplomacyScreen.DialogState.Negotiate: { drawCurs = new Vector2((float)(this.R.X + 15), (float)(this.R.Y + 10)); this.TheirOffer.Them = this.them; string txt = this.OurOffer.FormulateOfferText(this.Attitude, this.TheirOffer); this.OfferTextSL.Entries.Clear(); HelperFunctions.parseTextToSL(txt, (float)(this.DialogRect.Width - 30), Fonts.Consolas18, ref this.OfferTextSL); for (int i = this.OfferTextSL.indexAtTop; i < this.OfferTextSL.Entries.Count && i < this.OfferTextSL.indexAtTop + this.OfferTextSL.entriesToDisplay; i++) { ScrollList.Entry e = this.OfferTextSL.Entries[i]; drawCurs.Y = (float)(e.clickRect.Y - 33); this.DrawDropShadowText(e.item as string, drawCurs, Fonts.Consolas18); } if (!this.TheirOffer.IsBlank() || !this.OurOffer.IsBlank() || this.OurOffer.Alliance) { this.SendOffer.DrawWithShadow(base.ScreenManager); } base.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["GameScreens/Negotiate_Right"], this.Negotiate_Right, Color.White); base.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["GameScreens/Negotiate_Left"], this.Negotiate_Left, Color.White); base.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["GameScreens/Negotiate_Tone"], this.ToneContainerRect, Color.White); this.DrawOurItems(); this.DrawTheirItems(); this.OfferTextSL.Draw(base.ScreenManager.SpriteBatch); this.ap.Transition(this.Attitude_Pleading_Rect); this.ap.Draw(base.ScreenManager); this.at.Transition(this.Attitude_Threaten_Rect); this.at.Draw(base.ScreenManager); this.ar.Transition(this.Attitude_Respectful_Rect); this.ar.Draw(base.ScreenManager); drawCurs = new Vector2((float)(this.UsRect.X + 10), (float)(this.UsRect.Y - Fonts.Pirulen12.LineSpacing * 2 + 9)); base.ScreenManager.SpriteBatch.DrawString(Fonts.Pirulen12, Localizer.Token(1221), drawCurs, Color.White); drawCurs = new Vector2((float)(this.ThemRect.X + 10), (float)(this.ThemRect.Y - Fonts.Pirulen12.LineSpacing * 2 + 9)); base.ScreenManager.SpriteBatch.DrawString(Fonts.Pirulen12, Localizer.Token(1222), drawCurs, Color.White); goto case DiplomacyScreen.DialogState.Choosing; } case DiplomacyScreen.DialogState.TheirOffer: { base.ScreenManager.SpriteBatch.Draw(ResourceManager.TextureDict["UI/AcceptReject"], this.AccRejRect, Color.White); text = this.parseText(this.TheirText, (float)(this.DialogRect.Width - 20), Fonts.Consolas18); Position = new Vector2((float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2) - Fonts.Consolas18.MeasureString(text).X / 2f, this.TextCursor.Y); this.DrawDropShadowText(text, Position, Fonts.Consolas18); this.Accept.DrawWithShadow(base.ScreenManager); this.Reject.DrawWithShadow(base.ScreenManager); goto case DiplomacyScreen.DialogState.Choosing; } case DiplomacyScreen.DialogState.End: { Selector selector2 = new Selector(base.ScreenManager, this.DialogRect, new Color(0, 0, 0, 220)); text = this.parseText(this.TheirText, (float)(this.DialogRect.Width - 20), Fonts.Consolas18); Position = new Vector2((float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2) - Fonts.Consolas18.MeasureString(text).X / 2f, this.TextCursor.Y); HelperFunctions.ClampVectorToInt(ref Position); this.DrawDropShadowText(text, Position, Fonts.Consolas18); goto case DiplomacyScreen.DialogState.Choosing; } default: { goto case DiplomacyScreen.DialogState.Choosing; } } }