Beispiel #1
0
 private void applyTextureSet(string setName, bool useDefaultColors)
 {
     if (!model.isValidTextureSet(setName))
     {
         setName    = model.getDefaultTextureSet();
         textureSet = setName;
     }
     if (useDefaultColors)
     {
         TextureSet ts = Array.Find(model.modelDefinition.textureSets, m => m.name == setName);
         if (ts != null && ts.maskColors != null && ts.maskColors.Length > 0)
         {
             customColors    = new RecoloringData[3];
             customColors[0] = ts.maskColors[0];
             customColors[1] = ts.maskColors[1];
             customColors[2] = ts.maskColors[2];
         }
         else
         {
             RecoloringData dummy = new RecoloringData(Color.white, 0, 0);
             customColors = new RecoloringData[] { dummy, dummy, dummy };
         }
         saveColors(customColors);
     }
     model.enableTextureSet(textureSet, customColors);
     if (textureField != null)
     {
         model.updateTextureUIControl(partModule, textureField.name, textureSet);
     }
     SSTUModInterop.onPartTextureUpdated(part);
 }
Beispiel #2
0
 private void loadPersistentData(string data)
 {
     if (!string.IsNullOrEmpty(data))
     {
         string[] colorSplits = data.Split(';');
         int      len         = colorSplits.Length;
         customColors = new RecoloringData[len];
         for (int i = 0; i < len; i++)
         {
             customColors[i] = new RecoloringData(colorSplits[i]);
         }
     }
     else
     {
         customColors = new RecoloringData[0];
     }
 }