mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
Cleanup SexStatusWindow code
This commit is contained in:
parent
89439d1f32
commit
8f881a21e1
1 changed files with 624 additions and 658 deletions
|
@ -1,14 +1,11 @@
|
|||
using System;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
using Verse.Sound;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using RJWSexperience.ExtensionMethods;
|
||||
|
||||
namespace RJWSexperience.UI
|
||||
{
|
||||
|
@ -17,26 +14,27 @@ namespace RJWSexperience.UI
|
|||
Normal = 0,
|
||||
Recent = 1,
|
||||
Most = 2,
|
||||
Name, Maxvlaue = 3
|
||||
Name, MaxValue = 3
|
||||
};
|
||||
|
||||
public static class PartnerOrderModeExtension
|
||||
{
|
||||
public static PartnerOrderMode Next(this PartnerOrderMode mode)
|
||||
{
|
||||
return (PartnerOrderMode)(((int)mode + 1) % ((int)PartnerOrderMode.Maxvlaue+1));
|
||||
return (PartnerOrderMode)(((int)mode + 1) % ((int)PartnerOrderMode.MaxValue + 1));
|
||||
}
|
||||
}
|
||||
|
||||
public class SexStatusWindow : Window
|
||||
{
|
||||
public const float WINDOW_WIDTH = 900f;
|
||||
public const float WINDOW_HEIGHT = 600f;
|
||||
public const float FONTHEIGHT = RJWUIUtility.FONTHEIGHT;
|
||||
public const float CARDHEIGHT = RJWUIUtility.CARDHEIGHT;
|
||||
public const float LISTPAWNSIZE = RJWUIUtility.LISTPAWNSIZE;
|
||||
public const float BASESAT = RJWUIUtility.BASESAT;
|
||||
public const float ICONSIZE = RJWUIUtility.ICONSIZE;
|
||||
|
||||
|
||||
public static readonly int[] Sextype =
|
||||
{
|
||||
(int)xxx.rjwSextype.Vaginal,
|
||||
|
@ -56,7 +54,6 @@ namespace RJWSexperience.UI
|
|||
(int)xxx.rjwSextype.Sixtynine
|
||||
};
|
||||
|
||||
|
||||
protected Pawn pawn;
|
||||
protected SexPartnerHistoryRecord selectedPawn;
|
||||
protected SexPartnerHistory history;
|
||||
|
@ -64,18 +61,17 @@ namespace RJWSexperience.UI
|
|||
protected List<SexPartnerHistoryRecord> partnerList;
|
||||
protected PartnerOrderMode orderMode;
|
||||
|
||||
private static GUIStyleState fontstylestate = new GUIStyleState() { textColor = Color.white };
|
||||
private static GUIStyleState boxstylestate = GUI.skin.textArea.normal;
|
||||
private static GUIStyleState buttonstylestate = GUI.skin.button.normal;
|
||||
private static GUIStyle fontstylecenter = new GUIStyle() { alignment = TextAnchor.MiddleCenter, normal = fontstylestate };
|
||||
private static GUIStyle fontstyleright = new GUIStyle() { alignment = TextAnchor.MiddleRight, normal = fontstylestate };
|
||||
private static GUIStyle fontstyleleft = new GUIStyle() { alignment = TextAnchor.MiddleLeft, normal = fontstylestate };
|
||||
private static GUIStyle boxstyle = new GUIStyle(GUI.skin.textArea) { hover = boxstylestate, onHover = boxstylestate, onNormal = boxstylestate };
|
||||
private static GUIStyle buttonstyle = new GUIStyle(GUI.skin.button) { hover = buttonstylestate, onHover = buttonstylestate, onNormal = buttonstylestate };
|
||||
private static readonly GUIStyleState fontstylestate = new GUIStyleState() { textColor = Color.white };
|
||||
private static readonly GUIStyleState boxstylestate = GUI.skin.textArea.normal;
|
||||
private static readonly GUIStyleState buttonstylestate = GUI.skin.button.normal;
|
||||
private static readonly GUIStyle fontstylecenter = new GUIStyle() { alignment = TextAnchor.MiddleCenter, normal = fontstylestate };
|
||||
private static readonly GUIStyle fontstyleright = new GUIStyle() { alignment = TextAnchor.MiddleRight, normal = fontstylestate };
|
||||
private static readonly GUIStyle fontstyleleft = new GUIStyle() { alignment = TextAnchor.MiddleLeft, normal = fontstylestate };
|
||||
private static readonly GUIStyle boxstyle = new GUIStyle(GUI.skin.textArea) { hover = boxstylestate, onHover = boxstylestate, onNormal = boxstylestate };
|
||||
private static readonly GUIStyle buttonstyle = new GUIStyle(GUI.skin.button) { hover = buttonstylestate, onHover = buttonstylestate, onNormal = buttonstylestate };
|
||||
|
||||
private static Vector2 pos;
|
||||
private static Vector2 scroll;
|
||||
private static bool opened;
|
||||
private static Vector2 LastWindowPosition { get; set; }
|
||||
private Vector2 scroll;
|
||||
|
||||
public SexStatusWindow(Pawn pawn, SexPartnerHistory history)
|
||||
{
|
||||
|
@ -86,44 +82,36 @@ namespace RJWSexperience.UI
|
|||
this.partnerList = history?.PartnerList;
|
||||
orderMode = PartnerOrderMode.Recent;
|
||||
SortPartnerList(orderMode);
|
||||
}
|
||||
|
||||
protected override void SetInitialSizeAndPosition()
|
||||
{
|
||||
Vector2 initialSize = InitialSize;
|
||||
if (!opened)
|
||||
{
|
||||
windowRect = new Rect((Verse.UI.screenWidth - initialSize.x) / 2f, ((float)Verse.UI.screenHeight - initialSize.y) / 2f, initialSize.x, initialSize.y);
|
||||
opened = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
windowRect = new Rect(pos, initialSize);
|
||||
}
|
||||
windowRect = windowRect.Rounded();
|
||||
|
||||
}
|
||||
|
||||
public override Vector2 InitialSize
|
||||
{
|
||||
get
|
||||
{
|
||||
float width = 900f;
|
||||
float height = 600f;
|
||||
soundClose = SoundDefOf.CommsWindow_Close;
|
||||
absorbInputAroundWindow = false;
|
||||
forcePause = false;
|
||||
preventCameraMotion = false;
|
||||
draggable = true;
|
||||
doCloseX = true;
|
||||
return new Vector2(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SetInitialSizeAndPosition()
|
||||
{
|
||||
base.SetInitialSizeAndPosition();
|
||||
|
||||
if (LastWindowPosition == Vector2.zero)
|
||||
return;
|
||||
|
||||
windowRect.x = LastWindowPosition.x;
|
||||
windowRect.y = LastWindowPosition.y;
|
||||
}
|
||||
|
||||
public override Vector2 InitialSize => new Vector2(WINDOW_WIDTH, WINDOW_HEIGHT);
|
||||
|
||||
public override void PreClose()
|
||||
{
|
||||
base.PreClose();
|
||||
LastWindowPosition = windowRect.position;
|
||||
}
|
||||
|
||||
public override void DoWindowContents(Rect inRect)
|
||||
{
|
||||
pos = windowRect.position;
|
||||
if (!SexperienceMod.Settings.SelectionLocked)
|
||||
{
|
||||
List<Pawn> selected = Find.Selector.SelectedPawns;
|
||||
|
@ -138,8 +126,7 @@ namespace RJWSexperience.UI
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
DrawSexStatus(inRect,history);
|
||||
DrawSexStatus(inRect, history);
|
||||
}
|
||||
|
||||
public static void ToggleWindow(Pawn pawn, SexPartnerHistory history)
|
||||
|
@ -162,10 +149,14 @@ namespace RJWSexperience.UI
|
|||
public void ChangePawn(Pawn pawn, SexPartnerHistory history)
|
||||
{
|
||||
List<Pawn> selected = Find.Selector.SelectedPawns;
|
||||
if (!selected.NullOrEmpty()) foreach(Pawn p in selected)
|
||||
if (!selected.NullOrEmpty())
|
||||
{
|
||||
foreach (Pawn p in selected)
|
||||
{
|
||||
Find.Selector.Deselect(p);
|
||||
}
|
||||
}
|
||||
|
||||
this.pawn = pawn;
|
||||
this.history = history;
|
||||
this.selectedPawn = null;
|
||||
|
@ -204,7 +195,7 @@ namespace RJWSexperience.UI
|
|||
|
||||
Rect leftRect = new Rect(mainrect.x, mainrect.y, sectionwidth, mainrect.height);
|
||||
Rect centerRect = new Rect(mainrect.x + sectionwidth, mainrect.y, sectionwidth, mainrect.height);
|
||||
Rect rightRect = new Rect(mainrect.x + sectionwidth * 2, mainrect.y, sectionwidth, mainrect.height);
|
||||
Rect rightRect = new Rect(mainrect.x + (sectionwidth * 2), mainrect.y, sectionwidth, mainrect.height);
|
||||
|
||||
if (history != null)
|
||||
{
|
||||
|
@ -212,14 +203,11 @@ namespace RJWSexperience.UI
|
|||
DrawBaseSexInfoLeft(leftRect.ContractedBy(4f));
|
||||
|
||||
//Center section
|
||||
DrawBaseSexInfoCenter(centerRect.ContractedBy(4f),history.parent as Pawn);
|
||||
DrawBaseSexInfoCenter(centerRect.ContractedBy(4f), history.parent as Pawn);
|
||||
|
||||
//Right section
|
||||
DrawBaseSexInfoRight(rightRect.ContractedBy(4f));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void DrawInfoWithPortrait(Rect rect, SexPartnerHistoryRecord history, string tooltip = "")
|
||||
|
@ -229,8 +217,8 @@ namespace RJWSexperience.UI
|
|||
Rect portraitRect = new Rect(rect.x, rect.y, rect.height - FONTHEIGHT, rect.height - FONTHEIGHT);
|
||||
Rect nameRect = new Rect(rect.x + portraitRect.width, rect.y, rect.width - portraitRect.width, FONTHEIGHT);
|
||||
Rect sexinfoRect = new Rect(rect.x + portraitRect.width, rect.y + FONTHEIGHT, rect.width - portraitRect.width, FONTHEIGHT);
|
||||
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);
|
||||
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 (history != null)
|
||||
{
|
||||
|
@ -246,28 +234,30 @@ namespace RJWSexperience.UI
|
|||
ChangePawn(partner, pawnhistory);
|
||||
SoundDefOf.Click.PlayOneShotOnCamera();
|
||||
}
|
||||
else SoundDefOf.ClickReject.PlayOneShotOnCamera();
|
||||
else
|
||||
{
|
||||
SoundDefOf.ClickReject.PlayOneShotOnCamera();
|
||||
}
|
||||
}
|
||||
GUI.Label(nameRect, partner?.Name?.ToStringFull ?? history.Label.CapitalizeFirst(), fontstyleleft);
|
||||
GUI.Label(sexinfoRect, Keyed.RS_Sex_Count + history.TotalSexCount + " " + history.RapeInfo, fontstyleleft);
|
||||
GUI.Label(sexinfoRect2, Keyed.RS_Orgasms + history.OrgasmCount, fontstyleleft);
|
||||
GUI.Label(sexinfoRect2, pawn.GetRelationsString(partner) + " ", fontstyleright);
|
||||
float p = history.BestSatisfaction / BASESAT;
|
||||
FillableBarLabeled(bestsexRect,String.Format(Keyed.RS_Best_Sextype+": {0}", Keyed.Sextype[(int)history.BestSextype]), p / 2, HistoryUtility.SextypeColor[(int)history.BestSextype], Texture2D.blackTexture, null, String.Format("{0:P2}", p));
|
||||
FillableBarLabeled(bestsexRect, String.Format(Keyed.RS_Best_Sextype + ": {0}", Keyed.Sextype[(int)history.BestSextype]), p / 2, HistoryUtility.SextypeColor[(int)history.BestSextype], Texture2D.blackTexture, null, String.Format("{0:P2}", p));
|
||||
|
||||
if (history.IamFirst) str += "\n" + Keyed.RS_LostVirgin(history.Label, pawn.LabelShort);
|
||||
str += "\n" + history.BestSexDays;
|
||||
|
||||
TooltipHandler.TipRegion(rect, str);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Widgets.DrawTextureFitted(portraitRect, HistoryUtility.UnknownPawn, 1.0f);
|
||||
Widgets.Label(nameRect, Keyed.Unknown);
|
||||
Widgets.Label(sexinfoRect, Keyed.RS_Sex_Count + "?");
|
||||
Widgets.Label(sexinfoRect2, Keyed.RS_Orgasms+"?");
|
||||
FillableBarLabeled(bestsexRect,String.Format(Keyed .RS_Best_Sextype + ": {0}", Keyed.Sextype[(int)xxx.rjwSextype.None]), 0, Texture2D.linearGrayTexture, Texture2D.blackTexture);
|
||||
Widgets.Label(sexinfoRect2, Keyed.RS_Orgasms + "?");
|
||||
FillableBarLabeled(bestsexRect, String.Format(Keyed.RS_Best_Sextype + ": {0}", Keyed.Sextype[(int)xxx.rjwSextype.None]), 0, Texture2D.linearGrayTexture, Texture2D.blackTexture);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,9 +267,7 @@ namespace RJWSexperience.UI
|
|||
Rect infoRect = new Rect(rect.x, rect.y + FONTHEIGHT, rect.width, rect.height - FONTHEIGHT);
|
||||
GUI.Label(labelRect, label, fontstyleleft);
|
||||
GUI.Label(labelRect, rightlabel, fontstyleright);
|
||||
DrawInfoWithPortrait(infoRect,history, tooltip);
|
||||
|
||||
|
||||
DrawInfoWithPortrait(infoRect, history, tooltip);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -294,20 +282,18 @@ namespace RJWSexperience.UI
|
|||
DrawSexInfoCard(listmain.GetRect(CARDHEIGHT), history.GetMostPartnerHistory, Keyed.RS_Most_Sex_Partner, Keyed.RS_Most_Sex_Partner_ToolTip, history.MostSexDays);
|
||||
DrawSexInfoCard(listmain.GetRect(CARDHEIGHT), history.GetBestSexPartnerHistory, Keyed.RS_Best_Sex_Partner, Keyed.RS_Best_Sex_Partner_ToolTip, history.BestSexDays);
|
||||
GUI.Label(listmain.GetRect(FONTHEIGHT), Keyed.RS_PreferRace, fontstyleleft);
|
||||
DrawPreferRace(listmain.GetRect(66f+15f));
|
||||
DrawPreferRace(listmain.GetRect(66f + 15f));
|
||||
listmain.GetRect(15f);
|
||||
|
||||
|
||||
listmain.End();
|
||||
}
|
||||
|
||||
protected void DrawPreferRace(Rect rect)
|
||||
{
|
||||
Widgets.DrawMenuSection(rect);
|
||||
Rect portraitRect = new Rect(rect.x, rect.y, rect.height-15f, rect.height-15f);
|
||||
Rect portraitRect = new Rect(rect.x, rect.y, rect.height - 15f, rect.height - 15f);
|
||||
Rect infoRect1 = new Rect(rect.x + portraitRect.width, rect.y, rect.width - portraitRect.width, FONTHEIGHT);
|
||||
Rect infoRect2 = new Rect(rect.x + portraitRect.width, rect.y + FONTHEIGHT, rect.width - portraitRect.width, FONTHEIGHT);
|
||||
Rect infoRect3 = new Rect(rect.x + portraitRect.width, rect.y + FONTHEIGHT*2, rect.width - portraitRect.width - 2f, FONTHEIGHT);
|
||||
Rect infoRect3 = new Rect(rect.x + portraitRect.width, rect.y + (FONTHEIGHT * 2), rect.width - portraitRect.width - 2f, FONTHEIGHT);
|
||||
|
||||
if (history.PreferRace != null)
|
||||
{
|
||||
|
@ -319,7 +305,7 @@ namespace RJWSexperience.UI
|
|||
if (history.PreferRace.race.Animal ^ pawn.def.race.Animal)
|
||||
{
|
||||
GUI.Label(infoRect1, Keyed.RS_Bestiality + " ", fontstyleright);
|
||||
FillableBarLabeled(infoRect3, Keyed.RS_Sex_Info(Keyed.RS_Bestiality, history.BestialityCount.ToString()), history.BestialityCount/100f, Texture2D.linearGrayTexture, Texture2D.blackTexture);
|
||||
FillableBarLabeled(infoRect3, Keyed.RS_Sex_Info(Keyed.RS_Bestiality, history.BestialityCount.ToString()), history.BestialityCount / 100f, Texture2D.linearGrayTexture, Texture2D.blackTexture);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -335,14 +321,13 @@ namespace RJWSexperience.UI
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Center section
|
||||
/// </summary>
|
||||
protected void DrawBaseSexInfoCenter(Rect rect, Pawn pawn)
|
||||
{
|
||||
Rect portraitRect = new Rect(rect.x + rect.width / 4, rect.y, rect.width / 2, rect.width / 1.5f);
|
||||
Rect nameRect = new Rect(portraitRect.x, portraitRect.yMax - FONTHEIGHT * 2, portraitRect.width, FONTHEIGHT * 2);
|
||||
Rect portraitRect = new Rect(rect.x + (rect.width / 4), rect.y, rect.width / 2, rect.width / 1.5f);
|
||||
Rect nameRect = new Rect(portraitRect.x, portraitRect.yMax - (FONTHEIGHT * 2), portraitRect.width, FONTHEIGHT * 2);
|
||||
Rect infoRect = new Rect(rect.x, rect.y + portraitRect.height, rect.width, rect.height - portraitRect.height);
|
||||
Rect lockRect = new Rect(portraitRect.xMax - ICONSIZE, portraitRect.y, ICONSIZE, ICONSIZE);
|
||||
Rect tmp;
|
||||
|
@ -359,7 +344,6 @@ namespace RJWSexperience.UI
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
GUI.Box(portraitRect, "", boxstyle);
|
||||
Widgets.DrawTextureFitted(portraitRect, PortraitsCache.Get(pawn, portraitRect.size, Rot4.South, default, 1, true, true, false, false), 1.0f);
|
||||
Widgets.DrawHighlightIfMouseover(portraitRect);
|
||||
|
@ -394,10 +378,9 @@ namespace RJWSexperience.UI
|
|||
}
|
||||
listmain.Gap(1f);
|
||||
|
||||
|
||||
tmp = listmain.GetRect(FONTHEIGHT);
|
||||
p = pawn.records.GetValue(VariousDefOf.Lust);
|
||||
FillableBarLabeled(tmp, String.Format(Keyed.Lust +": {0:0.00}", p), Mathf.Clamp01(p.Normalization(-SexperienceMod.Settings.LustLimit*3, SexperienceMod.Settings.LustLimit*3)), HistoryUtility.Slaanesh, Texture2D.blackTexture, null, String.Format(xxx.sex_drive_stat.LabelCap.CapitalizeFirst() + ": {0:P2}", pawn.Dead ? 0 : pawn.GetStatValue(xxx.sex_drive_stat)));
|
||||
FillableBarLabeled(tmp, String.Format(Keyed.Lust + ": {0:0.00}", p), Mathf.Clamp01(p.Normalization(-SexperienceMod.Settings.LustLimit * 3, SexperienceMod.Settings.LustLimit * 3)), HistoryUtility.Slaanesh, Texture2D.blackTexture, null, String.Format(xxx.sex_drive_stat.LabelCap.CapitalizeFirst() + ": {0:P2}", pawn.Dead ? 0 : pawn.GetStatValue(xxx.sex_drive_stat)));
|
||||
listmain.Gap(1f);
|
||||
if (Mouse.IsOver(tmp))
|
||||
{
|
||||
|
@ -405,11 +388,11 @@ namespace RJWSexperience.UI
|
|||
}
|
||||
|
||||
p = history.GetBestSextype(out xxx.rjwSextype sextype) / BASESAT;
|
||||
FillableBarLabeled(listmain.GetRect(FONTHEIGHT),String.Format(Keyed.RS_Best_Sextype+": {0}", Keyed.Sextype[(int)sextype]), p / 2, HistoryUtility.SextypeColor[(int)sextype], Texture2D.blackTexture, null, Keyed.RS_SAT_AVG(String.Format("{0:P2}", p)));
|
||||
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), String.Format(Keyed.RS_Best_Sextype + ": {0}", Keyed.Sextype[(int)sextype]), p / 2, HistoryUtility.SextypeColor[(int)sextype], Texture2D.blackTexture, null, Keyed.RS_SAT_AVG(String.Format("{0:P2}", p)));
|
||||
listmain.Gap(1f);
|
||||
|
||||
p = history.GetRecentSextype(out sextype) / BASESAT;
|
||||
FillableBarLabeled(listmain.GetRect(FONTHEIGHT),String.Format(Keyed.RS_Recent_Sextype+": {0}", Keyed.Sextype[(int)sextype]), p / 2, HistoryUtility.SextypeColor[(int)sextype], Texture2D.blackTexture, null, String.Format("{0:P2}", p));
|
||||
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), String.Format(Keyed.RS_Recent_Sextype + ": {0}", Keyed.Sextype[(int)sextype]), p / 2, HistoryUtility.SextypeColor[(int)sextype], Texture2D.blackTexture, null, String.Format("{0:P2}", p));
|
||||
listmain.Gap(1f);
|
||||
|
||||
if (history.IncestuousCount < history.CorpseFuckCount)
|
||||
|
@ -466,10 +449,9 @@ namespace RJWSexperience.UI
|
|||
TooltipHandler.TipRegion(tmp, RJWUIUtility.GetStatExplanation(pawn, xxx.vulnerability_stat, pawn.Dead ? 0 : pawn.GetStatValue(xxx.vulnerability_stat)));
|
||||
}
|
||||
|
||||
|
||||
p = pawn.Dead ? 0 : pawn.GetStatValue(xxx.sex_satisfaction);
|
||||
tmp = listmain.GetRect(FONTHEIGHT);
|
||||
FillableBarLabeled(tmp, String.Format(xxx.sex_satisfaction.LabelCap.CapitalizeFirst() + ": {0:P2}", p), p/2, HistoryUtility.Satisfaction, Texture2D.blackTexture);
|
||||
FillableBarLabeled(tmp, String.Format(xxx.sex_satisfaction.LabelCap.CapitalizeFirst() + ": {0:P2}", p), p / 2, HistoryUtility.Satisfaction, Texture2D.blackTexture);
|
||||
listmain.Gap(1f);
|
||||
if (Mouse.IsOver(tmp))
|
||||
{
|
||||
|
@ -479,13 +461,12 @@ namespace RJWSexperience.UI
|
|||
SkillRecord skill = pawn.skills?.GetSkill(VariousDefOf.SexSkill);
|
||||
p = skill?.Level ?? 0;
|
||||
tmp = listmain.GetRect(FONTHEIGHT);
|
||||
FillableBarLabeled(tmp, String.Format(Keyed.RS_SexSkill + ": {0}, {1:P2}", p, skill?.xpSinceLastLevel/ skill?.XpRequiredForLevelUp), p / 20, HistoryUtility.Tzeentch, Texture2D.blackTexture, null, String.Format(xxx.sex_stat.LabelCap.CapitalizeFirst() + ": {0:P2}", pawn.Dead ? 0 : pawn.GetStatValue(xxx.sex_stat)), HistoryUtility.PassionBG[(int)(skill?.passion ?? 0)]);
|
||||
FillableBarLabeled(tmp, String.Format(Keyed.RS_SexSkill + ": {0}, {1:P2}", p, skill?.xpSinceLastLevel / skill?.XpRequiredForLevelUp), p / 20, HistoryUtility.Tzeentch, Texture2D.blackTexture, null, String.Format(xxx.sex_stat.LabelCap.CapitalizeFirst() + ": {0:P2}", pawn.Dead ? 0 : pawn.GetStatValue(xxx.sex_stat)), HistoryUtility.PassionBG[(int)(skill?.passion ?? 0)]);
|
||||
if (Mouse.IsOver(tmp))
|
||||
{
|
||||
TooltipHandler.TipRegion(tmp, RJWUIUtility.GetStatExplanation(pawn, xxx.sex_stat, pawn.Dead ? 0 : pawn.GetStatValue(xxx.sex_stat)));
|
||||
}
|
||||
|
||||
|
||||
listmain.Gap(1f);
|
||||
|
||||
if (selectedPawn != null) DrawSexInfoCard(listmain.GetRect(CARDHEIGHT), selectedPawn, Keyed.RS_Selected_Partner, Keyed.RS_Selected_Partner, RJWUIUtility.GetSexDays(selectedPawn.RecentSexTickAbs));
|
||||
|
@ -505,16 +486,9 @@ namespace RJWSexperience.UI
|
|||
listmain.Gap(1f);
|
||||
listmain.GetRect(FONTHEIGHT).DrawQuirk(pawn);
|
||||
listmain.Gap(1f);
|
||||
|
||||
|
||||
|
||||
listmain.End();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Left section
|
||||
/// </summary>
|
||||
|
@ -556,7 +530,7 @@ namespace RJWSexperience.UI
|
|||
//Partner list
|
||||
Rect listLabelRect = listmain.GetRect(FONTHEIGHT);
|
||||
Rect sortbtnRect = new Rect(listLabelRect.xMax - 80f, listLabelRect.y, 80f, listLabelRect.height);
|
||||
GUI.Label(listLabelRect ," "+Keyed.RS_PartnerList, fontstyleleft);
|
||||
GUI.Label(listLabelRect, " " + Keyed.RS_PartnerList, fontstyleleft);
|
||||
if (Widgets.ButtonText(sortbtnRect, orderMode.Translate()))
|
||||
{
|
||||
SoundDefOf.Click.PlayOneShotOnCamera();
|
||||
|
@ -566,8 +540,8 @@ namespace RJWSexperience.UI
|
|||
|
||||
listmain.Gap(1f);
|
||||
|
||||
Rect scrollRect = listmain.GetRect(CARDHEIGHT+1f);
|
||||
GUI.Box(scrollRect,"", buttonstyle);
|
||||
Rect scrollRect = listmain.GetRect(CARDHEIGHT + 1f);
|
||||
GUI.Box(scrollRect, "", buttonstyle);
|
||||
if (!partnerList.NullOrEmpty())
|
||||
{
|
||||
Rect listRect = new Rect(scrollRect.x, scrollRect.y, LISTPAWNSIZE * partnerList.Count, scrollRect.height - 30f);
|
||||
|
@ -585,7 +559,7 @@ namespace RJWSexperience.UI
|
|||
Rect pawnRect = new Rect(rect.x, rect.y, LISTPAWNSIZE, LISTPAWNSIZE);
|
||||
for (int i = 0; i < partnerList.Count; i++)
|
||||
{
|
||||
Rect labelRect = new Rect(pawnRect.x,pawnRect.yMax - FONTHEIGHT,pawnRect.width,FONTHEIGHT);
|
||||
Rect labelRect = new Rect(pawnRect.x, pawnRect.yMax - FONTHEIGHT, pawnRect.width, FONTHEIGHT);
|
||||
|
||||
DrawPawn(pawnRect, partnerList[i]);
|
||||
Widgets.DrawHighlightIfMouseover(pawnRect);
|
||||
|
@ -609,7 +583,7 @@ namespace RJWSexperience.UI
|
|||
if (history != null)
|
||||
{
|
||||
bool drawheart = false;
|
||||
Rect iconRect = new Rect(rect.x + rect.width * 3 / 4, rect.y, rect.width / 4, rect.height / 4);
|
||||
Rect iconRect = new Rect(rect.x + (rect.width * 3 / 4), rect.y, rect.width / 4, rect.height / 4);
|
||||
Texture img = HistoryUtility.UnknownPawn;
|
||||
|
||||
if (history.IamFirst)
|
||||
|
@ -622,10 +596,9 @@ namespace RJWSexperience.UI
|
|||
if (history.Partner != null)
|
||||
{
|
||||
img = PortraitsCache.Get(history.Partner, rect.size, Rot4.South, default, 1, true, true, false, false);
|
||||
|
||||
drawheart = LovePartnerRelationUtility.LovePartnerRelationExists(pawn, history.Partner);
|
||||
}
|
||||
else if (history.Race != null && history.Race.uiIcon != null)
|
||||
else if (history.Race?.uiIcon != null)
|
||||
{
|
||||
img = history.Race.uiIcon;
|
||||
}
|
||||
|
@ -638,15 +611,12 @@ namespace RJWSexperience.UI
|
|||
Widgets.DrawTextureFitted(rect, img, 1.0f);
|
||||
if (drawheart)
|
||||
{
|
||||
Widgets.DrawTextureFitted(iconRect, HistoryUtility.Heart,1.0f);
|
||||
Widgets.DrawTextureFitted(iconRect, HistoryUtility.Heart, 1.0f);
|
||||
iconRect.x -= iconRect.width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static void FillableBarLabeled(Rect rect, string label, float fillPercent, Texture2D filltexture, Texture2D bgtexture, string tooltip = null, string rightlabel = "", Texture2D border = null)
|
||||
{
|
||||
Widgets.FillableBar(rect, Math.Min(fillPercent, 1.0f), filltexture, bgtexture, true);
|
||||
|
@ -656,12 +626,8 @@ namespace RJWSexperience.UI
|
|||
if (tooltip != null) TooltipHandler.TipRegion(rect, tooltip);
|
||||
if (border != null)
|
||||
{
|
||||
rect.DrawBorder(border,2f);
|
||||
rect.DrawBorder(border, 2f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue