Added Alt Text And Images

This commit is contained in:
Ben C 2022-02-08 23:03:19 -05:00
parent 14f0e4cf80
commit 87244e317c
2 changed files with 78 additions and 67 deletions

View File

@ -116,7 +116,8 @@ namespace NewHorizons.Builder.ShipLog
{ {
id = entry._id, id = entry._id,
cardPosition = entryPosition, 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); entry.SetSprite(newData.sprite == null ? manager._shipLogLibrary.defaultEntrySprite : newData.sprite);
manager._entryDataDict.Add(entry._id, newData); manager._entryDataDict.Add(entry._id, newData);
@ -150,20 +151,32 @@ namespace NewHorizons.Builder.ShipLog
table[rumorName.Value] = rumorName.Value; table[rumorName.Value] = rumorName.Value;
} }
XElement rumorText = rumorFact.Element("Text"); AddTextTranslation(rumorFact, name, table);
if (rumorText != null) AddAltTextTranslation(rumorFact, name, table);
{
table[name + rumorText.Value] = rumorText.Value;
}
} }
foreach (XElement exploreFact in entry.Elements("ExploreFact")) foreach (XElement exploreFact in entry.Elements("ExploreFact"))
{ {
XElement exploreText = exploreFact.Element("Text"); AddTextTranslation(exploreFact, name, table);
if (exploreText != null) AddAltTextTranslation(exploreFact, name, table);
}
}
}
private static void AddTextTranslation(XElement fact, string name, Dictionary<string, string> table)
{ {
table[name + exploreText.Value] = exploreText.Value; XElement textElement = fact.Element("Text");
if (textElement != null)
{
table[name + textElement.Value] = textElement.Value;
} }
} }
private static void AddAltTextTranslation(XElement fact, string name, Dictionary<string, string> table)
{
XElement altTextElement = fact.Element("AltText");
if (altTextElement != null)
{
AddTextTranslation(altTextElement, name, table);
} }
} }

View File

@ -1,67 +1,65 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Astro Object Entry Info -->
<xs:element name="AstroObjectEntry"> <xs:element name="AstroObjectEntry">
<xs:complexType> <xs:complexType>
<xs:sequence> <xs:sequence>
<xs:element name="ID" type="xs:string"/> <xs:element name="ID" type="xs:string"/>
<xs:element name="Entry" maxOccurs="unbounded"> <xs:element name="Entry" maxOccurs="unbounded" type="entryInfo">
<xs:complexType> </xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Entry Info -->
<xs:complexType name="entryInfo">
<xs:sequence> <xs:sequence>
<xs:element name="ID" type="xs:string"/> <xs:element name="ID" type="xs:string"/>
<xs:element name="Name" type="xs:string"/> <xs:element name="Name" type="xs:string"/>
<xs:element name="Curiosity" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="Curiosity" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="IsCuriosity" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="IsCuriosity" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="RumorFact" minOccurs="0" maxOccurs="unbounded"> <xs:element name="IgnoreMoreToExplore" minOccurs="0"/>
<xs:complexType> <xs:element name="IgnoreMoreToExploreCondition" type="xs:string" minOccurs="0"/>
<xs:element name="AltPhotoCondition" type="xs:string" minOccurs="0"/>
<xs:element name="RumorFact" type="rumorFactInfo" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ExploreFact" type="exploreFactInfo" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Entry" type="entryInfo" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<!-- Rumor Fact Info -->
<xs:complexType name="rumorFactInfo">
<xs:sequence> <xs:sequence>
<xs:element name="ID" type="xs:string"/> <xs:element name="ID" type="xs:string"/>
<xs:element name="SourceID" type="xs:string" minOccurs="0"/> <xs:element name="SourceID" type="xs:string" minOccurs="0"/>
<xs:element name="RumorName" type="xs:string"/> <xs:element name="RumorName" type="xs:string" minOccurs="0"/>
<xs:element name="RumorNamePriority" type="xs:int" minOccurs="0"/> <xs:element name="RumorNamePriority" type="xs:int" minOccurs="0"/>
<xs:element name="Text" type="xs:string"/> <xs:element name="IgnoreMoreToExplore" minOccurs="0"/>
<xs:group ref="textData"/>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
</xs:element>
<xs:element name="ExploreFact" minOccurs="0" maxOccurs="unbounded"> <!-- Explore Fact Info -->
<xs:complexType> <xs:complexType name="exploreFactInfo">
<xs:all>
<xs:element name="ID" type="xs:string"/>
<xs:element name="Text" type="xs:string"/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name="Entry" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence> <xs:sequence>
<xs:element name="ID" type="xs:string"/> <xs:element name="ID" type="xs:string"/>
<xs:element name="Name" type="xs:string"/> <xs:element name="IgnoreMoreToExplore" minOccurs="0"/>
<xs:element name="Curiosity" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> <xs:group ref="textData"/>
<xs:element name="RumorFact" minOccurs="0" maxOccurs="unbounded"> </xs:sequence>
</xs:complexType>
<!-- Text Data Group -->
<xs:group name="textData">
<xs:sequence>
<xs:element name="Text" type="xs:string"/>
<xs:element name="AltText" minOccurs="0">
<xs:complexType> <xs:complexType>
<xs:sequence> <xs:sequence>
<xs:element name="ID" type="xs:string"/>
<xs:element name="SourceID" type="xs:string" minOccurs="0"/>
<xs:element name="RumorName" type="xs:string"/>
<xs:element name="RumorNamePriority" type="xs:int" minOccurs="0"/>
<xs:element name="Text" type="xs:string"/> <xs:element name="Text" type="xs:string"/>
</xs:sequence> <xs:element name="Condition" type="xs:string"/>
</xs:complexType>
</xs:element>
<xs:element name="ExploreFact" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:all>
<xs:element name="ID" type="xs:string"/>
<xs:element name="Text" type="xs:string"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
</xs:element> </xs:element>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:group>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema> </xs:schema>