Client LuaCsForBarotrauma
LevelGenerationParametersFile.cs
1
using
System;
2
using
System.Xml.Linq;
3
4
namespace
Barotrauma
5
{
6
sealed
class
LevelGenerationParametersFile
:
ContentFile
7
{
8
public
LevelGenerationParametersFile
(
ContentPackage
contentPackage,
ContentPath
path) : base(contentPackage, path) { }
9
10
private
void
LoadBiomes(
ContentXElement
element,
bool
isOverride)
11
{
12
foreach
(var subElement
in
element.
Elements
())
13
{
14
Biome
biome =
new
Biome
(subElement,
this
);
15
Biome
.
Prefabs
.Add(biome, isOverride);
16
}
17
}
18
19
private
void
LoadLevelGenerationParams(ContentXElement element,
bool
isOverride)
20
{
21
LevelGenerationParams lParams =
new
LevelGenerationParams(element,
this
);
22
LevelGenerationParams.LevelParams.Add(lParams, isOverride);
23
}
24
25
private
void
LoadSubElements(ContentXElement element,
bool
overridePropagation)
26
{
27
foreach
(var subElement
in
element.Elements())
28
{
29
if
(subElement.IsOverride())
30
{
31
LoadSubElements(subElement,
true
);
32
}
33
else
if
(subElement.NameAsIdentifier() ==
"clear"
)
34
{
35
LevelGenerationParams.LevelParams.AddOverrideFile(
this
);
36
Biome.Prefabs.AddOverrideFile(
this
);
37
}
38
else
if
(subElement.NameAsIdentifier() ==
"biomes"
)
39
{
40
LoadBiomes(subElement, overridePropagation);
41
}
42
else
43
{
44
LoadLevelGenerationParams(subElement, overridePropagation);
45
}
46
}
47
}
48
49
public
override
void
LoadFile
()
50
{
51
XDocument doc = XMLExtensions.TryLoadXml(Path);
52
if
(doc is
null
) {
return
; }
53
LoadSubElements(doc.Root.FromPackage(
ContentPackage
),
false
);
54
}
55
56
public
override
void
UnloadFile
()
57
{
58
LevelGenerationParams
.
LevelParams
.RemoveByFile(
this
);
59
Biome
.
Prefabs
.RemoveByFile(
this
);
60
}
61
62
public
override
void
Sort
()
63
{
64
LevelGenerationParams
.
LevelParams
.SortAll();
65
Biome
.
Prefabs
.SortAll();
66
}
67
}
68
}
Barotrauma.Biome
Definition:
Biome.cs:9
Barotrauma.Biome.Prefabs
static readonly PrefabCollection< Biome > Prefabs
Definition:
Biome.cs:10
Barotrauma.ContentFile
Base class for content file types, which are loaded from filelist.xml via reflection....
Definition:
ContentFile.cs:23
Barotrauma.ContentPackage
Definition:
ContentPackage.cs:18
Barotrauma.ContentPath
Definition:
ContentPath.cs:11
Barotrauma.ContentXElement
Definition:
ContentXElement.cs:13
Barotrauma.ContentXElement.Elements
IEnumerable< ContentXElement > Elements()
Barotrauma.LevelGenerationParametersFile
Definition:
LevelGenerationParametersFile.cs:7
Barotrauma.LevelGenerationParametersFile.Sort
override void Sort()
Definition:
LevelGenerationParametersFile.cs:62
Barotrauma.LevelGenerationParametersFile.LevelGenerationParametersFile
LevelGenerationParametersFile(ContentPackage contentPackage, ContentPath path)
Definition:
LevelGenerationParametersFile.cs:8
Barotrauma.LevelGenerationParametersFile.UnloadFile
override void UnloadFile()
Definition:
LevelGenerationParametersFile.cs:56
Barotrauma.LevelGenerationParametersFile.LoadFile
override void LoadFile()
Definition:
LevelGenerationParametersFile.cs:49
Barotrauma.LevelGenerationParams
Definition:
LevelGenerationParams.cs:11
Barotrauma.LevelGenerationParams.LevelParams
static readonly PrefabCollection< LevelGenerationParams > LevelParams
Definition:
LevelGenerationParams.cs:12
Barotrauma
Definition:
AchievementManager.cs:12
Barotrauma
BarotraumaShared
SharedSource
ContentManagement
ContentFile
LevelGenerationParametersFile.cs
Generated by
1.9.1