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