From 4150f7d1dbc9ff569889f2da69a179d4bcd31ff5 Mon Sep 17 00:00:00 2001 From: levimhuillet Date: Thu, 23 May 2024 10:51:11 -0500 Subject: [PATCH] added articles to full sentences; fixed rate sentences missing time units --- Assets/_Code/Data/Bestiary/Facts/Behavior/BFEat.cs | 6 +++--- .../_Code/Data/Bestiary/Facts/Behavior/BFParasite.cs | 8 ++++++-- .../_Code/Data/Bestiary/Utils/BestiaryFactFragment.cs | 6 ++++-- Assets/_Code/Data/Bestiary/Utils/BestiaryUtils.cs | 4 ++-- .../_Code/Data/WaterProperties/WaterPropertyDesc.cs | 11 ++++++----- Assets/_Content/Text/ES/ES-Loc.aqloc | 10 +++++----- 6 files changed, 26 insertions(+), 19 deletions(-) diff --git a/Assets/_Code/Data/Bestiary/Facts/Behavior/BFEat.cs b/Assets/_Code/Data/Bestiary/Facts/Behavior/BFEat.cs index c3b573636..daf964a7e 100644 --- a/Assets/_Code/Data/Bestiary/Facts/Behavior/BFEat.cs +++ b/Assets/_Code/Data/Bestiary/Facts/Behavior/BFEat.cs @@ -65,7 +65,7 @@ static private IEnumerable GenerateFragments(BFBase inFact, BFDiscov } yield return BFFragment.CreateLocVerb(bIsHuman ? IsCaughtByVerb : IsEatenByVerb); if (Services.Loc.IsCurrentLanguageGendered()) { - yield return BFFragment.CreateGenderedLocNoun(fact.Parent.CommonName(), fact.Parent.Gender()); + yield return BFFragment.CreateGenderedLocNoun(fact.Parent.CommonName(), fact.Parent.Gender(), true); } else { yield return BFFragment.CreateLocNoun(fact.Parent.CommonName()); @@ -88,7 +88,7 @@ static private IEnumerable GenerateFragments(BFBase inFact, BFDiscov } if (Services.Loc.IsCurrentLanguageGendered() && !BFType.HasRate(inFlags)) { - yield return BFFragment.CreateGenderedLocNoun(fact.Critter.CommonName(), fact.Critter.Gender()); + yield return BFFragment.CreateGenderedLocNoun(fact.Critter.CommonName(), fact.Critter.Gender(), true); } else { @@ -133,7 +133,7 @@ static private BFDetails GenerateDetails(BFBase inFact, BFDiscoveredFlags inFlag { details.Description = Loc.Format(EatRateSentence, inFact.Parent.CommonName(), - BestiaryUtils.FormatMass(fact.Amount), + BestiaryUtils.FormatMass(fact.Amount, "/t"), fact.Critter.CommonName()); } else diff --git a/Assets/_Code/Data/Bestiary/Facts/Behavior/BFParasite.cs b/Assets/_Code/Data/Bestiary/Facts/Behavior/BFParasite.cs index 97cea94bd..bcf13c269 100644 --- a/Assets/_Code/Data/Bestiary/Facts/Behavior/BFParasite.cs +++ b/Assets/_Code/Data/Bestiary/Facts/Behavior/BFParasite.cs @@ -57,7 +57,9 @@ static private IEnumerable GenerateFragments(BFBase inFact, BFDiscov yield return BFFragment.CreateLocVerb(IsStressedByVerb); if (Services.Loc.IsCurrentLanguageGendered()) { - yield return BFFragment.CreateGenderedLocNoun(fact.Parent.CommonName(), fact.Parent.Gender()); + // Remove article in second verb + //yield return BFFragment.CreateGenderedLocNoun(fact.Parent.CommonName(), fact.Parent.Gender(), true); + yield return BFFragment.CreateLocNoun(fact.Parent.CommonName()); } else { yield return BFFragment.CreateLocNoun(fact.Parent.CommonName()); @@ -79,7 +81,9 @@ static private IEnumerable GenerateFragments(BFBase inFact, BFDiscov } if (Services.Loc.IsCurrentLanguageGendered()) { - yield return BFFragment.CreateGenderedLocNoun(fact.Critter.CommonName(), fact.Critter.Gender()); + // Remove article in second verb + // yield return BFFragment.CreateGenderedLocNoun(fact.Critter.CommonName(), fact.Critter.Gender(), true); + yield return BFFragment.CreateLocNoun(fact.Parent.CommonName()); } else { yield return BFFragment.CreateLocNoun(fact.Critter.CommonName()); diff --git a/Assets/_Code/Data/Bestiary/Utils/BestiaryFactFragment.cs b/Assets/_Code/Data/Bestiary/Utils/BestiaryFactFragment.cs index b0a0759ce..da5d91386 100644 --- a/Assets/_Code/Data/Bestiary/Utils/BestiaryFactFragment.cs +++ b/Assets/_Code/Data/Bestiary/Utils/BestiaryFactFragment.cs @@ -27,10 +27,12 @@ static public BFFragment CreateLocNoun(TextId inWord) }; } - static public BFFragment CreateGenderedLocNoun(TextId inWord, TextId inArticle) + static public BFFragment CreateGenderedLocNoun(TextId inWord, TextId inArticle, bool makeLowerCase = false) { StringBuilder builder = new StringBuilder(); - builder.Append(Services.Loc.Localize(inArticle, true)); + if (makeLowerCase) { builder.Append(Services.Loc.Localize(inArticle, true).ToLower()); } + else { builder.Append(Services.Loc.Localize(inArticle, true)); } + if (!inArticle.IsEmpty) { builder.Append(" "); } diff --git a/Assets/_Code/Data/Bestiary/Utils/BestiaryUtils.cs b/Assets/_Code/Data/Bestiary/Utils/BestiaryUtils.cs index 6abb32bc4..9694f06cd 100644 --- a/Assets/_Code/Data/Bestiary/Utils/BestiaryUtils.cs +++ b/Assets/_Code/Data/Bestiary/Utils/BestiaryUtils.cs @@ -391,9 +391,9 @@ static public string FormatPopulation(BFBody inBody, uint inPopulation) /// /// Formats a mass amount. /// - static public string FormatMass(float inAmount) + static public string FormatMass(float inAmount, string suffix = null) { - return BestiaryUtils.Property(WaterPropertyId.Mass).FormatValue(inAmount); + return BestiaryUtils.Property(WaterPropertyId.Mass).FormatValue(inAmount, "", suffix); } /// diff --git a/Assets/_Code/Data/WaterProperties/WaterPropertyDesc.cs b/Assets/_Code/Data/WaterProperties/WaterPropertyDesc.cs index e2337c221..6d3344b14 100644 --- a/Assets/_Code/Data/WaterProperties/WaterPropertyDesc.cs +++ b/Assets/_Code/Data/WaterProperties/WaterPropertyDesc.cs @@ -72,7 +72,7 @@ public enum AllowedUnitConversions { public TextId StateChangeStressOnlyFormat() { return m_StateChangeStressOnlyFormat; } public TextId StateChangeUnaffectedFormat() { return m_StateChangeUnaffectedFormat; } - public string FormatValue(float inValue, string prefix = null) + public string FormatValue(float inValue, string prefix = null, string suffix = null) { inValue *= m_ValueScale; AdjustScale(ref inValue, GetAllowedConversions(), out string unitPrefix, out string unitOverride); @@ -81,12 +81,12 @@ public string FormatValue(float inValue, string prefix = null) if (!string.IsNullOrEmpty(prefix)) { psb.Builder.Append(prefix); } - FormatValue(psb.Builder, inValue, m_SignificantDigits, unitPrefix, unitOverride ?? m_Units); + FormatValue(psb.Builder, inValue, m_SignificantDigits, unitPrefix, suffix, unitOverride ?? m_Units); return psb.Builder.Flush(); } } - public string FormatRate(float inValue, string prefix = null, string additionalUnits = null) + public string FormatRate(float inValue, string prefix = null, string suffix = null, string additionalUnits = null) { inValue *= m_ValueScale; AdjustScale(ref inValue, GetAllowedConversions(), out string unitPrefix, out string unitOverride); @@ -95,7 +95,7 @@ public string FormatRate(float inValue, string prefix = null, string additionalU if (!string.IsNullOrEmpty(prefix)) { psb.Builder.Append(prefix); } - FormatValue(psb.Builder, inValue, m_SignificantDigits, unitPrefix, unitOverride ?? (!string.IsNullOrEmpty(m_RateUnits) ? m_RateUnits : m_Units)); + FormatValue(psb.Builder, inValue, m_SignificantDigits, unitPrefix, suffix, unitOverride ?? (!string.IsNullOrEmpty(m_RateUnits) ? m_RateUnits : m_Units)); if (additionalUnits != null) { psb.Builder.Append('/').Append(additionalUnits); } @@ -131,7 +131,8 @@ static public void AdjustScale(ref float val, AllowedUnitConversions allowedConv } } - static public void FormatValue(StringBuilder sb, float valueF, int significantDigits, string unitPrefix, string units) { + // this here + static public void FormatValue(StringBuilder sb, float valueF, int significantDigits, string unitPrefix, string unitSuffix, string units) { double value = valueF; int sign = Math.Sign(value); value = Math.Abs(value); diff --git a/Assets/_Content/Text/ES/ES-Loc.aqloc b/Assets/_Content/Text/ES/ES-Loc.aqloc index 16252137b..62bcaa84f 100644 --- a/Assets/_Content/Text/ES/ES-Loc.aqloc +++ b/Assets/_Content/Text/ES/ES-Loc.aqloc @@ -16317,16 +16317,16 @@ Esta informaciĆ³n requiere una {h}clave privada{/h} para descifrarse. {0} :: factFormat.eat -{critter-name}{0}{/critter-name} come {critter-name}{1}{/critter-name}. +{critter-name}{0}{/critter-name} se come {critter-name}{1}{/critter-name}. :: factFormat.eat.rate -{critter-name}{0}{/critter-name} come {1} de {critter-name}{2}{/critter-name}. +{critter-name}{0}{/critter-name} se come {1} de {critter-name}{2}{/critter-name}. :: factFormat.eat.stressed -{critter-name}{0}{/critter-name} come {critter-name}{1}{/critter-name} cuando se estresa. +{critter-name}{0}{/critter-name} se come {critter-name}{1}{/critter-name} cuando se estresa. :: factFormat.eat.stressed.rate -{critter-name}{0}{/critter-name} come {1} de {critter-name}{2}{/critter-name} cuando se estresa. +{critter-name}{0}{/critter-name} se come {1} de {critter-name}{2}{/critter-name} cuando se estresa. :: factFormat.catch {critter-name}{0}{/critter-name} atrapa {1} de {critter-name}{2}{/critter-name}. @@ -16350,7 +16350,7 @@ Esta informaciĆ³n requiere una {h}clave privada{/h} para descifrarse. {critter-name}{0}{/critter-name} consume {1} de {property-name}{2}{/property-name}. :: factFormat.consume.stressed -{critter-name}{0}{/critter-name} consume {1} {property-name}{2}{/property-name} cuando se estresa. +{critter-name}{0}{/critter-name} consume {1} de {property-name}{2}{/property-name} cuando se estresa. :: factFormat.reduce {critter-name}{0}{/critter-name} reduce {property-name}{2}{/property-name} por {1}.