rimworld-animations-patch_m.../Source/Scripts/Settings/BasicSettings.cs
AbstractConcept 38ec4f86c1 v 2.0.0
2023-02-04 01:13:57 -06:00

103 lines
3.3 KiB
C#

using System;
using System.Linq;
using System.Collections.Generic;
using UnityEngine;
using Verse;
using RimWorld;
namespace Rimworld_Animations_Patch
{
public class BasicSettings : ModSettings
{
public static bool autoscaleDeltaPos = true;
public static bool hideNamesForSex = false;
public static bool debugMode = false;
public static bool showHands = true;
public static bool redrawHair = true;
public static bool useLegacyAnimationSystem = false;
public static float genitalMasturbationChance = 1.0f;
public static float analMasturbationChance = 0.25f;
public static float breastsMasturbationChance = 0.5f;
public static float humpingMasturbationChance = 0.25f;
public static float otherMasturbationChance = 0.2f;
public static float sliderValue = 0f;
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look(ref autoscaleDeltaPos, "autoscaleDeltaPos", true);
Scribe_Values.Look(ref hideNamesForSex, "hideNamesForSex", false);
Scribe_Values.Look(ref debugMode, "debugMode", false);
Scribe_Values.Look(ref showHands, "showHands", true);
Scribe_Values.Look(ref redrawHair, "redrawHair", true);
}
}
public class BasicSettingsDisplay : Mod
{
public BasicSettingsDisplay(ModContentPack content) : base(content)
{
GetSettings<BasicSettings>();
}
public override void WriteSettings()
{
base.WriteSettings();
ApplySettings();
}
// Update all humanlike pawn graphics when settings window is closed
public void ApplySettings()
{
if (Current.ProgramState == ProgramState.Playing)
{
foreach (Pawn pawn in Current.Game.CurrentMap.mapPawns.AllPawns)
{
if (pawn == null) continue;
pawn.Drawer?.renderer?.graphics?.ResolveAllGraphics();
PortraitsCache.SetDirty(pawn);
GlobalTextureAtlasManager.TryMarkPawnFrameSetDirty(pawn);
}
}
}
public override void DoSettingsWindowContents(Rect inRect)
{
Listing_Standard listingStandard;
listingStandard = new Listing_Standard();
listingStandard.Begin(inRect);
listingStandard.Gap(10f);
listingStandard.Label("rimworld_animation_patch_general".Translate());
listingStandard.Gap(5f);
//listingStandard.Label("test slide: " + BasicSettings.sliderValue.ToString("F"), -1f);
//BasicSettings.sliderValue = listingStandard.Slider(BasicSettings.sliderValue, -2f, 2f);
listingStandard.CheckboxLabeled("hide_names_for_sex".Translate(), ref BasicSettings.hideNamesForSex, "hide_names_for_sex_desc".Translate());
listingStandard.CheckboxLabeled("debug_mode".Translate(), ref BasicSettings.debugMode, "debug_mode_desc".Translate());
listingStandard.Gap(10f);
listingStandard.Label("rimworld_animation_patch_animation".Translate());
listingStandard.Gap(5f);
listingStandard.CheckboxLabeled("autoscale_delta_pos".Translate(), ref BasicSettings.autoscaleDeltaPos, "autoscale_delta_pos_desc".Translate());
listingStandard.CheckboxLabeled("redraw_hair".Translate(), ref BasicSettings.redrawHair, "redraw_hair_desc".Translate());
listingStandard.CheckboxLabeled("show_hands".Translate(), ref BasicSettings.showHands, "show_hands_desc".Translate());
listingStandard.End();
base.DoSettingsWindowContents(inRect);
}
public sealed override string SettingsCategory()
{
return "rimworld_animation_patch_basicsettings".Translate();
}
}
}