mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
Refactored/optimized SexStatusWindow
This commit is contained in:
parent
e9ca084680
commit
cdc79acfa3
16 changed files with 1178 additions and 797 deletions
34
Source/RJWSexperience/SexHistory/UI/PartnerPortraitInfo.cs
Normal file
34
Source/RJWSexperience/SexHistory/UI/PartnerPortraitInfo.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using RimWorld;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.SexHistory.UI
|
||||
{
|
||||
public readonly struct PartnerPortraitInfo
|
||||
{
|
||||
public readonly SexPartnerHistoryRecord partnerRecord;
|
||||
public readonly bool lover;
|
||||
public readonly Func<Vector2, Texture> portraitGetter;
|
||||
|
||||
public PartnerPortraitInfo(Pawn pawn, SexPartnerHistoryRecord partnerRecord)
|
||||
{
|
||||
this.partnerRecord = partnerRecord;
|
||||
lover = false;
|
||||
|
||||
if (partnerRecord?.Partner != null)
|
||||
{
|
||||
portraitGetter = (size) => PortraitsCache.Get(partnerRecord.Partner, size, Rot4.South, default, 1, true, true, false, false);
|
||||
lover = LovePartnerRelationUtility.LovePartnerRelationExists(pawn, partnerRecord.Partner);
|
||||
}
|
||||
else if (partnerRecord?.Race?.uiIcon != null)
|
||||
{
|
||||
portraitGetter = (_) => partnerRecord.Race.uiIcon;
|
||||
}
|
||||
else
|
||||
{
|
||||
portraitGetter = (_) => HistoryUtility.UnknownPawn;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue