Client LuaCsForBarotrauma
SkillSettingsFile.cs
1 using System.Xml.Linq;
2 
3 namespace Barotrauma
4 {
6  {
7  public SkillSettingsFile(ContentPackage contentPackage, ContentPath path) : base(contentPackage, path) { }
8 
9  public override void LoadFile()
10  {
11  XDocument doc = XMLExtensions.TryLoadXml(Path);
12  if (doc == null) { return; }
13  var mainElement = doc.Root.FromPackage(ContentPackage);
14  bool allowOverriding = mainElement.IsOverride();
15  if (allowOverriding)
16  {
17  mainElement = mainElement.FirstElement();
18  }
19  var prefab = new SkillSettings(mainElement, this);
20  SkillSettings.Prefabs.Add(prefab, allowOverriding);
21  }
22 
23  public override void UnloadFile()
24  {
25  SkillSettings.Prefabs.RemoveByFile(this);
26  }
27 
28  public override void Sort()
29  {
30  SkillSettings.Prefabs.Sort();
31  }
32  }
33 }
Base class for content file types, which are loaded from filelist.xml via reflection....
Definition: ContentFile.cs:23
SkillSettingsFile(ContentPackage contentPackage, ContentPath path)
static readonly PrefabSelector< SkillSettings > Prefabs