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,
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<string, string> table)
{
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);
}
}
public static void UpdateEntryCuriosity(ref ShipLogEntry entry)
{
if (_entryIdToRawName.ContainsKey(entry._id))

View File

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