public void FillPartList() { // precalc our node dictionary Dictionary<string, ConfigNode> partnodes = new Dictionary<string, ConfigNode>(); foreach (ConfigNode node in GameDatabase.Instance.GetConfigNodes("ENTRYCOSTMODS")) foreach (ConfigNode n in node.GetNodes("PART")) if (n.HasValue("name")) partnodes[n.GetValue("name")] = n; // now fill our dictionary of parts if (PartLoader.Instance == null || PartLoader.LoadedPartsList == null) { Debug.LogError("*RP-0 EC: ERROR: Partloader instance null or list null!"); return; } for (int a = PartLoader.LoadedPartsList.Count - 1; a >= 0; --a) { AvailablePart ap = PartLoader.LoadedPartsList[a]; if (ap == null) { continue; } Part part = ap.partPrefab; if (part != null) { ConfigNode partnode = null; string name = GetPartName(ap); if (partnodes.TryGetValue(name, out partnode)) partlist[name] = new PartEntryCostHolder(partnode, ap); } } }
public double PartEntryCost(string partName) { PartEntryCostHolder ec = null; if (partlist.TryGetValue(partName, out ec)) { return(ec.EntryCost()); } Debug.LogError("*RP-0 EC: ERROR: entry cost modifier for " + partName + " does not exist!"); return(0d); }
public bool IsUnlocked(string partname) { PartEntryCostHolder partEC = null; if (ResearchAndDevelopment.Instance != null) { if (partlist.TryGetValue(partname, out partEC)) { return(ResearchAndDevelopment.PartModelPurchased(partEC.ap)); } } return(false); }
public void FillPartList() { // precalc our node dictionary Dictionary <string, ConfigNode> partnodes = new Dictionary <string, ConfigNode>(); foreach (ConfigNode node in GameDatabase.Instance.GetConfigNodes("ENTRYCOSTMODS")) { foreach (ConfigNode n in node.GetNodes("PART")) { if (n.HasValue("name")) { partnodes[n.GetValue("name")] = n; } } } // now fill our dictionary of parts if (PartLoader.Instance == null || PartLoader.LoadedPartsList == null) { Debug.LogError("*RP-0 EC: ERROR: Partloader instance null or list null!"); return; } for (int a = PartLoader.LoadedPartsList.Count - 1; a >= 0; --a) { AvailablePart ap = PartLoader.LoadedPartsList[a]; if (ap == null) { continue; } Part part = ap.partPrefab; if (part != null) { ConfigNode partnode = null; string name = GetPartName(ap); if (partnodes.TryGetValue(name, out partnode)) { partlist[name] = new PartEntryCostHolder(partnode, ap); } } } }