Exemple #1
0
            public static bool Prefix(ITab_Pawn_Gear __instance, ref float y, ref float width, Thing thing, ref bool inventory)
            {
                Pawn SelPawnForGear = Traverse.Create(__instance).Property("SelPawnForGear").GetValue<Pawn>();
                Corpse corpse = SelPawnForGear.Corpse;

                inventory = inventory && corpse == null;

                if (SelPawnForGear.Downed || corpse != null || SelPawnForGear.IsPrisoner && SelPawnForGear.guest.PrisonerIsSecure)
                {
                    CompStripChecker c = CompStripChecker.GetChecker(thing, false);
                    if (c == null)
                    {
                        width -= 24f;
                        return true;
                    }

                    ThingWithComps holder = corpse == null ? SelPawnForGear : (ThingWithComps)corpse;
                    Rect rect = new Rect(0f, y, width, 28f);

                    Rect rect2 = new Rect(rect.width - 24f, y, 24f, 24f);

                    if (c.ShouldStrip)
                    {
                        TooltipHandler.TipRegion(rect2, "StripThingCancel".Translate());

                        //weird shenanigans with colors
                        var cl = GUI.color;
                        if (Widgets.ButtonImage(rect2, ContentFinder<Texture2D>.Get("UI/Icons/Strip_Thing_Cancel"), hColor))
                        {
                            SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                            c.ShouldStrip = false;
                            if (CompStripChecker.getFirstMarked(SelPawnForGear) == null && holder.Map != null)
                            {
                                Designation d = holder.Map.designationManager.DesignationOn(holder, DesignationDefOf.Strip);
                                if (d != null) holder.Map.designationManager.RemoveDesignation(d);
                            }
                        }
                        GUI.color = cl;
                    }
                    else
                    {
                        TooltipHandler.TipRegion(rect2, "StripThing".Translate());
                        if (Widgets.ButtonImage(rect2, ContentFinder<Texture2D>.Get("UI/Icons/Strip_Thing")))
                        {
                            SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                            bool b = CompStripChecker.getFirstMarked(SelPawnForGear) == null && holder.Map.designationManager.DesignationOn(holder, DesignationDefOf.Strip) == null;
                            c.ShouldStrip = true;
                            if (b) holder.Map.designationManager.AddDesignation(new Designation(holder, DesignationDefOf.Strip));
                        }
                    }
                    width -= 24f;
                }
                return true;
            }
Exemple #2
0
 static void Postfix(ThingWithComps __instance)
 {
     if (Scribe.mode == LoadSaveMode.LoadingVars)
     {
         bool a = false;
         Scribe_Values.Look(ref a, "NonUnoPinataShouldStrip", defaultValue: false);
         if (a)
         {
             CompStripChecker.GetChecker(__instance, a);
         }
     }
 }
        public static void DrawThingRow(Pawn pawn, ref float y, ref float width, Thing thing, ref bool inventory)
        {
            Corpse corpse = pawn.Corpse;

            inventory = inventory && corpse == null;

            //if (pawn.Downed || corpse != null || pawn.IsPrisoner && pawn.guest.PrisonerIsSecure)
            //if(StrippableUtility.CanBeStrippedByColony(pawn))
            if (corpse != null || StrippableUtility.CanBeStrippedByColony(pawn))
            {
                CompStripChecker c = CompStripChecker.GetChecker(thing, false);
                if (c == null)
                {
                    width -= 24f;
                    return;
                }

                ThingWithComps holder = corpse == null ? pawn : (ThingWithComps)corpse;
                Rect           rect   = new Rect(0f, y, width, 28f);

                Rect rect2 = new Rect(rect.width - 24f, y, 24f, 24f);

                if (c.ShouldStrip)
                {
                    TooltipHandler.TipRegion(rect2, "StripThingCancel".Translate());

                    //weird shenanigans with colors
                    var cl = GUI.color;
                    if (Widgets.ButtonImage(rect2, ContentFinder <Texture2D> .Get("UI/Icons/Strip_Thing_Cancel"), hColor))
                    {
                        SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                        SetShouldStrip(false, c, pawn, holder);
                    }
                    GUI.color = cl;
                }
                else
                {
                    TooltipHandler.TipRegion(rect2, "StripThing".Translate());
                    if (Widgets.ButtonImage(rect2, ContentFinder <Texture2D> .Get("UI/Icons/Strip_Thing")))
                    {
                        SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                        SetShouldStrip(true, c, pawn, holder);
                    }
                }
                width -= 24f;
            }
            return;
        }