Hide name if parent unknown

This commit is contained in:
amevarashi 2022-04-24 09:52:10 +05:00
parent b0984f6d61
commit a884ab2652
4 changed files with 25 additions and 19 deletions

View file

@ -27,6 +27,7 @@
<Dialog_WombInfo09></Dialog_WombInfo09> <Dialog_WombInfo09></Dialog_WombInfo09>
<Dialog_DoCleanWomb_Tooltip>Gather cums into bucket</Dialog_DoCleanWomb_Tooltip> <Dialog_DoCleanWomb_Tooltip>Gather cums into bucket</Dialog_DoCleanWomb_Tooltip>
<Dialog_DontCleanWomb_Tooltip>Store cums in womb</Dialog_DontCleanWomb_Tooltip> <Dialog_DontCleanWomb_Tooltip>Store cums in womb</Dialog_DontCleanWomb_Tooltip>
<Dialog_FatherUnknown>Unknown</Dialog_FatherUnknown>
<Option1_Label_1>enable womb icon</Option1_Label_1> <Option1_Label_1>enable womb icon</Option1_Label_1>
<Option1_Label_2>enable button in health tab</Option1_Label_2> <Option1_Label_2>enable button in health tab</Option1_Label_2>

View file

@ -87,25 +87,24 @@ namespace RJW_Menstruation
public string GetFatherInfo() public string GetFatherInfo()
{ {
if (babies.NullOrEmpty())
return "Null";
string res = Translations.Dialog_WombInfo03 + ": "; string res = Translations.Dialog_WombInfo03 + ": ";
if (!babies.NullOrEmpty())
{ if (!is_parent_known && Configurations.InfoDetail != Configurations.DetailLevel.All)
return res + Translations.Dialog_FatherUnknown;
var babiesdistinct = babies.Distinct(new FatherComparer(pawn)); var babiesdistinct = babies.Distinct(new FatherComparer(pawn));
int iteration = 0; int iteration = 0;
foreach (Pawn baby in babiesdistinct) foreach (Pawn baby in babiesdistinct)
{ {
if (iteration > 0) res += ", "; if (iteration > 0) res += ", ";
res += Utility.GetFather(baby, pawn)?.LabelShort ?? "Unknown"; res += Utility.GetFather(baby, pawn)?.LabelShort ?? Translations.Dialog_FatherUnknown;
iteration++; iteration++;
} }
return res; return res;
} }
return "Null";
}
private void HumanlikeBirth(Pawn baby, List<Pawn> siblings) private void HumanlikeBirth(Pawn baby, List<Pawn> siblings)
{ {

View file

@ -21,6 +21,7 @@ namespace RJW_Menstruation
public static readonly string Button_MilkTooltip = "Button_MilkTooltip".Translate(); public static readonly string Button_MilkTooltip = "Button_MilkTooltip".Translate();
public static readonly string Dialog_DoCleanWomb_Tooltip = "Dialog_DoCleanWomb_Tooltip".Translate(); public static readonly string Dialog_DoCleanWomb_Tooltip = "Dialog_DoCleanWomb_Tooltip".Translate();
public static readonly string Dialog_DontCleanWomb_Tooltip = "Dialog_DontCleanWomb_Tooltip".Translate(); public static readonly string Dialog_DontCleanWomb_Tooltip = "Dialog_DontCleanWomb_Tooltip".Translate();
public static readonly string Dialog_FatherUnknown = "Dialog_FatherUnknown".Translate();
public static readonly string Dialog_WombInfo01 = "Dialog_WombInfo01".Translate(); public static readonly string Dialog_WombInfo01 = "Dialog_WombInfo01".Translate();
public static readonly string Dialog_WombInfo02 = "Dialog_WombInfo02".Translate(); public static readonly string Dialog_WombInfo02 = "Dialog_WombInfo02".Translate();

View file

@ -191,17 +191,22 @@ namespace RJW_Menstruation
Pawn fetus = pawn.GetFetus(); Pawn fetus = pawn.GetFetus();
if (fetus != null && Utility.ShowFetusInfo()) if (fetus != null && Utility.ShowFetusInfo())
{ {
preginfoheight = fontheight; preginfoheight = fontheight;
Rect preginfo = new Rect(0f, mainRect.yMax - wombRectHeight - 2, wombRectWidth, preginfoheight); Rect preginfo = new Rect(0f, mainRect.yMax - wombRectHeight - 2, wombRectWidth, preginfoheight);
fontstyleright.normal.textColor = Color.white; fontstyleright.normal.textColor = Color.white;
fontstyleright.alignment = TextAnchor.MiddleRight; fontstyleright.alignment = TextAnchor.MiddleRight;
buttonstyle.alignment = TextAnchor.MiddleLeft; buttonstyle.alignment = TextAnchor.MiddleLeft;
GUI.Box(preginfo, b.babies.Count + " " + fetus.def.label + " " + Translations.Dialog_WombInfo02, buttonstyle); string father;
GUI.Label(preginfo, Translations.Dialog_WombInfo03 + ": " + b.father.LabelShort + " ", fontstyleright);
}
if (!b.is_parent_known && Configurations.InfoDetail != Configurations.DetailLevel.All)
father = Translations.Dialog_FatherUnknown;
else
father = b.father.LabelShort;
GUI.Box(preginfo, b.babies.Count + " " + fetus.def.label + " " + Translations.Dialog_WombInfo02, buttonstyle);
GUI.Label(preginfo, Translations.Dialog_WombInfo03 + ": " + father + " ", fontstyleright);
}
} }
else cum = ContentFinder<Texture2D>.Get(("Womb/Empty"), true); else cum = ContentFinder<Texture2D>.Get(("Womb/Empty"), true);
} }