mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
Move history gizmo back to patch
This commit is contained in:
parent
97ea6c68d4
commit
18f066d7ff
3 changed files with 31 additions and 10 deletions
28
RJWSexperience/RJWSexperience/Patches/GetGizmos.cs
Normal file
28
RJWSexperience/RJWSexperience/Patches/GetGizmos.cs
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
using HarmonyLib;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Verse;
|
||||||
|
|
||||||
|
namespace RJWSexperience
|
||||||
|
{
|
||||||
|
[HarmonyPatch(typeof(Pawn), "GetGizmos")]
|
||||||
|
public static class Pawn_GetGizmos
|
||||||
|
{
|
||||||
|
public static void Postfix(ref IEnumerable<Gizmo> __result, Pawn __instance)
|
||||||
|
{
|
||||||
|
if (Find.Selector.NumSelected > 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
__result = AddHistoryGizmo(__instance, __result);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IEnumerable<Gizmo> AddHistoryGizmo(Pawn pawn, IEnumerable<Gizmo> gizmos)
|
||||||
|
{
|
||||||
|
foreach (Gizmo gizmo in gizmos)
|
||||||
|
yield return gizmo;
|
||||||
|
|
||||||
|
SexPartnerHistory history = pawn.GetPartnerHistory();
|
||||||
|
if (history != null)
|
||||||
|
yield return history.Gizmo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -63,6 +63,7 @@
|
||||||
<Compile Include="Logs\DebugLogProvider.cs" />
|
<Compile Include="Logs\DebugLogProvider.cs" />
|
||||||
<Compile Include="Logs\LogManager.cs" />
|
<Compile Include="Logs\LogManager.cs" />
|
||||||
<Compile Include="Patches\DefInjection.cs" />
|
<Compile Include="Patches\DefInjection.cs" />
|
||||||
|
<Compile Include="Patches\GetGizmos.cs" />
|
||||||
<Compile Include="Recipe_HymenSurgery.cs" />
|
<Compile Include="Recipe_HymenSurgery.cs" />
|
||||||
<Compile Include="Settings\SettingsTabHistory.cs" />
|
<Compile Include="Settings\SettingsTabHistory.cs" />
|
||||||
<Compile Include="Settings\SettingsTabDebug.cs" />
|
<Compile Include="Settings\SettingsTabDebug.cs" />
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace RJWSexperience
|
||||||
protected int mostsextickabscache = 0;
|
protected int mostsextickabscache = 0;
|
||||||
protected int bestsextickabscache = 0;
|
protected int bestsextickabscache = 0;
|
||||||
|
|
||||||
protected Gizmo historyGizmo;
|
public Gizmo Gizmo { get; private set; }
|
||||||
|
|
||||||
public SexPartnerHistoryRecord GetFirstPartnerHistory
|
public SexPartnerHistoryRecord GetFirstPartnerHistory
|
||||||
{
|
{
|
||||||
|
@ -476,7 +476,7 @@ namespace RJWSexperience
|
||||||
{
|
{
|
||||||
base.Initialize(props);
|
base.Initialize(props);
|
||||||
|
|
||||||
historyGizmo = new Command_Action
|
Gizmo = new Command_Action
|
||||||
{
|
{
|
||||||
defaultLabel = Keyed.RS_Sex_History,
|
defaultLabel = Keyed.RS_Sex_History,
|
||||||
icon = HistoryUtility.HistoryIcon,
|
icon = HistoryUtility.HistoryIcon,
|
||||||
|
@ -488,13 +488,5 @@ namespace RJWSexperience
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<Gizmo> CompGetGizmosExtra()
|
|
||||||
{
|
|
||||||
if (Find.Selector.NumSelected > 1)
|
|
||||||
yield break;
|
|
||||||
|
|
||||||
yield return historyGizmo;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue