diff --git a/Languages/English/Keyed/RJW_Sexperience.xml b/Languages/English/Keyed/RJW_Sexperience.xml
index 4e03722..c836557 100644
--- a/Languages/English/Keyed/RJW_Sexperience.xml
+++ b/Languages/English/Keyed/RJW_Sexperience.xml
@@ -60,6 +60,10 @@
last sex
Had best sex {0}.
+
+ Main
+ Debug
+
Enable record randomizer
Randomize pawn's sex records.
diff --git a/RJWSexperience/RJWSexperience/Configurations.cs b/RJWSexperience/RJWSexperience/Configurations.cs
index 69a95cc..c1362e5 100644
--- a/RJWSexperience/RJWSexperience/Configurations.cs
+++ b/RJWSexperience/RJWSexperience/Configurations.cs
@@ -4,8 +4,11 @@ using Verse;
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 AvgLustDefault = 0f;
public const float MaxSexCountDeviationDefault = 90f;
@@ -19,8 +22,9 @@ namespace RJWSexperience
public const bool MinSexableFromLifestageDefault = true;
public const float MinSexablePercentDefault = 0.2f;
public const float VirginRatioDefault = 0.01f;
- public const bool DebugDefault = false;
+ public const bool selectionLockedDefault = false;
+ // Private attributes
private float maxLustDeviation = MaxInitialLustDefault;
private float avgLust = AvgLustDefault;
private float maxSexCountDeviation = MaxSexCountDeviationDefault;
@@ -34,25 +38,24 @@ namespace RJWSexperience
private float minSexablePercent = MinSexablePercentDefault;
private float virginRatio = VirginRatioDefault;
private float maxSingleLustChange = MaxSingleLustChangeDefault;
- private bool debug = DebugDefault;
-
- 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;
+ private bool selectionLocked = selectionLockedDefault;
+ private Settings.SettingsTabDebug debug;
+ //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")]
public bool SelectionLocked { get => selectionLocked; set => selectionLocked = value; }
@@ -71,30 +74,38 @@ namespace RJWSexperience
minSexableFromLifestage = MinSexableFromLifestageDefault;
minSexablePercent = MinSexablePercentDefault;
virginRatio = VirginRatioDefault;
- debug = DebugDefault;
}
public override void ExposeData()
{
- Scribe_Values.Look(ref maxLustDeviation, "MaxLustDeviation", MaxInitialLustDefault, true);
- Scribe_Values.Look(ref avgLust, "AvgLust", AvgLustDefault, true);
- Scribe_Values.Look(ref maxSexCountDeviation, "MaxSexCountDeviation", MaxSexCountDeviationDefault, true);
- Scribe_Values.Look(ref lustEffectPower, "LustEffectPower", LustEffectPowerDefault, true);
- Scribe_Values.Look(ref sexPerYear, "SexPerYear", SexPerYearDefault, true);
- Scribe_Values.Look(ref slavesBeenRapedExp, "SlavesBeenRapedExp", SlavesBeenRapedExpDefault, true);
- Scribe_Values.Look(ref enableRecordRandomizer, "EnableRecordRandomizer", EnableStatRandomizerDefault, true);
- Scribe_Values.Look(ref enableBastardRelation, "EnableBastardRelation", EnableBastardRelationDefault, true);
- Scribe_Values.Look(ref lustLimit, "LustLimit", LustLimitDefault, true);
- Scribe_Values.Look(ref maxSingleLustChange, "maxSingleLustChange", MaxSingleLustChangeDefault, true);
- Scribe_Values.Look(ref minSexableFromLifestage, "MinSexableFromLifestage", MinSexableFromLifestageDefault, true);
- Scribe_Values.Look(ref minSexablePercent, "MinSexablePercent", MinSexablePercentDefault, true);
- Scribe_Values.Look(ref virginRatio, "VirginRatio", VirginRatioDefault, true);
- Scribe_Values.Look(ref debug, "Debug", DebugDefault, true);
- Scribe_Values.Look(ref selectionLocked, "SelectionLocked");
+ Scribe_Values.Look(ref maxLustDeviation, "MaxLustDeviation", MaxInitialLustDefault);
+ Scribe_Values.Look(ref avgLust, "AvgLust", AvgLustDefault);
+ Scribe_Values.Look(ref maxSexCountDeviation, "MaxSexCountDeviation", MaxSexCountDeviationDefault);
+ Scribe_Values.Look(ref lustEffectPower, "LustEffectPower", LustEffectPowerDefault);
+ Scribe_Values.Look(ref sexPerYear, "SexPerYear", SexPerYearDefault);
+ Scribe_Values.Look(ref slavesBeenRapedExp, "SlavesBeenRapedExp", SlavesBeenRapedExpDefault);
+ Scribe_Values.Look(ref enableRecordRandomizer, "EnableRecordRandomizer", EnableStatRandomizerDefault);
+ 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 minSexableFromLifestage, "MinSexableFromLifestage", MinSexableFromLifestageDefault);
+ Scribe_Values.Look(ref minSexablePercent, "MinSexablePercent", MinSexablePercentDefault);
+ Scribe_Values.Look(ref virginRatio, "VirginRatio", VirginRatioDefault);
+ Scribe_Values.Look(ref selectionLocked, "SelectionLocked", selectionLockedDefault);
+ Scribe_Deep.Look(ref debug, "Debug");
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;
@@ -132,7 +143,6 @@ namespace RJWSexperience
}
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))
{
diff --git a/RJWSexperience/RJWSexperience/Keyed.cs b/RJWSexperience/RJWSexperience/Keyed.cs
index 0ef50f9..83b8c32 100644
--- a/RJWSexperience/RJWSexperience/Keyed.cs
+++ b/RJWSexperience/RJWSexperience/Keyed.cs
@@ -63,6 +63,9 @@ namespace RJWSexperience
public static readonly string RS_Ago = "RS_Ago".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_Desc = "RSOption_1_Desc".Translate();
public static readonly string Option_2_Label = "RSOption_2_Label".Translate();
diff --git a/RJWSexperience/RJWSexperience/Logs/DebugLogProvider.cs b/RJWSexperience/RJWSexperience/Logs/DebugLogProvider.cs
index 38d978f..15576b6 100644
--- a/RJWSexperience/RJWSexperience/Logs/DebugLogProvider.cs
+++ b/RJWSexperience/RJWSexperience/Logs/DebugLogProvider.cs
@@ -4,6 +4,6 @@ namespace RJWSexperience.Logs
{
public class DebugLogProvider : ILogProvider
{
- public bool IsActive => SexperienceMod.Settings.Debug;
+ public bool IsActive => SexperienceMod.Settings.Debug.DevMode;
}
}
diff --git a/RJWSexperience/RJWSexperience/RJWSexperience.csproj b/RJWSexperience/RJWSexperience/RJWSexperience.csproj
index 3cc9267..ed3fc22 100644
--- a/RJWSexperience/RJWSexperience/RJWSexperience.csproj
+++ b/RJWSexperience/RJWSexperience/RJWSexperience.csproj
@@ -69,6 +69,7 @@
+
@@ -84,6 +85,9 @@
+
+
+
diff --git a/RJWSexperience/RJWSexperience/Settings/IResettable.cs b/RJWSexperience/RJWSexperience/Settings/IResettable.cs
new file mode 100644
index 0000000..238759d
--- /dev/null
+++ b/RJWSexperience/RJWSexperience/Settings/IResettable.cs
@@ -0,0 +1,7 @@
+namespace RJWSexperience.Settings
+{
+ internal interface IResettable
+ {
+ void Reset();
+ }
+}
\ No newline at end of file
diff --git a/RJWSexperience/RJWSexperience/Settings/ITab.cs b/RJWSexperience/RJWSexperience/Settings/ITab.cs
new file mode 100644
index 0000000..39e46c5
--- /dev/null
+++ b/RJWSexperience/RJWSexperience/Settings/ITab.cs
@@ -0,0 +1,10 @@
+using UnityEngine;
+
+namespace RJWSexperience.Settings
+{
+ public interface ITab
+ {
+ string Label { get; }
+ void DoTabContents(Rect inRect);
+ }
+}
\ No newline at end of file
diff --git a/RJWSexperience/RJWSexperience/Settings/SettingsTabDebug.cs b/RJWSexperience/RJWSexperience/Settings/SettingsTabDebug.cs
new file mode 100644
index 0000000..7aec4fe
--- /dev/null
+++ b/RJWSexperience/RJWSexperience/Settings/SettingsTabDebug.cs
@@ -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();
+ }
+ }
+}
diff --git a/RJWSexperience/RJWSexperience/SexperienceMod.cs b/RJWSexperience/RJWSexperience/SexperienceMod.cs
index 7b03aad..fe735ca 100644
--- a/RJWSexperience/RJWSexperience/SexperienceMod.cs
+++ b/RJWSexperience/RJWSexperience/SexperienceMod.cs
@@ -1,17 +1,24 @@
using UnityEngine;
+using System.Collections.Generic;
using Verse;
+using RJWSexperience.Settings;
namespace RJWSexperience
{
-
public class SexperienceMod : Mod
{
private static Configurations settings;
public static Configurations Settings { get => settings; }
+ public ITab CurrentTab { get; private set; }
+
+ private readonly List tabRecords;
+
public SexperienceMod(ModContentPack content) : base(content)
{
settings = GetSettings();
+ CurrentTab = settings;
+ tabRecords = new List();
}
public override string SettingsCategory()
@@ -19,6 +26,32 @@ namespace RJWSexperience
return Keyed.Mod_Title;
}
- public override void DoSettingsWindowContents(Rect inRect) => Settings.DoSettingsWindowContents(inRect);
+ ///
+ /// Fills tabRecords list.
+ /// This method cannot be called in constructor because at that stage language file is not loaded
+ ///
+ private void InitTabRecords()
+ {
+ List tabs = new List
+ {
+ 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);
+ }
}
}