public static bool ChangeSettingHairAcsColorPrefix(int parts, ChaControl __instance) { int HairAcsColorNum = __instance.GetHairAcsColorNum(parts); if (HairAcsColorNum == 0) { return(false); } ChaCustomHairComponent customHairComponent = __instance.GetCustomHairComponent(parts); if (null == customHairComponent) { return(false); } for (int i = 0; i < customHairComponent.rendAccessory.Length; i++) { for (int j = 0; j < HairAcsColorNum; j++) { if (customHairComponent.rendAccessory[i] == null) //Added null check { return(false); } } } return(true); }
public static bool ChangeSettingHairColor(int parts, bool c00, bool c01, bool c02, ChaControl __instance) { ChaCustomHairComponent customHairComponent = __instance.GetCustomHairComponent(parts); if (null == customHairComponent || customHairComponent.rendHair == null || customHairComponent.rendHair.Length == 0) { return(false); } ChaFileHair hair = __instance.chaFile.custom.hair; for (int i = 0; i < customHairComponent.rendHair.Length; i++) { if (c00) { if (1f > hair.parts[parts].baseColor.a) { hair.parts[parts].baseColor = new Color(hair.parts[parts].baseColor.r, hair.parts[parts].baseColor.g, hair.parts[parts].baseColor.b, 1f); } if (customHairComponent.rendHair[i] != null) //Added null check { customHairComponent.rendHair[i].material.SetColor(ChaShader._Color, hair.parts[parts].baseColor); } } if (c01) { if (1f > hair.parts[parts].startColor.a) { hair.parts[parts].startColor = new Color(hair.parts[parts].startColor.r, hair.parts[parts].startColor.g, hair.parts[parts].startColor.b, 1f); } if (customHairComponent.rendHair[i] != null) //Added null check { customHairComponent.rendHair[i].material.SetColor(ChaShader._Color2, hair.parts[parts].startColor); } } if (c02) { if (1f > hair.parts[parts].endColor.a) { hair.parts[parts].endColor = new Color(hair.parts[parts].endColor.r, hair.parts[parts].endColor.g, hair.parts[parts].endColor.b, 1f); } if (customHairComponent.rendHair[i] != null) //Added null check { customHairComponent.rendHair[i].material.SetColor(ChaShader._Color3, hair.parts[parts].endColor); } } } return(false); }
public static bool ChangeSettingHairOutlineColor(int parts, ChaControl __instance) { ChaCustomHairComponent customHairComponent = __instance.GetCustomHairComponent(parts); if (null == customHairComponent || customHairComponent.rendHair == null || customHairComponent.rendHair.Length == 0) { return(false); } ChaFileHair hair = __instance.chaFile.custom.hair; for (int i = 0; i < customHairComponent.rendHair.Length; i++) { if (customHairComponent.rendHair[i] != null) //Added null check { customHairComponent.rendHair[i].material.SetColor(ChaShader._LineColor, hair.parts[parts].outlineColor); } } return(false); }
public static bool ChangeSettingHairAcsColor(int parts, ChaControl __instance) { int hairAcsColorNum = __instance.GetHairAcsColorNum(parts); if (hairAcsColorNum == 0) { return(false); } ChaCustomHairComponent customHairComponent = __instance.GetCustomHairComponent(parts); if (null == customHairComponent) { return(false); } int[] array = new int[] { ChaShader._Color, ChaShader._Color2, ChaShader._Color3 }; ChaFileHair hair = __instance.chaFile.custom.hair; for (int i = 0; i < customHairComponent.rendAccessory.Length; i++) { for (int j = 0; j < hairAcsColorNum; j++) { if (1f > hair.parts[parts].acsColor[j].a) { hair.parts[parts].acsColor[j] = new Color(hair.parts[parts].acsColor[j].r, hair.parts[parts].acsColor[j].g, hair.parts[parts].acsColor[j].b, 1f); } if (customHairComponent.rendAccessory[i] != null) //Added null check { customHairComponent.rendAccessory[i].material.SetColor(array[j], hair.parts[parts].acsColor[j]); } } } return(false); }
internal static void ChangeSettingHairAcsColor(int parts, ChaControl __instance) => RemoveNullParts(__instance.GetCustomHairComponent(parts));
public static void ChangeSettingHairOutlineColor(int parts, ChaControl __instance) => RemoveNullParts(__instance.GetCustomHairComponent(parts));