public DoGAAtr getAtrFromPalette(DoGAAtr atr, string nameAtrColor, string nameAtrTexture, string nameAtrMaterial, Dictionary <string, DoGAAtr> atrsInPartsAssembler = null) { if (!this.doesUsePalette(atr.name)) { return(atr); } // If atr found in L3 attribute, use it and ignore palette. if (atrsInPartsAssembler != null && nameAtrColor != null && atrsInPartsAssembler.ContainsKey(nameAtrColor)) { atr.clearTexture(); atr.merge(atrsInPartsAssembler[nameAtrColor]); return(atr); } var atrRet = this.mergeAtrFromPalette(atr, nameAtrColor, nameAtrTexture, nameAtrMaterial); return(atrRet); }
public DoGAAtr mergeAtrFromPalette(DoGAAtr atr, string nameAtrColor, string nameAtrTexture, string nameAtrMaterial) { var atrsAttribute = this.palettes[DoGAAtrInfo.prefixPaletteAttribute]; var atrsColor = this.palettes[DoGAAtrInfo.prefixPaletteColor]; DoGAAtr atrColor = null; if (nameAtrColor != null) { if (atrsColor.ContainsKey(nameAtrColor)) { atrColor = atrsColor[nameAtrColor].atr.CloneDeep(); } else if (atrsAttribute.ContainsKey(nameAtrColor)) { atrColor = atrsAttribute[nameAtrColor].atr.CloneDeep(); } } if (atrColor != null) { atrColor.clearExceptColor(); atr.merge(atrColor); } var atrsTexture = this.palettes[DoGAAtrInfo.prefixPaletteTexture]; DoGAAtr atrTexture = null; if (nameAtrTexture != null) { if (atrsTexture.ContainsKey(nameAtrTexture)) { atrTexture = atrsTexture[nameAtrTexture].atr.CloneDeep(); } else if (atrsAttribute.ContainsKey(nameAtrTexture)) { atrTexture = atrsAttribute[nameAtrTexture].atr.CloneDeep(); } } if (atrTexture != null) { atrTexture.clearExceptTexture(); atr.clearTexture(); atr.merge(atrTexture); } var atrsMaterial = this.palettes[DoGAAtrInfo.prefixPaletteMaterial]; DoGAAtr atrMaterial = null; if (nameAtrMaterial != null) { if (atrsMaterial.ContainsKey(nameAtrMaterial)) { atrMaterial = atrsMaterial[nameAtrMaterial].atr.CloneDeep(); } else if (atrsAttribute.ContainsKey(nameAtrMaterial)) { atrMaterial = atrsAttribute[nameAtrMaterial].atr.CloneDeep(); } } if (atrMaterial != null) { atrMaterial.clearExceptMaterial(); atr.clearMaterial(); atr.merge(atrMaterial); } return(atr); }