mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
Add tabs in the mod settings
This commit is contained in:
parent
3807441418
commit
9dc47f704a
9 changed files with 154 additions and 41 deletions
|
@ -60,6 +60,10 @@
|
||||||
<RS_LastSex>last sex</RS_LastSex>
|
<RS_LastSex>last sex</RS_LastSex>
|
||||||
<RS_HadBestSexDaysAgo>Had best sex {0}.</RS_HadBestSexDaysAgo>
|
<RS_HadBestSexDaysAgo>Had best sex {0}.</RS_HadBestSexDaysAgo>
|
||||||
|
|
||||||
|
<!-- Settings tab labels -->
|
||||||
|
<TabLabelMain>Main</TabLabelMain>
|
||||||
|
<TabLabelDebug>Debug</TabLabelDebug>
|
||||||
|
|
||||||
<!-- Mod settings -->
|
<!-- Mod settings -->
|
||||||
<RSOption_1_Label>Enable record randomizer</RSOption_1_Label>
|
<RSOption_1_Label>Enable record randomizer</RSOption_1_Label>
|
||||||
<RSOption_1_Desc>Randomize pawn's sex records.</RSOption_1_Desc>
|
<RSOption_1_Desc>Randomize pawn's sex records.</RSOption_1_Desc>
|
||||||
|
|
|
@ -4,8 +4,11 @@ using Verse;
|
||||||
|
|
||||||
namespace RJWSexperience
|
namespace RJWSexperience
|
||||||
{
|
{
|
||||||
public class Configurations : ModSettings
|
public class Configurations : ModSettings, Settings.ITab
|
||||||
{
|
{
|
||||||
|
public string Label => Keyed.TabLabelMain;
|
||||||
|
|
||||||
|
// Defaults
|
||||||
public const float MaxInitialLustDefault = 400f;
|
public const float MaxInitialLustDefault = 400f;
|
||||||
public const float AvgLustDefault = 0f;
|
public const float AvgLustDefault = 0f;
|
||||||
public const float MaxSexCountDeviationDefault = 90f;
|
public const float MaxSexCountDeviationDefault = 90f;
|
||||||
|
@ -19,8 +22,9 @@ namespace RJWSexperience
|
||||||
public const bool MinSexableFromLifestageDefault = true;
|
public const bool MinSexableFromLifestageDefault = true;
|
||||||
public const float MinSexablePercentDefault = 0.2f;
|
public const float MinSexablePercentDefault = 0.2f;
|
||||||
public const float VirginRatioDefault = 0.01f;
|
public const float VirginRatioDefault = 0.01f;
|
||||||
public const bool DebugDefault = false;
|
public const bool selectionLockedDefault = false;
|
||||||
|
|
||||||
|
// Private attributes
|
||||||
private float maxLustDeviation = MaxInitialLustDefault;
|
private float maxLustDeviation = MaxInitialLustDefault;
|
||||||
private float avgLust = AvgLustDefault;
|
private float avgLust = AvgLustDefault;
|
||||||
private float maxSexCountDeviation = MaxSexCountDeviationDefault;
|
private float maxSexCountDeviation = MaxSexCountDeviationDefault;
|
||||||
|
@ -34,25 +38,24 @@ namespace RJWSexperience
|
||||||
private float minSexablePercent = MinSexablePercentDefault;
|
private float minSexablePercent = MinSexablePercentDefault;
|
||||||
private float virginRatio = VirginRatioDefault;
|
private float virginRatio = VirginRatioDefault;
|
||||||
private float maxSingleLustChange = MaxSingleLustChangeDefault;
|
private float maxSingleLustChange = MaxSingleLustChangeDefault;
|
||||||
private bool debug = DebugDefault;
|
private bool selectionLocked = selectionLockedDefault;
|
||||||
|
private Settings.SettingsTabDebug debug;
|
||||||
public float MaxLustDeviation { get => maxLustDeviation; }
|
|
||||||
public float AvgLust { get => avgLust; }
|
|
||||||
public float MaxSexCountDeviation { get => maxSexCountDeviation; }
|
|
||||||
public float LustEffectPower { get => lustEffectPower; }
|
|
||||||
public float SexPerYear { get => sexPerYear; }
|
|
||||||
public bool SlavesBeenRapedExp { get => slavesBeenRapedExp; }
|
|
||||||
public bool EnableRecordRandomizer { get => enableRecordRandomizer; }
|
|
||||||
public bool EnableBastardRelation { get => enableBastardRelation; }
|
|
||||||
public float LustLimit { get => lustLimit; }
|
|
||||||
public bool MinSexableFromLifestage { get => minSexableFromLifestage; }
|
|
||||||
public float MinSexablePercent { get => minSexablePercent; }
|
|
||||||
public float VirginRatio { get => virginRatio; }
|
|
||||||
public float MaxSingleLustChange { get => maxSingleLustChange; }
|
|
||||||
public bool Debug { get => debug; }
|
|
||||||
|
|
||||||
private bool selectionLocked = false;
|
|
||||||
|
|
||||||
|
//Public read-only properties
|
||||||
|
public float MaxLustDeviation => maxLustDeviation;
|
||||||
|
public float AvgLust => avgLust;
|
||||||
|
public float MaxSexCountDeviation => maxSexCountDeviation;
|
||||||
|
public float LustEffectPower => lustEffectPower;
|
||||||
|
public float SexPerYear => sexPerYear;
|
||||||
|
public bool SlavesBeenRapedExp => slavesBeenRapedExp;
|
||||||
|
public bool EnableRecordRandomizer => enableRecordRandomizer;
|
||||||
|
public bool EnableBastardRelation => enableBastardRelation;
|
||||||
|
public float LustLimit => lustLimit;
|
||||||
|
public bool MinSexableFromLifestage => minSexableFromLifestage;
|
||||||
|
public float MinSexablePercent => minSexablePercent;
|
||||||
|
public float VirginRatio => virginRatio;
|
||||||
|
public float MaxSingleLustChange => maxSingleLustChange;
|
||||||
|
public Settings.SettingsTabDebug Debug => debug;
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S2292:Trivial properties should be auto-implemented", Justification = "Can't scribe property")]
|
[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 bool SelectionLocked { get => selectionLocked; set => selectionLocked = value; }
|
||||||
|
|
||||||
|
@ -71,30 +74,38 @@ namespace RJWSexperience
|
||||||
minSexableFromLifestage = MinSexableFromLifestageDefault;
|
minSexableFromLifestage = MinSexableFromLifestageDefault;
|
||||||
minSexablePercent = MinSexablePercentDefault;
|
minSexablePercent = MinSexablePercentDefault;
|
||||||
virginRatio = VirginRatioDefault;
|
virginRatio = VirginRatioDefault;
|
||||||
debug = DebugDefault;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ExposeData()
|
public override void ExposeData()
|
||||||
{
|
{
|
||||||
Scribe_Values.Look(ref maxLustDeviation, "MaxLustDeviation", MaxInitialLustDefault, true);
|
Scribe_Values.Look(ref maxLustDeviation, "MaxLustDeviation", MaxInitialLustDefault);
|
||||||
Scribe_Values.Look(ref avgLust, "AvgLust", AvgLustDefault, true);
|
Scribe_Values.Look(ref avgLust, "AvgLust", AvgLustDefault);
|
||||||
Scribe_Values.Look(ref maxSexCountDeviation, "MaxSexCountDeviation", MaxSexCountDeviationDefault, true);
|
Scribe_Values.Look(ref maxSexCountDeviation, "MaxSexCountDeviation", MaxSexCountDeviationDefault);
|
||||||
Scribe_Values.Look(ref lustEffectPower, "LustEffectPower", LustEffectPowerDefault, true);
|
Scribe_Values.Look(ref lustEffectPower, "LustEffectPower", LustEffectPowerDefault);
|
||||||
Scribe_Values.Look(ref sexPerYear, "SexPerYear", SexPerYearDefault, true);
|
Scribe_Values.Look(ref sexPerYear, "SexPerYear", SexPerYearDefault);
|
||||||
Scribe_Values.Look(ref slavesBeenRapedExp, "SlavesBeenRapedExp", SlavesBeenRapedExpDefault, true);
|
Scribe_Values.Look(ref slavesBeenRapedExp, "SlavesBeenRapedExp", SlavesBeenRapedExpDefault);
|
||||||
Scribe_Values.Look(ref enableRecordRandomizer, "EnableRecordRandomizer", EnableStatRandomizerDefault, true);
|
Scribe_Values.Look(ref enableRecordRandomizer, "EnableRecordRandomizer", EnableStatRandomizerDefault);
|
||||||
Scribe_Values.Look(ref enableBastardRelation, "EnableBastardRelation", EnableBastardRelationDefault, true);
|
Scribe_Values.Look(ref enableBastardRelation, "EnableBastardRelation", EnableBastardRelationDefault);
|
||||||
Scribe_Values.Look(ref lustLimit, "LustLimit", LustLimitDefault, true);
|
Scribe_Values.Look(ref lustLimit, "LustLimit", LustLimitDefault);
|
||||||
Scribe_Values.Look(ref maxSingleLustChange, "maxSingleLustChange", MaxSingleLustChangeDefault, true);
|
Scribe_Values.Look(ref maxSingleLustChange, "maxSingleLustChange", MaxSingleLustChangeDefault);
|
||||||
Scribe_Values.Look(ref minSexableFromLifestage, "MinSexableFromLifestage", MinSexableFromLifestageDefault, true);
|
Scribe_Values.Look(ref minSexableFromLifestage, "MinSexableFromLifestage", MinSexableFromLifestageDefault);
|
||||||
Scribe_Values.Look(ref minSexablePercent, "MinSexablePercent", MinSexablePercentDefault, true);
|
Scribe_Values.Look(ref minSexablePercent, "MinSexablePercent", MinSexablePercentDefault);
|
||||||
Scribe_Values.Look(ref virginRatio, "VirginRatio", VirginRatioDefault, true);
|
Scribe_Values.Look(ref virginRatio, "VirginRatio", VirginRatioDefault);
|
||||||
Scribe_Values.Look(ref debug, "Debug", DebugDefault, true);
|
Scribe_Values.Look(ref selectionLocked, "SelectionLocked", selectionLockedDefault);
|
||||||
Scribe_Values.Look(ref selectionLocked, "SelectionLocked");
|
Scribe_Deep.Look(ref debug, "Debug");
|
||||||
base.ExposeData();
|
base.ExposeData();
|
||||||
|
|
||||||
|
if (Scribe.mode != LoadSaveMode.LoadingVars)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (debug == null)
|
||||||
|
{
|
||||||
|
debug = new Settings.SettingsTabDebug();
|
||||||
|
debug.Reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DoSettingsWindowContents(Rect inRect)
|
public void DoTabContents(Rect inRect)
|
||||||
{
|
{
|
||||||
const float lineHeight = 24f;
|
const float lineHeight = 24f;
|
||||||
|
|
||||||
|
@ -132,7 +143,6 @@ namespace RJWSexperience
|
||||||
}
|
}
|
||||||
|
|
||||||
listmain.CheckboxLabeled(Keyed.Option_EnableBastardRelation_Label, ref enableBastardRelation, Keyed.Option_EnableBastardRelation_Desc);
|
listmain.CheckboxLabeled(Keyed.Option_EnableBastardRelation_Label, ref enableBastardRelation, Keyed.Option_EnableBastardRelation_Desc);
|
||||||
listmain.CheckboxLabeled(Keyed.Option_Debug_Label, ref debug, Keyed.Option_Debug_Desc);
|
|
||||||
|
|
||||||
if (listmain.ButtonText(Keyed.Button_ResetToDefault))
|
if (listmain.ButtonText(Keyed.Button_ResetToDefault))
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,6 +63,9 @@ namespace RJWSexperience
|
||||||
public static readonly string RS_Ago = "RS_Ago".Translate();
|
public static readonly string RS_Ago = "RS_Ago".Translate();
|
||||||
public static readonly string RS_LastSex = "RS_LastSex".Translate();
|
public static readonly string RS_LastSex = "RS_LastSex".Translate();
|
||||||
|
|
||||||
|
public static readonly string TabLabelMain = "TabLabelMain".Translate();
|
||||||
|
public static readonly string TabLabelDebug = "TabLabelDebug".Translate();
|
||||||
|
|
||||||
public static readonly string Option_1_Label = "RSOption_1_Label".Translate();
|
public static readonly string Option_1_Label = "RSOption_1_Label".Translate();
|
||||||
public static readonly string Option_1_Desc = "RSOption_1_Desc".Translate();
|
public static readonly string Option_1_Desc = "RSOption_1_Desc".Translate();
|
||||||
public static readonly string Option_2_Label = "RSOption_2_Label".Translate();
|
public static readonly string Option_2_Label = "RSOption_2_Label".Translate();
|
||||||
|
|
|
@ -4,6 +4,6 @@ namespace RJWSexperience.Logs
|
||||||
{
|
{
|
||||||
public class DebugLogProvider : ILogProvider
|
public class DebugLogProvider : ILogProvider
|
||||||
{
|
{
|
||||||
public bool IsActive => SexperienceMod.Settings.Debug;
|
public bool IsActive => SexperienceMod.Settings.Debug.DevMode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
<Compile Include="Configurations.cs" />
|
<Compile Include="Configurations.cs" />
|
||||||
<Compile Include="Cum\CumUtility.cs" />
|
<Compile Include="Cum\CumUtility.cs" />
|
||||||
<Compile Include="Cum\JobGiver_UseBucket.cs" />
|
<Compile Include="Cum\JobGiver_UseBucket.cs" />
|
||||||
|
<Compile Include="Cum\WorkGiver_CleanSelfWithBucket.cs" />
|
||||||
<Compile Include="DebugAction.cs" />
|
<Compile Include="DebugAction.cs" />
|
||||||
<Compile Include="ExtensionMethods\PawnExtensions.cs" />
|
<Compile Include="ExtensionMethods\PawnExtensions.cs" />
|
||||||
<Compile Include="ExtensionMethods\SexPropsExtensions.cs" />
|
<Compile Include="ExtensionMethods\SexPropsExtensions.cs" />
|
||||||
|
@ -84,6 +85,9 @@
|
||||||
<Compile Include="Patches\DefInjection.cs" />
|
<Compile Include="Patches\DefInjection.cs" />
|
||||||
<Compile Include="Patches\GetGizmos.cs" />
|
<Compile Include="Patches\GetGizmos.cs" />
|
||||||
<Compile Include="Recipe_HymenSurgery.cs" />
|
<Compile Include="Recipe_HymenSurgery.cs" />
|
||||||
|
<Compile Include="Settings\SettingsTabDebug.cs" />
|
||||||
|
<Compile Include="Settings\IResettable.cs" />
|
||||||
|
<Compile Include="Settings\ITab.cs" />
|
||||||
<Compile Include="SexHistory\RecordRandomizer.cs" />
|
<Compile Include="SexHistory\RecordRandomizer.cs" />
|
||||||
<Compile Include="RJWUtility.cs" />
|
<Compile Include="RJWUtility.cs" />
|
||||||
<Compile Include="SexHistory\HistoryUtility.cs" />
|
<Compile Include="SexHistory\HistoryUtility.cs" />
|
||||||
|
|
7
RJWSexperience/RJWSexperience/Settings/IResettable.cs
Normal file
7
RJWSexperience/RJWSexperience/Settings/IResettable.cs
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
namespace RJWSexperience.Settings
|
||||||
|
{
|
||||||
|
internal interface IResettable
|
||||||
|
{
|
||||||
|
void Reset();
|
||||||
|
}
|
||||||
|
}
|
10
RJWSexperience/RJWSexperience/Settings/ITab.cs
Normal file
10
RJWSexperience/RJWSexperience/Settings/ITab.cs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace RJWSexperience.Settings
|
||||||
|
{
|
||||||
|
public interface ITab
|
||||||
|
{
|
||||||
|
string Label { get; }
|
||||||
|
void DoTabContents(Rect inRect);
|
||||||
|
}
|
||||||
|
}
|
42
RJWSexperience/RJWSexperience/Settings/SettingsTabDebug.cs
Normal file
42
RJWSexperience/RJWSexperience/Settings/SettingsTabDebug.cs
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
using UnityEngine;
|
||||||
|
using Verse;
|
||||||
|
|
||||||
|
namespace RJWSexperience.Settings
|
||||||
|
{
|
||||||
|
public class SettingsTabDebug : IExposable, IResettable, ITab
|
||||||
|
{
|
||||||
|
public string Label => Keyed.TabLabelDebug;
|
||||||
|
|
||||||
|
// Defaults
|
||||||
|
public const bool DevModeDefault = false;
|
||||||
|
|
||||||
|
// Private attributes
|
||||||
|
private bool devMode;
|
||||||
|
|
||||||
|
//Public read-only properties
|
||||||
|
public bool DevMode => devMode;
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
devMode = DevModeDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ExposeData()
|
||||||
|
{
|
||||||
|
Scribe_Values.Look(ref devMode, "DevMode", DevModeDefault);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DoTabContents(Rect inRect)
|
||||||
|
{
|
||||||
|
Listing_Standard listmain = new Listing_Standard();
|
||||||
|
listmain.Begin(inRect);
|
||||||
|
listmain.CheckboxLabeled(Keyed.Option_Debug_Label, ref devMode, Keyed.Option_Debug_Desc);
|
||||||
|
|
||||||
|
if (listmain.ButtonText(Keyed.Button_ResetToDefault))
|
||||||
|
{
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
|
listmain.End();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,17 +1,24 @@
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using System.Collections.Generic;
|
||||||
using Verse;
|
using Verse;
|
||||||
|
using RJWSexperience.Settings;
|
||||||
|
|
||||||
namespace RJWSexperience
|
namespace RJWSexperience
|
||||||
{
|
{
|
||||||
|
|
||||||
public class SexperienceMod : Mod
|
public class SexperienceMod : Mod
|
||||||
{
|
{
|
||||||
private static Configurations settings;
|
private static Configurations settings;
|
||||||
public static Configurations Settings { get => settings; }
|
public static Configurations Settings { get => settings; }
|
||||||
|
|
||||||
|
public ITab CurrentTab { get; private set; }
|
||||||
|
|
||||||
|
private readonly List<TabRecord> tabRecords;
|
||||||
|
|
||||||
public SexperienceMod(ModContentPack content) : base(content)
|
public SexperienceMod(ModContentPack content) : base(content)
|
||||||
{
|
{
|
||||||
settings = GetSettings<Configurations>();
|
settings = GetSettings<Configurations>();
|
||||||
|
CurrentTab = settings;
|
||||||
|
tabRecords = new List<TabRecord>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string SettingsCategory()
|
public override string SettingsCategory()
|
||||||
|
@ -19,6 +26,32 @@ namespace RJWSexperience
|
||||||
return Keyed.Mod_Title;
|
return Keyed.Mod_Title;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DoSettingsWindowContents(Rect inRect) => Settings.DoSettingsWindowContents(inRect);
|
/// <summary>
|
||||||
|
/// Fills tabRecords list.
|
||||||
|
/// This method cannot be called in constructor because at that stage language file is not loaded
|
||||||
|
/// </summary>
|
||||||
|
private void InitTabRecords()
|
||||||
|
{
|
||||||
|
List<ITab> tabs = new List<ITab>
|
||||||
|
{
|
||||||
|
settings,
|
||||||
|
settings.Debug
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach (ITab tab in tabs)
|
||||||
|
tabRecords.Add(new TabRecord(tab.Label, delegate { this.CurrentTab = tab; }, delegate { return this?.CurrentTab == tab; }));
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void DoSettingsWindowContents(Rect inRect)
|
||||||
|
{
|
||||||
|
if (tabRecords.NullOrEmpty())
|
||||||
|
InitTabRecords();
|
||||||
|
|
||||||
|
Rect contentRect = inRect.ContractedBy(TabDrawer.TabHeight);
|
||||||
|
|
||||||
|
_ = TabDrawer.DrawTabs(contentRect, tabRecords);
|
||||||
|
|
||||||
|
CurrentTab.DoTabContents(contentRect);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue