Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        private void setupForPart(Part part)
        {
            List <IRecolorable> mods = part.FindModulesImplementing <IRecolorable>();

            foreach (IRecolorable mod in mods)
            {
                ModuleRecolorData data = new ModuleRecolorData((PartModule)mod, mod);
                moduleRecolorData.Add(data);
            }
        }
Ejemplo n.º 3
0
 private void findFirstRecolorable(int moduleStart, out int module, out int section)
 {
     module = moduleStart;
     if (moduleStart < moduleRecolorData.Count)
     {
         ModuleRecolorData mrd = moduleRecolorData[moduleStart];
         int len = mrd.sectionData.Length;
         SectionRecolorData srd;
         for (int i = 0; i < len; i++)
         {
             srd = mrd.sectionData[i];
             if (srd.recoloringSupported())
             {
                 //found section in current module that supports recoloring, return it
                 section = i;
                 return;
             }
         }
     }
     //if recolorable could not be found in current module selection, default to searching entire part
     findFirstRecolorable(out module, out section);
 }