Beispiel #1
0
        // Save RDNode and parents.
        public void Save(ConfigNode node)
        {
            if (node == null)
            {
                HETTNSettings.Log("test11");
            }
            node.AddValue("id", this.techID);
            node.AddValue("tier", this.tier); // KTT compatibility.
            node.AddValue("title", this.title);
            node.AddValue("description", this.description);
            node.AddValue("cost", this.scienceCost);
            node.AddValue("hideEmpty", this.hideIfNoParts);
            node.AddValue("nodeName", this.nodeName);
            node.AddValue("anyToUnlock", this.AnyParentToUnlock);
            node.AddValue("icon", this.iconRef);
            node.AddValue("pos", KSPUtil.WriteVector(this.pos));
            node.AddValue("scale", this.scale);
            int count = this.parents.Length;

            for (int i = 0; i < count; i++)
            {
                this.parents[i].Save(node.AddNode("Parent"));
            }
            // ETT fix 4 of 5.
            if (this.unlocks != null)
            {
                this.unlocks.Save(node.AddNode("Unlocks"));
            }
        }
 // Event.
 private void onTechTreeSpawn(RDTechTree rdTechTree)
 {
     HETTNSettings.Log("Using tech tree path: {0}", HighLogic.CurrentGame.Parameters.Career.TechTreeUrl);
     Preload();
     HETTNSettings.Log2("Applying visual changes...");
     ChangeZoomScroll();
     ChangeViewable();
     HETTNSettings.Log2("Finished applying visual changes.");
 }
 // Unhide children when node is researched.
 public void ActionButtonClick(string state)
 {
     if (hettnSettings.forceHideUnresearchable == false)
     {
         return;
     }
     if (state == "research")
     {
         if (this.rdTechTree.controller.node_selected.IsResearched)
         {
             HETTNSettings.Log2("Attempting to unhide new researchable nodes...");
             int count = this.rdTechTree.controller.node_selected.children.Count;
             for (int i = 0; i < count; i++)
             {
                 this.rdTechTree.controller.node_selected.children[i].graphics.gameObject.SetActive(true);
                 this.rdTechTree.controller.node_selected.children[i].UpdateGraphics();
                 foreach (RDNode.Parent parent in this.rdTechTree.controller.node_selected.children[i].parents)
                 {
                     if (parent.parent.node.tech.techID == this.rdTechTree.controller.node_selected.tech.techID)
                     {
                         parent.line.active = true;
                         parent.arrowHead.gameObject.SetActive(true);
                         parent.parent.node.UpdateGraphics();
                     }
                 }
                 HETTNSettings.Log("Node: \"{0}\" | Unlocked child: \"{1}\".",
                                   this.rdTechTree.controller.node_selected.tech.techID,
                                   this.rdTechTree.controller.node_selected.children[i].tech.techID);
             }
             HETTNSettings.Log2("Successfully unhid new researchable nodes.");
         }
         else
         {
             HETTNSettings.Log2("Not enough science. Not showing children.");
         }
     }
 }