public Dialog_RenameThings(CompRenamable renamableComp)
 {
     renamableComps = new List <CompRenamable> {
         renamableComp
     };
     curName = renamableComp.Named ? renamableComp.Name : renamableComp.parent.LabelCapNoCount;
 }
Esempio n. 2
0
        public static IEnumerable <Gizmo> GetRenamableCompGizmos(CompRenamable renamableComp)
        {
            string filler = renamableComp.Props.inspectStringTranslationKey.Translate().UncapitalizeFirst();

            // Rename
            yield return(new Command_Rename()
            {
                renamable = renamableComp,
                defaultLabel = renamableComp.Props.renameTranslationKey.Translate(),
                defaultDesc = "RenameEverything.RenameGizmo_Description".Translate(filler),
                icon = TexButton.RenameTex,
                hotKey = KeyBindingDefOf.Misc1,
            });

            // Recolour label
            yield return(new Command_RecolourLabel()
            {
                renamable = renamableComp,
                defaultLabel = "RenameEverything.RecolourLabel".Translate(),
                defaultDesc = "RenameEverything.RecolourLabel_Description".Translate(filler),
                icon = TexButton.RecolourTex
            });

            if (renamableComp.Named || renamableComp.Coloured)
            {
                // Allow merging
                if (renamableComp.parent.def.stackLimit > 1)
                {
                    yield return new Command_Toggle()
                           {
                               defaultLabel = "RenameEverything.AllowMerging".Translate(),
                               defaultDesc  = "RenameEverything.AllowMerging_Description".Translate(),
                               icon         = TexButton.AllowMergingTex,
                               isActive     = () => renamableComp.allowMerge,
                               toggleAction = () => renamableComp.allowMerge = !renamableComp.allowMerge
                           }
                }
                ;

                // Remove name
                if (renamableComp.Named)
                {
                    yield return new Command_Action()
                           {
                               defaultLabel = "RenameEverything.RemoveName".Translate(),
                               defaultDesc  = "RenameEverything.RemoveName_Description".Translate(filler),
                               icon         = TexButton.DeleteX,
                               action       = () => renamableComp.Named = false,
                           }
                }
                ;
            }
        }
Esempio n. 3
0
 public static bool CanDrawThingName(Thing t, out CompRenamable renamableComp)
 {
     renamableComp = t.TryGetComp <CompRenamable>();
     return(renamableComp != null && renamableComp.Named && RenameEverythingSettings.showNameOnGround && !typeof(Building).IsAssignableFrom(t.GetType()));
 }
Esempio n. 4
0
        public static IEnumerable <FloatMenuOption> CaravanRenameThingButtonFloatMenuOptions(CompRenamable renamableComp)
        {
            // Rename
            yield return(new FloatMenuOption(renamableComp.Props.renameTranslationKey.Translate(), () => Find.WindowStack.Add(new Dialog_RenameThings(renamableComp))));

            // Recolour
            yield return(new FloatMenuOption("RenameEverything.RecolourLabel".Translate(), () => Find.WindowStack.Add(new Dialog_ColourPicker(renamableComp.labelColour, c => renamableComp.labelColour = c))));

            // Remove name
            if (renamableComp.Named)
            {
                yield return(new FloatMenuOption("RenameEverything.RemoveName".Translate(), () => renamableComp.Named = false));
            }
        }
Esempio n. 5
0
 private void RemoveNameAction(CompRenamable renamableComp)
 {
     renamableComp.Named = false;
 }
Esempio n. 6
0
 private void Callback(Color c, CompRenamable renamableComp)
 {
     renamableComp.labelColour = c;
 }
Esempio n. 7
0
 private static void RemoveNameGizmoAction(CompRenamable renamableComp)
 {
     renamableComp.Named = false;
 }
Esempio n. 8
0
 private static void AllowMergeGizmoToggleAction(CompRenamable renamableComp)
 {
     renamableComp.allowMerge = !renamableComp.allowMerge;
 }
Esempio n. 9
0
 private static bool CanDrawThingName(Thing t, out CompRenamable renamableComp)
 {
     renamableComp = t.TryGetComp <CompRenamable>();
     return(renamableComp != null && renamableComp.Named && RenameEverythingSettings.showNameOnGround &&
            !(t is Building));
 }