Esempio n. 1
0
        static void Postfix(Dialog_StylingStation __instance, Rect rect, Pawn ___pawn, Color ___desiredHairColor)
        {
            if (Traverse.Create(__instance).Field("curTab").GetValue <int>() != GlobalStylingStation.tabIndex)
            {
                return;
            }
            CompGradientHair comp = ___pawn.GetComp <CompGradientHair>();

            if (comp == null)
            {
                return;
            }

            rect.yMax -= 110f;

            Action <Rect, GradientHairMaskDef> drawAction = delegate(Rect r, GradientHairMaskDef h)
            {
                Graphic_MultiMask graphic = GlobalStylingStation.GraphicForHair(___pawn.story.hairDef, h);
                graphic.SetColors(___desiredHairColor, comp.Settings.colorB);
                graphic.Draw(r.ExpandedBy(r.width * 0.125f));

                if (h.modContentPack != GradientHair.myOwnPack)
                {
                    TooltipHandler.TipRegion(r, new TipSignal("GradientHairAddedByMod".Translate(h.modContentPack.Name)));
                }
            };
            Action <GradientHairMaskDef> selectAction = delegate(GradientHairMaskDef h)
            {
                comp.Settings.mask    = h.mask;
                comp.Settings.enabled = h.defName != "MaskNone";
            };
            Func <StyleItemDef, bool> hasStyleItem = x =>
            {
                GradientHairMaskDef h = x as GradientHairMaskDef;
                if (!comp.Settings.enabled)
                {
                    return(h.defName == "MaskNone");
                }

                return(comp.Settings.mask == h.mask);
            };
            Func <StyleItemDef, bool> hadStyleItem = x => true;

            MethodInfo methodA = typeof(Dialog_StylingStation).GetMethod("DrawStylingItemType", BindingFlags.NonPublic | BindingFlags.Instance);
            MethodInfo method  = methodA.MakeGenericMethod(typeof(GradientHairMaskDef));

            method.Invoke(__instance, new object[] { rect, GlobalStylingStation.hairGradientScrollPosition, drawAction, selectAction, hasStyleItem, hadStyleItem, null, false });

            GlobalStylingStation.DrawHairColors(new Rect(rect.x, rect.yMax + 10f, rect.width, 110f), comp.Settings);
        }
        static void Postfix(PawnGraphicSet __instance)
        {
            CompGradientHair comp = __instance.pawn.GetComp <CompGradientHair>();

            if (comp == null)
            {
                return;
            }

            GradientHairSettings settings = comp.Settings;

            if (!settings.enabled)
            {
                return;
            }

            __instance.hairGraphic = Graphic_MultiMask.Get(__instance.pawn.story.hairDef.texPath, settings.mask, __instance.pawn.story.hairColor, settings.colorB);
        }
Esempio n. 3
0
 public static Graphic_MultiMask GraphicForHair(HairDef hair, GradientHairMaskDef gradient)
 {
     return(Graphic_MultiMask.Get(hair.texPath, gradient.mask, new Color(1, 1, 1, 1.993f), new Color(1, 1, 1, 1.993f)) as Graphic_MultiMask);
 }