// Get all parts assigned to RDNode. public void GetPartsAssigned() { List <AvailablePart> partsList = null; if (PartLoader.Instance) { partsList = PartLoader.LoadedPartsList; } if (partsList == null) { HETTNSettings.LogWarning("No loaded part lists available!"); return; } this.partsAssigned = new List <AvailablePart>(); int count = partsList.Count; for (int i = 0; i < count; i++) { if (partsList[i].TechRequired == this.techID && !partsList[i].TechHidden) { this.partsAssigned.Add(partsList[i]); } } }
// --------------------------------------------------------- // Hide nodes whose parents are not yet researched. // I disable some graphic gameObjects, so it's feels kind of // hackey. But the normal Squad methods (SetViewable, etc.) // don't seem to work. // --------------------------------------------------------- #region CHANGE VIEWABLE public void ChangeViewable() { // Option is disabled. Return right away. if (hettnSettings.forceHideUnresearchable == false) { HETTNSettings.Log2("Hide Unresearchable Nodes option is disabled."); return; } HETTNSettings.Log2("Attempting to hide any unresearchable nodes..."); // Hide unresearchable nodes. foreach (RDNode node in this.rdTechTree.controller.nodes) { HETTNSettings.Log2("Node: \"{0}\" | SciCost: {1}({2}), State: {3}, Available: {4}, IsResearched: {5}, IsGraphicActive: {6}.", node.tech.techID, node.tech.scienceCost, this.rdTechTree.controller.ScienceCap, node.state, node.tech.state, node.IsResearched, node.graphics.isActiveAndEnabled); // Keep node active if researched or researchable, but remove their tech lines and arrows to unresearched parents. // Note: using "if (node.IsResearched == true)" in addition would create less warnings below. For some reason // "node.state" isn't always reliable. if (new[] { RDNode.State.RESEARCHED, RDNode.State.RESEARCHABLE }.Contains(node.state)) { foreach (RDNode.Parent parent in node.parents) { if (!parent.parent.node.IsResearched) { parent.line.active = false; parent.arrowHead.gameObject.SetActive(false); } } continue; } // Remove parent tech lines and arrows, but also repair nodes that are below science cap but have // visible parents. Also fix an occasional problem where nodes that should be visible are not // ("node.state" problem). Keep both these kinds of nodes active. else { bool flagUnhide = false; List <RDNode.Parent> list = new List <RDNode.Parent>(); foreach (RDNode.Parent parent in node.parents) { parent.line.active = false; parent.arrowHead.gameObject.SetActive(false); if (parent.parent.node.IsResearched) { list.Add(parent); flagUnhide = true; } } if (flagUnhide) { foreach (RDNode.Parent parent in list) { parent.line.active = true; parent.arrowHead.gameObject.SetActive(true); parent.parent.node.UpdateGraphics(); } if (node.tech.scienceCost < this.rdTechTree.controller.ScienceCap || node.state != RDNode.State.HIDDEN) { HETTNSettings.LogWarning("Something is wrong with node \"{0}\", it should be viewable. Forcing node graphics to active. Ignore message if you can see the node.", node.tech.title, node.IsResearched); } continue; } } // Deactive the remaining node graphics. node.graphics.gameObject.SetActive(false); } HETTNSettings.Log2("Finished hiding unresearchable nodes."); }