internal void refreshGui(Part part) { if (part != openPart) { return; } moduleRecolorData.Clear(); setupForPart(part); int len = moduleRecolorData.Count; if (moduleIndex >= len) { findFirstRecolorable(out moduleIndex, out sectionIndex); } len = moduleRecolorData[moduleIndex].sectionData.Length; if (sectionIndex >= len) { findFirstRecolorable(moduleIndex, out moduleIndex, out sectionIndex); } ModuleRecolorData mrd = moduleRecolorData[moduleIndex]; SectionRecolorData srd = mrd.sectionData[sectionIndex]; if (!srd.recoloringSupported()) { findFirstRecolorable(out moduleIndex, out sectionIndex); } setupSectionData(moduleRecolorData[moduleIndex].sectionData[sectionIndex], colorIndex); }
private void closeSectionGUI() { sectionData = null; editingColor = new RecoloringData(Color.white, 0, 0); rStr = gStr = bStr = aStr = "255"; colorIndex = 0; }
/// <summary> /// To be called from the external 'GuiCloseAction' delegate. /// </summary> internal void closeGui() { closeSectionGUI(); moduleRecolorData.Clear(); sectionData = null; openPart = null; InputLockManager.RemoveControlLock("SSTURecolorGUILock"); colorIndex = -1; moduleIndex = -1; sectionIndex = -1; }
public ModuleRecolorData(PartModule module, IRecolorable iModule) { this.module = module; this.iModule = iModule; string[] names = iModule.getSectionNames(); int len = names.Length; sectionData = new SectionRecolorData[len]; for (int i = 0; i < len; i++) { sectionData[i] = new SectionRecolorData(iModule, names[i], iModule.getSectionColors(names[i]), iModule.getSectionTexture(names[i])); } }
private void setupSectionData(SectionRecolorData section, int colorIndex) { this.sectionData = section; this.colorIndex = colorIndex; if (section.colors == null) { return; } editingColor = sectionData.colors[colorIndex]; rStr = (editingColor.color.r * 255f).ToString("F0"); gStr = (editingColor.color.g * 255f).ToString("F0"); bStr = (editingColor.color.b * 255f).ToString("F0"); aStr = (editingColor.specular * 255f).ToString("F0"); mStr = (editingColor.metallic * 255f).ToString("F0"); }