private void loadMeshSets(ConfigNode[] nodes) { meshSets = new Dictionary <string, SWVariant>(); SWVariant variant; for (int index = 0; index < nodes.Length; index++) { variant = new SWVariant(); variant.Load(nodes[index]); if (!meshSets.ContainsKey(variant.name)) { meshSets.Add(variant.name, variant); } } }
public void applyVariant(int newIndex, bool fireEvents = false) { if (variants == null || newIndex < 0 || newIndex > variants.Count - 1) { return; } SWVariant variant = variants[variantIndex]; variant.applyVariant(part, currentMeshSet); if (updateSymmetry) { int count = part.symmetryCounterparts.Count; SWPartVariants partVariant; for (int index = 0; index < count; index++) { partVariant = part.symmetryCounterparts[index].FindModuleImplementing <SWPartVariants>(); partVariant.variantIndex = variantIndex; partVariant.variantApplied = true; variant = partVariant.variants[variantIndex]; variant.applyVariant(part.symmetryCounterparts[index], currentMeshSet); } } if (fireEvents) { /* * UI_VariantSelector variantSelector = getVariantSelector(); * * GameEvents.onVariantApplied.Fire(part, variantSelector.variants[variantIndex]); * if (HighLogic.LoadedSceneIsEditor) * GameEvents.onEditorVariantApplied.Fire(part, variantSelector.variants[variantIndex]); */ if (variant.extraInfo.Count > 0) { onApplyVariantExtraInfo.Fire(this, variant.name, variant.extraInfo); } } variantApplied = true; }
private void loadVariantConfigs(ConfigNode node) { variants = new List <SWVariant>(); if (!node.HasNode("VARIANT")) { return; } ConfigNode[] variantNodes = node.GetNodes("VARIANT"); SWVariant variant; for (int index = 0; index < variantNodes.Length; index++) { variant = new SWVariant(); variant.Load(variantNodes[index]); if (!string.IsNullOrEmpty(variant.name)) { variants.Add(variant); } } }