public static void Postfix(Apparel apparel, BodyTypeDef bodyType, ref ApparelGraphicRecord rec)
        {
            if (apparel.def.apparel.wornGraphicPath.NullOrEmpty())
            {
                return;
            }
            CompAdvancedGraphic comp    = apparel.TryGetComp <CompAdvancedGraphic>();
            CompQuality         quality = apparel.TryGetComp <CompQuality>();
            CompArt             art     = apparel.TryGetComp <CompArt>();
            bool adv = comp != null;

            if (adv)
            {
                if (comp._graphic == null || comp._graphic.path.NullOrEmpty())
                {
                    bool flag = apparel.DefaultGraphic as Graphic_RandomRotated != null;
                    if (flag)
                    {
                        //	Log.Message(apparel.LabelShortCap + " as Graphic_RandomRotated");
                        Traverse traverse = Traverse.Create(apparel.DefaultGraphic);
                        Graphic_AdvancedSingle subGraphic = AG_Thing_get_DefaultGraphic_CompAdvancedGraphic_Patch.subgraphic.GetValue(apparel.DefaultGraphic) as Graphic_AdvancedSingle;
                        if (subGraphic != null)
                        {
                            //	Log.Message(apparel.LabelShortCap + " as Graphic_AdvancedSingle");
                            comp._graphic = subGraphic.SubGraphicFor(apparel);
                        }
                    }
                    else
                    {
                        comp._graphic = apparel.DefaultGraphic;
                        return;
                    }
                }
                string path   = apparel.def.apparel.wornGraphicPath;
                Shader shader = ShaderDatabase.Cutout;
                if (apparel.def.apparel.useWornGraphicMask)
                {
                    shader = ShaderDatabase.CutoutComplex;
                }
                if (apparel.def.apparel.LastLayer == ApparelLayerDefOf.Overhead || apparel.def.apparel.wornGraphicPath == BaseContent.PlaceholderImagePath)
                {
                    path = comp._graphic.path;
                }
                else
                {
                    path = comp._graphic.path + "_" + bodyType.defName;
                }
                Graphic graphic = GraphicDatabase.Get <Graphic_Multi>(path, shader, apparel.def.graphicData.drawSize, apparel.DrawColor, apparel.DrawColorTwo);
                rec = new ApparelGraphicRecord(graphic, apparel);
            }
            if (apparel.DrawColorTwo != Color.white)
            {
                rec.graphic = rec.graphic.GetColoredVersion(rec.graphic.Shader, apparel.DrawColor, apparel.DrawColorTwo);
            }
        }
Пример #2
0
 public static void Prefix(Thing __instance, Graphic __result, ref Graphic ___graphicInt)
 {
     if (__instance != null)
     {
         if (___graphicInt == null)
         {
             Graphic Graphic = __instance.def.graphicData?.Graphic;
             if (Graphic != null && Graphic is Graphic_RandomRotated R && R != null)
             {
                 Graphic innerGraphic          = AG_Thing_get_DefaultGraphic_CompAdvancedGraphic_Patch.subgraphic.GetValue(Graphic) as Graphic;
                 Graphic_SingleQuality quality = innerGraphic as Graphic_SingleQuality;
                 //    Graphic_SingleQuality quality = R.ExtractInnerGraphicFor(__instance) as Graphic_SingleQuality;
                 if (quality != null)
                 {
                     ___graphicInt = new Graphic_RandomRotated(quality.QualityGraphicFor(__instance), 35f);
                 }
                 else
                 {
                     Graphic_SingleRandomized randomized = innerGraphic as Graphic_SingleRandomized;
                     //    Graphic_SingleRandomized randomized = R.ExtractInnerGraphicFor(__instance) as Graphic_SingleRandomized;
                     if (randomized != null)
                     {
                         ___graphicInt = new Graphic_RandomRotated(randomized.RandomGraphicFor(__instance), 35f);
                     }
                     else
                     {
                         Graphic_AdvancedSingle advancedSingle = innerGraphic as Graphic_AdvancedSingle;
                         if (advancedSingle != null)
                         {
                             CompAdvancedGraphic advancedWeaponGraphic = __instance.TryGetComp <CompAdvancedGraphic>();
                             if (advancedWeaponGraphic != null)
                             {
                                 advancedWeaponGraphic._graphic = advancedSingle.SubGraphicFor(__instance);
                                 //    Log.Message(__instance.LabelShortCap + " subGraphic = " + subGraphic.GetType() + " " + advancedWeaponGraphic._graphic.path);
                                 ___graphicInt = new Graphic_RandomRotated(advancedWeaponGraphic._graphic, 35f);
                             }
                         }
                     }
                 }
             }
         }
     }
 }