public void onPartPurchased(AvailablePart ap) { Part part = ap.partPrefab; if (part != null) { for (int i = part.Modules.Count - 1; i >= 0; --i) { PartModule m = part.Modules[i]; if (m is ModuleEngineConfigs) { ModuleEngineConfigs mec = m as ModuleEngineConfigs; mec.CheckConfigs(); for (int j = mec.configs.Count - 1; j >= 0; --j) { ConfigNode cfg = mec.configs[j]; if (cfg.HasValue("name")) { string cfgName = cfg.GetValue("name"); // TL upgrades if (mec.techLevel >= 0) { string tUName = Utilities.GetPartName(ap) + cfgName; SetTLUnlocked(tUName, mec.techLevel); } // unlock the config if it defaults to unlocked, or if autoUnlock is on. bool auto = mec.autoUnlock; if (cfg.HasValue("techRequired")) { string tech = cfg.GetValue("techRequired"); if (tech != "" && tech != ap.TechRequired) { auto = false; } } bool unlocked = false; if (cfg.HasValue("unlocked")) { bool.TryParse(cfg.GetValue("unlocked"), out unlocked); } if (auto || unlocked) { SetConfigUnlock(cfgName, true); } } } } } } }
public void onPartPurchased(AvailablePart ap) { EntryCostDatabase.SetUnlocked(ap); StartCoroutine(updatePartEntryCosts()); Part part = ap.partPrefab; if (part != null) { for (int i = part.Modules.Count - 1; i >= 0; --i) { PartModule m = part.Modules[i]; if (m is ModuleEngineConfigs) { ModuleEngineConfigs mec = m as ModuleEngineConfigs; mec.CheckConfigs(); for (int j = mec.configs.Count - 1; j >= 0; --j) { ConfigNode cfg = mec.configs[j]; if (cfg.HasValue("name")) { string cfgName = cfg.GetValue("name"); // TL upgrades if (mec.techLevel >= 0) { string tUName = Utilities.GetPartName(ap) + cfgName; SetTLUnlocked(tUName, mec.techLevel); } } } } } } }
public static void FillUpgrades() { if (PartLoader.Instance == null || PartLoader.LoadedPartsList == null) { Debug.LogError("*RFUM: ERROR: Partloader instance null or list null!"); return; } configUpgrades = new Dictionary <string, EngineConfigUpgrade>(); techLevelUpgrades = new Dictionary <string, TLUpgrade>(); 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) { if (part.Modules == null) { continue; } for (int i = part.Modules.Count - 1; i >= 0; --i) { PartModule m = part.Modules[i]; if (m is ModuleEngineConfigs) { ModuleEngineConfigs mec = m as ModuleEngineConfigs; mec.CheckConfigs(); for (int j = mec.configs.Count - 1; j >= 0; --j) { ConfigNode cfg = mec.configs[j]; if (cfg.HasValue("name")) { string cfgName = cfg.GetValue("name"); if (RFSettings.Instance.usePartNameInConfigUnlock) { cfgName = Utilities.GetPartName(ap) + cfgName; } // config upgrades EngineConfigUpgrade eConfig = new EngineConfigUpgrade(cfg, cfgName); configUpgrades[cfgName] = eConfig; eConfig.unlocked = false; // TL upgrades if (mec.techLevel >= 0) { TLUpgrade tU = new TLUpgrade(cfg, mec); techLevelUpgrades[tU.name] = tU; } } } } } } } }
public void FillUpgrades() { if (PartLoader.Instance == null || PartLoader.LoadedPartsList == null) { Debug.LogError("*RFUM: 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) { if (part.Modules == null) { continue; } for (int i = part.Modules.Count - 1; i >= 0; --i) { PartModule m = part.Modules[i]; if (m is ModuleEngineConfigs) { ModuleEngineConfigs mec = m as ModuleEngineConfigs; mec.CheckConfigs(); for (int j = mec.configs.Count - 1; j >= 0; --j) { ConfigNode cfg = mec.configs[j]; if (cfg.HasValue("name")) { string cfgName = cfg.GetValue("name"); if (RFSettings.Instance.usePartNameInConfigUnlock) { cfgName = Utilities.GetPartName(ap) + cfgName; } // config upgrades EngineConfigUpgrade eConfig = new EngineConfigUpgrade(cfg, cfgName); configUpgrades[cfgName] = eConfig; if (ResearchAndDevelopment.Instance != null && ap.TechRequired != null) { if (ResearchAndDevelopment.PartModelPurchased(ap)) { if (cfg.HasValue("techRequired")) { string tech = cfg.GetValue("techRequired"); if (tech != "" && tech != ap.TechRequired) { continue; } } bool unlocked = false; if (cfg.HasValue("unlocked")) { bool.TryParse(cfg.GetValue("unlocked"), out unlocked); } if (mec.autoUnlock || unlocked) { eConfig.unlocked = true; } } else { eConfig.unlocked = false; } // TL upgrades if (mec.techLevel >= 0) { TLUpgrade tU = new TLUpgrade(cfg, mec); techLevelUpgrades[tU.name] = tU; } } } } } } } } }
public static void FillUpgrades() { if (PartLoader.Instance == null || PartLoader.LoadedPartsList == null) { log.error("Partloader instance null or list null!"); return; } configUpgrades = new Dictionary <string, EngineConfigUpgrade>(); techLevelUpgrades = new Dictionary <string, TLUpgrade>(); for (int a = PartLoader.LoadedPartsList.Count; a-- > 0;) { AvailablePart ap = PartLoader.LoadedPartsList[a]; if (ap == null || ap.partPrefab == null) { continue; } Part part = ap.partPrefab; if (part.Modules == null) { continue; } for (int i = part.Modules.Count; i-- > 0;) { PartModule m = part.Modules[i]; if (m is ModuleEngineConfigs) { ModuleEngineConfigs mec = m as ModuleEngineConfigs; mec.CheckConfigs(); for (int j = mec.configs.Count; j-- > 0;) { ConfigNode cfg = mec.configs[j]; string cfgName = cfg.GetValue("name"); if (!string.IsNullOrEmpty(cfgName)) { if (RFSettings.Instance.usePartNameInConfigUnlock) { cfgName = Utilities.GetPartName(ap) + cfgName; } // config upgrades if (!configUpgrades.ContainsKey(cfgName)) { EngineConfigUpgrade eConfig = new EngineConfigUpgrade(cfg, cfgName); configUpgrades[cfgName] = eConfig; } // TL upgrades if (mec.techLevel >= 0) { TLUpgrade tU = new TLUpgrade(cfg, mec); techLevelUpgrades[tU.name] = tU; } } } } } } }