Пример #1
0
 public static float AdjustPositionIfNamed(float original, Thing thing)
 {
     if (RenameUtility.CanDrawThingName(thing))
     {
         return(original - 0.26f);
     }
     return(original);
 }
Пример #2
0
 public static void Postfix(Thing __instance)
 {
     // If the thing doesn't have a GUI overlay for stack count or quality but is renamable and named, do our GUI overlay
     if (Find.CameraDriver.CurrentZoom == CameraZoomRange.Closest && RenameUtility.CanDrawThingName(__instance) && __instance.def.stackLimit <= 1 && !__instance.def.HasComp(typeof(CompQuality)))
     {
         RenameUtility.DrawThingName(__instance);
     }
 }
            private static void DoRenameFloatMenuButton(Rect rect, Thing thing)
            {
                var renamableComp = thing.TryGetComp <CompRenamable>();

                if (renamableComp != null && Widgets.ButtonImage(new Rect(rect.x, rect.y + 24, 24, 24), TexButton.RenameTex))
                {
                    Find.WindowStack.Add(new FloatMenu(RenameUtility.CaravanRenameThingButtonFloatMenuOptions(renamableComp).ToList()));
                }
            }
Пример #4
0
            public static void Postfix(MinifiedThing __instance, ref IEnumerable <Gizmo> __result)
            {
                var innerThing = __instance.InnerThing;

                if (innerThing != null && innerThing.TryGetComp <CompRenamable>() is CompRenamable renamableComp)
                {
                    __result = __result.Concat(RenameUtility.GetRenamableCompGizmos(renamableComp));
                }
            }
            private static void DoRenameFloatMenuButton(ref Rect rect2, Rect rect, TransferableImmutable thing)
            {
                rect2.width -= 24;
                var renamableComp = thing.AnyThing.TryGetComp <CompRenamable>();

                if (renamableComp != null && Widgets.ButtonImage(new Rect(rect2.width - 24, rect.height - 24, 24, 24), TexButton.RenameTex))
                {
                    Find.WindowStack.Add(new FloatMenu(RenameUtility.CaravanRenameThingButtonFloatMenuOptions(renamableComp).ToList()));
                }
            }
Пример #6
0
            public static void Postfix(Pawn __instance, ref IEnumerable <Gizmo> __result)
            {
                // Add weapon rename gizmos to pawn if they have any equipment that has CompRenamable
                if (RenameEverythingSettings.pawnWeaponRenameGizmos)
                {
                    var renamables = RenameUtility.GetRenamableEquipmentComps(__instance);
                    if (renamables.Any())
                    {
                        var renameGizmo = new Command_RenameFloatMenu()
                        {
                            pawnRenamables = new Pair <Pawn, List <CompRenamable> >(__instance, renamables.ToList()),
                            defaultLabel   = "RenameEverything.RenameEquipment".Translate(),
                            defaultDesc    = "RenameEverything.RenameEquipment_Description".Translate(),
                            icon           = TexButton.RenameTex,
                        };
                        __result = __result.Add(renameGizmo);

                        var recolourGizmo = new Command_RecolourLabelFloatMenu()
                        {
                            pawnRenamables = new Pair <Pawn, List <CompRenamable> >(__instance, renamables.ToList()),
                            defaultLabel   = "RenameEverything.RecolourLabel".Translate(),
                            defaultDesc    = "RenameEverything.RecolourEquipmentLabel_Description".Translate(),
                            icon           = TexButton.RecolourTex,
                        };
                        __result = __result.Add(recolourGizmo);

                        if (renamables.Any(r => r.Named))
                        {
                            var removeNameGizmo = new Command_RemoveNameFloatMenu()
                            {
                                pawnRenamables = new Pair <Pawn, List <CompRenamable> >(__instance, renamables.ToList()),
                                defaultLabel   = "RenameEverything.RemoveName".Translate(),
                                defaultDesc    = "RenameEverything.RemoveEquipmentName_Description".Translate(),
                                icon           = TexButton.DeleteX,
                            };
                            __result = __result.Add(removeNameGizmo);
                        }
                    }
                }
            }
Пример #7
0
 public static void Postfix(Thing thing)
 {
     RenameUtility.DrawThingName(thing);
 }