mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
More of reusing objects in SexStatusViewModel
This commit is contained in:
parent
bed83e1eca
commit
ffe6a9b7f7
6 changed files with 212 additions and 209 deletions
|
@ -47,25 +47,5 @@ namespace RJWSexperience.SexHistory.UI
|
|||
_labelRight = "";
|
||||
Border = null;
|
||||
}
|
||||
|
||||
public BarInfo(string label, float fillPercent, Texture2D fillTexture, TipSignal tooltip, string labelRight = "", Texture2D border = null)
|
||||
{
|
||||
_label = label.CapitalizeFirst();
|
||||
_fillPercent = Mathf.Clamp01(fillPercent);
|
||||
FillTexture = fillTexture;
|
||||
Tooltip = tooltip;
|
||||
_labelRight = labelRight.CapitalizeFirst();
|
||||
Border = border;
|
||||
}
|
||||
|
||||
public BarInfo(string label, float fillPercent, Texture2D fillTexture, string labelRight = "")
|
||||
{
|
||||
_label = label.CapitalizeFirst();
|
||||
_fillPercent = Mathf.Clamp01(fillPercent);
|
||||
FillTexture = fillTexture;
|
||||
Tooltip = default;
|
||||
_labelRight = labelRight.CapitalizeFirst();
|
||||
Border = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,86 +1,93 @@
|
|||
using RimWorld;
|
||||
using rjw;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.SexHistory.UI
|
||||
{
|
||||
public readonly struct InfoCard
|
||||
public class InfoCard
|
||||
{
|
||||
public readonly SexPartnerHistoryRecord partnerRecord;
|
||||
public readonly string label;
|
||||
public readonly string lastSexTime;
|
||||
public readonly string name;
|
||||
public readonly string sexCount;
|
||||
public readonly string orgasms;
|
||||
public readonly string relations;
|
||||
public readonly BarInfo bestSextype;
|
||||
public readonly PartnerPortraitInfo portraitInfo;
|
||||
public readonly TipSignal tooltip;
|
||||
private readonly Pawn _pawn;
|
||||
private readonly string _tooltipLabel;
|
||||
|
||||
public InfoCard(Pawn pawn, SexPartnerHistoryRecord partnerRecord, string label, string tooltipLabel, int lastSexTimeTicks)
|
||||
public string Label { get; }
|
||||
public string LastSexTime { get; set; }
|
||||
public string Name { get; private set; }
|
||||
public string SexCount { get; private set; }
|
||||
public string Orgasms { get; private set; }
|
||||
public string Relations { get; private set; }
|
||||
public BarInfo BestSextype { get; }
|
||||
public SexPartnerHistoryRecord PartnerRecord { get; private set; }
|
||||
public PartnerPortraitInfo PortraitInfo { get; }
|
||||
public TipSignal Tooltip { get; private set; }
|
||||
|
||||
public InfoCard(Pawn pawn, string label, string tooltipLabel)
|
||||
{
|
||||
this.partnerRecord = partnerRecord;
|
||||
this.label = label;
|
||||
Label = label;
|
||||
_pawn = pawn;
|
||||
_tooltipLabel = tooltipLabel;
|
||||
BestSextype = new BarInfo();
|
||||
PortraitInfo = new PartnerPortraitInfo(_pawn);
|
||||
}
|
||||
|
||||
lastSexTime = UIUtility.GetSexDays(lastSexTimeTicks);
|
||||
portraitInfo = new PartnerPortraitInfo(pawn, partnerRecord);
|
||||
public void UpdatePartnerRecord(SexPartnerHistoryRecord partnerRecord)
|
||||
{
|
||||
PartnerRecord = partnerRecord;
|
||||
PortraitInfo.UpdatePartnerRecord(partnerRecord);
|
||||
|
||||
if (partnerRecord != null)
|
||||
if (partnerRecord == null)
|
||||
{
|
||||
name = partnerRecord.Partner?.Name?.ToStringFull ?? partnerRecord.Label.CapitalizeFirst();
|
||||
sexCount = Keyed.RS_Sex_Count + partnerRecord.TotalSexCount;
|
||||
Name = Keyed.Unknown;
|
||||
SexCount = Keyed.RS_Sex_Count + "?";
|
||||
Orgasms = Keyed.RS_Orgasms + "?";
|
||||
Relations = string.Empty;
|
||||
Tooltip = default;
|
||||
|
||||
if (partnerRecord.Raped > 0)
|
||||
{
|
||||
sexCount += " " + Keyed.RS_Raped + partnerRecord.Raped;
|
||||
}
|
||||
if (partnerRecord.RapedMe > 0)
|
||||
{
|
||||
sexCount += " " + Keyed.RS_RapedMe + partnerRecord.RapedMe;
|
||||
}
|
||||
|
||||
orgasms = Keyed.RS_Orgasms + partnerRecord.OrgasmCount;
|
||||
relations = pawn.GetRelationsString(partnerRecord.Partner);
|
||||
tooltip = new TipSignal(() =>
|
||||
{
|
||||
string completeTip = tooltipLabel;
|
||||
|
||||
if (partnerRecord.Incest)
|
||||
{
|
||||
completeTip += " - " + Keyed.Incest;
|
||||
}
|
||||
if (partnerRecord.IamFirst)
|
||||
{
|
||||
completeTip += "\n" + Keyed.RS_LostVirgin(partnerRecord.Label, pawn.LabelShort);
|
||||
}
|
||||
if (partnerRecord.BestSexTickAbs != 0)
|
||||
{
|
||||
completeTip += "\n" + Keyed.RS_HadBestSexDaysAgo(partnerRecord.BestSexElapsedTicks.ToStringTicksToDays() + " " + Keyed.RS_Ago);
|
||||
}
|
||||
return completeTip;
|
||||
}, tooltipLabel.GetHashCode());
|
||||
|
||||
float relativeBestSatisfaction = partnerRecord.BestSatisfaction / UIUtility.BASESAT;
|
||||
bestSextype = new BarInfo(
|
||||
label: Keyed.RS_Best_Sextype + ": " + Keyed.Sextype[(int)partnerRecord.BestSextype],
|
||||
fillPercent: relativeBestSatisfaction / 2,
|
||||
fillTexture: HistoryUtility.SextypeColor[(int)partnerRecord.BestSextype],
|
||||
labelRight: relativeBestSatisfaction.ToStringPercent());
|
||||
BestSextype.Label = Keyed.RS_Best_Sextype + ": " + Keyed.Sextype[(int)xxx.rjwSextype.None];
|
||||
BestSextype.FillPercent = 0f;
|
||||
BestSextype.FillTexture = Texture2D.linearGrayTexture;
|
||||
BestSextype.LabelRight = "";
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
Name = partnerRecord.Partner?.Name?.ToStringFull ?? partnerRecord.Label.CapitalizeFirst();
|
||||
SexCount = Keyed.RS_Sex_Count + partnerRecord.TotalSexCount;
|
||||
|
||||
if (partnerRecord.Raped > 0)
|
||||
{
|
||||
name = Keyed.Unknown;
|
||||
sexCount = Keyed.RS_Sex_Count + "?";
|
||||
orgasms = Keyed.RS_Orgasms + "?";
|
||||
relations = string.Empty;
|
||||
tooltip = default;
|
||||
bestSextype = new BarInfo(
|
||||
label: String.Format(Keyed.RS_Best_Sextype + ": {0}", Keyed.Sextype[(int)xxx.rjwSextype.None]),
|
||||
fillPercent: 0f,
|
||||
fillTexture: Texture2D.linearGrayTexture);
|
||||
SexCount += " " + Keyed.RS_Raped + partnerRecord.Raped;
|
||||
}
|
||||
if (partnerRecord.RapedMe > 0)
|
||||
{
|
||||
SexCount += " " + Keyed.RS_RapedMe + partnerRecord.RapedMe;
|
||||
}
|
||||
|
||||
Orgasms = Keyed.RS_Orgasms + partnerRecord.OrgasmCount;
|
||||
Relations = _pawn.GetRelationsString(partnerRecord.Partner);
|
||||
Tooltip = new TipSignal(() =>
|
||||
{
|
||||
string completeTip = _tooltipLabel;
|
||||
|
||||
if (partnerRecord.Incest)
|
||||
{
|
||||
completeTip += " - " + Keyed.Incest;
|
||||
}
|
||||
if (partnerRecord.IamFirst)
|
||||
{
|
||||
completeTip += "\n" + Keyed.RS_LostVirgin(partnerRecord.Label, _pawn.LabelShort);
|
||||
}
|
||||
if (partnerRecord.BestSexTickAbs != 0)
|
||||
{
|
||||
completeTip += "\n" + Keyed.RS_HadBestSexDaysAgo(partnerRecord.BestSexElapsedTicks.ToStringTicksToDays() + " " + Keyed.RS_Ago);
|
||||
}
|
||||
return completeTip;
|
||||
}, _tooltipLabel.GetHashCode());
|
||||
|
||||
float relativeBestSatisfaction = partnerRecord.BestSatisfaction / UIUtility.BASESAT;
|
||||
BestSextype.Label = Keyed.RS_Best_Sextype + ": " + Keyed.Sextype[(int)partnerRecord.BestSextype];
|
||||
BestSextype.FillPercent = relativeBestSatisfaction / 2;
|
||||
BestSextype.FillTexture = HistoryUtility.SextypeColor[(int)partnerRecord.BestSextype];
|
||||
BestSextype.LabelRight = relativeBestSatisfaction.ToStringPercent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,29 +5,43 @@ using Verse;
|
|||
|
||||
namespace RJWSexperience.SexHistory.UI
|
||||
{
|
||||
public readonly struct PartnerPortraitInfo
|
||||
public class PartnerPortraitInfo
|
||||
{
|
||||
public readonly SexPartnerHistoryRecord partnerRecord;
|
||||
public readonly bool lover;
|
||||
public readonly Func<Vector2, Texture> portraitGetter;
|
||||
private readonly Pawn _pawn;
|
||||
|
||||
public SexPartnerHistoryRecord PartnerRecord { get; private set; }
|
||||
public bool Lover { get; private set; }
|
||||
public Func<Vector2, Texture> PortraitGetter { get; private set; }
|
||||
|
||||
public PartnerPortraitInfo(Pawn pawn)
|
||||
{
|
||||
_pawn = pawn;
|
||||
}
|
||||
|
||||
public PartnerPortraitInfo(Pawn pawn, SexPartnerHistoryRecord partnerRecord)
|
||||
{
|
||||
this.partnerRecord = partnerRecord;
|
||||
lover = false;
|
||||
_pawn = pawn;
|
||||
UpdatePartnerRecord(partnerRecord);
|
||||
}
|
||||
|
||||
public void UpdatePartnerRecord(SexPartnerHistoryRecord partnerRecord)
|
||||
{
|
||||
PartnerRecord = partnerRecord;
|
||||
|
||||
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);
|
||||
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;
|
||||
PortraitGetter = (_) => partnerRecord.Race.uiIcon;
|
||||
Lover = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
portraitGetter = (_) => HistoryUtility.UnknownPawn;
|
||||
PortraitGetter = (_) => HistoryUtility.UnknownPawn;
|
||||
Lover = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,53 +3,58 @@ using UnityEngine;
|
|||
|
||||
namespace RJWSexperience.SexHistory.UI
|
||||
{
|
||||
public readonly struct PreferedRaceCard
|
||||
public class PreferedRaceCard
|
||||
{
|
||||
public readonly string preferRaceLabel;
|
||||
public readonly string preferRaceTypeLabel;
|
||||
public readonly string sexCount;
|
||||
public readonly BarInfo barInfo;
|
||||
public readonly Func<Vector2, Texture> portraitGetter;
|
||||
private readonly SexHistoryComp _sexHistory;
|
||||
|
||||
public string PreferRaceLabel { get; private set; }
|
||||
public string PreferRaceTypeLabel { get; private set; }
|
||||
public string SexCount { get; private set; }
|
||||
public BarInfo BarInfo { get; } = new BarInfo(Texture2D.linearGrayTexture);
|
||||
public Func<Vector2, Texture> PortraitGetter { get; private set; }
|
||||
|
||||
public PreferedRaceCard(SexHistoryComp sexHistory)
|
||||
{
|
||||
if (sexHistory.PreferRace == null)
|
||||
_sexHistory = sexHistory;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (_sexHistory.PreferRace == null)
|
||||
{
|
||||
preferRaceLabel = Keyed.None;
|
||||
preferRaceTypeLabel = null;
|
||||
sexCount = null;
|
||||
barInfo = null;
|
||||
portraitGetter = (_) => HistoryUtility.UnknownPawn;
|
||||
PreferRaceLabel = Keyed.None;
|
||||
PreferRaceTypeLabel = null;
|
||||
SexCount = null;
|
||||
BarInfo.Label = null;
|
||||
BarInfo.FillPercent = 0f;
|
||||
PortraitGetter = (_) => HistoryUtility.UnknownPawn;
|
||||
return;
|
||||
}
|
||||
|
||||
preferRaceLabel = sexHistory.PreferRace.LabelCap;
|
||||
sexCount = Keyed.RS_Sex_Count + sexHistory.PreferRaceSexCount;
|
||||
portraitGetter = (size) => UIUtility.GetRaceIcon(sexHistory.PreferRacePawn, size);
|
||||
PreferRaceLabel = _sexHistory.PreferRace.LabelCap;
|
||||
SexCount = Keyed.RS_Sex_Count + _sexHistory.PreferRaceSexCount;
|
||||
PortraitGetter = (size) => UIUtility.GetRaceIcon(_sexHistory.PreferRacePawn, size);
|
||||
|
||||
if (sexHistory.PreferRace != sexHistory.ParentPawn.def)
|
||||
if (_sexHistory.PreferRace != _sexHistory.ParentPawn.def)
|
||||
{
|
||||
if (sexHistory.PreferRace.race.Animal != sexHistory.ParentPawn.def.race.Animal)
|
||||
if (_sexHistory.PreferRace.race.Animal != _sexHistory.ParentPawn.def.race.Animal)
|
||||
{
|
||||
preferRaceTypeLabel = Keyed.RS_Bestiality;
|
||||
barInfo = new BarInfo(
|
||||
label: Keyed.RS_SexInfo(Keyed.RS_Bestiality, sexHistory.BestialityCount),
|
||||
fillPercent: sexHistory.BestialityCount / 100f,
|
||||
fillTexture: Texture2D.linearGrayTexture);
|
||||
PreferRaceTypeLabel = Keyed.RS_Bestiality;
|
||||
BarInfo.Label = Keyed.RS_SexInfo(Keyed.RS_Bestiality, _sexHistory.BestialityCount);
|
||||
BarInfo.FillPercent = _sexHistory.BestialityCount / 100f;
|
||||
}
|
||||
else
|
||||
{
|
||||
preferRaceTypeLabel = Keyed.RS_Interspecies;
|
||||
barInfo = new BarInfo(
|
||||
label: Keyed.RS_SexInfo(Keyed.RS_Interspecies, sexHistory.InterspeciesCount),
|
||||
fillPercent: sexHistory.InterspeciesCount / 100f,
|
||||
fillTexture: Texture2D.linearGrayTexture);
|
||||
PreferRaceTypeLabel = Keyed.RS_Interspecies;
|
||||
BarInfo.Label = Keyed.RS_SexInfo(Keyed.RS_Interspecies, _sexHistory.InterspeciesCount);
|
||||
BarInfo.FillPercent = _sexHistory.InterspeciesCount / 100f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
preferRaceTypeLabel = null;
|
||||
barInfo = null;
|
||||
PreferRaceTypeLabel = null;
|
||||
BarInfo.Label = null;
|
||||
BarInfo.FillPercent = 0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,15 +48,31 @@ namespace RJWSexperience.SexHistory.UI
|
|||
{
|
||||
AgeAndTitle = Pawn.ageTracker.AgeBiologicalYears + ", " + Pawn.def.label;
|
||||
}
|
||||
|
||||
for (int i = 0; i < Sextype.Length; i++)
|
||||
{
|
||||
int sexIndex = Sextype[i];
|
||||
SexTypes.Add(new BarInfo(HistoryUtility.SextypeColor[sexIndex]));
|
||||
}
|
||||
|
||||
InfoCards.Add(new InfoCard(Pawn, Keyed.RS_Recent_Sex_Partner, Keyed.RS_Recent_Sex_Partner_ToolTip));
|
||||
InfoCards.Add(new InfoCard(Pawn, Keyed.RS_First_Sex_Partner, Keyed.RS_First_Sex_Partner_ToolTip));
|
||||
InfoCards.Add(new InfoCard(Pawn, Keyed.RS_Most_Sex_Partner, Keyed.RS_Most_Sex_Partner_ToolTip));
|
||||
InfoCards.Add(new InfoCard(Pawn, Keyed.RS_Best_Sex_Partner, Keyed.RS_Best_Sex_Partner_ToolTip));
|
||||
|
||||
SelectedPartnerCard = new InfoCard(Pawn, Keyed.RS_Selected_Partner, Keyed.RS_Selected_Partner);
|
||||
PreferedRaceCard = new PreferedRaceCard(_history);
|
||||
}
|
||||
|
||||
public Pawn Pawn => _history.ParentPawn;
|
||||
public string Name { get; }
|
||||
public string AgeAndTitle { get; }
|
||||
public List<InfoCard> InfoCards { get; } = new List<InfoCard>();
|
||||
public InfoCard SelectedPartnerCard { get; private set; }
|
||||
public PreferedRaceCard PreferedRaceCard { get; private set; }
|
||||
public InfoCard SelectedPartnerCard { get; }
|
||||
public PreferedRaceCard PreferedRaceCard { get; }
|
||||
public List<BarInfo> SexTypes { get; } = new List<BarInfo>();
|
||||
public BarInfo PartnerCount { get; } = new BarInfo(HistoryUtility.Partners);
|
||||
public BarInfo VirginsTaken { get; } = new BarInfo(HistoryUtility.Partners);
|
||||
public BarInfo TotalSex { get; } = new BarInfo(HistoryUtility.TotalSex);
|
||||
public BarInfo Lust { get; } = new BarInfo(HistoryUtility.Slaanesh);
|
||||
public BarInfo BestSextype { get; } = new BarInfo();
|
||||
|
@ -87,7 +103,7 @@ namespace RJWSexperience.SexHistory.UI
|
|||
UpdateBars();
|
||||
UpdateQuirks();
|
||||
UpdateVirginAndSexuality();
|
||||
PreferedRaceCard = new PreferedRaceCard(_history);
|
||||
PreferedRaceCard.Update();
|
||||
|
||||
int tickRateMultiplier = (int)Find.TickManager.TickRateMultiplier;
|
||||
if (tickRateMultiplier == 0) // Paused
|
||||
|
@ -101,35 +117,21 @@ namespace RJWSexperience.SexHistory.UI
|
|||
|
||||
private void UpdateInfoCards()
|
||||
{
|
||||
InfoCards.Clear();
|
||||
InfoCard recentSexPartner = InfoCards[0];
|
||||
recentSexPartner.LastSexTime = UIUtility.GetSexDays(_history.RecentSexTickAbs);
|
||||
recentSexPartner.UpdatePartnerRecord(_history.RecentPartnerRecord);
|
||||
|
||||
InfoCards.Add(new InfoCard(
|
||||
pawn: Pawn,
|
||||
partnerRecord: _history.RecentPartnerRecord,
|
||||
label: Keyed.RS_Recent_Sex_Partner,
|
||||
tooltipLabel: Keyed.RS_Recent_Sex_Partner_ToolTip,
|
||||
lastSexTimeTicks: _history.RecentSexTickAbs));
|
||||
InfoCard firstSexPartner = InfoCards[1];
|
||||
firstSexPartner.LastSexTime = UIUtility.GetSexDays(_history.FirstSexTickAbs);
|
||||
firstSexPartner.UpdatePartnerRecord(_history.FirstPartnerRecord);
|
||||
|
||||
InfoCards.Add(new InfoCard(
|
||||
pawn: Pawn,
|
||||
partnerRecord: _history.FirstPartnerRecord,
|
||||
label: Keyed.RS_First_Sex_Partner,
|
||||
tooltipLabel: Keyed.RS_First_Sex_Partner_ToolTip,
|
||||
lastSexTimeTicks: _history.FirstSexTickAbs));
|
||||
InfoCard mostSexPartner = InfoCards[2];
|
||||
mostSexPartner.LastSexTime = UIUtility.GetSexDays(_history.MostSexTickAbs);
|
||||
mostSexPartner.UpdatePartnerRecord(_history.MostPartnerRecord);
|
||||
|
||||
InfoCards.Add(new InfoCard(
|
||||
pawn: Pawn,
|
||||
partnerRecord: _history.MostPartnerRecord,
|
||||
label: Keyed.RS_Most_Sex_Partner,
|
||||
tooltipLabel: Keyed.RS_Most_Sex_Partner_ToolTip,
|
||||
lastSexTimeTicks: _history.MostSexTickAbs));
|
||||
|
||||
InfoCards.Add(new InfoCard(
|
||||
pawn: Pawn,
|
||||
partnerRecord: _history.BestSexPartnerRecord,
|
||||
label: Keyed.RS_Best_Sex_Partner,
|
||||
tooltipLabel: Keyed.RS_Best_Sex_Partner_ToolTip,
|
||||
lastSexTimeTicks: _history.BestSexTickAbs));
|
||||
InfoCard bestSexPartner = InfoCards[3];
|
||||
bestSexPartner.LastSexTime = UIUtility.GetSexDays(_history.BestSexTickAbs);
|
||||
bestSexPartner.UpdatePartnerRecord(_history.BestSexPartnerRecord);
|
||||
|
||||
if (SelectedPartner != null)
|
||||
{
|
||||
|
@ -145,34 +147,28 @@ namespace RJWSexperience.SexHistory.UI
|
|||
maxSatisfaction = UIUtility.BASESAT;
|
||||
}
|
||||
|
||||
SexTypes.Clear();
|
||||
|
||||
for (int i = 0; i < Sextype.Length; i++)
|
||||
{
|
||||
int sexIndex = Sextype[i];
|
||||
float AverageSatisfaction = _history.GetAVGSat(sexIndex);
|
||||
float relativeSat = AverageSatisfaction / maxSatisfaction;
|
||||
float satisfactionRelativeToBase = AverageSatisfaction / UIUtility.BASESAT;
|
||||
SexTypes.Add(new BarInfo(
|
||||
label: Keyed.RS_SexInfo(Keyed.Sextype[sexIndex], _history.GetSexCount(sexIndex)),
|
||||
fillPercent: relativeSat,
|
||||
fillTexture: HistoryUtility.SextypeColor[sexIndex],
|
||||
tooltip: Keyed.RS_LastSex + ": " + UIUtility.GetSexDays(_history.GetSextypeRecentTickAbs(sexIndex), true),
|
||||
labelRight: Keyed.RS_SatAVG(satisfactionRelativeToBase)));
|
||||
|
||||
BarInfo sexTypeBar = SexTypes[i];
|
||||
sexTypeBar.Label = Keyed.RS_SexInfo(Keyed.Sextype[sexIndex], _history.GetSexCount(sexIndex));
|
||||
sexTypeBar.FillPercent = relativeSat;
|
||||
sexTypeBar.Tooltip = Keyed.RS_LastSex + ": " + UIUtility.GetSexDays(_history.GetSextypeRecentTickAbs(sexIndex), true);
|
||||
sexTypeBar.LabelRight = Keyed.RS_SatAVG(satisfactionRelativeToBase);
|
||||
}
|
||||
|
||||
SexTypes.Add(new BarInfo(
|
||||
label: string.Format(Keyed.RS_Sex_Partners + ": {0} ({1})", _history.PartnerCount, Pawn.records.GetValue(RsDefOf.Record.SexPartnerCount)),
|
||||
fillPercent: _history.PartnerCount / 50,
|
||||
fillTexture: HistoryUtility.Partners));
|
||||
PartnerCount.Label = string.Format(Keyed.RS_Sex_Partners + ": {0} ({1})", _history.PartnerCount, Pawn.records.GetValue(RsDefOf.Record.SexPartnerCount));
|
||||
PartnerCount.FillPercent = _history.PartnerCount / 50f;
|
||||
|
||||
SexTypes.Add(new BarInfo(
|
||||
label: string.Format(Keyed.RS_VirginsTaken + ": {0:0}", _history.VirginsTaken),
|
||||
fillPercent: _history.VirginsTaken / 100,
|
||||
fillTexture: HistoryUtility.Partners));
|
||||
VirginsTaken.Label = string.Format(Keyed.RS_VirginsTaken + ": {0:0}", _history.VirginsTaken);
|
||||
VirginsTaken.FillPercent = _history.VirginsTaken / 100f;
|
||||
|
||||
TotalSex.Label = string.Format(Keyed.RS_TotalSexHad + ": {0:0} ({1:0})", _history.TotalSexHad, Pawn.records.GetValue(xxx.CountOfSex));
|
||||
TotalSex.FillPercent = _history.TotalSexHad / 100;
|
||||
TotalSex.FillPercent = _history.TotalSexHad / 100f;
|
||||
TotalSex.LabelRight = Keyed.RS_SatAVG(_history.AVGSat);
|
||||
|
||||
float lust = Pawn.records.GetValue(RsDefOf.Record.Lust);
|
||||
|
@ -308,13 +304,13 @@ namespace RJWSexperience.SexHistory.UI
|
|||
Partners = partners;
|
||||
break;
|
||||
case PartnerOrderMode.Recent:
|
||||
Partners = partners.OrderBy(x => x.partnerRecord.RecentSexTickAbs);
|
||||
Partners = partners.OrderBy(x => x.PartnerRecord.RecentSexTickAbs);
|
||||
break;
|
||||
case PartnerOrderMode.Most:
|
||||
Partners = partners.OrderBy(x => x.partnerRecord.TotalSexCount);
|
||||
Partners = partners.OrderBy(x => x.PartnerRecord.TotalSexCount);
|
||||
break;
|
||||
case PartnerOrderMode.Name:
|
||||
Partners = partners.OrderBy(x => x.partnerRecord.Label);
|
||||
Partners = partners.OrderBy(x => x.PartnerRecord.Label);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -327,18 +323,16 @@ namespace RJWSexperience.SexHistory.UI
|
|||
|
||||
private void UpdateSelectedPartnerCard()
|
||||
{
|
||||
SelectedPartnerCard.UpdatePartnerRecord(SelectedPartner);
|
||||
|
||||
if (SelectedPartner == null)
|
||||
{
|
||||
SelectedPartnerCard = default;
|
||||
return;
|
||||
SelectedPartnerCard.LastSexTime = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
SelectedPartnerCard.LastSexTime = UIUtility.GetSexDays(SelectedPartner.RecentSexTickAbs);
|
||||
}
|
||||
|
||||
SelectedPartnerCard = new InfoCard(
|
||||
pawn: Pawn,
|
||||
partnerRecord: SelectedPartner,
|
||||
label: Keyed.RS_Selected_Partner,
|
||||
tooltipLabel: Keyed.RS_Selected_Partner,
|
||||
lastSexTimeTicks: SelectedPartner.RecentSexTickAbs);
|
||||
}
|
||||
|
||||
private float GetStatValue(StatDef statDef) => Pawn.Dead ? 0f : Pawn.GetStatValue(statDef);
|
||||
|
|
|
@ -161,13 +161,13 @@ namespace RJWSexperience.SexHistory.UI
|
|||
Rect sexinfoRect2 = new Rect(rect.x + portraitRect.width, rect.y + (FONTHEIGHT * 2), rect.width - portraitRect.width, FONTHEIGHT);
|
||||
Rect bestsexRect = new Rect(rect.x + 2f, rect.y + (FONTHEIGHT * 3), rect.width - 4f, FONTHEIGHT - 2f);
|
||||
|
||||
if (context.partnerRecord != null)
|
||||
if (context.PartnerRecord != null)
|
||||
{
|
||||
DrawPartnerPortrait(portraitRect, context.portraitInfo);
|
||||
DrawPartnerPortrait(portraitRect, context.PortraitInfo);
|
||||
Widgets.DrawHighlightIfMouseover(portraitRect);
|
||||
if (Widgets.ButtonInvisible(portraitRect))
|
||||
{
|
||||
SexHistoryComp partnerHistory = context.partnerRecord.Partner?.TryGetComp<SexHistoryComp>();
|
||||
SexHistoryComp partnerHistory = context.PartnerRecord.Partner?.TryGetComp<SexHistoryComp>();
|
||||
if (partnerHistory != null)
|
||||
{
|
||||
ChangePawn(partnerHistory);
|
||||
|
@ -179,24 +179,24 @@ namespace RJWSexperience.SexHistory.UI
|
|||
}
|
||||
}
|
||||
|
||||
GUI.Label(sexinfoRect2, context.relations + " ", fontStyleRight);
|
||||
TooltipHandler.TipRegion(rect, context.tooltip);
|
||||
GUI.Label(sexinfoRect2, context.Relations + " ", fontStyleRight);
|
||||
TooltipHandler.TipRegion(rect, context.Tooltip);
|
||||
}
|
||||
else
|
||||
{
|
||||
Widgets.DrawTextureFitted(portraitRect, HistoryUtility.UnknownPawn, 1.0f);
|
||||
}
|
||||
Widgets.Label(nameRect, context.name);
|
||||
Widgets.Label(sexinfoRect, context.sexCount);
|
||||
Widgets.Label(sexinfoRect2, context.orgasms);
|
||||
UIUtility.FillableBarLabeled(bestsexRect, context.bestSextype);
|
||||
Widgets.Label(nameRect, context.Name);
|
||||
Widgets.Label(sexinfoRect, context.SexCount);
|
||||
Widgets.Label(sexinfoRect2, context.Orgasms);
|
||||
UIUtility.FillableBarLabeled(bestsexRect, context.BestSextype);
|
||||
}
|
||||
|
||||
protected void DrawSexInfoCard(Rect rect, InfoCard context)
|
||||
{
|
||||
rect.SplitHorizontally(FONTHEIGHT, out Rect labelRect, out Rect infoRect);
|
||||
GUI.Label(labelRect, context.label, fontStyleLeft);
|
||||
GUI.Label(labelRect, context.lastSexTime, fontStyleRight);
|
||||
GUI.Label(labelRect, context.Label, fontStyleLeft);
|
||||
GUI.Label(labelRect, context.LastSexTime, fontStyleRight);
|
||||
DrawInfoWithPortrait(infoRect, context);
|
||||
}
|
||||
|
||||
|
@ -225,22 +225,22 @@ namespace RJWSexperience.SexHistory.UI
|
|||
Rect infoRect2 = new Rect(infoRect.x, infoRect.y + FONTHEIGHT, infoRect.width, FONTHEIGHT);
|
||||
Rect infoRect3 = new Rect(infoRect.x, infoRect.y + (FONTHEIGHT * 2), infoRect.width - 2f, FONTHEIGHT);
|
||||
|
||||
Widgets.DrawTextureFitted(portraitRect, preferedRaceCard.portraitGetter(portraitRect.size), 1.0f);
|
||||
GUI.Label(infoRect1, preferedRaceCard.preferRaceLabel, fontStyleLeft);
|
||||
Widgets.DrawTextureFitted(portraitRect, preferedRaceCard.PortraitGetter(portraitRect.size), 1.0f);
|
||||
GUI.Label(infoRect1, preferedRaceCard.PreferRaceLabel, fontStyleLeft);
|
||||
|
||||
if (preferedRaceCard.preferRaceTypeLabel != null)
|
||||
if (preferedRaceCard.PreferRaceTypeLabel != null)
|
||||
{
|
||||
GUI.Label(infoRect1, preferedRaceCard.preferRaceTypeLabel + " ", fontStyleRight);
|
||||
GUI.Label(infoRect1, preferedRaceCard.PreferRaceTypeLabel + " ", fontStyleRight);
|
||||
}
|
||||
|
||||
if (preferedRaceCard.sexCount != null)
|
||||
if (preferedRaceCard.SexCount != null)
|
||||
{
|
||||
GUI.Label(infoRect2, preferedRaceCard.sexCount, fontStyleLeft);
|
||||
GUI.Label(infoRect2, preferedRaceCard.SexCount, fontStyleLeft);
|
||||
}
|
||||
|
||||
if (preferedRaceCard.barInfo != null)
|
||||
if (preferedRaceCard.BarInfo.Label != null)
|
||||
{
|
||||
UIUtility.FillableBarLabeled(infoRect3, preferedRaceCard.barInfo);
|
||||
UIUtility.FillableBarLabeled(infoRect3, preferedRaceCard.BarInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -390,6 +390,9 @@ namespace RJWSexperience.SexHistory.UI
|
|||
listmain.FillableBarLabeled(_context.SexTypes[i]);
|
||||
}
|
||||
|
||||
listmain.FillableBarLabeled(_context.PartnerCount);
|
||||
listmain.FillableBarLabeled(_context.VirginsTaken);
|
||||
|
||||
//Partner list
|
||||
Rect listLabelRect = listmain.GetRect(FONTHEIGHT);
|
||||
Rect sortbtnRect = new Rect(listLabelRect.xMax - 80f, listLabelRect.y, 80f, listLabelRect.height);
|
||||
|
@ -429,13 +432,13 @@ namespace RJWSexperience.SexHistory.UI
|
|||
|
||||
DrawPartnerPortrait(pawnRect, partner);
|
||||
Widgets.DrawHighlightIfMouseover(pawnRect);
|
||||
GUI.Label(labelRect, partner.partnerRecord.Label, fontStyleCenter);
|
||||
GUI.Label(labelRect, partner.PartnerRecord.Label, fontStyleCenter);
|
||||
if (Widgets.ButtonInvisible(pawnRect))
|
||||
{
|
||||
_context.SetSelectedPartner(partner.partnerRecord);
|
||||
_context.SetSelectedPartner(partner.PartnerRecord);
|
||||
SoundDefOf.Click.PlayOneShotOnCamera();
|
||||
}
|
||||
if (partner.partnerRecord == _context.SelectedPartner)
|
||||
if (partner.PartnerRecord == _context.SelectedPartner)
|
||||
{
|
||||
Widgets.DrawHighlightSelected(pawnRect);
|
||||
}
|
||||
|
@ -447,22 +450,22 @@ namespace RJWSexperience.SexHistory.UI
|
|||
protected void DrawPartnerPortrait(Rect rect, PartnerPortraitInfo context)
|
||||
{
|
||||
Rect iconRect = new Rect(rect.x + (rect.width * 3 / 4), rect.y, rect.width / 4, rect.height / 4);
|
||||
Texture img = context.portraitGetter(rect.size);
|
||||
Texture img = context.PortraitGetter(rect.size);
|
||||
|
||||
if (context.partnerRecord.IamFirst)
|
||||
if (context.PartnerRecord.IamFirst)
|
||||
{
|
||||
GUI.color = HistoryUtility.HistoryColor;
|
||||
Widgets.DrawTextureFitted(rect, HistoryUtility.FirstOverlay, 1.0f);
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
|
||||
if (context.partnerRecord.Incest)
|
||||
if (context.PartnerRecord.Incest)
|
||||
{
|
||||
Widgets.DrawTextureFitted(iconRect, HistoryUtility.Incest, 1.0f);
|
||||
iconRect.x -= iconRect.width;
|
||||
}
|
||||
Widgets.DrawTextureFitted(rect, img, 1.0f);
|
||||
if (context.lover)
|
||||
if (context.Lover)
|
||||
{
|
||||
Widgets.DrawTextureFitted(iconRect, HistoryUtility.Heart, 1.0f);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue