From 87244e317cf006f6d317cf76f78a230bfa330fc7 Mon Sep 17 00:00:00 2001 From: Ben C Date: Tue, 8 Feb 2022 23:03:19 -0500 Subject: [PATCH] Added Alt Text And Images --- .../Builder/ShipLog/RumorModeBuilder.cs | 35 ++++-- NewHorizons/shiplog_schema.xsd | 110 +++++++++--------- 2 files changed, 78 insertions(+), 67 deletions(-) diff --git a/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs b/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs index b19ebcae..ff051fac 100644 --- a/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs +++ b/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs @@ -116,7 +116,8 @@ namespace NewHorizons.Builder.ShipLog { id = entry._id, cardPosition = entryPosition, - sprite = body.Config.ShipLog.spriteFolder == null ? null : GetEntrySprite(entry._id, body) + sprite = body.Config.ShipLog.spriteFolder == null ? null : GetEntrySprite(entry._id, body), + altSprite = body.Config.ShipLog.spriteFolder == null ? null : GetEntrySprite(entry._id + "_ALT", body) }; entry.SetSprite(newData.sprite == null ? manager._shipLogLibrary.defaultEntrySprite : newData.sprite); manager._entryDataDict.Add(entry._id, newData); @@ -150,23 +151,35 @@ namespace NewHorizons.Builder.ShipLog table[rumorName.Value] = rumorName.Value; } - XElement rumorText = rumorFact.Element("Text"); - if (rumorText != null) - { - table[name + rumorText.Value] = rumorText.Value; - } + AddTextTranslation(rumorFact, name, table); + AddAltTextTranslation(rumorFact, name, table); } foreach (XElement exploreFact in entry.Elements("ExploreFact")) { - XElement exploreText = exploreFact.Element("Text"); - if (exploreText != null) - { - table[name + exploreText.Value] = exploreText.Value; - } + AddTextTranslation(exploreFact, name, table); + AddAltTextTranslation(exploreFact, name, table); } } } + private static void AddTextTranslation(XElement fact, string name, Dictionary table) + { + XElement textElement = fact.Element("Text"); + if (textElement != null) + { + table[name + textElement.Value] = textElement.Value; + } + } + + private static void AddAltTextTranslation(XElement fact, string name, Dictionary table) + { + XElement altTextElement = fact.Element("AltText"); + if (altTextElement != null) + { + AddTextTranslation(altTextElement, name, table); + } + } + public static void UpdateEntryCuriosity(ref ShipLogEntry entry) { if (_entryIdToRawName.ContainsKey(entry._id)) diff --git a/NewHorizons/shiplog_schema.xsd b/NewHorizons/shiplog_schema.xsd index 43ea8334..c6b77898 100644 --- a/NewHorizons/shiplog_schema.xsd +++ b/NewHorizons/shiplog_schema.xsd @@ -1,67 +1,65 @@  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file