mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
Move history gizmo to comp
This commit is contained in:
parent
c4492651e3
commit
174974220f
3 changed files with 27 additions and 47 deletions
|
@ -1,46 +0,0 @@
|
||||||
using HarmonyLib;
|
|
||||||
using RJWSexperience.UI;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
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 CreateHistoryGizmo(pawn, history);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Gizmo CreateHistoryGizmo(Pawn pawn, SexPartnerHistory history)
|
|
||||||
{
|
|
||||||
Gizmo gizmo = new Command_Action
|
|
||||||
{
|
|
||||||
defaultLabel = Keyed.RS_Sex_History,
|
|
||||||
icon = HistoryUtility.HistoryIcon,
|
|
||||||
defaultIconColor = HistoryUtility.HistoryColor,
|
|
||||||
hotKey = VariousDefOf.OpenSexStatistics,
|
|
||||||
action = delegate
|
|
||||||
{
|
|
||||||
SexStatusWindow.ToggleWindow(pawn, history);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return gizmo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -83,7 +83,6 @@
|
||||||
<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\SettingsTabDebug.cs" />
|
<Compile Include="Settings\SettingsTabDebug.cs" />
|
||||||
<Compile Include="Settings\IResettable.cs" />
|
<Compile Include="Settings\IResettable.cs" />
|
||||||
|
|
|
@ -46,6 +46,8 @@ namespace RJWSexperience
|
||||||
protected int mostsextickabscache = 0;
|
protected int mostsextickabscache = 0;
|
||||||
protected int bestsextickabscache = 0;
|
protected int bestsextickabscache = 0;
|
||||||
|
|
||||||
|
protected Gizmo historyGizmo;
|
||||||
|
|
||||||
public SexPartnerHistoryRecord GetFirstPartnerHistory
|
public SexPartnerHistoryRecord GetFirstPartnerHistory
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -468,5 +470,30 @@ namespace RJWSexperience
|
||||||
Pawn pawn = parent as Pawn;
|
Pawn pawn = parent as Pawn;
|
||||||
return pawn?.IsVirgin() == true;
|
return pawn?.IsVirgin() == true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Initialize(CompProperties props)
|
||||||
|
{
|
||||||
|
base.Initialize(props);
|
||||||
|
|
||||||
|
historyGizmo = new Command_Action
|
||||||
|
{
|
||||||
|
defaultLabel = Keyed.RS_Sex_History,
|
||||||
|
icon = HistoryUtility.HistoryIcon,
|
||||||
|
defaultIconColor = HistoryUtility.HistoryColor,
|
||||||
|
hotKey = VariousDefOf.OpenSexStatistics,
|
||||||
|
action = delegate
|
||||||
|
{
|
||||||
|
UI.SexStatusWindow.ToggleWindow(parent as Pawn, this);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IEnumerable<Gizmo> CompGetGizmosExtra()
|
||||||
|
{
|
||||||
|
if (Find.Selector.NumSelected > 1)
|
||||||
|
yield break;
|
||||||
|
|
||||||
|
yield return historyGizmo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue