mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
Hide history Gizmo when several pawns selected
This commit is contained in:
parent
7ebc0e4878
commit
503fbae7e7
1 changed files with 34 additions and 44 deletions
|
@ -1,57 +1,47 @@
|
||||||
using System;
|
using HarmonyLib;
|
||||||
|
using RJWSexperience.UI;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using RimWorld;
|
|
||||||
using Verse;
|
using Verse;
|
||||||
using HarmonyLib;
|
|
||||||
using rjw;
|
|
||||||
using RJWSexperience.UI;
|
|
||||||
|
|
||||||
namespace RJWSexperience
|
namespace RJWSexperience
|
||||||
{
|
{
|
||||||
[HarmonyPatch(typeof(Pawn),"GetGizmos")]
|
[HarmonyPatch(typeof(Pawn), "GetGizmos")]
|
||||||
public class Pawn_GetGizmos
|
public class Pawn_GetGizmos
|
||||||
{
|
{
|
||||||
public static void Postfix(ref IEnumerable<Gizmo> __result, Pawn __instance)
|
public static void Postfix(ref IEnumerable<Gizmo> __result, Pawn __instance)
|
||||||
{
|
{
|
||||||
|
if (Find.Selector.NumSelected > 1)
|
||||||
|
return;
|
||||||
|
|
||||||
List<Gizmo> gizmoList = __result.ToList();
|
List<Gizmo> gizmoList = __result.ToList();
|
||||||
|
|
||||||
AddHistoryGizmo(__instance, ref gizmoList);
|
AddHistoryGizmo(__instance, ref gizmoList);
|
||||||
|
|
||||||
|
__result = gizmoList;
|
||||||
|
}
|
||||||
|
|
||||||
__result = gizmoList;
|
private static void AddHistoryGizmo(Pawn pawn, ref List<Gizmo> gizmos)
|
||||||
}
|
{
|
||||||
|
SexPartnerHistory history = pawn.GetPartnerHistory();
|
||||||
private static void AddHistoryGizmo(Pawn pawn, ref List<Gizmo> gizmos)
|
if (history != null) gizmos.Add(CreateHIstoryGizmo(pawn, history));
|
||||||
{
|
}
|
||||||
SexPartnerHistory history = pawn.GetPartnerHistory();
|
|
||||||
if (history != null) gizmos.Add(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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue