public void Draw(Rectangle container, Ship_Game.ScreenManager ScreenManager) { this.Node = new TreeNode(new Vector2((float)container.X, (float)container.Y) + new Vector2(100f, 20f), this.Node.tech, this.screen); this.bup.r = new Rectangle(container.X + 15, container.Y + container.Height / 2 - 33, 30, 30); this.bdown.r = new Rectangle(container.X + 15, container.Y + container.Height / 2 - 33 + 36, 30, 30); this.bcancel.r = new Rectangle(container.X + 15 + 30 + 12, container.Y + container.Height / 2 - 15, 30, 30); this.bup.Draw(ScreenManager); this.bdown.Draw(ScreenManager); this.bcancel.Draw(ScreenManager); this.Node.DrawGlow(ScreenManager); this.Node.Draw(ScreenManager); }
public ResearchQItem(Vector2 Position, TreeNode Node, ResearchScreenNew screen) { this.pos = Position; this.screen = screen; this.container = new Rectangle((int)Position.X, (int)Position.Y, 320, 110); this.Node = new TreeNode(new Vector2((float)this.container.X, (float)this.container.Y) + new Vector2(100f, 20f), Node.tech, screen); this.Up = new Rectangle(this.container.X + 15, this.container.Y + this.container.Height / 2 - 33, 30, 30); this.Down = new Rectangle(this.container.X + 15, this.container.Y + this.container.Height / 2 - 33 + 36, 30, 30); this.Cancel = new Rectangle(this.container.X + 15 + 30 + 12, this.container.Y + this.container.Height / 2 - 15, 30, 30); this.bup = new TexturedButton(this.Up, "ResearchMenu/button_queue_up", "ResearchMenu/button_queue_up_hover", "ResearchMenu/button_queue_up_press"); this.bdown = new TexturedButton(this.Down, "ResearchMenu/button_queue_down", "ResearchMenu/button_queue_down_hover", "ResearchMenu/button_queue_down_press"); this.bcancel = new TexturedButton(this.Cancel, "ResearchMenu/button_queue_cancel", "ResearchMenu/button_queue_cancel_hover", "ResearchMenu/button_queue_cancel_press"); }
public void AddToQueue(TreeNode researchItem) { if (this.CurrentResearch == null) { EmpireManager.GetEmpireByName(this.screen.empireUI.screen.PlayerLoyalty).ResearchTopic = researchItem.tech.UID; this.CurrentResearch = new ResearchQItem(new Vector2((float)(this.csub.Menu.X + 5), (float)(this.csub.Menu.Y + 30)), researchItem, this.screen); return; } if (!EmpireManager.GetEmpireByName(this.screen.empireUI.screen.PlayerLoyalty).data.ResearchQueue.Contains(researchItem.tech.UID) && EmpireManager.GetEmpireByName(this.screen.empireUI.screen.PlayerLoyalty).ResearchTopic != researchItem.tech.UID) { EmpireManager.GetEmpireByName(this.screen.empireUI.screen.PlayerLoyalty).data.ResearchQueue.Add(researchItem.tech.UID); ResearchQItem qi = new ResearchQItem(new Vector2((float)(this.csub.Menu.X + 5), (float)(this.csub.Menu.Y + 30)), researchItem, this.screen); this.QSL.AddItem(qi); } }
public void LoadQueue(TreeNode researchItem) { if (this.CurrentResearch == null) { this.CurrentResearch = new ResearchQItem(new Vector2((float)(this.csub.Menu.X + 5), (float)(this.csub.Menu.Y + 30)), researchItem, this.screen); return; } ResearchQItem qi = new ResearchQItem(new Vector2((float)(this.csub.Menu.X + 5), (float)(this.csub.Menu.Y + 30)), researchItem, this.screen); this.QSL.AddItem(qi); }
public void PopulateNodesFromSubNode(Node treenode) { Vector2 Position = new Vector2(this.Cursor.X, this.Cursor.Y); bool SeatTaken = false; foreach (Vector2 v in this.ClaimedSpots) { if (v.X != Position.X || v.Y != Position.Y) { continue; } SeatTaken = true; } if (SeatTaken) { this.Cursor.Y = this.Cursor.Y + 1f; } else { this.ClaimedSpots.Add(Position); } for (int i = 0; i < ResourceManager.TechTree[treenode.tech.UID].LeadsTo.Count; i++) { if (!ResourceManager.TechTree[ResourceManager.TechTree[treenode.tech.UID].LeadsTo[i].UID].Secret || EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).GetTDict()[ResourceManager.TechTree[treenode.tech.UID].LeadsTo[i].UID].Discovered) { if (i != 0) { this.Cursor.Y = (float)(this.FindDeepestYSubNodes() + 1); } else { this.Cursor.Y = (float)this.FindDeepestYSubNodes(); } this.Cursor.X = treenode.NodePosition.X + 1f; TechEntry te = EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict()[ResourceManager.TechTree[treenode.tech.UID].LeadsTo[i].UID]; TreeNode newNode = new TreeNode(this.MainMenuOffset + new Vector2((float)(this.ColumnOffset * (int)this.Cursor.X), (float)(this.RowOffset * (int)this.Cursor.Y)), te, this) { NodePosition = this.Cursor }; if (EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict()[te.UID].Unlocked) { newNode.complete = true; } this.SubNodes.Add(newNode.tech.UID, newNode); this.PopulateNodesFromSubNode(newNode); } } }
public void PopulateNodesFromRoot(RootNode Root) { this.UIDCurrentRoot = Root.tech.UID; this.SubNodes.Clear(); int Rows = 1; int Cols = CalculateTreeDemensionsFromRoot(Root.tech.UID, ref Rows, 0, 0); if (Rows < 9) this.RowOffset = (MainMenu.Menu.Height - 40) / Rows; else this.RowOffset = (MainMenu.Menu.Height - 40) / 9; if (Cols > 0 && Cols < 9) this.ColumnOffset = (MainMenu.Menu.Width - 350) / Cols + 1; else this.ColumnOffset = 165; foreach (KeyValuePair<string, Node> node in this.TechTree) { (node.Value as RootNode).nodeState = NodeState.Normal; } Root.nodeState = NodeState.Press; this.ClaimedSpots.Clear(); this.Cursor = new Vector2(1f, 1f); bool first = true; for (int i = 0; i < ResourceManager.TechTree[Root.tech.UID].LeadsTo.Count; i++) { if (!ResourceManager.TechTree[ResourceManager.TechTree[Root.tech.UID].LeadsTo[i].UID].Secret || EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).GetTDict()[ResourceManager.TechTree[Root.tech.UID].LeadsTo[i].UID].Discovered) { if (!first) { this.Cursor.Y = (float)(this.FindDeepestYSubNodes() + 1); } else { this.Cursor.Y = (float)this.FindDeepestYSubNodes(); first = false; } this.Cursor.X = Root.NodePosition.X + 1f; TechEntry te = EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict()[ResourceManager.TechTree[Root.tech.UID].LeadsTo[i].UID]; TreeNode newNode = new TreeNode(this.MainMenuOffset + new Vector2((float)(this.ColumnOffset * (int)this.Cursor.X), (float)(this.RowOffset * (int)this.Cursor.Y)), te, this) { NodePosition = this.Cursor }; if (EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict()[te.UID].Unlocked) { newNode.complete = true; } this.SubNodes.Add(newNode.tech.UID, newNode); this.PopulateNodesFromSubNode(newNode); } } }
public void PopulateAllTechsFromRoot(RootNode Root) { foreach (KeyValuePair<string, Node> node in this.TechTree) { (node.Value as RootNode).nodeState = NodeState.Normal; } Root.nodeState = NodeState.Press; this.Cursor = new Vector2(1f, 1f); for (int i = 0; i < ResourceManager.TechTree[Root.tech.UID].LeadsTo.Count; i++) { if (!ResourceManager.TechTree[ResourceManager.TechTree[Root.tech.UID].LeadsTo[i].UID].Secret || EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).GetTDict()[ResourceManager.TechTree[Root.tech.UID].LeadsTo[i].UID].Discovered) { TechEntry te = EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict()[ResourceManager.TechTree[Root.tech.UID].LeadsTo[i].UID]; TreeNode newNode = new TreeNode(this.MainMenuOffset + new Vector2((float)(this.ColumnOffset * (int)this.Cursor.X), (float)(this.RowOffset * (int)this.Cursor.Y)), te, this) { NodePosition = this.Cursor }; if (EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict()[te.UID].Unlocked) { newNode.complete = true; } this.CompleteSubNodeTree.Add(newNode.tech.UID, newNode); this.PopulateAllTechs(newNode); } } }
public void PopulateAllTechs(Node treenode) { for (int i = 0; i < ResourceManager.TechTree[treenode.tech.UID].LeadsTo.Count; i++) { if (!ResourceManager.TechTree[ResourceManager.TechTree[treenode.tech.UID].LeadsTo[i].UID].Secret || EmpireManager.GetEmpireByName(Ship.universeScreen.PlayerLoyalty).GetTDict()[ResourceManager.TechTree[treenode.tech.UID].LeadsTo[i].UID].Discovered) { if (i != 0) { this.Cursor.Y = (float)(this.FindDeepestYSubNodes() + 1); } else { this.Cursor.Y = (float)this.FindDeepestYSubNodes(); } this.Cursor.X = treenode.NodePosition.X + 1f; TechEntry te = EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict()[ResourceManager.TechTree[treenode.tech.UID].LeadsTo[i].UID]; TreeNode newNode = new TreeNode(this.MainMenuOffset + new Vector2((float)(this.ColumnOffset * (int)this.Cursor.X), (float)(this.RowOffset * (int)this.Cursor.Y)), te, this) { NodePosition = this.Cursor }; if (EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict()[te.UID].Unlocked) { newNode.complete = true; } this.CompleteSubNodeTree.Add(newNode.tech.UID, newNode); this.PopulateAllTechs(newNode); } } }