protected void Dispose(bool disposing) { if (!disposed) { if (disposing) { if (this.qcomponent != null) this.qcomponent.Dispose(); } this.qcomponent = null; this.disposed = true; } }
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(); }