예제 #1
0
        public static void ClearAll(this LetterStack stack, Predicate <Letter> shouldRemove)
        {
            var letters = stack.LettersListForReading.ListFullCopy();

            letters.ForEach(letter =>
            {
                if (shouldRemove(letter))
                {
                    stack.RemoveLetter(letter);
                }
            });
        }
예제 #2
0
        // Close info letters during simulation and for the arbiter instance
        static void Postfix(LetterStack __instance)
        {
            if (Multiplayer.Client == null)
            {
                return;
            }
            if (!TickPatch.Simulating && !Multiplayer.arbiterInstance)
            {
                return;
            }

            for (int i = __instance.letters.Count - 1; i >= 0; i--)
            {
                var letter = __instance.letters[i];
                if (letter is ChoiceLetter choice && choice.Choices.Any(c => c.action?.Method == choice.Option_Close.action.Method) && Time.time - letter.arrivalTime > 4)
                {
                    __instance.RemoveLetter(letter);
                }
            }
        }
        static FloatMenuUtil()
        {
            groups  = new Dictionary <string, List <string> >();
            items   = new Dictionary <string, Action>();
            devOnly = new Dictionary <string, bool>();

            string group;

            group = GroupFix;
            Add(group, "FloatDebugLog".Translate(), delegate {
                if (!Find.WindowStack.TryRemove(typeof(EditWindow_Log), true))
                {
                    Find.WindowStack.Add(new EditWindow_Log());
                }
            });
            Add(group, "FloatAGRegen".Translate(), delegate {
                foreach (Map map in Find.Maps)
                {
                    map.avoidGrid.Regenerate();
                }
                Message("MsgTextAGR".Translate(), MessageTypeDefOf.PositiveEvent);
            });
            Add(group, "FloatFactionFixItems1".Translate(), delegate {
                CleanserUtil.FixFactionRelationships();
                Message("MsgTextFFR".Translate(), MessageTypeDefOf.PositiveEvent);
            });
            Add(group, "FloatFactionFixItems2".Translate(), delegate {
                Message("MsgTextFFL".Translate(CleanserUtil.FixFactionLeader_Wrapped()), MessageTypeDefOf.PositiveEvent);
            });

            group = GroupTools;
            Add(group, "FloatToolsItems1".Translate(), delegate {
                int a = CleanserUtil.DeconstructAnimalFamily();
                Verse.Log.Message("CleanserUtil.DeconstructAnimalFamily():Round 1 completed.");
                CleanserUtil.DeconstructAnimalFamily();
                Verse.Log.Message("CleanserUtil.DeconstructAnimalFamily():Round 2 completed.");
                Message("MsgTextAFT".Translate(a), MessageTypeDefOf.PositiveEvent);
            });

            Add(group, "FloatToolsItems2".Translate(), delegate {
                Message("MsgTextRFH".Translate(CleanserUtil.RemoveFilth(Find.CurrentMap, true)), MessageTypeDefOf.PositiveEvent);
            });
            Add(group, "FloatToolsItems2Dev1".Translate(), delegate {
                Message("MsgTextRFM".Translate(CleanserUtil.RemoveFilth(Find.CurrentMap, false)), MessageTypeDefOf.PositiveEvent);
            }, true);
            Add(group, "FloatToolsItems2Dev2".Translate(), delegate {
                int i = 0;
                foreach (Map m in Find.Maps)
                {
                    i += CleanserUtil.RemoveFilth(m, false);
                }
                Message("MsgTextRFW".Translate(i), MessageTypeDefOf.PositiveEvent);
            }, true);

            Add(group, "FloatToolsItems2Snow".Translate(), delegate {
                CleanserUtil.RemoveSnow(Find.CurrentMap, true);
                Message("MsgTextRSH".Translate(), MessageTypeDefOf.PositiveEvent);
            });
            Add(group, "FloatToolsItems2SnowDev1".Translate(), delegate {
                CleanserUtil.RemoveSnow(Find.CurrentMap, false);
                Message("MsgTextRSM".Translate(), MessageTypeDefOf.PositiveEvent);
            }, true);
            Add(group, "FloatToolsItems2SnowDev2".Translate(), delegate {
                foreach (Map m in Find.Maps)
                {
                    CleanserUtil.RemoveSnow(m, false);
                }
                Message("MsgTextRSW".Translate(), MessageTypeDefOf.PositiveEvent);
            }, true);

            Add(group, "FloatToolsItems3".Translate(), delegate {
                Message("MsgTextRCM".Translate(CleanserUtil.RemoveCorpses()), MessageTypeDefOf.NeutralEvent);
            });
            Add(group, "FloatToolsItems4".Translate(), delegate {
                Message("MsgTextRBL".Translate(CleanserUtil.RemoveAllBattleLogEntries()), MessageTypeDefOf.PositiveEvent);
            });

            Add(group, "FloatToolsItems5".Translate(), delegate {
                Message("MsgTextRAM".Translate(CleanserUtil.RemoveIArchivable(false)), MessageTypeDefOf.PositiveEvent);
            });
            Add(group, "FloatToolsItems5Dev".Translate(), delegate {
                Message("MsgTextRAM".Translate(CleanserUtil.RemoveIArchivable(true)), MessageTypeDefOf.PositiveEvent);
            }, true);

            //StorytellerFix menus here

            //Storyteller Info Window for non Dev Mode
            Add(group, "StorytellerFixQueueInfo".Translate(), delegate { StorytellerFix.StorytellerFix_GetInfoButton(); }, false);

            //Storyteller Clear Queue for Dev Mode only
            Add(group, "StorytellerFixQueueClearDev".Translate(), delegate { StorytellerFix.StorytellerFix_ClearButton(); }, true);

            //end of StorytellerFix


            group = GroupQuickbar;
            Add(group, "QuickCloseLetStack".Translate(), delegate {
                LetterStack ls = Find.LetterStack;
                if (ls == null)
                {
                    return;
                }
                for (int i = ls.LettersListForReading.Count - 1; i > -1; i--)
                {
                    ls.RemoveLetter(ls.LettersListForReading[i]);
                }
            });
            Add(group, "QuickUnlockSpeedLimit".Translate(), delegate {
                CleanserUtil.UnlockNormalSpeedLimit();
                Find.WindowStack.TryRemove(typeof(UserInterface));
            });
            Add(group, "QuickOpenSettings".Translate(), delegate {
                CleanserUtil.OpenModSettingsPage();
            });


            group = GroupMMUpdateMode;
            foreach (MemoryMonitorUpdateMode m in Enum.GetValues(typeof(MemoryMonitorUpdateMode)))
            {
                Add(group, ("MMUpdate_" + m.ToString()).Translate(), delegate
                {
                    RuntimeGC.Settings.MemoryMonitorUpdateInterval = (int)m;
                    UIUtil.Notify_MMBtnLabelChanged();
                }, m.ToString().Contains("Debug_"));
            }
        }