public ResearchScreenNew(EmpireUIOverlay empireUI) { this.empireUI = empireUI; base.IsPopup = true; base.TransitionOnTime = TimeSpan.FromSeconds(0.25); base.TransitionOffTime = TimeSpan.FromSeconds(0.25); this.camera = new Camera2d(); }
public override void LoadContent() { LightRig rig = base.ScreenManager.Content.Load<LightRig>("example/ShipyardLightrig"); lock (GlobalStats.ObjectManagerLocker) { base.ScreenManager.inter.LightManager.Clear(); base.ScreenManager.inter.LightManager.Submit(rig); } if (base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth <= 1280 || base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight <= 768) { this.LowRes = true; } Rectangle leftRect = new Rectangle(5, 45, 405, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 45 - (int)(0.4f * (float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight) + 10); this.ModuleSelectionMenu = new Menu1(base.ScreenManager, leftRect); Rectangle modSelR = new Rectangle(0, (this.LowRes ? 45 : 100), 305, (this.LowRes ? 350 : 400)); this.modSel = new Submenu(base.ScreenManager, modSelR, true); this.modSel.AddTab("Wpn"); this.modSel.AddTab("Pwr"); this.modSel.AddTab("Def"); this.modSel.AddTab("Spc"); this.weaponSL = new ScrollList(this.modSel); Vector2 Cursor = new Vector2((float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth / 2 - 175), 80f); Rectangle active = new Rectangle(modSelR.X, modSelR.Y + modSelR.Height + 15, modSelR.Width, 300); this.activeModWindow = new Menu1(base.ScreenManager, active); Rectangle acsub = new Rectangle(active.X, modSelR.Y + modSelR.Height + 15, 305, 320); if (base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight > 760) { acsub.Height = acsub.Height + 120; } this.activeModSubMenu = new Submenu(base.ScreenManager, acsub); this.activeModSubMenu.AddTab("Active Module"); this.choosefighterrect = new Rectangle(acsub.X + acsub.Width + 5, acsub.Y, 240, 270); if (this.choosefighterrect.Y + this.choosefighterrect.Height > base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight) { int diff = this.choosefighterrect.Y + this.choosefighterrect.Height - base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight; this.choosefighterrect.Height = this.choosefighterrect.Height - (diff + 10); } this.choosefighterrect.Height = acsub.Height; this.ChooseFighterSub = new Submenu(base.ScreenManager, this.choosefighterrect); this.ChooseFighterSub.AddTab("Choose Fighter"); this.ChooseFighterSL = new ScrollList(this.ChooseFighterSub, 40); foreach (KeyValuePair<string, bool> hull in EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).GetHDict()) { if (!hull.Value) { continue; } this.AvailableHulls.Add(Ship_Game.ResourceManager.HullsDict[hull.Key]); } PrimitiveQuad.graphicsDevice = base.ScreenManager.GraphicsDevice; float width = (float)base.ScreenManager.GraphicsDevice.Viewport.Width; Viewport viewport = base.ScreenManager.GraphicsDevice.Viewport; float aspectRatio = width / (float)viewport.Height; this.offset = new Vector2(); Viewport viewport1 = base.ScreenManager.GraphicsDevice.Viewport; this.offset.X = (float)(viewport1.Width / 2 - 256); Viewport viewport2 = base.ScreenManager.GraphicsDevice.Viewport; this.offset.Y = (float)(viewport2.Height / 2 - 256); this.camera = new Camera2d(); Camera2d vector2 = this.camera; Viewport viewport3 = base.ScreenManager.GraphicsDevice.Viewport; float single = (float)viewport3.Width / 2f; Viewport viewport4 = base.ScreenManager.GraphicsDevice.Viewport; vector2.Pos = new Vector2(single, (float)viewport4.Height / 2f); Vector3 camPos = this.cameraPosition * new Vector3(-1f, 1f, 1f); this.view = ((Matrix.CreateTranslation(0f, 0f, 0f) * Matrix.CreateRotationY(MathHelper.ToRadians(180f))) * Matrix.CreateRotationX(MathHelper.ToRadians(0f))) * Matrix.CreateLookAt(camPos, new Vector3(camPos.X, camPos.Y, 0f), new Vector3(0f, -1f, 0f)); this.projection = Matrix.CreatePerspectiveFieldOfView(0.7853982f, aspectRatio, 1f, 20000f); this.ChangeHull(this.AvailableHulls[0]); lock (GlobalStats.ObjectManagerLocker) { if (!this.ActiveHull.Animated) { this.ActiveModel = base.ScreenManager.Content.Load<Model>(this.ActiveHull.ModelPath); this.CreateSOFromHull(); } else { base.ScreenManager.inter.ObjectManager.Remove(this.shipSO); SkinnedModel sm = Ship_Game.ResourceManager.GetSkinnedModel(this.ActiveHull.ModelPath); this.shipSO = new SceneObject(sm.Model) { ObjectType = ObjectType.Dynamic, World = this.worldMatrix }; base.ScreenManager.inter.ObjectManager.Submit(this.shipSO); this.SetupSlots(); } } foreach (ModuleSlotData slot in this.ActiveHull.ModuleSlotList) { if (slot.Position.X < this.LowestX) { this.LowestX = slot.Position.X; } if (slot.Position.X <= this.HighestX) { continue; } this.HighestX = slot.Position.X; } float xDistance = this.HighestX - this.LowestX; BoundingSphere bs = this.shipSO.WorldBoundingSphere; Viewport viewport5 = base.ScreenManager.GraphicsDevice.Viewport; Vector3 pScreenSpace = viewport5.Project(Vector3.Zero, this.projection, this.view, Matrix.Identity); Vector2 pPos = new Vector2(pScreenSpace.X, pScreenSpace.Y); Vector2 radialPos = this.GeneratePointOnCircle(90f, Vector2.Zero, xDistance); Viewport viewport6 = base.ScreenManager.GraphicsDevice.Viewport; Vector3 insetRadialPos = viewport6.Project(new Vector3(radialPos, 0f), this.projection, this.view, Matrix.Identity); Vector2 insetRadialSS = new Vector2(insetRadialPos.X, insetRadialPos.Y); float Radius = Vector2.Distance(insetRadialSS, pPos) + 10f; if (Radius >= xDistance) { while (Radius > xDistance) { camPos = this.cameraPosition * new Vector3(-1f, 1f, 1f); this.view = ((Matrix.CreateTranslation(0f, 0f, 0f) * Matrix.CreateRotationY(MathHelper.ToRadians(180f))) * Matrix.CreateRotationX(MathHelper.ToRadians(0f))) * Matrix.CreateLookAt(camPos, new Vector3(camPos.X, camPos.Y, 0f), new Vector3(0f, -1f, 0f)); bs = this.shipSO.WorldBoundingSphere; Viewport viewport7 = base.ScreenManager.GraphicsDevice.Viewport; pScreenSpace = viewport7.Project(Vector3.Zero, this.projection, this.view, Matrix.Identity); pPos = new Vector2(pScreenSpace.X, pScreenSpace.Y); radialPos = this.GeneratePointOnCircle(90f, Vector2.Zero, xDistance); Viewport viewport8 = base.ScreenManager.GraphicsDevice.Viewport; insetRadialPos = viewport8.Project(new Vector3(radialPos, 0f), this.projection, this.view, Matrix.Identity); insetRadialSS = new Vector2(insetRadialPos.X, insetRadialPos.Y); Radius = Vector2.Distance(insetRadialSS, pPos) + 10f; this.cameraPosition.Z = this.cameraPosition.Z + 1f; } } else { while (Radius < xDistance) { camPos = this.cameraPosition * new Vector3(-1f, 1f, 1f); this.view = ((Matrix.CreateTranslation(0f, 0f, 0f) * Matrix.CreateRotationY(MathHelper.ToRadians(180f))) * Matrix.CreateRotationX(MathHelper.ToRadians(0f))) * Matrix.CreateLookAt(camPos, new Vector3(camPos.X, camPos.Y, 0f), new Vector3(0f, -1f, 0f)); bs = this.shipSO.WorldBoundingSphere; Viewport viewport9 = base.ScreenManager.GraphicsDevice.Viewport; pScreenSpace = viewport9.Project(Vector3.Zero, this.projection, this.view, Matrix.Identity); pPos = new Vector2(pScreenSpace.X, pScreenSpace.Y); radialPos = this.GeneratePointOnCircle(90f, Vector2.Zero, xDistance); Viewport viewport10 = base.ScreenManager.GraphicsDevice.Viewport; insetRadialPos = viewport10.Project(new Vector3(radialPos, 0f), this.projection, this.view, Matrix.Identity); insetRadialSS = new Vector2(insetRadialPos.X, insetRadialPos.Y); Radius = Vector2.Distance(insetRadialSS, pPos) + 10f; this.cameraPosition.Z = this.cameraPosition.Z - 1f; } } this.BlackBar = new Rectangle(0, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 70, 3000, 70); this.SideBar = new Rectangle(0, 0, 280, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight); Rectangle w = new Rectangle(20, this.modSel.Menu.Y - 10, 32, 32); Rectangle p = new Rectangle(80, w.Y, 32, 32); Rectangle df = new Rectangle(150, w.Y, 32, 32); Rectangle sp = new Rectangle(220, w.Y, 32, 32); this.wpn = new SkinnableButton(w, "Modules/FlakTurret3x3") { IsToggle = true, Toggled = true }; this.pwr = new SkinnableButton(p, "Modules/NuclearReactorMedium") { IsToggle = true }; this.def = new SkinnableButton(df, "Modules/SteelArmorMedium") { IsToggle = true }; this.spc = new SkinnableButton(sp, "Modules/sensors_2x2") { IsToggle = true }; this.SelectedCatTextPos = new Vector2(20f, (float)(w.Y - 25 - Fonts.Arial20Bold.LineSpacing / 2)); this.SearchBar = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 585, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 47, 210, 25); Cursor = new Vector2((float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 370), (float)(modSelR.Y + modSelR.Height + 408)); Vector2 OrdersBarPos = new Vector2(Cursor.X - 60f, (float)((int)Cursor.Y + 10)); ToggleButton AttackRuns = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_headon"); this.CombatStatusButtons.Add(AttackRuns); AttackRuns.Action = "attack"; AttackRuns.HasToolTip = true; AttackRuns.WhichToolTip = 1; OrdersBarPos.X = OrdersBarPos.X + 29f; ToggleButton Artillery = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_aft"); this.CombatStatusButtons.Add(Artillery); Artillery.Action = "arty"; Artillery.HasToolTip = true; Artillery.WhichToolTip = 2; OrdersBarPos.X = OrdersBarPos.X + 29f; ToggleButton HoldPos = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_x"); this.CombatStatusButtons.Add(HoldPos); HoldPos.Action = "hold"; HoldPos.HasToolTip = true; HoldPos.WhichToolTip = 65; OrdersBarPos.X = OrdersBarPos.X + 29f; ToggleButton OrbitLeft = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_left"); this.CombatStatusButtons.Add(OrbitLeft); OrbitLeft.Action = "orbit_left"; OrbitLeft.HasToolTip = true; OrbitLeft.WhichToolTip = 3; OrdersBarPos.Y = OrdersBarPos.Y + 29f; ToggleButton BroadsideLeft = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_bleft"); this.CombatStatusButtons.Add(BroadsideLeft); BroadsideLeft.Action = "broadside_left"; BroadsideLeft.HasToolTip = true; BroadsideLeft.WhichToolTip = 159; OrdersBarPos.Y = OrdersBarPos.Y - 29f; OrdersBarPos.X = OrdersBarPos.X + 29f; ToggleButton OrbitRight = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_right"); this.CombatStatusButtons.Add(OrbitRight); OrbitRight.Action = "orbit_right"; OrbitRight.HasToolTip = true; OrbitRight.WhichToolTip = 4; OrdersBarPos.Y = OrdersBarPos.Y + 29f; ToggleButton BroadsideRight = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_bright"); this.CombatStatusButtons.Add(BroadsideRight); BroadsideRight.Action = "broadside_right"; BroadsideRight.HasToolTip = true; BroadsideRight.WhichToolTip = 160; OrdersBarPos.Y = OrdersBarPos.Y - 29f; OrdersBarPos.X = OrdersBarPos.X + 29f; ToggleButton Evade = new ToggleButton(new Rectangle((int)OrdersBarPos.X, (int)OrdersBarPos.Y, 24, 24), "SelectionBox/button_formation_active", "SelectionBox/button_formation_inactive", "SelectionBox/button_formation_hover", "SelectionBox/button_formation_press", "SelectionBox/icon_formation_stop"); this.CombatStatusButtons.Add(Evade); Evade.Action = "evade"; Evade.HasToolTip = true; Evade.WhichToolTip = 6; Cursor = new Vector2((float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 150), (float)base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight - 47); this.SaveButton = new UIButton() { Rect = new Rectangle((int)Cursor.X, (int)Cursor.Y, Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"].Width, Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"].Height), NormalTexture = Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"], HoverTexture = Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_hover"], PressedTexture = Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_pressed"], Text = Localizer.Token(105), Launches = "Save As..." }; this.Buttons.Add(this.SaveButton); this.LoadButton = new UIButton() { Rect = new Rectangle((int)Cursor.X - 78, (int)Cursor.Y, Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px"].Width, Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px"].Height), NormalTexture = Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px"], HoverTexture = Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px_hover"], PressedTexture = Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px_pressed"], Text = Localizer.Token(8), Launches = "Load" }; this.Buttons.Add(this.LoadButton); this.ToggleOverlayButton = new UIButton() { Rect = new Rectangle(this.LoadButton.Rect.X - 140, (int)Cursor.Y, Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"].Width, Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_68px"].Height), NormalTexture = Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px"], HoverTexture = Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_hover"], PressedTexture = Ship_Game.ResourceManager.TextureDict["EmpireTopBar/empiretopbar_btn_132px_pressed"], Launches = "Toggle Overlay", Text = Localizer.Token(106) }; this.Buttons.Add(this.ToggleOverlayButton); this.bottom_sep = new Rectangle(this.BlackBar.X, this.BlackBar.Y, this.BlackBar.Width, 1); this.HullSelectionRect = new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 285, (this.LowRes ? 45 : 100), 280, (this.LowRes ? 350 : 400)); this.hullSelectionSub = new Submenu(base.ScreenManager, this.HullSelectionRect, true); this.weaponSL = new ScrollList(this.modSel); this.hullSelectionSub.AddTab(Localizer.Token(107)); this.hullSL = new ScrollList(this.hullSelectionSub); List<string> Categories = new List<string>(); foreach (KeyValuePair<string, ShipData> hull in Ship_Game.ResourceManager.HullsDict) { if (!EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).GetHDict()[hull.Key]) { continue; } string cat = Localizer.GetRole(hull.Value.Role, EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty)); if (Categories.Contains(cat)) { continue; } Categories.Add(cat); } Categories.Sort(); foreach (string cat in Categories) { ModuleHeader type = new ModuleHeader(cat, 240f); this.hullSL.AddItem(type); } foreach (ScrollList.Entry e in this.hullSL.Entries) { foreach (KeyValuePair<string, ShipData> hull in Ship_Game.ResourceManager.HullsDict) { if (!EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty).GetHDict()[hull.Key] || !((e.item as ModuleHeader).Text == Localizer.GetRole(hull.Value.Role, EmpireManager.GetEmpireByName(this.EmpireUI.screen.PlayerLoyalty)))) { continue; } e.AddItem(hull.Value); } } Rectangle ShipStatsPanel = new Rectangle(this.HullSelectionRect.X + 50, this.HullSelectionRect.Y + this.HullSelectionRect.Height - 20, 280, 320); this.classifCursor = new Vector2(ShipStatsPanel.X - 100, ShipStatsPanel.Y + ShipStatsPanel.Height + 92); dropdownRect = new Rectangle((int)ShipStatsPanel.X, (int)ShipStatsPanel.Y + ShipStatsPanel.Height + 118, 100, 18); this.CategoryList = new DropOptions(dropdownRect); this.CategoryList.AddOption("Unclassified", 1); this.CategoryList.AddOption("Civilian", 2); this.CategoryList.AddOption("Recon", 3); this.CategoryList.AddOption("Fighter", 4); this.CategoryList.AddOption("Bomber", 5); this.CarrierOnly = this.ActiveHull.CarrierShip; Ref<bool> CORef = new Ref<bool>(() => this.CarrierOnly, (bool x) => { this.CarrierOnly = x; }); this.COBoxCursor = new Vector2(dropdownRect.X + 106, dropdownRect.Y); this.CarrierOnlyBox = new Checkbox(this.COBoxCursor, "Carrier Only", CORef, Fonts.Arial12Bold); this.ShipStats = new Menu1(base.ScreenManager, ShipStatsPanel); this.statsSub = new Submenu(base.ScreenManager, ShipStatsPanel); this.statsSub.AddTab(Localizer.Token(108)); this.ArcsButton = new GenericButton(new Vector2((float)(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 32), 97f), "Arcs", Fonts.Pirulen20, Fonts.Pirulen16); this.close = new CloseButton(new Rectangle(base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth - 27, 99, 20, 20)); this.OriginalZ = this.cameraPosition.Z; }
public override void LoadContent() { this.camera = new Camera2d(); Camera2d vector2 = this.camera; Viewport viewport = base.ScreenManager.GraphicsDevice.Viewport; float width = (float)viewport.Width / 2f; Viewport viewport1 = base.ScreenManager.GraphicsDevice.Viewport; vector2.Pos = new Vector2(width, (float)viewport1.Height / 2f); Rectangle main = new Rectangle(0, 0, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth, base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight); this.MainMenu = new Menu2(base.ScreenManager, main); this.MainMenuOffset = new Vector2((float)(main.X + 20), (float)(main.Y + 30)); this.close = new CloseButton(new Rectangle(main.X + main.Width - 40, main.Y + 20, 20, 20)); this.QueueContainer = new Rectangle(main.X + main.Width - 355, main.Y + 40, 330, main.Height - 100); this.qcomponent = new QueueComponent(base.ScreenManager, this.QueueContainer, this); if (base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferWidth < 1600) { this.qcomponent.SetInvisible(); } int numRoots = 0; foreach (KeyValuePair<string, TechEntry> tech in EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict()) { if (ResourceManager.TechTree[tech.Value.UID].RootNode != 1) { continue; } if (!ResourceManager.TechTree[tech.Value.UID].Secret) { numRoots++; } else if (EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict()[tech.Value.UID].Discovered) { numRoots++; } } this.RowOffset = (main.Height - 40) / numRoots; this.MainMenuOffset.Y = (float)(main.Y + this.RowOffset / 3); if (base.ScreenManager.GraphicsDevice.PresentationParameters.BackBufferHeight <= 720) { this.MainMenuOffset.Y = this.MainMenuOffset.Y + 8f; } foreach (KeyValuePair<string, TechEntry> tech in EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict()) { if (ResourceManager.TechTree[tech.Value.UID].RootNode != 1) { continue; } if (ResourceManager.TechTree[tech.Value.UID].Secret) { if (!EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict()[tech.Value.UID].Discovered) { continue; } this.Cursor.X = 0f; this.Cursor.Y = (float)(this.FindDeepestY() + 1); this.SetNode(tech.Value); } else { this.Cursor.X = 0f; this.Cursor.Y = (float)(this.FindDeepestY() + 1); this.SetNode(tech.Value); } } this.RowOffset = (main.Height - 40) / 6; foreach (KeyValuePair<string, Node> entry in this.TechTree) { this.PopulateAllTechsFromRoot(entry.Value as RootNode); } this.PopulateNodesFromRoot(this.TechTree[GlobalStats.ResearchRootUIDToDisplay] as RootNode); string resTop = EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).ResearchTopic; if (!string.IsNullOrEmpty(resTop)) { this.qcomponent.LoadQueue(this.CompleteSubNodeTree[resTop] as TreeNode); } foreach (string uid in EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).data.ResearchQueue) { this.qcomponent.LoadQueue(this.CompleteSubNodeTree[uid] as TreeNode); } base.LoadContent(); }
public bool HandleInput(InputState input, Ship_Game.ScreenManager ScreenManager, Camera2d camera) { Vector2 RectPos = camera.GetScreenSpaceFromWorldSpace(new Vector2((float)this.BaseRect.X, (float)this.BaseRect.Y)); Rectangle moddedRect = new Rectangle((int)RectPos.X, (int)RectPos.Y, this.BaseRect.Width, this.BaseRect.Height); Vector2 RectPos2 = camera.GetScreenSpaceFromWorldSpace(new Vector2((float)this.UnlocksRect.X, (float)this.UnlocksRect.Y)); Rectangle moddedRect2 = new Rectangle((int)RectPos2.X, (int)RectPos2.Y, this.UnlocksRect.Width, this.UnlocksRect.Height); Vector2 RectPos3 = camera.GetScreenSpaceFromWorldSpace(new Vector2((float)this.IconRect.X, (float)this.IconRect.Y)); Rectangle moddedRect3 = new Rectangle((int)RectPos3.X, (int)RectPos3.Y, this.IconRect.Width, this.IconRect.Height); if (HelperFunctions.CheckIntersection(moddedRect, input.CursorPosition) || HelperFunctions.CheckIntersection(moddedRect2, input.CursorPosition)) { if (this.nodeState != NodeState.Hover) { AudioManager.PlayCue("mouse_over4"); } this.nodeState = NodeState.Hover; if (input.InGameSelect) { this.nodeState = NodeState.Press; return true; } if (input.RightMouseClick) { this.screen.RightClicked = true; ScreenManager.AddScreen(new ResearchPopup(this.screen.empireUI.screen, new Rectangle(0, 0, 600, 600), this.tech.UID)); return false; } } else { this.nodeState = NodeState.Normal; } if (!HelperFunctions.CheckIntersection(moddedRect3, input.CursorPosition)) { foreach (UnlocksGrid.GridItem gridItem in this.grid.GridOfUnlocks) { Vector2 RectPos4 = camera.GetScreenSpaceFromWorldSpace(new Vector2((float)gridItem.rect.X, (float)gridItem.rect.Y)); Rectangle moddedRect4 = new Rectangle((int)RectPos4.X, (int)RectPos4.Y, gridItem.rect.Width, gridItem.rect.Height); if (!HelperFunctions.CheckIntersection(moddedRect4, input.CursorPosition)) { continue; } string tip = string.Concat(gridItem.item.privateName, "\n\n", gridItem.item.Description); if (gridItem.item.HullUnlocked == null) { ToolTip.CreateTooltip(tip, ScreenManager); } else { ToolTip.CreateTooltip(string.Concat(ResourceManager.HullsDict[gridItem.item.HullUnlocked].Name, " (", Localizer.GetRole(ResourceManager.HullsDict[gridItem.item.HullUnlocked].Role, EmpireManager.GetEmpireByName(screen.empireUI.screen.PlayerLoyalty)), ")"), ScreenManager); } } } else { ToolTip.CreateTooltip(string.Concat("Right Click to Expand \n\n", Localizer.Token(ResourceManager.TechTree[this.tech.UID].DescriptionIndex)), ScreenManager); } return false; }