Exemplo n.º 1
0
        public override void DoSettingsWindowContents(Rect inRect)
        {
            var x  = inRect.x;
            var y  = inRect.y;
            var LH = Text.LineHeight;

            y += LH;

            Text.Font = GameFont.Medium;
            Widgets.Label(new Rect(x, y, 200, Text.LineHeight), "Global settings");
            y        += Text.LineHeight + 2;
            Text.Font = GameFont.Small;
            if (defaultThresholdField.DoField(y, "Default target time", ref settings.defaultThreshold))
            {
                Messages.Message("Default target time changed to " + settings.defaultThreshold,
                                 MessageTypeDefOf.NeutralEvent);
            }

            TooltipHandler.TipRegion(new Rect(x, y, 360, LH),
                                     "Has no effect if 'Put recipes in context menu' is checked");

            y += LH;
            var r1 = new Rect(x, y, 360, LH);

            Widgets.CheckboxLabeled(r1, "Limit to x5 recipes", ref settings.limitToX5);
            TooltipHandler.TipRegion(r1, "Add only x5 recipes");
            y += LH;
            var r2 = new Rect(x, y, 360, LH);

            Widgets.CheckboxLabeled(r2, "Put recipes in context menu", ref settings.useRightClickMenu);
            TooltipHandler.TipRegion(r2,
                                     "Put recipes to context menu of source recipe instead of adding after it in the same list.");

            y += (2 * LH) + 2;

            if (Current.Game == null)
            {
                //lastGame = null;
                return;
            }

            Text.Font = GameFont.Medium;
            Widgets.Label(new Rect(x, y, 200, Text.LineHeight), "World settings");
            y        += Text.LineHeight + 2;
            Text.Font = GameFont.Small;

            var bills = Ad2.FindRecipesUses();
            var s     = $"Remove modded recipes from save ({bills.Count} found)";
            var w     = Text.CalcSize(s).x + 64;

            if (!Widgets.ButtonText(new Rect(x, y, w, 32), s))
            {
                return;
            }

            foreach (var bill in bills)
            {
                bill.billStack.Delete(bill);
            }

            Messages.Message(bills.Count + " bills removed", MessageTypeDefOf.NeutralEvent);
        }