mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
New settings handling
This commit is contained in:
parent
fed4b54915
commit
8d49addd63
24 changed files with 309 additions and 233 deletions
|
@ -1,64 +1,48 @@
|
|||
using UnityEngine;
|
||||
using Verse;
|
||||
using Verse;
|
||||
using RJWSexperience.Settings;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
public class Configurations : ModSettings, ITab
|
||||
public class Configurations : ModSettings
|
||||
{
|
||||
public string Label => Keyed.TabLabelMain;
|
||||
public const int CurrentSettingsVersion = 1;
|
||||
|
||||
// Defaults
|
||||
public const float LustEffectPowerDefault = 0.5f;
|
||||
public const bool EnableBastardRelationDefault = true;
|
||||
public const float LustLimitDefault = SettingsTabHistory.MaxLustDeviationDefault / 3f;
|
||||
public const float MaxSingleLustChangeDefault = 0.5f;
|
||||
public const bool SexCanFillBucketsDefault = false;
|
||||
public const bool selectionLockedDefault = false;
|
||||
public readonly SettingHandle<float> LustEffectPower = new SettingHandle<float>("LustEffectPower", 0.5f);
|
||||
public readonly SettingHandle<bool> EnableBastardRelation = new SettingHandle<bool>("EnableBastardRelation", true);
|
||||
public readonly SettingHandle<float> LustLimit = new SettingHandle<float>("LustLimit", 150f);
|
||||
public readonly SettingHandle<float> MaxSingleLustChange = new SettingHandle<float>("maxSingleLustChange", 1f);
|
||||
public readonly SettingHandle<bool> SexCanFillBuckets = new SettingHandle<bool>("SexCanFillBuckets", false);
|
||||
|
||||
// Private attributes
|
||||
private float lustEffectPower = LustEffectPowerDefault;
|
||||
private bool enableBastardRelation = EnableBastardRelationDefault;
|
||||
private float lustLimit = LustLimitDefault;
|
||||
private float maxSingleLustChange = MaxSingleLustChangeDefault;
|
||||
private bool sexCanFillBuckets = SexCanFillBucketsDefault;
|
||||
private bool selectionLocked = selectionLockedDefault;
|
||||
private SettingsTabHistory history = SettingsTabHistory.CreateDefault();
|
||||
private SettingsTabDebug debug = new SettingsTabDebug();
|
||||
public readonly SettingHandle<bool> EnableRecordRandomizer = new SettingHandle<bool>("EnableRecordRandomizer", true);
|
||||
public readonly SettingHandle<float> MaxLustDeviation = new SettingHandle<float>("MaxLustDeviation", 200f);
|
||||
public readonly SettingHandle<float> AvgLust = new SettingHandle<float>("AvgLust", 0f);
|
||||
public readonly SettingHandle<float> MaxSexCountDeviation = new SettingHandle<float>("MaxSexCountDeviation", 90f);
|
||||
public readonly SettingHandle<float> SexPerYear = new SettingHandle<float>("SexPerYear", 30f);
|
||||
public readonly SettingHandle<bool> MinSexableFromLifestage = new SettingHandle<bool>("MinSexableFromLifestage", true);
|
||||
public readonly SettingHandle<float> MinSexablePercent = new SettingHandle<float>("MinSexablePercent", 0.2f);
|
||||
public readonly SettingHandle<float> VirginRatio = new SettingHandle<float>("VirginRatio", 0.01f);
|
||||
public readonly SettingHandle<bool> SlavesBeenRapedExp = new SettingHandle<bool>("SlavesBeenRapedExp", true);
|
||||
public readonly SettingHandle<bool> EnableSexHistory = new SettingHandle<bool>("EnableSexHistory", true);
|
||||
public readonly SettingHandle<bool> HideGizmoWhenDrafted = new SettingHandle<bool>("HideGizmoWhenDrafted", true);
|
||||
public readonly SettingHandle<bool> HideGizmoWithRJW = new SettingHandle<bool>("HideGizmoWithRJW", false);
|
||||
|
||||
//Public read-only properties
|
||||
public float LustEffectPower => lustEffectPower;
|
||||
public bool EnableBastardRelation => enableBastardRelation;
|
||||
public float LustLimit => lustLimit;
|
||||
public float MaxSingleLustChange => maxSingleLustChange;
|
||||
public bool SexCanFillBuckets => sexCanFillBuckets;
|
||||
public SettingsTabHistory History => history;
|
||||
public SettingsTabDebug Debug => debug;
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S2292:Trivial properties should be auto-implemented", Justification = "Can't scribe property")]
|
||||
public bool SelectionLocked { get => selectionLocked; set => selectionLocked = value; }
|
||||
public readonly SettingHandle<bool> DevMode = new SettingHandle<bool>("DevMode", false);
|
||||
|
||||
public void ResetToDefault()
|
||||
{
|
||||
lustEffectPower = LustEffectPowerDefault;
|
||||
enableBastardRelation = EnableBastardRelationDefault;
|
||||
lustLimit = LustLimitDefault;
|
||||
maxSingleLustChange = MaxSingleLustChangeDefault;
|
||||
sexCanFillBuckets = SexCanFillBucketsDefault;
|
||||
}
|
||||
public readonly SettingHandle<bool> SelectionLocked = new SettingHandle<bool>("SelectionLocked", false);
|
||||
|
||||
public override void ExposeData()
|
||||
{
|
||||
SettingsContainer history = SettingsContainer.CreateHistoryContainer(this);
|
||||
int version = CurrentSettingsVersion;
|
||||
Scribe_Values.Look(ref version, "SettingsVersion", 0);
|
||||
Scribe_Values.Look(ref lustEffectPower, "LustEffectPower", LustEffectPowerDefault);
|
||||
Scribe_Values.Look(ref enableBastardRelation, "EnableBastardRelation", EnableBastardRelationDefault);
|
||||
Scribe_Values.Look(ref lustLimit, "LustLimit", LustLimitDefault);
|
||||
Scribe_Values.Look(ref maxSingleLustChange, "maxSingleLustChange", MaxSingleLustChangeDefault);
|
||||
Scribe_Values.Look(ref selectionLocked, "SelectionLocked", selectionLockedDefault);
|
||||
Scribe_Values.Look(ref sexCanFillBuckets, "SexCanFillBuckets", SexCanFillBucketsDefault);
|
||||
Scribe_Deep.Look(ref history, "History");
|
||||
Scribe_Deep.Look(ref debug, "Debug");
|
||||
LustEffectPower.Scribe();
|
||||
EnableBastardRelation.Scribe();
|
||||
LustLimit.Scribe();
|
||||
MaxSingleLustChange.Scribe();
|
||||
SelectionLocked.Scribe();
|
||||
SexCanFillBuckets.Scribe();
|
||||
DevMode.Scribe();
|
||||
Scribe_Deep.Look(ref history, "History", history.Handles);
|
||||
base.ExposeData();
|
||||
|
||||
if (Scribe.mode != LoadSaveMode.LoadingVars)
|
||||
|
@ -66,41 +50,9 @@ namespace RJWSexperience
|
|||
|
||||
if (history == null)
|
||||
{
|
||||
history = new SettingsTabHistory();
|
||||
// Previously history settings were in Configurations. Direct call to try read old data
|
||||
history.ExposeData();
|
||||
SettingsContainer.CreateHistoryContainer(this).ExposeData();
|
||||
}
|
||||
|
||||
if (debug == null)
|
||||
{
|
||||
debug = new SettingsTabDebug();
|
||||
debug.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
public void DoTabContents(Rect inRect)
|
||||
{
|
||||
const float lineHeight = SettingsWidgets.lineHeight;
|
||||
|
||||
Listing_Standard listmain = new Listing_Standard();
|
||||
listmain.maxOneColumn = true;
|
||||
listmain.Begin(inRect);
|
||||
|
||||
SettingsWidgets.SliderOption(listmain.GetRect(lineHeight * 2f), Keyed.Option_2_Label + " x" + lustEffectPower, Keyed.Option_2_Desc, ref lustEffectPower, 0f, 2f, 0.01f);
|
||||
SettingsWidgets.SliderOption(listmain.GetRect(lineHeight * 2f), Keyed.Option_8_Label + " " + lustLimit, Keyed.Option_8_Desc, ref lustLimit, 0f, 5000f, 1f);
|
||||
SettingsWidgets.SliderOption(listmain.GetRect(lineHeight * 2f), Keyed.Option_MaxSingleLustChange_Label + " " + maxSingleLustChange, Keyed.Option_MaxSingleLustChange_Desc, ref maxSingleLustChange, 0f, 10f, 0.05f);
|
||||
|
||||
listmain.CheckboxLabeled(Keyed.Option_EnableBastardRelation_Label, ref enableBastardRelation, Keyed.Option_EnableBastardRelation_Desc);
|
||||
listmain.CheckboxLabeled(Keyed.Option_SexCanFillBuckets_Label, ref sexCanFillBuckets, Keyed.Option_SexCanFillBuckets_Desc);
|
||||
|
||||
if (SexperienceMod.Settings.Debug.DevMode)
|
||||
LustUtility.DrawGraph(listmain.GetRect(300f));
|
||||
|
||||
if (listmain.ButtonText(Keyed.Button_ResetToDefault))
|
||||
{
|
||||
ResetToDefault();
|
||||
}
|
||||
listmain.End();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue