Unstable 0.17.0.0

This commit is contained in:
Markus Isberg
2022-02-26 02:43:01 +09:00
parent a83f375681
commit 3974067915
913 changed files with 32472 additions and 32364 deletions
@@ -0,0 +1,44 @@
using System.Xml.Linq;
namespace Barotrauma
{
sealed class NPCConversationsFile : ContentFile
{
public NPCConversationsFile(ContentPackage contentPackage, ContentPath path) : base(contentPackage, path) { }
public override void LoadFile()
{
XDocument doc = XMLExtensions.TryLoadXml(Path);
if (doc == null) { return; }
var mainElement = doc.Root.FromPackage(ContentPackage);
bool allowOverriding = doc.Root.IsOverride();
if (allowOverriding)
{
mainElement = mainElement.FirstElement();
}
var npcConversationCollection = new NPCConversationCollection(this, mainElement);
if (!NPCConversationCollection.Collections.ContainsKey(npcConversationCollection.Language))
{
NPCConversationCollection.Collections.Add(npcConversationCollection.Language, new PrefabCollection<NPCConversationCollection>());
}
NPCConversationCollection.Collections[npcConversationCollection.Language].Add(npcConversationCollection, allowOverriding);
}
public override void UnloadFile()
{
foreach (var collection in NPCConversationCollection.Collections.Values)
{
collection.RemoveByFile(this);
}
}
public override void Sort()
{
foreach (var collection in NPCConversationCollection.Collections.Values)
{
collection.SortAll();
}
}
}
}