Beispiel #1
0
        public void DoWindowContents(Rect wrect)
        {
            Listing_Standard options      = new Listing_Standard();
            Color            defaultColor = GUI.color;

            options.Begin(wrect);

            GUI.color   = defaultColor;
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            options.Gap();
            // Same GUI colour as Merciless
            GUI.color = new Color(1f, 0.2f, 0.2f);
            options.CheckboxLabeled("Settings_HardcoreMode".Translate(), ref hardcoreMode, "Settings_HardcoreMode_Tooltip".Translate());
            GUI.color = defaultColor;
            options.Gap();
            options.CheckboxLabeled("Settings_ToolMapGen".Translate(), ref toolMapGen, "Settings_ToolMapGen_Tooltip".Translate());
            options.Gap();
            options.CheckboxLabeled("Settings_ToolLimit".Translate(), ref toolLimit, "Settings_ToolLimit_Tooltip".Translate());
            options.Gap();
            options.AddLabeledSlider("Settings_ToolDegradationRate".Translate(), ref toolDegradationFactor, 0f, 2f,
                                     rightAlignedLabel: ToolDegradationFactor.ToStringByStyle(ToStringStyle.FloatTwo, ToStringNumberSense.Factor), roundTo: 0.01f);
            options.Gap();
            options.CheckboxLabeled("Settings_toolAutoDropExcess".Translate(), ref toolAutoDropExcess, "Settings_toolAutoDropExcess_Tooltip".Translate());
            options.Gap();
            options.CheckboxLabeled("Settings_ToolOptimization".Translate(), ref toolOptimization, "Settings_ToolOptimization_Tooltip".Translate());
            options.End();

            Mod.GetSettings <SurvivalToolsSettings>().Write();
        }
        public void DoWindowContents(Rect wrect)
        {
            Listing_Standard options      = new Listing_Standard();
            Color            defaultColor = GUI.color;

            options.Begin(wrect);

            GUI.color   = defaultColor;
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            options.Gap();

            // General settings
            options.CheckboxLabeled("Settings_AccuracyPenalties".Translate(), ref accuracyPenalties, "Settings_AccuracyPenalties_Tooltip".Translate());
            options.Gap();
            options.AddLabeledSlider("Settings_TargModeResetFrequency".Translate(), ref targModeResetFrequencyInt, 0, 5,
                                     rightAlignedLabel: $"Settings_TargModeResetFrequency_{targModeResetFrequencyInt}".Translate(), roundTo: 1);
            options.GapLine(24);

            // Settings for AI
            options.CheckboxLabeled("Settings_RaidersUseTargetingModes".Translate(), ref raidersUseTargModes, "Settings_RaidersUseTargetingModes_Tooltip".Translate());
            options.Gap();

            // Grey out this section if raiders can't use targeting modes
            if (!raidersUseTargModes)
            {
                GUI.color = Color.grey;
            }

            options.AddLabeledSlider("Settings_MinRaiderWeaponSkill".Translate(), ref raiderMinSkillForTargMode, 0, 20,
                                     rightAlignedLabel: raiderMinSkillForTargMode.ToString(), roundTo: 1);
            options.Gap();
            options.AddLabeledSlider("Settings_MechTargModeChance".Translate(), ref mechanoidTargModeChance, 0, 1,
                                     rightAlignedLabel: mechanoidTargModeChance.ToStringPercent(), roundTo: 0.01f);
            options.Gap();
            options.AddLabeledSlider("Settings_BaseManhunterTargModeChance".Translate(), ref baseManhunterTargModeChance, 0, 1,
                                     rightAlignedLabel: baseManhunterTargModeChance.ToStringPercent(), roundTo: 0.01f);

            // End of section
            GUI.color = defaultColor;

            // End of settings
            options.End();
            Mod.GetSettings <TargetingModesSettings>().Write();
        }
        public void DoWindowContents(Rect canvas)
        {
            Listing_Standard _Listing_Standard = new Listing_Standard();

            _Listing_Standard.ColumnWidth = 375;
            _Listing_Standard.Begin(canvas);

            Text.Font = GameFont.Medium;
            _Listing_Standard.Label("TIT_TamingSkillBoostType".Translate(), -1f, null);
            Text.Font = GameFont.Small;
            _Listing_Standard.Gap(12f);
            _Listing_Standard.Label("TIT_SettingsExplanation".Translate());
            _Listing_Standard.GapLine(12f);
            _Listing_Standard.Label(string.Empty, -1f, null);
            if (_Listing_Standard.RadioButton("TIT_TameAnyAnimal".Translate(), Boost == BoostType.Unlimited, 0f, null))
            {
                Boost = BoostType.Unlimited;
            }
            if (_Listing_Standard.RadioButton("TIT_BoostByPercentage".Translate(), Boost == BoostType.Percentage, 0f, null))
            {
                Boost = BoostType.Percentage;
            }
            if (Boost == BoostType.Percentage)
            {
                _Listing_Standard.AddLabeledSlider($"    +{100*BoostPercentage}%", ref BoostPercentage, 0, 1, "+0%", "+100%", 0.1f, false);
            }
            if (_Listing_Standard.RadioButton("TIT_BoostByLevels".Translate(), Boost == BoostType.Levels, 0f, null))
            {
                Boost = BoostType.Levels;
            }
            if (Boost == BoostType.Levels)
            {
                _Listing_Standard.AddLabeledSlider($"    +{BoostLevels}", ref BoostLevels, 0, 20, "+0", "+20", 1, false);
            }
            _Listing_Standard.End();
        }
    public void DoSettingsWindowContents(Rect inRect)
    {
        var listingStandard = new Listing_Standard();

        listingStandard.Begin(inRect);
        listingStandard.Label("CPT.combatpower.label".Translate());
        if (listingStandard.ButtonTextLabeled("CPT.reset.label".Translate(), "CPT.reset.button".Translate()))
        {
            foreach (var keyValue in CombatPowerTweakerMod.Settings.vanillaMemory)
            {
                CombatPowerTweakerMod.Settings.modifiedStats[keyValue.Key] = keyValue.Value;
            }
        }

        if (listingStandard.ButtonTextLabeled("CPT.percentup.label".Translate(), "CPT.percentup.button".Translate()))
        {
            foreach (var keyValue in CombatPowerTweakerMod.Settings.vanillaMemory)
            {
                CombatPowerTweakerMod.Settings.modifiedStats[keyValue.Key] *= 1.1f;
                if (CombatPowerTweakerMod.Settings.modifiedStats[keyValue.Key] > maxValue)
                {
                    CombatPowerTweakerMod.Settings.modifiedStats[keyValue.Key] = maxValue;
                }
            }
        }

        if (listingStandard.ButtonTextLabeled("CPT.percentdown.label".Translate(),
                                              "CPT.percentdown.button".Translate()))
        {
            foreach (var keyValue in CombatPowerTweakerMod.Settings.vanillaMemory)
            {
                CombatPowerTweakerMod.Settings.modifiedStats[keyValue.Key] *= 0.9f;
            }
        }

        var searchLabel = listingStandard.Label("CPT.search.label".Translate());

        searchText =
            Widgets.TextField(
                new Rect(searchLabel.position + new Vector2((inRect.width / 3 * 2) - (searchSize.x / 3 * 2), 0),
                         searchSize),
                searchText);
        TooltipHandler.TipRegion(new Rect(
                                     searchLabel.position + new Vector2((inRect.width / 2) - (searchSize.x / 2), 0),
                                     searchSize), "CPT.search.label".Translate());
        var keys = modifiedStats.Keys.ToList();

        if (!string.IsNullOrEmpty(searchText))
        {
            keys = keys.Where(s => s.ToLower().Contains(searchText.ToLower())).ToList();
        }

        listingStandard.GapLine();

        listingStandard.End();

        keys.Reverse();
        var rect  = new Rect(inRect.x, inRect.y + 160f, inRect.width, inRect.height - 160f);
        var rect2 = new Rect(0f, 0f, inRect.width - 30f, keys.Count * 35);

        Widgets.BeginScrollView(rect, ref scrollPosition, rect2);
        var listingScroll = new Listing_Standard();

        listingScroll.Begin(rect2);
        for (var num = keys.Count - 1; num >= 0; num--)
        {
            var test = modifiedStats[keys[num]];
            listingScroll.AddLabeledSlider(
                $"{pawnKindNames[keys[num]].CapitalizeFirst()} ({vanillaMemory[keys[num]]})", ref test, 1f,
                maxValue, test.ToString(), null, 1);
            modifiedStats[keys[num]] = test;
        }

        listingScroll.End();
        Widgets.EndScrollView();
        Write();
    }