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 ShowDetailPop(Node node, string techUID) { Technology unlockedTech = ResourceManager.TechTree[techUID]; //this.ShowingDetailPopUp = true; this.DetailInfo = node; this.DetailPopUpRect = node.NodeRect; this.UnlocksSubMenu = new Submenu(base.ScreenManager, this.DetailPopUpRect); this.UnlockSL = new ScrollList(this.UnlocksSubMenu, 96) { indexAtTop = 0 }; this.DetailUnlocks.Clear(); foreach (Technology.UnlockedMod unlockMod in unlockedTech.ModulesUnlocked) { if (EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).data.Traits.ShipType == unlockMod.Type || unlockMod.Type == null || unlockMod.Type == EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict()[techUID].AcquiredFrom) { ResearchScreenNew.UnlockItem unlock = new ResearchScreenNew.UnlockItem() { Type = "SHIPMODULE", module = ResourceManager.ShipModulesDict[unlockMod.ModuleUID] }; this.UnlockSL.AddItem(unlock); } } foreach (Technology.UnlockedTroop troop in unlockedTech.TroopsUnlocked) { if (troop.Type == EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).data.Traits.ShipType || troop.Type == null || troop.Type == "ALL" || troop.Type == EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict()[techUID].AcquiredFrom) { ResearchScreenNew.UnlockItem unlock = new ResearchScreenNew.UnlockItem() { Type = "TROOP", troop = ResourceManager.TroopsDict[troop.Name] }; this.UnlockSL.AddItem(unlock); } } foreach (Technology.UnlockedHull hull in unlockedTech.HullsUnlocked) { if (EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).data.Traits.ShipType == hull.ShipType || hull.ShipType == null || hull.ShipType == EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict()[techUID].AcquiredFrom) { ResearchScreenNew.UnlockItem unlock = new ResearchScreenNew.UnlockItem() { Type = "HULL", privateName = hull.Name, HullUnlocked = ResourceManager.HullsDict[hull.Name].Name }; int size = 0; foreach (ModuleSlotData moduleSlotList in ResourceManager.HullsDict[hull.Name].ModuleSlotList) { size++; } unlock.Description = string.Concat(Localizer.Token(4042), " ", Localizer.GetRole(ResourceManager.HullsDict[hull.Name].Role, EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty))); this.UnlockSL.AddItem(unlock); } } foreach (Technology.UnlockedBuilding unlockedB in unlockedTech.BuildingsUnlocked) { if (EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).data.Traits.ShipType == unlockedB.Type || unlockedB.Type == null || unlockedB.Type == EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict()[techUID].AcquiredFrom) { ResearchScreenNew.UnlockItem unlock = new ResearchScreenNew.UnlockItem() { Type = "BUILDING", building = ResourceManager.BuildingsDict[unlockedB.Name] }; this.UnlockSL.AddItem(unlock); } } foreach (Technology.UnlockedBonus ub in unlockedTech.BonusUnlocked) { if (EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).data.Traits.ShipType == ub.Type || ub.Type == null || ub.Type == EmpireManager.GetEmpireByName(this.empireUI.screen.PlayerLoyalty).GetTDict()[techUID].AcquiredFrom) { ResearchScreenNew.UnlockItem unlock = new ResearchScreenNew.UnlockItem() { Type = "ADVANCE", privateName = ub.Name, }; this.UnlockSL.AddItem(unlock); } } }
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); } } }