public override void LoadContent() { float screenWidth = (float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth; float screenHeight = (float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight; Rectangle titleRect = new Rectangle((int)screenWidth / 2 - 200, 44, 400, 80); this.TitleBar = new Menu2(base.ScreenManager, titleRect); this.TitlePos = new Vector2((float)(titleRect.X + titleRect.Width / 2) - Fonts.Laserian14.MeasureString(Localizer.Token(1600)).X / 2f, (float)(titleRect.Y + titleRect.Height / 2 - Fonts.Laserian14.LineSpacing / 2)); Rectangle leftRect = new Rectangle((int)screenWidth / 2 - 640, (screenHeight > 768f ? titleRect.Y + titleRect.Height + 5 : 44), 1280, 660); this.DMenu = new Menu2(base.ScreenManager, leftRect); this.close = new CloseButton(new Rectangle(leftRect.X + leftRect.Width - 40, leftRect.Y + 20, 20, 20)); this.SelectedInfoRect = new Rectangle(leftRect.X + 60, leftRect.Y + 250, 368, 376); this.IntelligenceRect = new Rectangle(this.SelectedInfoRect.X + this.SelectedInfoRect.Width + 30, this.SelectedInfoRect.Y, 368, 376); this.OperationsRect = new Rectangle(this.IntelligenceRect.X + this.IntelligenceRect.Width + 30, this.SelectedInfoRect.Y, 368, 376); this.ArtifactsRect = new Rectangle(this.SelectedInfoRect.X + 20, this.SelectedInfoRect.Y + 180, this.SelectedInfoRect.Width - 40, 130); Submenu ArtifactsSub = new Submenu(base.ScreenManager, this.ArtifactsRect); this.ArtifactsSL = new ScrollList(ArtifactsSub, 40); this.Contact = new DanButton(new Vector2((float)(this.SelectedInfoRect.X + this.SelectedInfoRect.Width / 2 - 91), (float)(this.SelectedInfoRect.Y + this.SelectedInfoRect.Height - 45)), Localizer.Token(1644)) { Toggled = true }; foreach (Empire e in EmpireManager.EmpireList) { if (e != EmpireManager.GetEmpireByName(this.screen.PlayerLoyalty)) { if (e.isFaction || e.MinorRace) { continue; } RaceEntry re = new RaceEntry() { e = e }; this.Races.Add(re); } else { RaceEntry re = new RaceEntry() { e = e }; this.SelectedEmpire = e; this.ArtifactsSL.Entries.Clear(); this.ArtifactsSL.indexAtTop = 0; ArtifactEntry entry = new ArtifactEntry(); for (int i = 0; i < e.data.OwnedArtifacts.Count; i++) { Artifact art = e.data.OwnedArtifacts[i]; SkinnableButton button = new SkinnableButton(new Rectangle(0, 0, 32, 32), string.Concat("Artifact Icons/", art.Name)) { IsToggle = false, ReferenceObject = art, BaseColor = Color.White }; if (entry.ArtifactButtons.Count < 5) { entry.ArtifactButtons.Add(button); } if (entry.ArtifactButtons.Count == 5 || i == e.data.OwnedArtifacts.Count - 1) { this.ArtifactsSL.AddItem(entry); entry = new ArtifactEntry(); } } this.Races.Add(re); } } Vector2 Cursor = new Vector2(screenWidth / 2f - (float)(148 * this.Races.Count / 2), (float)(leftRect.Y + 10)); int j = 0; foreach (RaceEntry re in this.Races) { re.container = new Rectangle((int)Cursor.X + 10 + j * 148, leftRect.Y + 40, 124, 148); j++; } base.ScreenManager.racialMusic.SetVolume(0f); }
public override void HandleInput(InputState input) { if (input.CurrentKeyboardState.IsKeyDown(Keys.I) && !input.LastKeyboardState.IsKeyDown(Keys.I) && !GlobalStats.TakingInput) { AudioManager.PlayCue("echo_affirm"); this.ExitScreen(); return; } if (this.close.HandleInput(input)) { this.ExitScreen(); return; } //this.showExecuteButton = false; if (this.SelectedEmpire != EmpireManager.GetEmpireByName(this.screen.PlayerLoyalty) && !this.SelectedEmpire.data.Defeated && this.Contact.HandleInput(input)) { base.ScreenManager.AddScreen(new DiplomacyScreen(this.SelectedEmpire, EmpireManager.GetEmpireByName(this.screen.PlayerLoyalty), "Greeting")); } foreach (RaceEntry race in this.Races) { if (EmpireManager.GetEmpireByName(this.screen.PlayerLoyalty) == race.e || !EmpireManager.GetEmpireByName(this.screen.PlayerLoyalty).GetRelations()[race.e].Known) { if (EmpireManager.GetEmpireByName(this.screen.PlayerLoyalty) != race.e || !HelperFunctions.ClickedRect(race.container, input)) { continue; } this.SelectedEmpire = race.e; this.ArtifactsSL.Entries.Clear(); this.ArtifactsSL.indexAtTop = 0; ArtifactEntry entry = new ArtifactEntry(); for (int i = 0; i < this.SelectedEmpire.data.OwnedArtifacts.Count; i++) { Artifact art = this.SelectedEmpire.data.OwnedArtifacts[i]; SkinnableButton button = new SkinnableButton(new Rectangle(0, 0, 32, 32), string.Concat("Artifact Icons/", art.Name)) { IsToggle = false, ReferenceObject = art, BaseColor = Color.White }; if (entry.ArtifactButtons.Count < 5) { entry.ArtifactButtons.Add(button); } if (entry.ArtifactButtons.Count == 5 || i == this.SelectedEmpire.data.OwnedArtifacts.Count - 1) { this.ArtifactsSL.AddItem(entry); entry = new ArtifactEntry(); } } AudioManager.PlayCue("echo_affirm"); } else { if (!HelperFunctions.ClickedRect(race.container, input)) { continue; } this.SelectedEmpire = race.e; this.ArtifactsSL.Entries.Clear(); this.ArtifactsSL.indexAtTop = 0; ArtifactEntry entry = new ArtifactEntry(); for (int i = 0; i < this.SelectedEmpire.data.OwnedArtifacts.Count; i++) { Artifact art = this.SelectedEmpire.data.OwnedArtifacts[i]; SkinnableButton button = new SkinnableButton(new Rectangle(0, 0, 32, 32), string.Concat("Artifact Icons/", art.Name)) { IsToggle = false, ReferenceObject = art, BaseColor = Color.White }; if (entry.ArtifactButtons.Count < 5) { entry.ArtifactButtons.Add(button); } if (entry.ArtifactButtons.Count == 5 || i == this.SelectedEmpire.data.OwnedArtifacts.Count - 1) { this.ArtifactsSL.AddItem(entry); entry = new ArtifactEntry(); } } } } for (int i = this.ArtifactsSL.indexAtTop; i < this.ArtifactsSL.Entries.Count && i < this.ArtifactsSL.indexAtTop + this.ArtifactsSL.entriesToDisplay; i++) { foreach (SkinnableButton button in (this.ArtifactsSL.Entries[i].item as ArtifactEntry).ArtifactButtons) { if (!HelperFunctions.CheckIntersection(button.r, input.CursorPosition)) { continue; } string Text = string.Concat(Localizer.Token((button.ReferenceObject as Artifact).NameIndex), "\n\n"); Text = string.Concat(Text, Localizer.Token((button.ReferenceObject as Artifact).DescriptionIndex)); ToolTip.CreateTooltip(Text, base.ScreenManager); } } if (input.Escaped || input.CurrentMouseState.RightButton == ButtonState.Pressed) { this.ExitScreen(); } base.HandleInput(input); }