mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Replace a bunch of string concatenations with stringbuilders
This commit is contained in:
parent
003f5d6d29
commit
b2da75d9e6
7 changed files with 49 additions and 37 deletions
Binary file not shown.
|
@ -1,6 +1,7 @@
|
||||||
using RimWorld;
|
using RimWorld;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Verse;
|
using Verse;
|
||||||
|
|
||||||
|
@ -264,13 +265,14 @@ namespace RJW_Menstruation
|
||||||
|
|
||||||
public string GetIngredients()
|
public string GetIngredients()
|
||||||
{
|
{
|
||||||
string res = "";
|
StringBuilder res = new StringBuilder();
|
||||||
|
|
||||||
if (!cums.NullOrEmpty()) for (int i = 0; i < cums.Count; i++)
|
if (!cums.NullOrEmpty()) for (int i = 0; i < cums.Count; i++)
|
||||||
{
|
{
|
||||||
res += cums[i];
|
res.Append(cums[i]);
|
||||||
if (i < cums.Count - 1) res += ", ";
|
if (i < cums.Count - 1) res.Append(", ");
|
||||||
}
|
}
|
||||||
return res;
|
return res.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ using rjw;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Verse;
|
using Verse;
|
||||||
|
|
||||||
|
@ -423,19 +424,19 @@ namespace RJW_Menstruation
|
||||||
{
|
{
|
||||||
if (eggs.NullOrEmpty()) return "";
|
if (eggs.NullOrEmpty()) return "";
|
||||||
|
|
||||||
string res = "";
|
StringBuilder res = new StringBuilder();
|
||||||
int fertilized = eggs.Count(egg => egg.fertilized);
|
int fertilized = eggs.Count(egg => egg.fertilized);
|
||||||
if (fertilized != 0) res += fertilized + " " + Translations.Dialog_WombInfo05;
|
if (fertilized != 0) res.AppendFormat("{0} {1}", fertilized, Translations.Dialog_WombInfo05);
|
||||||
if (fertilized != 0 && eggs.Count - fertilized != 0) res += ", ";
|
if (fertilized != 0 && eggs.Count - fertilized != 0) res.Append(", ");
|
||||||
if (cums.NullOrEmpty() || TotalFertCum == 0)
|
if (cums.NullOrEmpty() || TotalFertCum == 0)
|
||||||
{
|
{
|
||||||
if (eggs.Count - fertilized != 0) res += eggs.Count - fertilized + " " + Translations.Dialog_WombInfo07;
|
if (eggs.Count - fertilized != 0) res.AppendFormat("{0} {1}", eggs.Count - fertilized, Translations.Dialog_WombInfo07);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (eggs.Count - fertilized != 0) res += eggs.Count - fertilized + " " + Translations.Dialog_WombInfo06;
|
if (eggs.Count - fertilized != 0) res.AppendFormat("{0} {1}", eggs.Count - fertilized, Translations.Dialog_WombInfo06);
|
||||||
}
|
}
|
||||||
return res;
|
return res.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public bool IsEggFertilizing
|
public bool IsEggFertilizing
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using rjw;
|
using rjw;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Verse;
|
using Verse;
|
||||||
|
|
||||||
|
@ -78,19 +79,19 @@ namespace RJW_Menstruation
|
||||||
if (babies.NullOrEmpty())
|
if (babies.NullOrEmpty())
|
||||||
return "Null";
|
return "Null";
|
||||||
|
|
||||||
string res = "";
|
StringBuilder res = new StringBuilder();
|
||||||
|
|
||||||
IEnumerable<Pawn> babiesdistinct = babies.Distinct(new RaceComparer());
|
IEnumerable<Pawn> babiesdistinct = babies.Distinct(new RaceComparer());
|
||||||
int iteration = 0;
|
int iteration = 0;
|
||||||
foreach (Pawn baby in babiesdistinct)
|
foreach (Pawn baby in babiesdistinct)
|
||||||
{
|
{
|
||||||
int num = babies.Where(x => x.def.Equals(baby.def)).Count();
|
int num = babies.Where(x => x.def.Equals(baby.def)).Count();
|
||||||
if (iteration > 0) res += ", ";
|
if (iteration > 0) res.Append(", ");
|
||||||
res += num + " " + baby.def.label;
|
res.AppendFormat("{0} {1}", num, baby.def.label);
|
||||||
iteration++;
|
iteration++;
|
||||||
}
|
}
|
||||||
res += " " + Translations.Dialog_WombInfo02;
|
res.AppendFormat(" {0}", Translations.Dialog_WombInfo02);
|
||||||
return res;
|
return res.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetFatherInfo()
|
public string GetFatherInfo()
|
||||||
|
@ -98,20 +99,21 @@ namespace RJW_Menstruation
|
||||||
if (babies.NullOrEmpty())
|
if (babies.NullOrEmpty())
|
||||||
return "Null";
|
return "Null";
|
||||||
|
|
||||||
string res = Translations.Dialog_WombInfo03 + ": ";
|
StringBuilder res = new StringBuilder();
|
||||||
|
res.AppendFormat("{0}: ", Translations.Dialog_WombInfo03);
|
||||||
|
|
||||||
if (!is_parent_known && Configurations.InfoDetail != Configurations.DetailLevel.All)
|
if (!is_parent_known && Configurations.InfoDetail != Configurations.DetailLevel.All)
|
||||||
return res + Translations.Dialog_FatherUnknown;
|
return res.Append(Translations.Dialog_FatherUnknown).ToString();
|
||||||
|
|
||||||
IEnumerable<Pawn> babiesdistinct = babies.Distinct(new FatherComparer(pawn));
|
IEnumerable<Pawn> 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.Append(", ");
|
||||||
res += Utility.GetFather(baby, pawn)?.LabelShort ?? Translations.Dialog_FatherUnknown;
|
res.Append(Utility.GetFather(baby, pawn)?.LabelShort ?? Translations.Dialog_FatherUnknown);
|
||||||
iteration++;
|
iteration++;
|
||||||
}
|
}
|
||||||
return res;
|
return res.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HumanlikeBirth(Pawn baby)
|
private void HumanlikeBirth(Pawn baby)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using rjw;
|
using rjw;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Verse;
|
using Verse;
|
||||||
|
|
||||||
|
@ -42,15 +43,20 @@ namespace RJW_Menstruation
|
||||||
private static Gizmo CreateGizmo_WombStatus(Pawn pawn, HediffComp_Menstruation comp)
|
private static Gizmo CreateGizmo_WombStatus(Pawn pawn, HediffComp_Menstruation comp)
|
||||||
{
|
{
|
||||||
Texture2D icon, icon_overay;
|
Texture2D icon, icon_overay;
|
||||||
string description = "";
|
StringBuilder description = new StringBuilder();
|
||||||
if (Configurations.Debug) {
|
if (Configurations.Debug)
|
||||||
description += comp.curStage + ": " + comp.curStageHrs + "\n" +
|
{
|
||||||
(comp.Pregnancy is Hediff_MultiplePregnancy preg ? "due: " + preg.DueDate() + "\n" : "") +
|
description
|
||||||
"fertcums: " + comp.TotalFertCum + "\n" +
|
.AppendFormat("{0}: {1}\n", comp.curStage, comp.curStageHrs);
|
||||||
"ovarypower: " + comp.ovarypower + "\n" +
|
if (comp.Pregnancy is Hediff_MultiplePregnancy preg) description
|
||||||
"eggs: " + comp.GetNumOfEggs + "\n";
|
.AppendFormat("due: {0}\n", preg.DueDate());
|
||||||
|
description
|
||||||
|
.AppendFormat("fertcums: {0}\n" +
|
||||||
|
"ovarypower: {1}\n" +
|
||||||
|
"eggs: {2}\n",
|
||||||
|
comp.TotalFertCum, comp.ovarypower, comp.GetNumOfEggs);
|
||||||
}
|
}
|
||||||
else description += comp.GetCurStageLabel + "\n";
|
else description.AppendFormat("{0}\n", comp.GetCurStageLabel);
|
||||||
if (pawn.IsRJWPregnant())
|
if (pawn.IsRJWPregnant())
|
||||||
{
|
{
|
||||||
Hediff_BasePregnancy hediff = comp.Pregnancy;
|
Hediff_BasePregnancy hediff = comp.Pregnancy;
|
||||||
|
@ -84,14 +90,14 @@ namespace RJW_Menstruation
|
||||||
icon_overay = comp.GetCumIcon();
|
icon_overay = comp.GetCumIcon();
|
||||||
|
|
||||||
}
|
}
|
||||||
foreach (string s in comp.GetCumsInfo) description += s + "\n";
|
foreach (string s in comp.GetCumsInfo) description.AppendFormat("{0}\n", s);
|
||||||
|
|
||||||
Color c = comp.GetCumMixtureColor;
|
Color c = comp.GetCumMixtureColor;
|
||||||
|
|
||||||
return new Gizmo_Womb
|
return new Gizmo_Womb
|
||||||
{
|
{
|
||||||
defaultLabel = pawn.LabelShort,
|
defaultLabel = pawn.LabelShort,
|
||||||
defaultDesc = description,
|
defaultDesc = description.ToString(),
|
||||||
icon = icon,
|
icon = icon,
|
||||||
icon_overay = icon_overay,
|
icon_overay = icon_overay,
|
||||||
shrinkable = Configurations.AllowShrinkIcon,
|
shrinkable = Configurations.AllowShrinkIcon,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Verse;
|
using Verse;
|
||||||
|
|
||||||
|
@ -38,13 +39,13 @@ namespace RJW_Menstruation.Sexperience
|
||||||
|
|
||||||
public override string GetInspectString()
|
public override string GetInspectString()
|
||||||
{
|
{
|
||||||
string res = "";
|
StringBuilder res = new StringBuilder();
|
||||||
if (!ingredients.NullOrEmpty()) for (int i = 0; i < ingredients.Count; i++)
|
if (!ingredients.NullOrEmpty()) for (int i = 0; i < ingredients.Count; i++)
|
||||||
{
|
{
|
||||||
res += ingredients[i];
|
res.Append(ingredients[i]);
|
||||||
if (i != ingredients.Count - 1) res += ", ";
|
if (i != ingredients.Count - 1) res.Append(", ");
|
||||||
}
|
}
|
||||||
return res;
|
return res.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InitwithCum(CumMixture cum)
|
public void InitwithCum(CumMixture cum)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Version 1.0.7.5
|
Version 1.0.7.5
|
||||||
- Fix error when one womb's concealed estrus is overwritten by another womb's visible estrus.
|
- Fix error when one womb's concealed estrus is overwritten by another womb's visible estrus.
|
||||||
- Properly calculate cramp pain falloff again.
|
- Properly calculate cramp pain falloff again.
|
||||||
- Climacteric and menopause are now per-womb. Their effect on overall sex drive and satisfaction will depend on the health of any other wombs.
|
- Climacteric and menopause are now per-womb, appearing in the womb dialog instead of as hediffs. Any old hediffs should disappear upon loading the save.
|
||||||
- Added new property to vaginas to multiply the number of eggs available. Archotech vaginas will have quadruple the normal amount.
|
- Added new property to vaginas to multiply the number of eggs available. Archotech vaginas will have quadruple the normal amount.
|
||||||
|
|
||||||
Version 1.0.7.4
|
Version 1.0.7.4
|
||||||
|
|
Loading…
Reference in a new issue