mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix dialogue replacement overwriting character names
This commit is contained in:
parent
e1411db3af
commit
cab087d6f9
@ -68,8 +68,6 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
private static CharacterDialogueTree AddToExistingDialogue(DialogueInfo info, string xml)
|
||||
{
|
||||
AddTranslation(xml);
|
||||
|
||||
var existingDialogue = SearchUtilities.Find(info.pathToExistingDialogue)?.GetComponent<CharacterDialogueTree>();
|
||||
|
||||
if (existingDialogue == null)
|
||||
@ -125,6 +123,9 @@ namespace NewHorizons.Builder.Props
|
||||
|
||||
existingDialogue.SetTextXml(newTextAsset);
|
||||
|
||||
var characterName = existingDialogueTree.SelectSingleNode("NameField").InnerText;
|
||||
AddTranslation(xml, characterName);
|
||||
|
||||
return existingDialogue;
|
||||
}
|
||||
|
||||
@ -374,14 +375,20 @@ namespace NewHorizons.Builder.Props
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddTranslation(string xml)
|
||||
private static void AddTranslation(string xml, string characterName = null)
|
||||
{
|
||||
var xmlDocument = new XmlDocument();
|
||||
xmlDocument.LoadXml(xml);
|
||||
var xmlNode = xmlDocument.SelectSingleNode("DialogueTree");
|
||||
var xmlNodeList = xmlNode.SelectNodes("DialogueNode");
|
||||
string characterName = xmlNode.SelectSingleNode("NameField").InnerText;
|
||||
|
||||
// When adding dialogue to existing stuff, we have to pass in the character name
|
||||
// Otherwise we translate it if its from a new dialogue object
|
||||
if (characterName == null)
|
||||
{
|
||||
characterName = xmlNode.SelectSingleNode("NameField").InnerText;
|
||||
TranslationHandler.AddDialogue(characterName);
|
||||
}
|
||||
|
||||
foreach (object obj in xmlNodeList)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user